Skip to content

Commit

Permalink
remove createType (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax authored Oct 20, 2023
1 parent 47ece98 commit 0be585f
Showing 1 changed file with 29 additions and 31 deletions.
60 changes: 29 additions & 31 deletions src/dripper/polkadot/PolkadotActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,46 +98,44 @@ export class PolkadotActions {
async teleportTokens(dripAmount: bigint, address: string, parachain_id: string): Promise<DripResponse> {
logger.info("💸 teleporting tokens");

const prefix = networkName === "rococo" ? "Staging" : "";

const dest = polkadotApi.createType(`${prefix}XcmVersionedMultiLocation`, {
V3: polkadotApi.createType(`${prefix}XcmV3MultiLocation`, {
interior: polkadotApi.createType(`${prefix}XcmV3Junctions`, {
X1: polkadotApi.createType(`${prefix}XcmV3Junction`, {
Parachain: polkadotApi.createType("Compact<u32>", parachain_id),
}),
}),
const dest = {
V3: {
interior: {
X1: {
Parachain: parachain_id,
},
},
parents: 0,
}),
});
},
};

const addressHex = polkadotApi.registry.createType("AccountId", address).toHex();
const beneficiary = polkadotApi.createType(`${prefix}XcmVersionedMultiLocation`, {
V3: polkadotApi.createType(`${prefix}XcmV3MultiLocation`, {
interior: polkadotApi.createType(`${prefix}XcmV3Junctions`, {
X1: polkadotApi.createType(`${prefix}XcmV3Junction`, {
AccountId32: { id: addressHex, network: polkadotApi.createType(`${prefix}XcmV3JunctionNetworkId`) },
}),
}),
const beneficiary = {
V3: {
interior: {
X1: {
AccountId32: { id: addressHex, network: null },
},
},
parents: 0,
}),
});
},
};

const assets = polkadotApi.createType(`${prefix}XcmVersionedMultiAssets`, {
const assets = {
V3: [
polkadotApi.createType(`${prefix}XcmV3MultiAsset`, {
fun: polkadotApi.createType(`${prefix}XcmV3MultiassetFungibility`, { Fungible: dripAmount }),
id: polkadotApi.createType(`${prefix}XcmV3MultiassetAssetId`, {
Concrete: polkadotApi.createType(`${prefix}XcmV3MultiLocation`, {
interior: polkadotApi.createType(`${prefix}XcmV3Junctions`, "Here"),
{
fun: { Fungible: dripAmount },
id: {
Concrete: {
interior: "Here",
parents: 0,
}),
}),
}),
},
},
},
],
});
};

const weightLimit = polkadotApi.createType(`${prefix}XcmV3WeightLimit`, { Unlimited: null });
const weightLimit = { Unlimited: null };

const feeAssetItem = 0;

Expand Down

0 comments on commit 0be585f

Please sign in to comment.