Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/localnet/src/suiWithdrawAndCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
import { NetworkID } from "./constants";
import { log } from "./log";

const suiCoinType = "0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";

Check failure on line 7 in packages/localnet/src/suiWithdrawAndCall.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `⏎·`

export const suiWithdrawAndCall = async ({
amount,
targetModule,
message,
assetCoinType,
client,
keypair,
moduleId,
Expand All @@ -17,8 +20,11 @@
try {
const nonce = await fetchGatewayNonce(client, gatewayObjectId);
const tx = new Transaction();
const coinType =
"0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";

// when creating a tx, coin type that are not SUI token expect to have a prefix "0x"
if (assetCoinType !== suiCoinType) {
assetCoinType = `0x${assetCoinType}`;
}

// withdraw the coins and get the coins ID
const [coins, coinsBudget] = tx.moveCall({
Expand All @@ -30,7 +36,7 @@
tx.object(withdrawCapObjectId),
],
target: `${moduleId}::gateway::withdraw_impl`,
typeArguments: [coinType],
typeArguments: [assetCoinType],
});

// transfer the amount for budget to the TSS
Expand All @@ -51,7 +57,7 @@
// TODO: check all objects are shared and not owned by the sender
// https://github.com/zeta-chain/localnet/issues/134

const onCallTypeArguments = [coinType, ...additionalTypeArguments];
const onCallTypeArguments = [assetCoinType, ...additionalTypeArguments];
const onCallArguments = [
coins,
...objects.map((obj: any) => tx.object(ethers.hexlify(obj))),
Expand Down
1 change: 1 addition & 0 deletions packages/localnet/src/zetachainWithdrawAndCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
await suiWithdrawAndCall({
amount,
message,
assetCoinType: coinType,

Check failure on line 73 in packages/localnet/src/zetachainWithdrawAndCall.ts

View workflow job for this annotation

GitHub Actions / lint

Expected object keys to be in ascending order. 'assetCoinType' should be before 'message'
targetModule: receiver,
...contracts.suiContracts.env,
});
Expand Down
Loading