Skip to content

Commit

Permalink
prettier and include mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jun 19, 2024
1 parent 4886636 commit 5774306
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
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 = "0x1bc4c0259a0427f239bc6464548dc47d3beac0c2c55aec9b33323084d04dcddf"
published-at = "0x0"
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 = "0x1bc4c0259a0427f239bc6464548dc47d3beac0c2c55aec9b33323084d04dcddf"
abi = "0x0"
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"test-js": "npx mocha",
"test": "npm run test-move && npm run test-js",
"coverage": "./scripts/coverage.sh",
"lint": "eslint --fix './src/*.ts'",
"prettier": "prettier --write './src/*.ts'",
"lint": "eslint --fix './src/*.ts' './test/*.js'",
"prettier": "prettier --write './src/*.ts' './test/*.js'",
"compile": "npx tsc",
"postinstall": "npm run compile"
},
Expand Down Expand Up @@ -45,7 +45,8 @@
"eslint": "^8.57.0",
"eslint-config-richardpringle": "^2.0.0",
"prettier": "^2.8.7",
"prettier-plugin-sort-imports": "^1.8.5"
"prettier-plugin-sort-imports": "^1.8.5",
"mocha": "^10.4.0"
},
"description": "Axelar Sui Move contracts"
}
11 changes: 4 additions & 7 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
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() => {
before(async () => {
client = new SuiClient({ url: getFullnodeUrl('localnet') });
const privKey = Buffer.from(process.env.SUI_PRIVATE_KEY, 'hex');

Expand Down Expand Up @@ -39,12 +38,10 @@ describe('test', () => {
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 () => {

});
});
it('test', async () => {});
});
21 changes: 9 additions & 12 deletions test/utils.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@

require('dotenv').config();
const { TxBuilder } = require('../dist/tx-builder');
const { updateMoveToml } = require('../dist/utils');

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 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;
const packageId = (publishTxn.objectChanges?.find((a) => a.type === 'published') ?? []).packageId;

updateMoveToml(packageName, packageId);
return { packageId, publishTxn };
updateMoveToml(packageName, packageId);
return { packageId, publishTxn };
}

module.exports = {
publishPackage,
}
};

0 comments on commit 5774306

Please sign in to comment.