diff --git a/lerna.json b/lerna.json index 1571177a..99fc431f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,7 +1,7 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "2.1.0", + "version": "2.1.1", "packages": [ "packages/*" ] diff --git a/package-lock.json b/package-lock.json index 5148e12e..c91917e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,20 +41,41 @@ } }, "node_modules/@axelar-network/axelar-cgp-solidity": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@axelar-network/axelar-cgp-solidity/-/axelar-cgp-solidity-5.0.0.tgz", - "integrity": "sha512-j/HshdS6MNZgEzqVgJq7gz9b1TgIwEr0QjmAUQMJWcGXk6EPp520+EWIFP+SomX3Zpu6p+Hg6+wf9giaLmrIQw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@axelar-network/axelar-cgp-solidity/-/axelar-cgp-solidity-6.1.0.tgz", + "integrity": "sha512-NHoJySnSujCmytYQIXtT760oPd4G8HSxH9qDhK6xd64soGLT6cnoMpZzQuhfonSqZRc/XWW7VJnvVX2AlgQ0Aw==", "dependencies": { - "@axelar-network/axelar-gmp-sdk-solidity": "^4.0.0" + "@axelar-network/axelar-gmp-sdk-solidity": "^5.3.0" }, "engines": { - "node": "^16.0.0 || ^18.0.0" + "node": ">=16" + } + }, + "node_modules/@axelar-network/axelar-chains-config": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@axelar-network/axelar-chains-config/-/axelar-chains-config-0.1.0.tgz", + "integrity": "sha512-ZUEiye0baTk3WmFlLk96I3gjR+eywI0cFRGCJlG8U/JytPRb3+vHqOwh6kSQenkqtCULXDkKTQzige5mCRs2Kw==", + "dependencies": { + "fs-extra": "^11.1.1" + } + }, + "node_modules/@axelar-network/axelar-chains-config/node_modules/fs-extra": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", + "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" } }, "node_modules/@axelar-network/axelar-gmp-sdk-solidity": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@axelar-network/axelar-gmp-sdk-solidity/-/axelar-gmp-sdk-solidity-4.0.2.tgz", - "integrity": "sha512-AiO6ez3A42Kh8PTtoo3R8gqoZzBKGFZRogTQBy0GXm7ZMAUdAbHcDPbQwBwjOw8+fxVNSpLTvXxsAR2FUq85GQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@axelar-network/axelar-gmp-sdk-solidity/-/axelar-gmp-sdk-solidity-5.3.0.tgz", + "integrity": "sha512-gLAslEu7qamwUic2sTrXBqyY9kKI0jccSeKCleK6PZ3rGuHIDHvaM3Ap75oO6nYmp++i9MqxWlf+MJJk5f0IQA==", "engines": { "node": ">=16" } @@ -743,6 +764,32 @@ "case": "^1.6.3" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -6021,6 +6068,38 @@ "web3": "1.7.4" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "optional": true, + "peer": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/@tufjs/canonical-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz", @@ -6865,6 +6944,17 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/add-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", @@ -7066,6 +7156,14 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -9211,6 +9309,14 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/cross-fetch": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", @@ -26932,6 +27038,62 @@ "node": ">=12" } }, + "node_modules/ts-node": { + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -27511,6 +27673,14 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/v8-to-istanbul": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", @@ -29533,6 +29703,17 @@ "node": ">=12" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "optional": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -29547,11 +29728,12 @@ }, "packages/axelar-local-dev": { "name": "@axelar-network/axelar-local-dev", - "version": "2.1.0", + "version": "2.1.1", "license": "ISC", "dependencies": { - "@axelar-network/axelar-cgp-solidity": "^5.0.0", - "@axelar-network/axelar-gmp-sdk-solidity": "^4.0.2", + "@axelar-network/axelar-cgp-solidity": "^6.1.0", + "@axelar-network/axelar-chains-config": "^0.1.0", + "@axelar-network/axelar-gmp-sdk-solidity": "^5.3.0", "ethers": "^5.6.5", "fs-extra": "^10.1.0", "ganache": "^7.1.0", @@ -29594,29 +29776,43 @@ }, "packages/axelar-local-dev-aptos": { "name": "@axelar-network/axelar-local-dev-aptos", - "version": "2.1.0", + "version": "2.1.1", "license": "ISC", "dependencies": { "@axelar-network/axelar-cgp-aptos": "^1.0.5", - "@axelar-network/axelar-local-dev": "2.1.0", + "@axelar-network/axelar-local-dev": "2.1.1", "aptos": "1.3.16" } }, + "packages/axelar-local-dev-cosmos": { + "name": "@axelar-network/axelar-local-dev-cosmos", + "version": "2.1.0", + "extraneous": true, + "license": "ISC", + "dependencies": { + "@axelar-network/axelar-local-dev": "2.1.0", + "@cosmjs/stargate": "^0.31.1" + }, + "devDependencies": { + "docker-compose": "^0.24.2", + "ts-node": "^10.9.1" + } + }, "packages/axelar-local-dev-near": { "name": "@axelar-network/axelar-local-dev-near", - "version": "2.1.0", + "version": "2.1.1", "license": "ISC", "dependencies": { "@axelar-network/axelar-cgp-near": "^1.0.0", - "@axelar-network/axelar-local-dev": "2.1.0" + "@axelar-network/axelar-local-dev": "2.1.1" } }, "packages/axelar-local-dev-sui": { "name": "@axelar-network/axelar-local-dev-sui", - "version": "2.1.0", + "version": "2.1.1", "license": "ISC", "dependencies": { - "@axelar-network/axelar-local-dev": "2.1.0", + "@axelar-network/axelar-local-dev": "2.1.1", "@mysten/sui.js": "^0.41.0" } } diff --git a/packages/axelar-local-dev-aptos/__tests__/aptos.spec.ts b/packages/axelar-local-dev-aptos/__tests__/aptos.spec.ts index 255bd985..d6f7016d 100644 --- a/packages/axelar-local-dev-aptos/__tests__/aptos.spec.ts +++ b/packages/axelar-local-dev-aptos/__tests__/aptos.spec.ts @@ -1,11 +1,10 @@ import { HexString, TxnBuilderTypes } from 'aptos'; -import { AptosNetwork, AptosRelayer, createAptosNetwork, findNodeModulesPath } from '..'; +import { AptosNetwork, AptosRelayer, createAptosNetwork } from '..'; import fs from 'fs'; import path from 'path'; import { ethers } from 'ethers'; -import { Network, createNetwork, deployContract, relay, setLogger } from '@axelar-network/axelar-local-dev'; +import { Network, createNetwork, deployContract, relay, setLogger, EvmRelayer } from '@axelar-network/axelar-local-dev'; import HelloWorld from '../artifacts/__tests__/contracts/HelloWorld.sol/HelloWorld.json'; -import { EvmRelayer } from '@axelar-network/axelar-local-dev/dist/relay/EvmRelayer'; const { keccak256, toUtf8Bytes } = ethers.utils; setLogger(() => undefined); diff --git a/packages/axelar-local-dev-aptos/__tests__/utils.spec.ts b/packages/axelar-local-dev-aptos/__tests__/utils.spec.ts index 65c1b726..7cba090c 100644 --- a/packages/axelar-local-dev-aptos/__tests__/utils.spec.ts +++ b/packages/axelar-local-dev-aptos/__tests__/utils.spec.ts @@ -1,5 +1,6 @@ -import { findNodeModulesPath } from '..'; +import { findNodeModulesPath, findAxelarFramework } from '..'; import path from 'path'; +import fs from 'fs'; describe('utils', () => { it('should be able to find base `node_modules` path when the current dir is deep inside the node_modules folder', () => { @@ -11,4 +12,13 @@ describe('utils', () => { const path = findNodeModulesPath(__dirname); expect(path.endsWith('node_modules')).toBeTruthy(); }); + + it('should be able to find `axelar_framework` path when the current dir is deep inside the node_modules folder', () => { + const frameworkPath = findAxelarFramework( + path.join(__dirname, '..', '..', '..', '/node_modules/@axelar-network/axelar-local-dev/dist'), + ); + + const files = fs.readdirSync(frameworkPath); + expect(files.indexOf('package-metadata.bcs') > -1); + }); }); diff --git a/packages/axelar-local-dev-aptos/package.json b/packages/axelar-local-dev-aptos/package.json index 456a37fd..d079af7f 100644 --- a/packages/axelar-local-dev-aptos/package.json +++ b/packages/axelar-local-dev-aptos/package.json @@ -1,6 +1,6 @@ { "name": "@axelar-network/axelar-local-dev-aptos", - "version": "2.1.0", + "version": "2.1.1", "main": "dist/index.js", "files": [ "dist/", @@ -12,14 +12,14 @@ "test": "jest", "build-ts": "tsc", "build-aptos": "bash ./__tests__/modules/build.sh", - "build-contract": "hardhat compile", + "build-contract": "hardhat clean && hardhat compile", "build": "run-s clean build-ts build-contract build-aptos", "clean": "rm -rf src/types dist artifacts", "prettier": "prettier --write 'src/**/*.ts'" }, "dependencies": { "@axelar-network/axelar-cgp-aptos": "^1.0.5", - "@axelar-network/axelar-local-dev": "2.1.0", + "@axelar-network/axelar-local-dev": "2.1.1", "aptos": "1.3.16" }, "author": "", diff --git a/packages/axelar-local-dev-aptos/src/AptosNetwork.ts b/packages/axelar-local-dev-aptos/src/AptosNetwork.ts index e4cc9792..ca4cfb5c 100644 --- a/packages/axelar-local-dev-aptos/src/AptosNetwork.ts +++ b/packages/axelar-local-dev-aptos/src/AptosNetwork.ts @@ -2,7 +2,7 @@ import { AptosAccount, AptosClient, CoinClient, HexString, TxnBuilderTypes, BCS, import fs from 'fs'; import path from 'path'; import { sha3_256 as sha3Hash } from '@noble/hashes/sha3'; -import { findNodeModulesPath } from './utils'; +import { findAxelarFramework } from './utils'; declare type EntryFunctionPayload = { function: string; @@ -80,7 +80,7 @@ export class AptosNetwork extends AptosClient { txHash = await this.publishPackage( this.owner, new HexString(packageMetadata.toString('hex')).toUint8Array(), - moduleDatas.map((moduleData: any) => new TxnBuilderTypes.Module(new HexString(moduleData.toString('hex')).toUint8Array())) + moduleDatas.map((moduleData: any) => new TxnBuilderTypes.Module(new HexString(moduleData.toString('hex')).toUint8Array())), ); } @@ -96,8 +96,7 @@ export class AptosNetwork extends AptosClient { } deployAxelarFrameworkModules() { - const nodeModulesPath = findNodeModulesPath(__dirname); - const modulePath = path.join(nodeModulesPath, '@axelar-network/axelar-cgp-aptos/aptos/modules/axelar/build/AxelarFramework'); + const modulePath = findAxelarFramework(__dirname); return this.deploy(modulePath, ['axelar_gas_service.mv', 'address_utils.mv', 'gateway.mv'], '0x1234'); } @@ -121,7 +120,7 @@ export class AptosNetwork extends AptosClient { this.resourceAddress, `${this.resourceAddress}::gateway::OutgoingContractCallsState`, 'events', - _options + _options, ); } @@ -131,7 +130,7 @@ export class AptosNetwork extends AptosClient { this.resourceAddress, `${this.resourceAddress}::axelar_gas_service::GasServiceEventStore`, 'native_gas_paid_for_contract_call_events', - _options + _options, ); } @@ -140,7 +139,7 @@ export class AptosNetwork extends AptosClient { sourceChain: string, sourceAddress: string, destinationAddress: string, - payloadHash: Uint8Array + payloadHash: Uint8Array, ) { const tx = await this.submitTransactionAndWait(this.owner.address(), { function: `${this.resourceAddress}::gateway::approve_contract_call`, diff --git a/packages/axelar-local-dev-aptos/src/utils.ts b/packages/axelar-local-dev-aptos/src/utils.ts index 7bf1ddd9..8ce32734 100644 --- a/packages/axelar-local-dev-aptos/src/utils.ts +++ b/packages/axelar-local-dev-aptos/src/utils.ts @@ -8,14 +8,23 @@ export const getAptosLogID = (chain: string, event: any) => { return ethers.utils.id(chain + ':' + event.guid.account_address + ':' + event.version + ':' + event.sequence_number); }; -export const findNodeModulesPath = (currentDir: string) => { - let pathfinder: string = currentDir; - while (!pathfinder.endsWith('node_modules')) { - pathfinder = path.join(pathfinder, '..'); - const dirs = fs.readdirSync(pathfinder); - if (dirs.indexOf('node_modules') > -1) { - pathfinder += '/node_modules'; +export const findAxelarFramework = (currentDir: string): string => { + const node_module = findNodeModulesPath(currentDir); + const dirs = fs.readdirSync(node_module); + if (dirs.indexOf('@axelar-network') > -1) { + const axelarDirs = fs.readdirSync(path.join(node_module, '@axelar-network')); + if (axelarDirs.indexOf('axelar-cgp-aptos') > -1) { + return path.join(node_module, '@axelar-network', 'axelar-cgp-aptos', 'aptos', 'modules', 'axelar', 'build', 'AxelarFramework'); } } - return pathfinder; + + return findAxelarFramework(path.join(currentDir, '..')); +}; + +export const findNodeModulesPath = (currentDir: string): string => { + const dirs = fs.readdirSync(currentDir); + if (dirs.indexOf('node_modules') > -1) { + return path.join(currentDir, 'node_modules'); + } + return findNodeModulesPath(path.join(currentDir, '..')); }; diff --git a/packages/axelar-local-dev-near/package.json b/packages/axelar-local-dev-near/package.json index 80762877..0c40a312 100644 --- a/packages/axelar-local-dev-near/package.json +++ b/packages/axelar-local-dev-near/package.json @@ -1,6 +1,6 @@ { "name": "@axelar-network/axelar-local-dev-near", - "version": "2.1.0", + "version": "2.1.1", "description": "", "main": "dist/index.js", "files": [ @@ -21,7 +21,7 @@ }, "dependencies": { "@axelar-network/axelar-cgp-near": "^1.0.0", - "@axelar-network/axelar-local-dev": "2.1.0" + "@axelar-network/axelar-local-dev": "2.1.1" }, "author": "", "license": "ISC" diff --git a/packages/axelar-local-dev-sui/package.json b/packages/axelar-local-dev-sui/package.json index 97ea7a7e..9a20b5a8 100644 --- a/packages/axelar-local-dev-sui/package.json +++ b/packages/axelar-local-dev-sui/package.json @@ -1,6 +1,6 @@ { "name": "@axelar-network/axelar-local-dev-sui", - "version": "2.1.0", + "version": "2.1.1", "main": "dist/index.js", "files": [ "dist/", @@ -17,7 +17,7 @@ "build-sui": "cd move && sui move build" }, "dependencies": { - "@axelar-network/axelar-local-dev": "2.1.0", + "@axelar-network/axelar-local-dev": "2.1.1", "@mysten/sui.js": "^0.41.0" }, "author": "euro@axelar.network", diff --git a/packages/axelar-local-dev/package.json b/packages/axelar-local-dev/package.json index e8857941..52e7ef44 100644 --- a/packages/axelar-local-dev/package.json +++ b/packages/axelar-local-dev/package.json @@ -1,6 +1,6 @@ { "name": "@axelar-network/axelar-local-dev", - "version": "2.1.0", + "version": "2.1.1", "description": "", "main": "dist/index.js", "files": [ @@ -33,8 +33,9 @@ }, "homepage": "https://github.com/axelarnetwork/axelar-local-dev#readme", "dependencies": { - "@axelar-network/axelar-cgp-solidity": "^5.0.0", - "@axelar-network/axelar-gmp-sdk-solidity": "^4.0.2", + "@axelar-network/axelar-cgp-solidity": "^6.1.0", + "@axelar-network/axelar-chains-config": "^0.1.0", + "@axelar-network/axelar-gmp-sdk-solidity": "^5.3.0", "ethers": "^5.6.5", "fs-extra": "^10.1.0", "ganache": "^7.1.0", diff --git a/packages/axelar-local-dev/src/__tests__/forking.spec.ts b/packages/axelar-local-dev/src/__tests__/forking.spec.ts index a50ef925..060387f4 100644 --- a/packages/axelar-local-dev/src/__tests__/forking.spec.ts +++ b/packages/axelar-local-dev/src/__tests__/forking.spec.ts @@ -14,8 +14,7 @@ interface NetworkUsdc extends Network { usdc?: Contract; } -describe.skip("forking", () => { - +describe.skip('forking', () => { afterEach(async () => { await stopAll(); }); @@ -24,8 +23,8 @@ describe.skip("forking", () => { const chainName = 'Avalanche'; const tokenAlias = 'uusdc'; const testAmount = 1234; - const chains = mainnetInfo; - const avalanche = chains.find((chain: { name: string }) => chain.name === chainName) as any; + const chains = mainnetInfo as any; + const avalanche = chains[chainName.toLowerCase()]; const chain: NetworkUsdc = await forkNetwork(avalanche, { ganacheOptions: { fork: { deleteCache: true }, @@ -40,11 +39,11 @@ describe.skip("forking", () => { }); it('should fork Avalanche and Ethereum and send some USDC back and forth', async () => { - const chains = mainnetInfo; + const chains = mainnetInfo as any; const alias = 'uusdc'; for (const chainName of ['Avalanche', 'Ethereum']) { - const chainInfo = chains.find((chain: { name: string }) => chain.name === chainName) as any; + const chainInfo = chains[chainName.toLowerCase()]; const chain = (await forkNetwork(chainInfo)) as any; chain.usdc = await chain.getTokenContract(alias); } diff --git a/packages/axelar-local-dev/src/contracts/index.ts b/packages/axelar-local-dev/src/contracts/index.ts index 96682334..3215b40d 100644 --- a/packages/axelar-local-dev/src/contracts/index.ts +++ b/packages/axelar-local-dev/src/contracts/index.ts @@ -7,8 +7,8 @@ import Auth from '../artifacts/@axelar-network/axelar-cgp-solidity/contracts/aut import AxelarGasReceiver from '../artifacts/@axelar-network/axelar-cgp-solidity/contracts/gas-service/AxelarGasService.sol/AxelarGasService.json'; import AxelarGasReceiverProxy from '../artifacts/@axelar-network/axelar-cgp-solidity/contracts/gas-service/AxelarGasServiceProxy.sol/AxelarGasServiceProxy.json'; import IAxelarGasService from '../artifacts/@axelar-network/axelar-cgp-solidity/contracts/interfaces/IAxelarGasService.sol/IAxelarGasService.json'; -import ConstAddressDeployer from '@axelar-network/axelar-gmp-sdk-solidity/dist/ConstAddressDeployer.json'; -import Create3Deployer from '@axelar-network/axelar-gmp-sdk-solidity/dist/Create3Deployer.json'; +import ConstAddressDeployer from '@axelar-network/axelar-gmp-sdk-solidity/artifacts/contracts/deploy/ConstAddressDeployer.sol/ConstAddressDeployer.json'; +import Create3Deployer from '@axelar-network/axelar-gmp-sdk-solidity/artifacts/contracts/deploy/Create3Deployer.sol/Create3Deployer.json'; import IAxelarExecutable from '../artifacts/@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarExecutable.sol/IAxelarExecutable.json'; export { diff --git a/packages/axelar-local-dev/src/exportUtils.ts b/packages/axelar-local-dev/src/exportUtils.ts index e0976312..7190b38c 100644 --- a/packages/axelar-local-dev/src/exportUtils.ts +++ b/packages/axelar-local-dev/src/exportUtils.ts @@ -5,8 +5,9 @@ import { setJSON } from './utils'; import { Network, NetworkOptions } from './Network'; import { RelayData, RelayerMap, relay } from './relay'; import { createNetwork, forkNetwork, listen, stopAll } from './networkUtils'; -import { testnetInfo, mainnetInfo } from './info'; +import { testnetInfo } from './info'; import { EvmRelayer } from './relay/EvmRelayer'; +import { getChainArray } from '@axelar-network/axelar-chains-config'; let interval: any; @@ -60,9 +61,7 @@ export async function createAndExport(options: CreateLocalOptions = {}) { seed: name, ganacheOptions: {}, }); - const testnet = testnetInfo.find((info: any) => { - return info.name === name; - }); + const testnet = (testnetInfo as any)[name]; const info = chain.getCloneInfo() as any; info.rpc = `http://localhost:${_options.port}/${i}`; (info.tokenName = testnet?.tokenName), (info.tokenSymbol = testnet?.tokenSymbol), localChains.push(info); @@ -130,7 +129,8 @@ export async function forkAndExport(options: CloneLocalOptions = {}) { if (_options.env != 'mainnet' && _options.env != 'testnet') { console.log(`Forking ${_options.env.length} chains from custom data.`); } - const chainsRaw = _options.env == 'mainnet' ? mainnetInfo : _options.env == 'testnet' ? testnetInfo : _options.env; + const chainsRaw = + _options.env == 'mainnet' ? getChainArray('mainnet') : _options.env == 'testnet' ? getChainArray('testnet') : _options.env; const chains = _options.chains?.length == 0 diff --git a/packages/axelar-local-dev/src/info.ts b/packages/axelar-local-dev/src/info.ts index bb2fa6b3..baa66e40 100644 --- a/packages/axelar-local-dev/src/info.ts +++ b/packages/axelar-local-dev/src/info.ts @@ -1,7 +1,5 @@ -import testnetInfo from '@axelar-network/axelar-cgp-solidity/info/testnet.json'; -import mainnetInfo from '@axelar-network/axelar-cgp-solidity/info/mainnet.json'; +import mainnet from '@axelar-network/axelar-chains-config/info/mainnet.json'; +import testnet from '@axelar-network/axelar-chains-config/info/testnet.json'; -export { - testnetInfo, - mainnetInfo -} +export const mainnetInfo = mainnet.chains; +export const testnetInfo = testnet.chains; diff --git a/packages/axelar-local-dev/tsconfig.json b/packages/axelar-local-dev/tsconfig.json index 926963cc..4545c07e 100644 --- a/packages/axelar-local-dev/tsconfig.json +++ b/packages/axelar-local-dev/tsconfig.json @@ -13,7 +13,7 @@ "declarationMap": true /* Create sourcemaps for d.ts files. */, "sourceMap": true /* Create source map files for emitted JavaScript files. */, "rootDirs": ["./src", "src/__test__"] /* Specify the root folder within your source files. */, - "outDir": "./dist" /* Specify an output folder for all emitted files. */, + "outDir": "dist" /* Specify an output folder for all emitted files. */, /* Interop Constraints */ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */