Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sui): modify gmp send-call to send more params #331

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
31 changes: 6 additions & 25 deletions 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.3.0",
"@axelar-network/axelar-cgp-sui": "^0.0.0-snapshot.08213e4",
npty marked this conversation as resolved.
Show resolved Hide resolved
"@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 @@ -19,9 +19,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 @@ -34,28 +33,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 @@ -160,7 +147,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
Loading