Skip to content
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

feat: add support for pallet-xcm claimAssets call #394

Merged
merged 11 commits into from
Apr 15, 2024

Conversation

marshacb
Copy link
Contributor

@marshacb marshacb commented Apr 15, 2024

Description

This PR adds support for constructing local claimAssets runtime calls to the AssetTransferApi for claiming trapped assets.

Claimable Assets

Assets to claim can be provided as asset symbols (e.g. usdt, wnd), locations (e.g. {"parents":"0","interior":{"X2":[{"PalletInstance":"50"},{"GeneralIndex":"66"}]}}) or integers (e.g. 66, 1984).

Note: An asset can also be provided as an empty string. In this case the assetId will be recognized as the relay chains native asset. (e.g. [''] will be equivalent to wnd when on a Westend chain).

Example of constructing a claimAssets call to claim trapped WND on Westend:

api.claimAssets(
	['WND'],
	['1000000000000'],
	'5HBuLJz9LdkUNseUEL6DLeVkx2bqEi6pQr8Ea7fS4bzx7i7E', 
	{
		xcmVersion: 4,
		format: 'payload',
		sendersAddr: '5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX'
	} 
)

Expected output:

{"origin":"0","dest":"westend","direction":"local","xcmVersion":4,"method":"claimAssets","format":"payload","tx":"0xc8630c0404000000070010a5d4e80400010100e2aa84cbfa479f0150bb77eb06756ee2c725ec625e16dd68b2678a0820e8d834b500940050690f0018000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e901c8a5932603948278d24d86dfc72e508d890723bf6bd3cf9f8645be53cbdc2"}

closes: #373

Copy link
Member

@TarikGul TarikGul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great job. Just a a few small nits in the examples

examples/claimAssets.ts Outdated Show resolved Hide resolved
examples/claimAssets.ts Outdated Show resolved Hide resolved
@marshacb marshacb merged commit 685ca19 into main Apr 15, 2024
6 checks passed
@Polkadot-Forum
Copy link

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/paritytech-update-for-april/7646/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add asset claim support
3 participants