forked from open-web3-stack/polkadot-ecosystem-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhydration.moonbeam.test.ts
75 lines (60 loc) · 2.38 KB
/
hydration.moonbeam.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { describe } from 'vitest'
import { defaultAccounts } from '@e2e-test/networks'
import { hydration, moonbeam, polkadot } from '@e2e-test/networks/chains'
import { query, tx } from '@e2e-test/shared/api'
import { runXtokenstHorizontal } from '@e2e-test/shared/xcm'
import { setupNetworks } from '@e2e-test/shared'
describe('hydration & moonbeam', async () => {
const [hydrationClient, moonbeamClient, polkadotClient] = await setupNetworks(hydration, moonbeam, polkadot)
const hydrationDot = hydration.custom.relayToken
const moonbeamDot = moonbeam.custom.dot
const glmr = hydration.custom.glmr
runXtokenstHorizontal('hydration transfer DOT to moonbeam', async () => {
return {
fromChain: hydrationClient,
fromBalance: query.tokens(hydrationDot),
fromAccount: defaultAccounts.alice,
toChain: moonbeamClient,
toBalance: query.assets(moonbeamDot),
toAccount: defaultAccounts.alith,
routeChain: polkadotClient,
isCheckUmp: true,
tx: tx.xtokens.transfer(hydrationDot, 2e12, tx.xtokens.parachainAccountId20V3(moonbeam.paraId!)),
}
})
runXtokenstHorizontal('moonbeam transfer DOT to hydration', async () => {
await moonbeamClient.dev.setStorage({
Assets: {
account: [[[moonbeamDot, defaultAccounts.alith.address], { balance: 10e12 }]],
},
})
return {
fromChain: moonbeamClient,
fromBalance: query.assets(moonbeamDot),
fromAccount: defaultAccounts.alith,
toChain: hydrationClient,
toBalance: query.tokens(hydrationDot),
toAccount: defaultAccounts.bob,
routeChain: polkadotClient,
isCheckUmp: true,
tx: tx.xtokens.transfer({ ForeignAsset: moonbeamDot }, 2e10, tx.xtokens.parachainV3(hydration.paraId!)),
}
})
runXtokenstHorizontal('hydration transfer GLMR to moonbeam', async () => {
await hydrationClient.dev.setStorage({
Tokens: {
Accounts: [[[defaultAccounts.alice.address, glmr], { free: '50000000000000000000000' }]],
},
})
return {
fromChain: hydrationClient,
fromBalance: query.tokens(glmr),
fromAccount: defaultAccounts.alice,
routeChain: polkadotClient,
toChain: moonbeamClient,
toBalance: query.balances,
toAccount: defaultAccounts.baltathar,
tx: tx.xtokens.transfer(glmr, '200000000000000000000', tx.xtokens.parachainAccountId20V3(moonbeam.paraId!)),
}
})
})