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: implement add gas function for sui #335

Merged
merged 22 commits into from
Jan 2, 2025
Merged

feat: implement add gas function for sui #335

merged 22 commits into from
Jan 2, 2025

Conversation

npty
Copy link
Member

@npty npty commented Nov 7, 2024

Description

https://axelarnetwork.atlassian.net/browse/AXE-6365

This PR implements add gas function for sui. Also, the typescript version is bumped to the latest version (5.6.3)

Noted: amount is an optional params for now, if the user hasn't passed the amount, it is temporarily hardcoded as 0.01 Sui. The default value will be updated after this pr is merged.

Usage

Here's an usage example for node.js application.

import { Secp256k1Keypair } from "@mysten/sui/keypairs/secp256k1";
import { SuiClient } from "@mysten/sui/client";
import { AxelarGMPRecoveryAPI } from "@axelar-network/axelarjs-sdk";

const api: AxelarGMPRecoveryAPI = new AxelarGMPRecoveryAPI({ environment: Environment.DEVNET });

const tx = await api.addGasToSuiChain({
  gasParams: "0x",
  messageId: "test-1",
  refundAddress: keypair.toSuiAddress(),
});

const keypair: Secp256k1Keypair = Secp256k1Keypair.deriveKeypair(
  "test test test test test test test test test test test junk"
);

const suiClient = new SuiClient({
  url: "https://sui-testnet-rpc.publicnode.com",
});

const response = await suiClient.signAndExecuteTransaction({
  transaction: tx,
  signer: keypair,
  options: {
    showEffects: true,
    showEvents: true,
    showObjectChanges: true,
  },
});

For web application like axelarscan, you may want to use sui's dapps kit, so you can use this hook and pass the returned transaction into the signAndExecuteTransaction function.

Pre-release Version

npm i @axelar-network/[email protected]

Blockers For Merging

  • Needdevnet-amplifier config with latest sui contract info (same as this one) deployed to s3. I've hardcoded it to point to the raw file in the github repo instead.

@npty npty self-assigned this Nov 7, 2024
src/chains/index.ts Outdated Show resolved Hide resolved
@npty
Copy link
Member Author

npty commented Nov 11, 2024

@nrsirapop I've published the new version to fix cors issue.

npm i @axelar-network/[email protected]

Could you please try updating to see if it's fixed?

@npty npty marked this pull request as draft November 13, 2024 14:26
@npty npty marked this pull request as ready for review December 17, 2024 13:35
@npty npty merged commit ad3b4e6 into main Jan 2, 2025
4 checks passed
@npty npty deleted the feat/add-gas-for-sui branch January 2, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants