diff --git a/clients/js/aptos.ts b/clients/js/aptos.ts index e2b5b3d55..fd391975f 100644 --- a/clients/js/aptos.ts +++ b/clients/js/aptos.ts @@ -67,7 +67,11 @@ export async function execute_aptos( // transaction that deploys a module cannot use that module // // Tx 1. - await callEntryFunc(network, rpc, `${contract}::wrapped`, "create_wrapped_coin_type", [], [bcsVAA]); + try { + await callEntryFunc(network, rpc, `${contract}::wrapped`, "create_wrapped_coin_type", [], [bcsVAA]); + } catch (e) { + console.log("this one already happened (probably)") + } // We just deployed the module (notice the "wait" argument which makes // the previous step block until finality). @@ -175,7 +179,7 @@ export async function callEntryFunc( TxnBuilderTypes.AccountAddress.fromHex(accountFrom.address()), BigInt(sequenceNumber), txPayload, - BigInt(30000), //max gas to be used. TODO(csongor): we could compute this from the simulation below... + BigInt(100000), //max gas to be used. TODO(csongor): we could compute this from the simulation below... BigInt(100), //price per unit gas TODO(csongor): we should get this dynamically BigInt(Math.floor(Date.now() / 1000) + 10), new TxnBuilderTypes.ChainId(chainId), diff --git a/clients/js/cmds/aptos.ts b/clients/js/cmds/aptos.ts index 51533f7b6..dab58e14b 100644 --- a/clients/js/cmds/aptos.ts +++ b/clients/js/cmds/aptos.ts @@ -173,7 +173,7 @@ exports.builder = function(y: typeof yargs) { // TODO(csongor): use deployer address from sdk (when it's there) let module_name = "0x277fa055b6a73c42c0662d5236c65c864ccbf2d4abd21f174a30c8b786eab84b::deployer"; - if (network == "TESTNET") { + if (network == "TESTNET" || network == "MAINNET") { module_name = "0x0108bc32f7de18a5f6e1e7d6ee7aff9f5fc858d0d87ac0da94dd8d2a5d267d6b::deployer"; } const rpc = argv.rpc ?? NETWORKS[network]["aptos"].rpc; @@ -202,7 +202,7 @@ exports.builder = function(y: typeof yargs) { const rpc = NETWORKS[network]["aptos"].rpc; // TODO(csongor): use sdk address let module_name = "0x277fa055b6a73c42c0662d5236c65c864ccbf2d4abd21f174a30c8b786eab84b::sender"; - if (network == "TESTNET") { + if (network == "TESTNET" || network == "MAINNET") { module_name = "0x0108bc32f7de18a5f6e1e7d6ee7aff9f5fc858d0d87ac0da94dd8d2a5d267d6b::sender"; } await callEntryFunc(network, rpc, module_name, "send_message", [], [BCS.bcsSerializeBytes(Buffer.from(argv["message"], "ascii"))]) diff --git a/clients/js/networks.ts b/clients/js/networks.ts index 000311064..768223f33 100644 --- a/clients/js/networks.ts +++ b/clients/js/networks.ts @@ -94,8 +94,8 @@ const MAINNET = { key: undefined, }, aptos: { - rpc: undefined, - key: undefined, + rpc: "https://fullnode.mainnet.aptoslabs.com/v1", + key: get_env_var("APTOS_KEY"), }, sui: { rpc: undefined,