Skip to content

Commit

Permalink
update bridgeSDK version & snapshots (#186)
Browse files Browse the repository at this point in the history
* Pending changes exported from your codespace

* update snapshot

* lint

* update

* update

* update

* update
  • Loading branch information
StrawberryFlavor authored Apr 15, 2024
1 parent e2a0460 commit 5fd827b
Show file tree
Hide file tree
Showing 13 changed files with 495 additions and 491 deletions.
4 changes: 2 additions & 2 deletions networks/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Config } from './types'

import acalaConfig from './acala'
import acalaNextConfig from './acala-next'
import assethubConfig from './assethub'
import astarConfig from './astar'
import bifrostConfig from './bifrost'
import centrifugeConfig from './centrifuge'
Expand All @@ -13,12 +14,11 @@ import moonbeamConfig from './moonbeam'
// import parallelConfig from './parallel'
import phalaConfig from './phala'
import polkadotConfig from './polkadot'
import statemintConfig from './statemint'
import uniqueConfig from './unique'

const all = {
polkadot: polkadotConfig,
statemint: statemintConfig,
assethub: assethubConfig,
acala: acalaConfig,
astar: astarConfig,
acalaNext: acalaNextConfig,
Expand Down
10 changes: 5 additions & 5 deletions networks/statemint.ts → networks/assethub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Config } from './types'

export default {
polkadot: {
name: 'statemint' as const,
name: 'assetHubPolkadot' as const,
endpoint: 'wss://rpc-asset-hub-polkadot.luckyfriday.io',
},
kusama: {
name: 'statemine' as const,
name: 'assetHubKusama' as const,
endpoint: 'wss://rpc-asset-hub-kusama.luckyfriday.io',
},
config: ({ alice }) => ({
Expand All @@ -16,21 +16,21 @@ export default {
},
Assets: {
account: [
[[statemine.usdtIndex, alice.address], { balance: 1000e6 }], // USDT
[[assetHubKusama.usdtIndex, alice.address], { balance: 1000e6 }], // USDT
],
},
},
}),
} satisfies Config

export const statemint = {
export const assetHubPolkadot = {
paraId: 1000,
dot: { Concrete: { parents: 1, interior: 'Here' } },
wbtc: { Concrete: { parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 21 }] } } },
wbtcIndex: 21,
} as const

