Skip to content

Commit

Permalink
feat: support external url (#103)
Browse files Browse the repository at this point in the history
* feat: add setupAndExport function

* feat: allow to pass custom networks to relay function

* chore: refactor

* chore: add test for setupAndExport

* chore: update tests port

* chore: skip sui relayer tests

* chore: add test comment

* chore: rename

* chore: clean up

* v2.1.9
  • Loading branch information
npty authored Feb 16, 2024
1 parent 1d06b36 commit 27f8dcf
Show file tree
Hide file tree
Showing 17 changed files with 616 additions and 3,680 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Cache node_modules
uses: actions/cache@v3
with:
Expand All @@ -54,5 +57,7 @@ jobs:
run: |
nohup sh -c "sui-test-validator" > nohup.out 2> nohup.err < /dev/null &
nohup sh -c "aptos node run-local-testnet --with-faucet" > nohup.out 2> nohup.err < /dev/null &
nohup sh -c "anvil" < /dev/null &
nohup sh -c "anvil -p 8546" < /dev/null &
sleep 10
npm run test
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "2.1.8",
"version": "2.1.9",
"packages": [
"packages/*"
]
Expand Down
3,811 changes: 277 additions & 3,534 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/axelar-local-dev-aptos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-local-dev-aptos",
"version": "2.1.8",
"version": "2.1.9",
"main": "dist/index.js",
"files": [
"dist/",
Expand All @@ -19,7 +19,7 @@
},
"dependencies": {
"@axelar-network/axelar-cgp-aptos": "^1.0.5",
"@axelar-network/axelar-local-dev": "2.1.8",
"@axelar-network/axelar-local-dev": "2.1.9",
"aptos": "1.3.16"
},
"author": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/axelar-local-dev-near/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-local-dev-near",
"version": "2.1.8",
"version": "2.1.9",
"description": "",
"main": "dist/index.js",
"files": [
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@axelar-network/axelar-cgp-near": "^1.0.0",
"@axelar-network/axelar-local-dev": "2.1.8"
"@axelar-network/axelar-local-dev": "2.1.9"
},
"author": "",
"license": "ISC"
Expand Down
10 changes: 6 additions & 4 deletions packages/axelar-local-dev-sui/__tests__/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SuiNetwork } from '../src/SuiNetwork';
import { TransactionBlock } from '@mysten/sui.js/transactions';
import path from 'path';

