diff --git a/.mocharc.yaml b/.mocharc.yaml new file mode 100644 index 00000000..9e15fd2a --- /dev/null +++ b/.mocharc.yaml @@ -0,0 +1,3 @@ +exit: true +spec: test/**/*.js +timeout: 100000 diff --git a/move/abi/Move.lock b/move/abi/Move.lock index 75dc1a79..1db9b4db 100644 --- a/move/abi/Move.lock +++ b/move/abi/Move.lock @@ -2,7 +2,7 @@ [move] version = 2 -manifest_digest = "1250E6948210D730AADA7F51BB7CEA2D4A337A6A3D982567112494E70CC7F7BA" +manifest_digest = "89B38FFD4D0D8B2DCFE440924446CCF3A347EA904B2657C9CA229BD7BB881131" deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" dependencies = [ { name = "Sui" }, diff --git a/move/abi/Move.toml b/move/abi/Move.toml index 0244441f..d8d50dd3 100644 --- a/move/abi/Move.toml +++ b/move/abi/Move.toml @@ -1,11 +1,11 @@ [package] name = "Abi" version = "0.1.0" -published-at = "0x09ede88971119f6a4fb5d5f5dd927fb48d1eeb92ba23a6ee696b1f51459354cb" +published-at = "0x1bc4c0259a0427f239bc6464548dc47d3beac0c2c55aec9b33323084d04dcddf" edition = "2024.beta" [dependencies] Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.25.3" } [addresses] -abi = "0x09ede88971119f6a4fb5d5f5dd927fb48d1eeb92ba23a6ee696b1f51459354cb" +abi = "0x1bc4c0259a0427f239bc6464548dc47d3beac0c2c55aec9b33323084d04dcddf" diff --git a/move/axelar_gateway/Move.lock b/move/axelar_gateway/Move.lock index a9960526..1242c5d3 100644 --- a/move/axelar_gateway/Move.lock +++ b/move/axelar_gateway/Move.lock @@ -2,7 +2,7 @@ [move] version = 2 -manifest_digest = "DFA4511B74DB0D387117726B3B29774671B68A69FABD22CD106286A3F83D0528" +manifest_digest = "10303CE6C59BAA2CE814E3D11BACC8CB24BE0F8D66753B02190E291CA40F0D39" deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" dependencies = [ { name = "Sui" }, diff --git a/move/axelar_gateway/Move.toml b/move/axelar_gateway/Move.toml index 1e6bf58a..ecaaddac 100644 --- a/move/axelar_gateway/Move.toml +++ b/move/axelar_gateway/Move.toml @@ -1,12 +1,12 @@ [package] name = "AxelarGateway" version = "0.1.0" -published-at = "0xdd3b165835ec3d510016f8492519feb74a631f235f0126f44fec079c8aa81186" +published-at = "0x1611b7e3e958f74e4ef9f4727333a98d095a9f71baf4c814d310d986db1f5662" edition = "2024.beta" [dependencies] Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.25.3" } [addresses] -axelar_gateway = "0xdd3b165835ec3d510016f8492519feb74a631f235f0126f44fec079c8aa81186" +axelar_gateway = "0x1611b7e3e958f74e4ef9f4727333a98d095a9f71baf4c814d310d986db1f5662" clock = "0x6" diff --git a/move/gas_service/Move.lock b/move/gas_service/Move.lock index 04215722..5cc24c5f 100644 --- a/move/gas_service/Move.lock +++ b/move/gas_service/Move.lock @@ -2,7 +2,7 @@ [move] version = 2 -manifest_digest = "C1DEC087FF16954984395BB68E2E81D4A38E64A7F0BAB88AAF73A121C563E2D4" +manifest_digest = "A020C8D244BDE64D6F5F3107506F682AEA99E933953DE1FB01352999724E43EB" deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082" dependencies = [ { name = "Sui" }, diff --git a/move/gas_service/Move.toml b/move/gas_service/Move.toml index 49ee70fc..9c83307d 100644 --- a/move/gas_service/Move.toml +++ b/move/gas_service/Move.toml @@ -1,10 +1,11 @@ [package] name = "GasService" version = "0.1.0" +published-at = "0xe356c310916a4f0c76a2c50b1101f66a328eee2626f709b1138e5ca2a537d438" edition = "2024.beta" [dependencies] Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.25.3" } [addresses] -gas_service = "0x105" +gas_service = "0xe356c310916a4f0c76a2c50b1101f66a328eee2626f709b1138e5ca2a537d438" diff --git a/move/governance/Move.lock b/move/governance/Move.lock index 096fd921..a4cb0602 100644 --- a/move/governance/Move.lock +++ b/move/governance/Move.lock @@ -2,7 +2,7 @@ [move] version = 2 -manifest_digest = "4F26118CD341A5D382F6D63184C33AE0DEFBC380DA34B844908B98C7C2B228D9" +manifest_digest = "9DC4C192CAEBB80F2FBB1DC3CCEC7F9714E98AF18EBC9396F08BDB826A59E4F3" deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3" dependencies = [ { name = "Abi" }, diff --git a/move/governance/Move.toml b/move/governance/Move.toml index f45f85da..59b7e05a 100644 --- a/move/governance/Move.toml +++ b/move/governance/Move.toml @@ -1,6 +1,7 @@ [package] name = "Governance" version = "0.1.0" +published-at = "0x5b07e6dd81eda8900a3f7e5cab693a0b9e32eaec30d27f26830611e536dead13" edition = "2024.beta" [dependencies] @@ -9,4 +10,4 @@ AxelarGateway = { local = "../axelar_gateway" } Abi = { local = "../abi" } [addresses] -governance = "0x101" +governance = "0x5b07e6dd81eda8900a3f7e5cab693a0b9e32eaec30d27f26830611e536dead13" diff --git a/move/its/Move.lock b/move/its/Move.lock index d45ae8ec..c52c3519 100644 --- a/move/its/Move.lock +++ b/move/its/Move.lock @@ -2,7 +2,7 @@ [move] version = 2 -manifest_digest = "8EB070D5A26ADEEBB191384EDCD8FE28EE8539D051B47C110ACB2E1BC0675B6A" +manifest_digest = "C47498B72EFC749BF4D0D66D86BC3702ADBFBD16CF406FA05127DAD55FBE28C4" deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3" dependencies = [ { name = "AxelarGateway" }, diff --git a/move/its/Move.toml b/move/its/Move.toml index cc9d85d2..d11a4805 100644 --- a/move/its/Move.toml +++ b/move/its/Move.toml @@ -1,6 +1,7 @@ [package] name = "ITS" version = "0.1.0" +published-at = "0x542952f6e1278d7183d2fe788efe472a96f204c45328af28fa4e6fba36b432f2" edition = "2024.beta" [dependencies] @@ -9,4 +10,4 @@ AxelarGateway = { local = "../axelar_gateway" } Governance = { local = "../governance" } [addresses] -its = "0x102" +its = "0x542952f6e1278d7183d2fe788efe472a96f204c45328af28fa4e6fba36b432f2" diff --git a/move/squid/Move.lock b/move/squid/Move.lock index f7bcfa21..f6bf9855 100644 --- a/move/squid/Move.lock +++ b/move/squid/Move.lock @@ -2,7 +2,7 @@ [move] version = 2 -manifest_digest = "9568F12CBDAE1FD019A32A5F77C0B7CF8038887E8FAFE61D45CD75757251E932" +manifest_digest = "384A3D94552582FBDD012034F0BE9AC30A837A35416FCCFBA340F7C3597FB0D3" deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C" dependencies = [ { name = "AxelarGateway" }, diff --git a/move/squid/Move.toml b/move/squid/Move.toml index 5501ade5..1b8474ec 100644 --- a/move/squid/Move.toml +++ b/move/squid/Move.toml @@ -1,6 +1,7 @@ [package] name = "Squid" version = "0.1.0" +published-at = "0x0" edition = "2024.beta" [dependencies] @@ -10,4 +11,4 @@ AxelarGateway = { local = "../axelar_gateway" } ITS = { local = "../its" } [addresses] -squid = "0x104" +squid = "0x0" diff --git a/test/test.js b/test/test.js index 52b0e3b9..9e3c1e9d 100644 --- a/test/test.js +++ b/test/test.js @@ -1,16 +1,49 @@ require('dotenv').config(); const { TxBuilder } = require('../dist/tx-builder'); const { SuiClient, getFullnodeUrl } = require('@mysten/sui.js/client'); +const { Ed25519Keypair } = require('@mysten/sui.js/keypairs/ed25519'); +const { requestSuiFromFaucetV0, getFaucetHost } = require('@mysten/sui.js/faucet'); +const { publishPackage } = require('./utils'); describe('test', () => { let client, keypair; before(async() => { - client = new SuiClient(getFullnodeUrl('localnet')); - keypair = new SuiKeypair(); - const builder = new TxBuilder(client); + client = new SuiClient({ url: getFullnodeUrl('localnet') }); + const privKey = Buffer.from(process.env.SUI_PRIVATE_KEY, 'hex'); - const response = await builder.signAndExecute(keypair); - }) + keypair = Ed25519Keypair.fromSecretKey(privKey); + await requestSuiFromFaucetV0({ + host: getFaucetHost('localnet'), + recipient: keypair.toSuiAddress(), + }); + let result = await publishPackage(client, keypair, 'abi'); + const abiPackageId = result.packageId; + const abiCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + + result = await publishPackage(client, keypair, 'axelar_gateway'); + const axelarPackageId = result.packageId; + const axelarCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + + result = await publishPackage(client, keypair, 'gas_service'); + const gasServicePackageId = result.packageId; + const gasServiceCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + + result = await publishPackage(client, keypair, 'governance'); + const governancePackageId = result.packageId; + const governanceCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + + result = await publishPackage(client, keypair, 'its'); + const itsPackageId = result.packageId; + const itsCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + + result = await publishPackage(client, keypair, 'squid'); + const squidPackageId = result.packageId; + const squidCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + + result = await publishPackage(client, keypair, 'test'); + const testPackageId = result.packageId; + const testCap = result.publishTxn.objectChanges.find((change) => change.objectType === `0x2::package::UpgradeCap`).objectId; + }); it('test', async () => { }); diff --git a/test/utils.js b/test/utils.js new file mode 100644 index 00000000..ed2bed3a --- /dev/null +++ b/test/utils.js @@ -0,0 +1,20 @@ + +require('dotenv').config(); +const { TxBuilder } = require('../dist/tx-builder'); +const { updateMoveToml } = require('../dist/utils'); + + +async function publishPackage(client, keypair, packageName) { + const builder = new TxBuilder(client); + await builder.publishPackageAndTransferCap(packageName, keypair.toSuiAddress()); + const publishTxn = await builder.signAndExecute(keypair); + + const packageId = (publishTxn.objectChanges?.find((a) => a.type === 'published') ?? []).packageId; + + updateMoveToml(packageName, packageId); + return { packageId, publishTxn }; +} + +module.exports = { + publishPackage, +} \ No newline at end of file