-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
6,994 additions
and
805 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- split network into chains -> runtimes + utilty chain | ||
- investigate if limitedReserveTransferAssets should be split into different versions (Outcome: each testpairs for different versions.) | ||
- For the future: Test against generic transact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ | |
"author": "[\"KILT <[email protected]>\"]", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@acala-network/chopsticks": "0.10.0", | ||
"@acala-network/chopsticks-testing": "0.10.1", | ||
"@acala-network/chopsticks": "0.11.0", | ||
"@acala-network/chopsticks-testing": "0.11.0", | ||
"@polkadot/api": "^10.11.2", | ||
"@types/node": "^20.11.30", | ||
"@typescript-eslint/eslint-plugin": "^7.7.0", | ||
|
@@ -19,15 +19,15 @@ | |
"eslint-config-prettier": "^9.1.0", | ||
"eslint-config-standard-with-typescript": "^43.0.1", | ||
"eslint-plugin-import": "^2.25.2", | ||
"eslint-plugin-jsx-a11y": "^6.8.0", | ||
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"prettier": "^3.2.5", | ||
"ts-node": "^10.9.2", | ||
"tsx": "^4.7.1", | ||
"typescript": "*", | ||
"vitest": "^1.4.0", | ||
"eslint-plugin-jsx-a11y": "^6.8.0" | ||
"vitest": "^1.4.0" | ||
}, | ||
"scripts": { | ||
"ts-check": "tsc --noEmit", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { ApiPromise } from '@polkadot/api' | ||
|
||
export const xtokens = { | ||
parachainV2: (paraId: number) => (acc: any) => ({ | ||
V1: { | ||
parents: 1, | ||
interior: { | ||
X2: [ | ||
{ Parachain: paraId }, | ||
{ | ||
AccountId32: { | ||
network: 'Any', | ||
id: acc, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}), | ||
parachainV3: (paraId: number) => (acc: any) => ({ | ||
V3: { | ||
parents: 1, | ||
interior: { | ||
X2: [ | ||
{ Parachain: paraId }, | ||
{ | ||
AccountId32: { | ||
id: acc, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}), | ||
transfer: | ||
(token: any, amount: any, dest: (dest: any) => any, weight: any = 'Unlimited') => | ||
({ api }: { api: ApiPromise }, acc: any) => | ||
api.tx.xTokens.transfer(token, amount, dest(acc), weight), | ||
} | ||
|
||
export const xcmPallet = { | ||
parachainV2: (parents: number, paraId: number) => ({ | ||
V2: { | ||
parents, | ||
interior: { | ||
X1: { Parachain: paraId }, | ||
}, | ||
}, | ||
}), | ||
parachainV3: (parents: number, paraId: any) => ({ | ||
V3: { | ||
parents, | ||
interior: { | ||
X1: { Parachain: paraId }, | ||
}, | ||
}, | ||
}), | ||
limitedTeleportAssets: | ||
(token: any, amount: any, dest: any) => | ||
({ api }: { api: ApiPromise }, acc: any) => | ||
(api.tx.xcmPallet || api.tx.polkadotXcm).limitedTeleportAssets( | ||
dest, | ||
{ | ||
V3: { | ||
parents: 0, | ||
interior: { | ||
X1: { | ||
AccountId32: { | ||
// network: 'Any', | ||
id: acc, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
V3: [ | ||
{ | ||
id: token, | ||
fun: { Fungible: amount }, | ||
}, | ||
], | ||
}, | ||
0, | ||
'Unlimited' | ||
), | ||
limitedReserveTransferAssetsV2: | ||
(token: any, dest: any) => | ||
({ api }: { api: ApiPromise }, acc: any, amount: any) => | ||
(api.tx.xcmPallet || api.tx.polkadotXcm).limitedReserveTransferAssets( | ||
dest, | ||
{ | ||
V2: { | ||
parents: 0, | ||
interior: { | ||
X1: { | ||
AccountId32: { | ||
network: 'Any', | ||
id: acc, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
V2: [ | ||
{ | ||
id: token, | ||
fun: { Fungible: amount }, | ||
}, | ||
], | ||
}, | ||
0, | ||
'Unlimited' | ||
), | ||
limitedReserveTransferAssetsV3: | ||
(token: any, amount: any, dest: any) => | ||
({ api }: { api: ApiPromise }, acc: any) => | ||
(api.tx.xcmPallet || api.tx.polkadotXcm).limitedReserveTransferAssets( | ||
dest, | ||
{ | ||
V3: { | ||
parents: 0, | ||
interior: { | ||
X1: { | ||
AccountId32: { | ||
id: acc, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
V3: [ | ||
{ | ||
id: token, | ||
fun: { Fungible: amount }, | ||
}, | ||
], | ||
}, | ||
0, | ||
'Unlimited' | ||
), | ||
} | ||
|
||
export const tx = { | ||
xtokens, | ||
xcmPallet, | ||
} | ||
|
||
export const query = { | ||
balances: async ({ api }: { api: ApiPromise }, address: string) => | ||
BigInt(((await api.query.system.account(address)) as any).data.free), | ||
tokens: | ||
(token: any) => | ||
async ({ api }: { api: ApiPromise }, address: string) => | ||
BigInt(((await api.query.tokens.accounts(address, token)) as any).free), | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
integration-tests/chopsticks/src/network/polkadot/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as SpiritnetConfig from './spiritnet.js' | ||
import * as PolkadotConfig from './relay.js' | ||
import * as HydraDxConfig from './hydraDx.js' | ||
import { ChainConfigs } from '../types.js' | ||
|
||
const BLOCK_NUMBER_SPIRITNET = 5_000_000 | ||
const BLOCK_NUMBER_HYDRADX_POLKADOT = 4_000_000 | ||
|
||
export const chainConfigs: ChainConfigs = { | ||
spiritnet: { config: SpiritnetConfig.getSetupOptions, blockNumber: BLOCK_NUMBER_SPIRITNET, name: 'spiritnet' }, | ||
hydraDx: { config: HydraDxConfig.getSetupOptions, blockNumber: BLOCK_NUMBER_HYDRADX_POLKADOT, name: 'hydradx' }, | ||
polkadot: { config: PolkadotConfig.getSetupOptions, blockNumber: BLOCK_NUMBER_HYDRADX_POLKADOT, name: 'polkadot' }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import type { setupContext } from '@acala-network/chopsticks-testing' | ||
import type { SetupOption, setupContext } from '@acala-network/chopsticks-testing' | ||
|
||
export type Config = Awaited<ReturnType<typeof setupContext>> | ||
|
||
export interface Chain { | ||
config: (blockNumber?: number | undefined) => SetupOption | ||
blockNumber: number | ||
name: string | ||
} | ||
|
||
export type ChainConfigs = Record<string, Chain> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.