clients/js: add aptos network info

This commit is contained in:
Csongor Kiss 2022-10-19 15:39:31 +01:00 committed by Evan Gray
parent 7d53c68aad
commit 8a4a49983e
3 changed files with 10 additions and 6 deletions

View File

@ -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),

View File

@ -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"))])

View File

@ -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,