diff --git a/wormchain/contracts/tools/deploy_wormchain.ts b/wormchain/contracts/tools/deploy_wormchain.ts index cc1273be93..c2aafefd8b 100644 --- a/wormchain/contracts/tools/deploy_wormchain.ts +++ b/wormchain/contracts/tools/deploy_wormchain.ts @@ -148,9 +148,11 @@ async function main() { vaa.signatures = sign(VAA_SIGNERS, vaa as unknown as VAA); console.log("uploading", file); const msg = client.core.msgStoreCode({ - signer, - wasm_byte_code: new Uint8Array(contract_bytes), - vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + value: { + signer, + wasmByteCode: new Uint8Array(contract_bytes), + vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + } }); const result = await client.signAndBroadcast(signer, [msg], { ...ZERO_FEE, @@ -173,13 +175,13 @@ async function main() { // Instantiate contracts. - async function instantiate(code_id: number, inst_msg: any, label: string) { + async function instantiate(codeId: number, inst_msg: any, label: string) { const instMsgBinary = toBinary(inst_msg); const instMsgBytes = fromBase64(instMsgBinary); // see /sdk/vaa/governance.go const codeIdBuf = Buffer.alloc(8); - codeIdBuf.writeBigInt64BE(BigInt(code_id)); + codeIdBuf.writeBigInt64BE(BigInt(codeId)); const codeIdHash = keccak256(codeIdBuf); const codeIdLabelHash = keccak256( Buffer.concat([ @@ -213,11 +215,13 @@ async function main() { // TODO: check for number of guardians in set and use the corresponding keys vaa.signatures = sign(VAA_SIGNERS, vaa as unknown as VAA); const msg = client.core.msgInstantiateContract({ - signer, - code_id, - label, - msg: instMsgBytes, - vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + value: { + signer, + codeId, + label, + msg: instMsgBytes, + vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + } }); const result = await client.signAndBroadcast(signer, [msg], { ...ZERO_FEE, @@ -229,7 +233,7 @@ async function main() { .events.find(({ type }) => type === "instantiate") .attributes.find(({ key }) => key === "_contract_address").value; console.log( - `deployed contract ${label}, codeID: ${code_id}, address: ${addr}, txHash: ${result.transactionHash}` + `deployed contract ${label}, codeID: ${codeId}, address: ${addr}, txHash: ${result.transactionHash}` ); return addr; @@ -267,16 +271,18 @@ async function main() { Buffer.from(r, "hex").toString("base64") ); const msg = client.wasm.msgExecuteContract({ - sender: signer, - contract: addresses["global_accountant.wasm"], - msg: toUtf8( - JSON.stringify({ - submit_vaas: { - vaas: accountingRegistrations, - }, - }) - ), - funds: [], + value: { + sender: signer, + contract: addresses["global_accountant.wasm"], + msg: toUtf8( + JSON.stringify({ + submit_vaas: { + vaas: accountingRegistrations, + }, + }) + ), + funds: [], + } }); const res = await client.signAndBroadcast(signer, [msg], { ...ZERO_FEE, @@ -330,10 +336,12 @@ async function main() { }, }; const executeMsg = client.wasm.msgExecuteContract({ - sender: signer, - contract: addresses["wormchain_ibc_receiver.wasm"], - msg: toUtf8(JSON.stringify(wormchainIbcReceiverUpdateWhitelistMsg)), - funds: [], + value: { + sender: signer, + contract: addresses["wormchain_ibc_receiver.wasm"], + msg: toUtf8(JSON.stringify(wormchainIbcReceiverUpdateWhitelistMsg)), + funds: [], + } }); const updateIbcWhitelistRes = await client.signAndBroadcast( signer, @@ -364,44 +372,60 @@ async function main() { signer, [ client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole14vtqhv6550uh6gycxxum8qmx3kmy7ak2qwzecx", - name: "ibcRelayer", + value: { + signer: signer, + address: "wormhole14vtqhv6550uh6gycxxum8qmx3kmy7ak2qwzecx", + name: "ibcRelayer", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole1s5a6dg9p902z5rhjgkk0ts8lulvtmhmpftasxe", - name: "guardianGatewayRelayer0", + value: { + signer: signer, + address: "wormhole1s5a6dg9p902z5rhjgkk0ts8lulvtmhmpftasxe", + name: "guardianGatewayRelayer0", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole1dtwappgz4zfmlhay44x5r787u6ap0zhrk2m09m", - name: "guardianGatewayRelayer1", + value: { + signer: signer, + address: "wormhole1dtwappgz4zfmlhay44x5r787u6ap0zhrk2m09m", + name: "guardianGatewayRelayer1", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole1karc53cm5zyyaeqsw9stmjvu0vwzky7k07lhwm", - name: "guardianNttAccountant0", + value: { + signer: signer, + address: "wormhole1karc53cm5zyyaeqsw9stmjvu0vwzky7k07lhwm", + name: "guardianNttAccountant0", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole1cdvy8ae9xgmfjj4pztz77dwqm4wa04glz68r5w", - name: "guardianNttAccountant1", + value: { + signer: signer, + address: "wormhole1cdvy8ae9xgmfjj4pztz77dwqm4wa04glz68r5w", + name: "guardianNttAccountant1", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole18s5lynnmx37hq4wlrw9gdn68sg2uxp5rwf5k3u", - name: "nttAccountantTest", + value: { + signer: signer, + address: "wormhole18s5lynnmx37hq4wlrw9gdn68sg2uxp5rwf5k3u", + name: "nttAccountantTest", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole1h6v7cku5w803pf563czepx5s32vrzz5cntj9k4", - name: "guardianAccountant0", + value: { + signer: signer, + address: "wormhole1h6v7cku5w803pf563czepx5s32vrzz5cntj9k4", + name: "guardianAccountant0", + } }), client.core.msgCreateAllowlistEntryRequest({ - signer: signer, - address: "wormhole1g25zz7gyuyh6chuejc3ppfemgfla4xpsm69lzq", - name: "guardianAccountant1", + value: { + signer: signer, + address: "wormhole1g25zz7gyuyh6chuejc3ppfemgfla4xpsm69lzq", + name: "guardianAccountant1", + } }), ], { @@ -491,16 +515,18 @@ async function main() { console.log(`Registering chains for ${contract}:`); for (const registration of registrations) { const executeMsg = client.wasm.msgExecuteContract({ - sender: signer, - contract: addresses[contract], - msg: toUtf8( - JSON.stringify({ - submit_vaa: { - data: Buffer.from(registration, "hex").toString("base64"), - }, - }) - ), - funds: [], + value: { + sender: signer, + contract: addresses[contract], + msg: toUtf8( + JSON.stringify({ + submit_vaa: { + data: Buffer.from(registration, "hex").toString("base64"), + }, + }) + ), + funds: [], + } }); const executeRes = await client.signAndBroadcast(signer, [executeMsg], { ...ZERO_FEE, @@ -544,10 +570,12 @@ async function main() { vaa.signatures = sign(VAA_SIGNERS, vaa as unknown as VAA); const msgInstantiateAllowlist = client.core.msgAddWasmInstantiateAllowlist({ - signer: signer, - address: addresses["cw_token_bridge.wasm"], - code_id: codeIds["cw20_wrapped_2.wasm"], - vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + value: { + signer: signer, + address: addresses["cw_token_bridge.wasm"], + codeId: codeIds["cw20_wrapped_2.wasm"], + vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + } }); const msgInstantiateAllowlistRes = await client.signAndBroadcast( signer, @@ -602,19 +630,21 @@ async function main() { updateChannelVaa as unknown as VAA ); const updateMsg = client.wasm.msgExecuteContract({ - sender: signer, - contract: addresses["ibc_translator.wasm"], - msg: toUtf8( - JSON.stringify({ - submit_update_chain_to_channel_map: { - vaa: Buffer.from( - serialiseVAA(updateChannelVaa as unknown as VAA), - "hex" - ).toString("base64"), - }, - }) - ), - funds: [], + value: { + sender: signer, + contract: addresses["ibc_translator.wasm"], + msg: toUtf8( + JSON.stringify({ + submit_update_chain_to_channel_map: { + vaa: Buffer.from( + serialiseVAA(updateChannelVaa as unknown as VAA), + "hex" + ).toString("base64"), + }, + }) + ), + funds: [], + } }); const executeRes = await client.signAndBroadcast(signer, [updateMsg], { ...ZERO_FEE, @@ -639,10 +669,12 @@ async function main() { }, }; const setParamsMsg = client.core.msgExecuteGatewayGovernanceVaa({ - signer: signer, - vaa: hexToUint8Array( - serialiseVAA(setDefaultParamsVaa as unknown as VAA) - ), + value: { + signer: signer, + vaa: hexToUint8Array( + serialiseVAA(setDefaultParamsVaa as unknown as VAA) + ), + } }); await client .signAndBroadcast(signer, [setParamsMsg], { diff --git a/wormchain/contracts/tools/upgrade_wormchain_testnet.ts b/wormchain/contracts/tools/upgrade_wormchain_testnet.ts index 15e681fedd..a3d48d3756 100644 --- a/wormchain/contracts/tools/upgrade_wormchain_testnet.ts +++ b/wormchain/contracts/tools/upgrade_wormchain_testnet.ts @@ -128,9 +128,11 @@ async function main() { vaa.signatures = sign(VAA_SIGNERS, vaa as unknown as VAA); console.log("uploading", file); const msg = client.core.msgStoreCode({ - signer, - wasm_byte_code: new Uint8Array(contract_bytes), - vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + value: { + signer, + wasmByteCode: new Uint8Array(contract_bytes), + vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + } }); const result = await client.signAndBroadcast(signer, [msg], { ...ZERO_FEE, @@ -153,13 +155,13 @@ async function main() { // Migrate contracts. - async function migrate(code_id: number, migrate_msg: any, contract: string) { + async function migrate(codeId: number, migrate_msg: any, contract: string) { const migrateMsgBinary = toBinary(migrate_msg); const migrateMsgBytes = fromBase64(migrateMsgBinary); // see /sdk/vaa/governance.go const codeIdBuf = Buffer.alloc(8); - codeIdBuf.writeBigInt64BE(BigInt(code_id)); + codeIdBuf.writeBigInt64BE(BigInt(codeId)); const codeIdHash = keccak256(codeIdBuf); const codeIdContractHash = keccak256( Buffer.concat([ @@ -193,11 +195,13 @@ async function main() { // TODO: check for number of guardians in set and use the corresponding keys vaa.signatures = sign(VAA_SIGNERS, vaa as unknown as VAA); const msg = client.core.msgMigrateContract({ - signer, - code_id, - contract, - msg: migrateMsgBytes, - vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + value: { + signer, + codeId, + contract, + msg: migrateMsgBytes, + vaa: hexToUint8Array(serialiseVAA(vaa as unknown as VAA)), + } }); const result = await client.signAndBroadcast(signer, [msg], { ...ZERO_FEE, @@ -206,7 +210,7 @@ async function main() { console.log("contract migration msg: ", msg); console.log("contract migration result: ", result); console.log( - `migrated contract ${contract}, codeID: ${code_id}, txHash: ${result.transactionHash}` + `migrated contract ${contract}, codeID: ${codeId}, txHash: ${result.transactionHash}` ); }