You can withdraw the assets by submitting an XCM extrinsic directly to the Karura parachain (this applies to any parachain that uses the xtokens
pallet: xtokens).
This can be done from the command line, but the easier way is to use the Polkadot.js interface for the relevant parachain, the Karura interface can be found here: Karura - Extrinsics.
An example of an xToken
transfer in a JSON format looks like this:
[
{
name: "currency_id",
type: "acala_primitives:currency:CurrencyId",
type_name: "CurrencyId",
value: {
Token: "KSM"
}
},
{
name: "amount",
type: "U128",
type_name: "Balance",
value: "123400000000"
},
{
name: "dest",
type: "xcm:VersionedMultiLocation",
type_name: "Box<VersionedMultiLocation>",
value: {
V1: {
interior: {
X1: {
AccountId32: {
id: "0x46ebddef8cd9bb167dc30878d7113b7e168e6f0646beffd77d69d39bad76b47a",
network: {
Any: null
}
}
}
},
parents: 1
}
}
},
{
name: "dest_weight",
type: "U64",
type_name: "Weight",
value: 5000000000
}
]
Arg 1: currency_id
defines the token you want to transfer - in our case it's KSM
.
Arg 2: amount
defines the amount of tokens you want to transfer - this value uses base units so 1 KSM is 1000000000000 in base units - in our case 123400000000 is equal to 0.1234 KSM
Arg 3: dest
defines the destination address to which we want to send the tokens - note that this is the 32 byte account ID and not the SS58 address format (you can get the account ID from an address using the subkey inspect <SS58>
command in the terminal).
Note: The parent junctions parameter parents
should be set to 1
as we are sending the funds to an external address on the relay chain (i.e. 1 level up in the consensus hierarchy).
Arg 4: dest_weight
defines the weight for XCM execution on the destination chain - here we set a constant of 5000000000.
Using the Polkadot.js interface we can fill out the xTokens.transfer()
extrinsic information like so:
We can then submit the transaction and the KSM tokens should be transferred from Karura to Kusama when the transaction is included in the chain.