Skip to content

Commit 9fdd8ae

Browse files
authored
Deprecate polkadotXcm.transferAssets (#1558)
* Switch to transferAssetsUsingTypeAndThen for V1 * Fix import
1 parent 31c3a2c commit 9fdd8ae

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

web/packages/api/src/history_v2.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { forInterParachain } from "src"
21
import {
32
fetchToPolkadotTransfers,
43
fetchToEthereumTransfers,

web/packages/api/src/toEthereum_v2.ts

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -853,18 +853,35 @@ function createAssetHubTx(
853853
},
854854
],
855855
}
856-
const destination = { v4: bridgeLocation(ethChainId) }
857-
const beneficiaryLocation = {
858-
v4: {
859-
parents: 0,
860-
interior: { x1: [{ accountKey20: { key: beneficiaryAccount } }] },
861-
},
856+
const feeAsset = {
857+
v4: assetLocation,
862858
}
863-
return parachain.tx.polkadotXcm.transferAssets(
859+
const destination = { v4: bridgeLocation(ethChainId) }
860+
let customXcm = parachain.registry.createType("XcmVersionedXcm", {
861+
v4: [
862+
{
863+
depositAsset: {
864+
assets: {
865+
Wild: {
866+
AllCounted: 1,
867+
},
868+
},
869+
beneficiary: {
870+
parents: 0,
871+
interior: { x1: [{ accountKey20: { key: beneficiaryAccount } }] },
872+
},
873+
},
874+
},
875+
],
876+
})
877+
let reserveType = asset.location ? "LocalReserve" : "DestinationReserve"
878+
return parachain.tx.polkadotXcm.transferAssetsUsingTypeAndThen(
864879
destination,
865-
beneficiaryLocation,
866880
assets,
867-
0,
881+
reserveType,
882+
feeAsset,
883+
reserveType,
884+
customXcm,
868885
"Unlimited"
869886
)
870887
}

0 commit comments

Comments
 (0)