Skip to content

Commit

Permalink
added deployment test
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jun 19, 2024
1 parent 1cd9f11 commit fb549fa
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .mocharc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exit: true
spec: test/**/*.js
timeout: 100000
2 changes: 1 addition & 1 deletion move/abi/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "1250E6948210D730AADA7F51BB7CEA2D4A337A6A3D982567112494E70CC7F7BA"
manifest_digest = "89B38FFD4D0D8B2DCFE440924446CCF3A347EA904B2657C9CA229BD7BB881131"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
Expand Down
4 changes: 2 additions & 2 deletions move/abi/Move.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion move/axelar_gateway/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "DFA4511B74DB0D387117726B3B29774671B68A69FABD22CD106286A3F83D0528"
manifest_digest = "10303CE6C59BAA2CE814E3D11BACC8CB24BE0F8D66753B02190E291CA40F0D39"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
Expand Down
4 changes: 2 additions & 2 deletions move/axelar_gateway/Move.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion move/gas_service/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "C1DEC087FF16954984395BB68E2E81D4A38E64A7F0BAB88AAF73A121C563E2D4"
manifest_digest = "A020C8D244BDE64D6F5F3107506F682AEA99E933953DE1FB01352999724E43EB"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
Expand Down
3 changes: 2 additions & 1 deletion move/gas_service/Move.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion move/governance/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "4F26118CD341A5D382F6D63184C33AE0DEFBC380DA34B844908B98C7C2B228D9"
manifest_digest = "9DC4C192CAEBB80F2FBB1DC3CCEC7F9714E98AF18EBC9396F08BDB826A59E4F3"
deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3"
dependencies = [
{ name = "Abi" },
Expand Down
3 changes: 2 additions & 1 deletion move/governance/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "Governance"
version = "0.1.0"
published-at = "0x5b07e6dd81eda8900a3f7e5cab693a0b9e32eaec30d27f26830611e536dead13"
edition = "2024.beta"

[dependencies]
Expand All @@ -9,4 +10,4 @@ AxelarGateway = { local = "../axelar_gateway" }
Abi = { local = "../abi" }

[addresses]
governance = "0x101"
governance = "0x5b07e6dd81eda8900a3f7e5cab693a0b9e32eaec30d27f26830611e536dead13"
2 changes: 1 addition & 1 deletion move/its/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "8EB070D5A26ADEEBB191384EDCD8FE28EE8539D051B47C110ACB2E1BC0675B6A"
manifest_digest = "C47498B72EFC749BF4D0D66D86BC3702ADBFBD16CF406FA05127DAD55FBE28C4"
deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3"
dependencies = [
{ name = "AxelarGateway" },
Expand Down
3 changes: 2 additions & 1 deletion move/its/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "ITS"
version = "0.1.0"
published-at = "0x542952f6e1278d7183d2fe788efe472a96f204c45328af28fa4e6fba36b432f2"
edition = "2024.beta"

[dependencies]
Expand All @@ -9,4 +10,4 @@ AxelarGateway = { local = "../axelar_gateway" }
Governance = { local = "../governance" }

[addresses]
its = "0x102"
its = "0x542952f6e1278d7183d2fe788efe472a96f204c45328af28fa4e6fba36b432f2"
2 changes: 1 addition & 1 deletion move/squid/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "9568F12CBDAE1FD019A32A5F77C0B7CF8038887E8FAFE61D45CD75757251E932"
manifest_digest = "384A3D94552582FBDD012034F0BE9AC30A837A35416FCCFBA340F7C3597FB0D3"
deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C"
dependencies = [
{ name = "AxelarGateway" },
Expand Down
3 changes: 2 additions & 1 deletion move/squid/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "Squid"
version = "0.1.0"
published-at = "0x0"
edition = "2024.beta"

[dependencies]
Expand All @@ -10,4 +11,4 @@ AxelarGateway = { local = "../axelar_gateway" }
ITS = { local = "../its" }

[addresses]
squid = "0x104"
squid = "0x0"
43 changes: 38 additions & 5 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -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 () => {

});
Expand Down
20 changes: 20 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -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,
}

0 comments on commit fb549fa

Please sign in to comment.