describe('Sui Network', () => {
describe.skip('Sui Network', () => {
let client: SuiNetwork;

beforeEach(async () => {
Expand All @@ -19,8 +19,10 @@ describe('Sui Network', () => {
it('should deploy and execute a function', async () => {
const response = await client.deploy(path.join(__dirname, '../move/sample'));
const packageId = response.packages[0].packageId;
const singleton: any = response.publishTxn.objectChanges?.find((change) => (change as any).objectType === `${packageId}::test::Singleton` )

const singleton: any = response.publishTxn.objectChanges?.find(
(change) => (change as any).objectType === `${packageId}::test::Singleton`,
);

const tx = new TransactionBlock();
const msg = 'hello from test';

Expand All @@ -40,7 +42,7 @@ describe('Sui Network', () => {
limit: 1,
});

const event = (data[0].parsedJson as any);
const event = data[0].parsedJson as any;

expect(event.destination_chain).toEqual('Avalanche');
expect(event.destination_address).toEqual('0x0');
Expand Down
24 changes: 16 additions & 8 deletions packages/axelar-local-dev-sui/__tests__/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SuiNetwork, SuiRelayer, initSui } from '@axelar-network/axelar-local-de
import path from 'path';
const { arrayify } = ethers.utils;

describe('e2e', () => {
describe.skip('e2e', () => {
let client: SuiNetwork;
let relayer: SuiRelayer;
let evmNetwork: Network;
Expand Down Expand Up @@ -35,8 +35,10 @@ describe('e2e', () => {
// Deploy a sample module
const response = await client.deploy(path.join(__dirname, '../move/sample'));
const packageId = response.packages[0].packageId;
const singleton: any = response.publishTxn.objectChanges?.find((change) => (change as any).objectType === `${packageId}::test::Singleton` )

const singleton: any = response.publishTxn.objectChanges?.find(
(change) => (change as any).objectType === `${packageId}::test::Singleton`,
);

const msg = 'hello from sui';

const payload = ethers.utils.defaultAbiCoder.encode(['string'], [msg]);
Expand All @@ -45,7 +47,12 @@ describe('e2e', () => {
const tx = new TransactionBlock();
tx.moveCall({
target: `${response.packages[0].packageId}::test::send_call`,
arguments: [tx.object(singleton.objectId), tx.pure(evmChainName), tx.pure(evmContract.address), tx.pure(String.fromCharCode(...arrayify(payload)))],
arguments: [
tx.object(singleton.objectId),
tx.pure(evmChainName),
tx.pure(evmContract.address),
tx.pure(String.fromCharCode(...arrayify(payload))),
],
});
await client.execute(tx);

Expand All @@ -68,14 +75,15 @@ describe('e2e', () => {
// Deploy a sample module
const response = await client.deploy(path.join(__dirname, '../move/sample'));
const packageId = response.packages[0].packageId;
const singleton: any = response.publishTxn.objectChanges?.find((change) => (change as any).objectType === `${packageId}::test::Singleton` )

const singleton: any = response.publishTxn.objectChanges?.find(
(change) => (change as any).objectType === `${packageId}::test::Singleton`,
);

const singletonFields: any = await client.getObject({
id: singleton.objectId,
options: {
showContent: true,
}

},
});

let tx = new TransactionBlock();
Expand Down
19 changes: 14 additions & 5 deletions packages/axelar-local-dev-sui/__tests__/relayer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import path from 'path';
import { ethers } from 'ethers';
import { TransactionBlock } from '@mysten/sui.js/transactions';

const { utils: { arrayify } } = ethers;
const {
utils: { arrayify },
} = ethers;

describe('relayer', () => {
describe.skip('relayer', () => {
let client: SuiNetwork;
let relayer: SuiRelayer;

Expand All @@ -25,16 +27,23 @@ describe('relayer', () => {
// Deploy a sample module
const response = await client.deploy(path.join(__dirname, '../move/sample'));
const packageId = response.packages[0].packageId;
const singleton: any = response.publishTxn.objectChanges?.find((change) => (change as any).objectType === `${packageId}::test::Singleton` )

const singleton: any = response.publishTxn.objectChanges?.find(
(change) => (change as any).objectType === `${packageId}::test::Singleton`,
);

const msg = 'hello from sui';
const payload = ethers.utils.defaultAbiCoder.encode(['string'], [msg]);

// Send a callContract transaction
const tx = new TransactionBlock();
tx.moveCall({
target: `${packageId}::test::send_call`,
arguments: [tx.object(singleton.objectId), tx.pure('Avalanche'), tx.pure('0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789'), tx.pure(String.fromCharCode(...arrayify(payload)))],
arguments: [
tx.object(singleton.objectId),
tx.pure('Avalanche'),
tx.pure('0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789'),
tx.pure(String.fromCharCode(...arrayify(payload))),
],
});
await client.execute(tx);

Expand Down
4 changes: 2 additions & 2 deletions packages/axelar-local-dev-sui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-local-dev-sui",
"version": "2.1.8",
"version": "2.1.9",
"main": "dist/index.js",
"files": [
"dist/",
Expand All @@ -18,7 +18,7 @@
},
"dependencies": {
"@axelar-network/axelar-cgp-sui": "https://github.com/axelarnetwork/axelar-cgp-sui.git",
"@axelar-network/axelar-local-dev": "2.1.8",
"@axelar-network/axelar-local-dev": "2.1.9",
"@mysten/sui.js": "^0.41.0"
},
"author": "euro@axelar.network",
Expand Down
2 changes: 1 addition & 1 deletion packages/axelar-local-dev/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@axelar-network/axelar-local-dev",
"version": "2.1.8",
"version": "2.1.9",
"description": "",
"main": "dist/index.js",
"files": [
Expand Down
7 changes: 4 additions & 3 deletions packages/axelar-local-dev/src/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ export interface NetworkInfo {
export interface NetworkSetup {
name?: string;
chainId?: number;
seed?: string;
userKeys?: Wallet[];
ownerKey: Wallet;
ownerKey?: Wallet;
operatorKey?: Wallet;
relayerKey?: Wallet;
adminKeys?: Wallet[];
Expand Down Expand Up @@ -208,7 +209,7 @@ export class Network {
}

async deployCreate3Deployer(): Promise<Contract> {
logger.log(`Deploying the ConstAddressDeployer for ${this.name}... `);
logger.log(`Deploying the Create3Deployer for ${this.name}... `);
const create3DeployerPrivateKey = keccak256(toUtf8Bytes('const-address-deployer-deployer'));
const deployerWallet = new Wallet(create3DeployerPrivateKey, this.provider);
await this.ownerWallet
Expand All @@ -220,7 +221,7 @@ export class Network {
const create3Deployer = await deployContract(deployerWallet, Create3Deployer, []);

this.create3Deployer = new Contract(create3Deployer.address, Create3Deployer.abi, this.provider);
logger.log(`Deployed at ${this.constAddressDeployer.address}`);
logger.log(`Deployed at ${this.create3Deployer.address}`);
return this.create3Deployer;
}

Expand Down
Loading

0 comments on commit 27f8dcf

Please sign in to comment.