Skip to content

Commit

Permalink
add fee options
Browse files Browse the repository at this point in the history
  • Loading branch information
critesjosh committed Dec 20, 2022
1 parent 201c12f commit eea1ee7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/commands/defibridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,30 @@ export default class DefiBridge extends BaseCommand {
const WstEthToEth = new BridgeCallData(5, 2, 0); // IN: wstETH (2), OUT: ETH (0)
const donationBridge = new BridgeCallData(17, 0, 0);

let bridge = donationBridge;
let bridge = WstEthToEth;

const tokenAssetId = this.sdk!.getAssetIdBySymbol(asset.toUpperCase());
const tokenQuantity = BigInt((amount as number) * 10 ** 18);

const tokenAssetValue: AssetValue = {
const assetValue: AssetValue = {
assetId: tokenAssetId,
value: tokenQuantity,
};

const fee = (await this.sdk.getDefiFees(bridge))[settlementTime];
let bridgeFeeOptions = {
assetValue,
userId: accountKeys.publicKey,
// userSpendingKeyRequired?: boolean;
// excludePendingNotes?: boolean;
// feeSignificantFigures?: number;
}

const fee = (await this.sdk.getDefiFees(bridge, bridgeFeeOptions))[settlementTime];
const controller = this.sdk.createDefiController(
accountKeys.publicKey,
signer,
bridge,
tokenAssetValue,
assetValue,
fee
);
await controller.createProof();
Expand Down

0 comments on commit eea1ee7

Please sign in to comment.