Skip to content

Commit

Permalink
made lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Foivos committed Jul 4, 2024
1 parent 4d335fb commit c339779
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
19 changes: 7 additions & 12 deletions test/axelar-gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const domainSeparator = getRandomBytes32();
let operatorKeys;
let signers;
let nonce = 0;
let packageId, pubkeys, gateway;

function calculateNextSigners() {
operatorKeys = [getRandomBytes32(), getRandomBytes32(), getRandomBytes32()];
Expand Down Expand Up @@ -161,7 +162,7 @@ describe('test', () => {

describe('Contract Call', () => {
let channel;
before(async() => {
before(async () => {
const builder = new TxBuilder(client);

channel = await builder.moveCall({
Expand All @@ -175,7 +176,7 @@ describe('test', () => {
const response = await builder.signAndExecute(keypair);

channel = response.objectChanges.find((change) => change.objectType === `${packageId}::channel::Channel`).objectId;
})
});

it('Make Contract Call', async () => {
const destinationChain = 'Destination Chain';
Expand All @@ -185,12 +186,7 @@ describe('test', () => {

await builder.moveCall({
target: `${packageId}::gateway::call_contract`,
arguments: [
channel,
destinationChain,
destinationAddress,
payload,
],
arguments: [channel, destinationChain, destinationAddress, payload],
typeArguments: [],
});

Expand All @@ -202,11 +198,10 @@ describe('test', () => {
payload: arrayify(payload),
payload_hash: keccak256(payload),
source_id: channel,
}
})
},
});
});
})

});
});

module.exports = {
Expand Down
20 changes: 8 additions & 12 deletions test/its.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
const { SuiClient, getFullnodeUrl } = require('@mysten/sui.js/client');
const { Ed25519Keypair } = require('@mysten/sui.js/keypairs/ed25519');
const { Secp256k1Keypair } = require('@mysten/sui.js/keypairs/secp256k1');
const { requestSuiFromFaucetV0, getFaucetHost } = require('@mysten/sui.js/faucet');
const { publishPackage, getRandomBytes32, expectRevert } = require('./utils');
const { TxBuilder } = require('../dist/tx-builder');
const {
bcsStructs: { axelarStructs },
} = require('../dist/bcs');
const { arrayify, hexlify, keccak256 } = require('ethers/lib/utils');
const secp256k1 = require('secp256k1');
const { publishPackage, getRandomBytes32 } = require('./utils');

const { arrayify } = require('ethers/lib/utils');
const { deployGateway } = require('./axelar-gateway');

async function deployIts(client, keypair) {
const { packageId, gateway } = await deployGateway(client, keypair);
await deployGateway(client, keypair);
await publishPackage(client, keypair, 'abi');
await publishPackage(client, keypair, 'governance');
const result = await publishPackage(client, keypair, 'its');

return result;
}

describe.only('test', () => {
describe('test', () => {
let client;
const operator = Ed25519Keypair.fromSecretKey(arrayify(getRandomBytes32()));
const deployer = Ed25519Keypair.fromSecretKey(arrayify(getRandomBytes32()));
const keypair = Ed25519Keypair.fromSecretKey(arrayify(getRandomBytes32()));
const domainSeparator = getRandomBytes32();
let packageId;
let its;

Expand All @@ -47,5 +41,7 @@ describe.only('test', () => {
its = result.publishTxn.objectChanges.find((change) => change.objectType === `${packageId}::its::ITS`).objectId;
});

it('Should not rotate to empty signers', async () => {});
it('Should not rotate to empty signers', async () => {
console.log(its);
});
});
13 changes: 8 additions & 5 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,25 @@ async function expectRevert(builder, keypair, error = {}) {
}

async function expectEvent(builder, keypair, eventData = {}) {
const response = await builder.signAndExecute(keypair, {showEvents: true});
const response = await builder.signAndExecute(keypair, { showEvents: true });

const event = response.events.find((event) => event.type == eventData.type);
const event = response.events.find((event) => event.type === eventData.type);

function compare(a, b) {
if(Array.isArray(a)) {
if (Array.isArray(a)) {
expect(a.length).to.equal(b.length);
for(let i=0; i<a.length; i++) {

for (let i = 0; i < a.length; i++) {
compare(a[i], b[i]);
}

return;
}

expect(a).to.equal(b);
}
for(const key of Object.keys(eventData.arguments)) {

for (const key of Object.keys(eventData.arguments)) {
compare(event.parsedJson[key], eventData.arguments[key]);
}
}
Expand Down

0 comments on commit c339779

Please sign in to comment.