export const statemine = {
export const assetHubKusama = {
paraId: 1000,
ksm: { Concrete: { parents: 1, interior: 'Here' } },
usdt: { Concrete: { parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 1984 }] } } },
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@acala-network/sdk": "^4.1.9-13",
"@acala-network/sdk-core": "^4.1.9-13",
"@polkadot/api": "^10.12.6",
"@polkawallet/bridge": "^0.1.5-31",
"@polkawallet/bridge": "^0.1.6-2",
"@swc/core": "^1.4.12",
"axios": "^1.6.8",
"dotenv": "^16.4.5",
Expand Down
66 changes: 33 additions & 33 deletions tests/bridge-sdk/__snapshots__/kusama.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ exports[`'altair' to 'karura' using bridgeSDK cross-chain 'AIR' > parachain brid
}
`;

exports[`'assetHubKusama' to 'kusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": "(rounded 8)",
"toChain": "(rounded 12)",
}
`;

exports[`'assetHubKusama' to 'kusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.00008)"`;

exports[`'assetHubKusama' to 'kusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": 10,
"toChain": 10,
}
`;

exports[`'basilisk' to 'karura' using bridgeSDK cross-chain 'BSX' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
Expand Down Expand Up @@ -300,45 +320,45 @@ exports[`'kintsugi' to 'karura' using bridgeSDK cross-chain 'LKSM' > parachain b
}
`;

exports[`'kusama' to 'basilisk' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
exports[`'kusama' to 'assetHubKusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": "(rounded 8)",
"toChain": "(rounded 1000)",
"toChain": "(rounded 12)",
}
`;

exports[`'kusama' to 'basilisk' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
exports[`'kusama' to 'assetHubKusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.0001)"`;

exports[`'kusama' to 'assetHubKusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": 10,
"toChain": 1000,
"toChain": 10,
}
`;

exports[`'kusama' to 'karura' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
exports[`'kusama' to 'basilisk' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": "(rounded 8)",
"toChain": "(rounded 12)",
"toChain": "(rounded 1000)",
}
`;

exports[`'kusama' to 'karura' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.00004)"`;

exports[`'kusama' to 'karura' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
exports[`'kusama' to 'basilisk' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": 10,
"toChain": 10,
"toChain": 1000,
}
`;

exports[`'kusama' to 'statemine' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
exports[`'kusama' to 'karura' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
Expand All @@ -347,9 +367,9 @@ exports[`'kusama' to 'statemine' using bridgeSDK cross-chain 'KSM' > parachain b
}
`;

exports[`'kusama' to 'statemine' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.0001)"`;
exports[`'kusama' to 'karura' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.00004)"`;

exports[`'kusama' to 'statemine' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
exports[`'kusama' to 'karura' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
Expand Down Expand Up @@ -377,23 +397,3 @@ exports[`'shiden' to 'karura' using bridgeSDK cross-chain 'KUSD' > parachain bri
"toChain": 10,
}
`;

exports[`'statemine' to 'kusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": "(rounded 8)",
"toChain": "(rounded 12)",
}
`;

exports[`'statemine' to 'kusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.00008)"`;

exports[`'statemine' to 'kusama' using bridgeSDK cross-chain 'KSM' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 12,
"fromChain": 10,
"toChain": 10,
}
`;
46 changes: 23 additions & 23 deletions tests/bridge-sdk/__snapshots__/polkadot.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,26 @@ exports[`'acala' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bri
}
`;

exports[`'assetHubPolkadot' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 10,
"fromChain": "(rounded 998)",
"toChain": "(rounded 1000)",
}
`;

exports[`'assetHubPolkadot' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.002)"`;

exports[`'assetHubPolkadot' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 10,
"fromChain": 1000,
"toChain": 1000,
}
`;

exports[`'astar' to 'acala' using bridgeSDK cross-chain 'AUSD' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
Expand Down Expand Up @@ -140,27 +160,7 @@ exports[`'polkadot' to 'acala' using bridgeSDK cross-chain 'DOT' > parachain bri
}
`;

exports[`'polkadot' to 'statemint' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 10,
"fromChain": "(rounded 998)",
"toChain": "(rounded 1000)",
}
`;

exports[`'polkadot' to 'statemint' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.004)"`;

exports[`'polkadot' to 'statemint' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 10,
"fromChain": 1000,
"toChain": 1000,
}
`;

exports[`'statemint' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
exports[`'polkadot' to 'assetHubPolkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > after 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 10,
Expand All @@ -169,9 +169,9 @@ exports[`'statemint' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain
}
`;

exports[`'statemint' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.002)"`;
exports[`'polkadot' to 'assetHubPolkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > fee 1`] = `"(rounded 0.004)"`;

exports[`'statemint' to 'polkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
exports[`'polkadot' to 'assetHubPolkadot' using bridgeSDK cross-chain 'DOT' > parachain bridge to releaychain > Cross-chain using BridgeSDK works > initial 1`] = `
{
"address": "5FA9nQDVg267DEd8m1ZypXLBnvN7SFxYwV7ndqSYGiN9TTpu",
"decimals": 10,
Expand Down
4 changes: 2 additions & 2 deletions tests/bridge-sdk/kusama.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const tests = [
token: 'KSM',
},
{
from: 'statemine',
from: 'assetHubKusama',
to: 'kusama',
token: 'KSM',
},
{
from: 'kusama',
to: 'statemine',
to: 'assetHubKusama',
token: 'KSM',
},
{
Expand Down
4 changes: 2 additions & 2 deletions tests/bridge-sdk/polkadot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const tests = [
},
{
from: 'polkadot',
to: 'statemint',
to: 'assetHubPolkadot',
token: 'DOT',
},
{
from: 'statemint',
from: 'assetHubPolkadot',
to: 'polkadot',
token: 'DOT',
},
Expand Down
6 changes: 3 additions & 3 deletions tests/bridge-sdk/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { sendTransaction, testingPairs } from '@acala-network/chopsticks-testing

import { AcalaAdapter } from '@polkawallet/bridge/adapters/acala/acala'
import { AltairAdapter } from '@polkawallet/bridge/adapters/centrifuge'
import { AssetHubKusamaAdapter, AssetHubPolkadotAdapter } from '@polkawallet/bridge/adapters/assethub'
import { AstarAdapter, ShidenAdapter } from '@polkawallet/bridge/adapters/astar'
import { BasiliskAdapter } from '@polkawallet/bridge/adapters/hydradx'
import { BifrostAdapter } from '@polkawallet/bridge/adapters/bifrost'
Expand All @@ -18,7 +19,6 @@ import { KusamaAdapter, PolkadotAdapter } from '@polkawallet/bridge/adapters/pol
import { MoonbeamAdapter, MoonriverAdapter } from '@polkawallet/bridge/adapters/moonbeam'
import { QuartzAdapter, UniqueAdapter } from '@polkawallet/bridge/adapters/unique'
import { ShadowAdapter } from '@polkawallet/bridge/adapters/crust'
import { StatemineAdapter, StatemintAdapter } from '@polkawallet/bridge/adapters/statemint'

import { Network, NetworkNames, createNetworks } from '../../networks'
import { check } from '../../helpers'
Expand Down Expand Up @@ -96,10 +96,10 @@ export const buildTests = (tests: ReadonlyArray<TestTtype>) => {
karura: KaruraAdapter,
kusama: KusamaAdapter,
moonriver: MoonriverAdapter,
statemine: StatemineAdapter,
assetHubKusama: AssetHubKusamaAdapter,
basilisk: BasiliskAdapter,
polkadot: PolkadotAdapter,
statemint: StatemintAdapter,
assetHubPolkadot: AssetHubPolkadotAdapter,
moonbeam: MoonbeamAdapter,
acala: AcalaAdapter,
bifrost: BifrostAdapter,
Expand Down
Loading

0 comments on commit 5fd827b

Please sign in to comment.