Skip to content

Commit

Permalink
feat(sui): modify gmp send-call to send more params (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
npty authored Aug 20, 2024
1 parent 2e1ad02 commit 9d9d9af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"homepage": "https://github.com/axelarnetwork/axelar-contract-deployments#readme",
"dependencies": {
"@axelar-network/axelar-cgp-solidity": "6.3.1",
"@axelar-network/axelar-cgp-sui": "^0.0.0-snapshot.218635e",
"@axelar-network/axelar-cgp-sui": "0.0.0-snapshot.218635e",
"@axelar-network/axelar-gmp-sdk-solidity": "5.10.0",
"@axelar-network/interchain-token-service": "1.2.4",
"@cosmjs/cosmwasm-stargate": "^0.32.1",
Expand Down
27 changes: 7 additions & 20 deletions sui/gmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ async function sendCommand(keypair, client, contracts, args, options) {
const params = options.params;

const [testConfig, gasServiceConfig] = contracts;
const gasServicePackageId = gasServiceConfig.address;
const singletonObjectId = testConfig.objects.singleton;
const channelId = testConfig.objects.channelId;
const gasServiceObjectId = gasServiceConfig.objects.GasService;
const singletonObjectId = testConfig.objects.Singleton;

const unitAmount = getUnitAmount(feeAmount);
const walletAddress = keypair.toSuiAddress();
Expand All @@ -38,28 +37,16 @@ async function sendCommand(keypair, client, contracts, args, options) {
target: `${testConfig.address}::test::send_call`,
arguments: [
tx.object(singletonObjectId),
tx.object(gasServiceObjectId),
tx.pure(bcs.string().serialize(destinationChain).toBytes()),
tx.pure(bcs.string().serialize(destinationAddress).toBytes()),
tx.pure(bcs.vector(bcs.u8()).serialize(arrayify(payload)).toBytes()),
tx.pure.address(refundAddress),
coin,
tx.pure(bcs.vector(bcs.u8()).serialize(arrayify(params)).toBytes()),
],
});

if (gasServiceConfig) {
tx.moveCall({
target: `${gasServicePackageId}::gas_service::pay_gas`,
arguments: [
tx.object(gasServiceConfig.objects.GasService),
coin, // Coin<SUI>
tx.pure.address(channelId), // Channel address
tx.pure(bcs.string().serialize(destinationChain).toBytes()), // Destination chain
tx.pure(bcs.string().serialize(destinationAddress).toBytes()), // Destination address
tx.pure(bcs.vector(bcs.u8()).serialize(arrayify(payload)).toBytes()), // Payload
tx.pure.address(refundAddress), // Refund address
tx.pure(bcs.vector(bcs.u8()).serialize(arrayify(params)).toBytes()), // Params
],
});
}

const receipt = await broadcast(client, keypair, tx);

printInfo('Call sent', receipt.digest);
Expand Down Expand Up @@ -164,7 +151,7 @@ async function processCommand(command, chain, args, options) {

await printWalletInfo(keypair, client, chain, options);

const contracts = [chain.contracts.test, chain.contracts.GasService, chain.contracts.axelar_gateway];
const contracts = [chain.contracts.Test, chain.contracts.GasService, chain.contracts.AxelarGateway];

await command(keypair, client, contracts, args, options);
}
Expand Down

0 comments on commit 9d9d9af

Please sign in to comment.