-
Notifications
You must be signed in to change notification settings - Fork 747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added reserve asset transfer script #6990
base: papi_chopsticks_docs
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
endpoint: wss://westend-penpal-rpc.polkadot.io | ||
mock-signature-host: true | ||
#block: ${env.WESTEND_BRIDGE_HUB_BLOCK_NUMBER} | ||
db: ./db.sqlite | ||
runtime-log-level: 5 | ||
wasm-override: wasms/penpal_runtime.compact.compressed.wasm | ||
|
||
import-storage: | ||
PolkadotXcm: | ||
SafeXcmVersion: 5 | ||
System: | ||
Account: | ||
- | ||
- | ||
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice | ||
- providers: 1 | ||
data: | ||
free: 1000000000000000 | ||
- | ||
- | ||
- 5Eg2fntQqFi3EvFWAf71G66Ecjjah26bmFzoANAeHFgj9Lia | ||
- providers: 1 | ||
data: | ||
free: 1000000000000000 | ||
- | ||
- | ||
- 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty # Bob | ||
- providers: 1 | ||
data: | ||
free: 1000000000000000 | ||
Assets: | ||
Account: | ||
- [[1984, 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY], { balance: 1000000000 }] | ||
- [[1984, 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty], { balance: 1000000000 }] # Bob | ||
Asset: [[[1984], { supply: 1000000000 }]] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -387,3 +387,99 @@ test("Initiate Teleport with remote fees", async () => { | |
const r = await ahToWnd.signAndSubmit(aliceSigner); | ||
expect(r).toBeTruthy(); | ||
}) | ||
|
||
test("Withdraw USDT from Alice to Bob", async () => { | ||
|
||
const msg = Enum('V5', [ | ||
XcmV4Instruction.WithdrawAsset([ | ||
{ | ||
id: { | ||
parents: 1, | ||
interior: XcmV3Junctions.Here(), | ||
}, | ||
fun: XcmV3MultiassetFungibility.Fungible(3_000_000_000_000n), | ||
}, | ||
]), | ||
Enum('PayFees', { | ||
asset: { | ||
id: { | ||
parents: 1, | ||
interior: XcmV3Junctions.Here(), | ||
}, | ||
fun: XcmV3MultiassetFungibility.Fungible(1_000_000_000_000n), | ||
} | ||
}), | ||
XcmV4Instruction.TransferReserveAsset({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're using V5, you should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah penpal is still on v4, we should fix that |
||
assets: [ | ||
{ | ||
id: { | ||
parents: 0, | ||
interior: XcmV3Junctions.X2([ | ||
XcmV3Junction.PalletInstance(50), | ||
XcmV3Junction.GeneralIndex(1984n)]), | ||
}, | ||
fun: XcmV3MultiassetFungibility.Fungible(100_000_000n), | ||
}, | ||
{ | ||
id: { | ||
parents: 1, | ||
interior: XcmV3Junctions.Here(), | ||
}, | ||
fun: XcmV3MultiassetFungibility.Fungible(2_000_000_000_000n), | ||
}, | ||
], | ||
dest: { | ||
parents: 1, | ||
interior: XcmV3Junctions.X1( | ||
XcmV3Junction.Parachain(2042), | ||
), | ||
}, | ||
xcm: [ | ||
Enum('PayFees', { | ||
asset: { | ||
id: { | ||
parents: 1, | ||
interior: XcmV3Junctions.Here(), | ||
}, | ||
fun: XcmV3MultiassetFungibility.Fungible(1_000_000_000_000n), | ||
} | ||
}), | ||
XcmV4Instruction.DepositAsset({ | ||
assets: XcmV3MultiassetMultiAssetFilter.Wild({ | ||
type: 'All', | ||
value: undefined, | ||
}), | ||
// granular version | ||
// assets: XcmV4AssetAssetFilter.Definite([{ | ||
// id: { | ||
// parents: 1, | ||
// // interior: XcmV3Junctions.Here(), | ||
// interior: XcmV3Junctions.X3([ | ||
// XcmV3Junction.Parachain(1000), | ||
// XcmV3Junction.PalletInstance(50), | ||
// XcmV3Junction.GeneralIndex(1984n)]), | ||
// }, | ||
// // fun: XcmV3MultiassetFungibility.Fungible(1_000_000_000_000n), | ||
// fun: XcmV3MultiassetFungibility.Fungible(100_000_000n), | ||
// }]), | ||
beneficiary: { | ||
parents: 0, | ||
interior: XcmV3Junctions.X1(XcmV3Junction.AccountId32({ | ||
network: undefined, | ||
id: Binary.fromBytes(hdkdKeyPairAlice.publicKey), | ||
})), | ||
}, | ||
}), | ||
], | ||
}), | ||
]); | ||
|
||
|
||
const ahToWnd = AHApi.tx.PolkadotXcm.execute({ | ||
message: msg, | ||
max_weight: { ref_time: 81834380000n, proof_size: 823193n }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should get it from the runtime API |
||
}, | ||
); | ||
const r = await ahToWnd.signAndSubmit(aliceSigner); | ||
expect(r).toBeTruthy(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this assertion enough? |
||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a
package.json
somewhere?