@paraspell/sdk-pjs 8.5.1 → 8.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.cjs +46 -365
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +46 -366
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -333,6 +333,9 @@ await getTransferInfo({from, to, address, destinationAddress, currency /*- {id:
|
|
|
333
333
|
|
|
334
334
|
//Get bridge and execution fee for transfer from Parachain to Ethereum. Returns as an object of 2 values - [bridgeFee, executionFee]
|
|
335
335
|
await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
|
|
336
|
+
|
|
337
|
+
//Verify whether XCM message you wish to send will reach above existential deposit on destination chain.
|
|
338
|
+
await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
|
|
336
339
|
```
|
|
337
340
|
|
|
338
341
|
## 💻 Tests
|
package/dist/index.cjs
CHANGED
|
@@ -7,8 +7,6 @@ var api$1 = require('@polkadot/api');
|
|
|
7
7
|
var types = require('@polkadot/types');
|
|
8
8
|
var utilCrypto = require('@polkadot/util-crypto');
|
|
9
9
|
var util = require('@polkadot/util');
|
|
10
|
-
var ethers = require('ethers');
|
|
11
|
-
var viem = require('viem');
|
|
12
10
|
|
|
13
11
|
function _arrayLikeToArray(r, a) {
|
|
14
12
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -18,9 +16,6 @@ function _arrayLikeToArray(r, a) {
|
|
|
18
16
|
function _arrayWithHoles(r) {
|
|
19
17
|
if (Array.isArray(r)) return r;
|
|
20
18
|
}
|
|
21
|
-
function _arrayWithoutHoles(r) {
|
|
22
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
23
|
-
}
|
|
24
19
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
25
20
|
try {
|
|
26
21
|
var i = n[a](c),
|
|
@@ -68,9 +63,6 @@ function _defineProperty(e, r, t) {
|
|
|
68
63
|
writable: true
|
|
69
64
|
}) : e[r] = t, e;
|
|
70
65
|
}
|
|
71
|
-
function _iterableToArray(r) {
|
|
72
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
73
|
-
}
|
|
74
66
|
function _iterableToArrayLimit(r, l) {
|
|
75
67
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
76
68
|
if (null != t) {
|
|
@@ -98,9 +90,6 @@ function _iterableToArrayLimit(r, l) {
|
|
|
98
90
|
function _nonIterableRest() {
|
|
99
91
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
100
92
|
}
|
|
101
|
-
function _nonIterableSpread() {
|
|
102
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
103
|
-
}
|
|
104
93
|
function ownKeys(e, r) {
|
|
105
94
|
var t = Object.keys(e);
|
|
106
95
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -426,9 +415,6 @@ function _regeneratorRuntime() {
|
|
|
426
415
|
function _slicedToArray(r, e) {
|
|
427
416
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
428
417
|
}
|
|
429
|
-
function _toConsumableArray(r) {
|
|
430
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
431
|
-
}
|
|
432
418
|
function _toPrimitive(t, r) {
|
|
433
419
|
if ("object" != typeof t || !t) return t;
|
|
434
420
|
var e = t[Symbol.toPrimitive];
|
|
@@ -443,15 +429,6 @@ function _toPropertyKey(t) {
|
|
|
443
429
|
var i = _toPrimitive(t, "string");
|
|
444
430
|
return "symbol" == typeof i ? i : i + "";
|
|
445
431
|
}
|
|
446
|
-
function _typeof(o) {
|
|
447
|
-
"@babel/helpers - typeof";
|
|
448
|
-
|
|
449
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
450
|
-
return typeof o;
|
|
451
|
-
} : function (o) {
|
|
452
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
453
|
-
}, _typeof(o);
|
|
454
|
-
}
|
|
455
432
|
function _unsupportedIterableToArray(r, a) {
|
|
456
433
|
if (r) {
|
|
457
434
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -479,13 +456,6 @@ var createContext = function createContext(executionUrl, config) {
|
|
|
479
456
|
});
|
|
480
457
|
};
|
|
481
458
|
|
|
482
|
-
var isEthersSigner = function isEthersSigner(signer) {
|
|
483
|
-
return _typeof(signer) === 'object' && signer !== null && 'provider' in signer;
|
|
484
|
-
};
|
|
485
|
-
var isEthersContract = function isEthersContract(contract) {
|
|
486
|
-
return !('abi' in contract);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
459
|
/**
|
|
490
460
|
* Transfers an Ethereum asset to a Polkadot account.
|
|
491
461
|
*
|
|
@@ -521,7 +491,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
521
491
|
}
|
|
522
492
|
throw new Error('provider parameter is required for Snowbridge transfers.');
|
|
523
493
|
case 7:
|
|
524
|
-
if (isEthersSigner(signer)) {
|
|
494
|
+
if (sdkCore.isEthersSigner(signer)) {
|
|
525
495
|
_context.next = 9;
|
|
526
496
|
break;
|
|
527
497
|
}
|
|
@@ -896,15 +866,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
896
866
|
}
|
|
897
867
|
return createApiInstance;
|
|
898
868
|
}()
|
|
899
|
-
}, {
|
|
900
|
-
key: "createAccountId",
|
|
901
|
-
value: function createAccountId(address) {
|
|
902
|
-
return this.api.createType('AccountId32', address).toHex();
|
|
903
|
-
}
|
|
904
869
|
}, {
|
|
905
870
|
key: "accountToHex",
|
|
906
871
|
value: function accountToHex(address) {
|
|
907
872
|
var isPrefixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
873
|
+
if (util.isHex(address)) return address;
|
|
908
874
|
var uint8Array = utilCrypto.decodeAddress(address);
|
|
909
875
|
return util.u8aToHex(uint8Array, -1, isPrefixed);
|
|
910
876
|
}
|
|
@@ -926,6 +892,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
926
892
|
var section = mode === sdkCore.BatchMode.BATCH_ALL ? 'batchAll' : 'batch';
|
|
927
893
|
return this.api.tx.utility[section](calls);
|
|
928
894
|
}
|
|
895
|
+
}, {
|
|
896
|
+
key: "objectToHex",
|
|
897
|
+
value: function objectToHex(obj, typeName) {
|
|
898
|
+
return Promise.resolve(this.api.createType(typeName, obj).toHex());
|
|
899
|
+
}
|
|
900
|
+
}, {
|
|
901
|
+
key: "hexToUint8a",
|
|
902
|
+
value: function hexToUint8a(hex) {
|
|
903
|
+
return util.hexToU8a(hex);
|
|
904
|
+
}
|
|
905
|
+
}, {
|
|
906
|
+
key: "stringToUint8a",
|
|
907
|
+
value: function stringToUint8a(str) {
|
|
908
|
+
return util.stringToU8a(str);
|
|
909
|
+
}
|
|
929
910
|
}, {
|
|
930
911
|
key: "calculateTransactionFee",
|
|
931
912
|
value: function () {
|
|
@@ -1194,29 +1175,41 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1194
1175
|
return getBalanceForeignAssetsAccount;
|
|
1195
1176
|
}()
|
|
1196
1177
|
}, {
|
|
1197
|
-
key: "
|
|
1178
|
+
key: "getFromRpc",
|
|
1198
1179
|
value: function () {
|
|
1199
|
-
var
|
|
1200
|
-
var response;
|
|
1180
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(module, method, key) {
|
|
1181
|
+
var rpcModule, response;
|
|
1201
1182
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1202
1183
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1203
1184
|
case 0:
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1185
|
+
rpcModule = this.api.rpc[module];
|
|
1186
|
+
if (!(!rpcModule || !rpcModule[method])) {
|
|
1187
|
+
_context13.next = 3;
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
throw new Error("RPC method ".concat(module, ".").concat(method, " not available"));
|
|
1191
|
+
case 3:
|
|
1192
|
+
_context13.next = 5;
|
|
1193
|
+
return rpcModule[method](key);
|
|
1194
|
+
case 5:
|
|
1207
1195
|
response = _context13.sent;
|
|
1208
1196
|
return _context13.abrupt("return", response.toHex());
|
|
1209
|
-
case
|
|
1197
|
+
case 7:
|
|
1210
1198
|
case "end":
|
|
1211
1199
|
return _context13.stop();
|
|
1212
1200
|
}
|
|
1213
1201
|
}, _callee13, this);
|
|
1214
1202
|
}));
|
|
1215
|
-
function
|
|
1216
|
-
return
|
|
1203
|
+
function getFromRpc(_x22, _x23, _x24) {
|
|
1204
|
+
return _getFromRpc.apply(this, arguments);
|
|
1217
1205
|
}
|
|
1218
|
-
return
|
|
1206
|
+
return getFromRpc;
|
|
1219
1207
|
}()
|
|
1208
|
+
}, {
|
|
1209
|
+
key: "blake2AsHex",
|
|
1210
|
+
value: function blake2AsHex(data) {
|
|
1211
|
+
return utilCrypto.blake2AsHex(data);
|
|
1212
|
+
}
|
|
1220
1213
|
}, {
|
|
1221
1214
|
key: "clone",
|
|
1222
1215
|
value: function clone() {
|
|
@@ -1241,7 +1234,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1241
1234
|
}
|
|
1242
1235
|
}, _callee14);
|
|
1243
1236
|
}));
|
|
1244
|
-
function createApiForNode(
|
|
1237
|
+
function createApiForNode(_x25) {
|
|
1245
1238
|
return _createApiForNode.apply(this, arguments);
|
|
1246
1239
|
}
|
|
1247
1240
|
return createApiForNode;
|
|
@@ -1297,7 +1290,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1297
1290
|
}
|
|
1298
1291
|
}, _callee15, this);
|
|
1299
1292
|
}));
|
|
1300
|
-
function getDryRun(
|
|
1293
|
+
function getDryRun(_x26) {
|
|
1301
1294
|
return _getDryRun.apply(this, arguments);
|
|
1302
1295
|
}
|
|
1303
1296
|
return getDryRun;
|
|
@@ -1463,6 +1456,7 @@ var getOriginFeeDetails = createPolkadotJsApiCall(sdkCore.getOriginFeeDetails);
|
|
|
1463
1456
|
var getMaxNativeTransferableAmount = createPolkadotJsApiCall(sdkCore.getMaxNativeTransferableAmount);
|
|
1464
1457
|
var getMaxForeignTransferableAmount = createPolkadotJsApiCall(sdkCore.getMaxForeignTransferableAmount);
|
|
1465
1458
|
var getTransferableAmount = createPolkadotJsApiCall(sdkCore.getTransferableAmount);
|
|
1459
|
+
var verifyEdOnDestination = createPolkadotJsApiCall(sdkCore.verifyEdOnDestination);
|
|
1466
1460
|
|
|
1467
1461
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1468
1462
|
__proto__: null,
|
|
@@ -1493,324 +1487,10 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1493
1487
|
getTransferInfo: getTransferInfo,
|
|
1494
1488
|
getTransferableAmount: getTransferableAmount,
|
|
1495
1489
|
hasSupportForAsset: sdkCore.hasSupportForAsset,
|
|
1496
|
-
isNodeEvm: sdkCore.isNodeEvm
|
|
1490
|
+
isNodeEvm: sdkCore.isNodeEvm,
|
|
1491
|
+
verifyEdOnDestination: verifyEdOnDestination
|
|
1497
1492
|
});
|
|
1498
1493
|
|
|
1499
|
-
var abi = [
|
|
1500
|
-
{
|
|
1501
|
-
inputs: [
|
|
1502
|
-
{
|
|
1503
|
-
components: [
|
|
1504
|
-
{
|
|
1505
|
-
internalType: "uint8",
|
|
1506
|
-
name: "parents",
|
|
1507
|
-
type: "uint8"
|
|
1508
|
-
},
|
|
1509
|
-
{
|
|
1510
|
-
internalType: "bytes[]",
|
|
1511
|
-
name: "interior",
|
|
1512
|
-
type: "bytes[]"
|
|
1513
|
-
}
|
|
1514
|
-
],
|
|
1515
|
-
internalType: "struct XCM.Location",
|
|
1516
|
-
name: "dest",
|
|
1517
|
-
type: "tuple"
|
|
1518
|
-
},
|
|
1519
|
-
{
|
|
1520
|
-
components: [
|
|
1521
|
-
{
|
|
1522
|
-
internalType: "address",
|
|
1523
|
-
name: "asset",
|
|
1524
|
-
type: "address"
|
|
1525
|
-
},
|
|
1526
|
-
{
|
|
1527
|
-
internalType: "uint256",
|
|
1528
|
-
name: "amount",
|
|
1529
|
-
type: "uint256"
|
|
1530
|
-
}
|
|
1531
|
-
],
|
|
1532
|
-
internalType: "struct XCM.AssetAddressInfo[]",
|
|
1533
|
-
name: "assets",
|
|
1534
|
-
type: "tuple[]"
|
|
1535
|
-
},
|
|
1536
|
-
{
|
|
1537
|
-
internalType: "enum XCM.TransferType",
|
|
1538
|
-
name: "assetsTransferType",
|
|
1539
|
-
type: "uint8"
|
|
1540
|
-
},
|
|
1541
|
-
{
|
|
1542
|
-
internalType: "uint8",
|
|
1543
|
-
name: "remoteFeesIdIndex",
|
|
1544
|
-
type: "uint8"
|
|
1545
|
-
},
|
|
1546
|
-
{
|
|
1547
|
-
internalType: "enum XCM.TransferType",
|
|
1548
|
-
name: "feesTransferType",
|
|
1549
|
-
type: "uint8"
|
|
1550
|
-
},
|
|
1551
|
-
{
|
|
1552
|
-
internalType: "bytes",
|
|
1553
|
-
name: "customXcmOnDest",
|
|
1554
|
-
type: "bytes"
|
|
1555
|
-
}
|
|
1556
|
-
],
|
|
1557
|
-
name: "transferAssetsUsingTypeAndThenAddress",
|
|
1558
|
-
outputs: [
|
|
1559
|
-
],
|
|
1560
|
-
stateMutability: "nonpayable",
|
|
1561
|
-
type: "function"
|
|
1562
|
-
}
|
|
1563
|
-
];
|
|
1564
|
-
|
|
1565
|
-
// https://github.com/moonbeam-foundation/moonbeam/blob/b2b1bde7ced13aad4bd2928effc415c521fd48cb/runtime/moonbeam/src/precompiles.rs#L281
|
|
1566
|
-
var xcmInterfacePrecompile = '0x000000000000000000000000000000000000081A';
|
|
1567
|
-
var XCDOT = '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080';
|
|
1568
|
-
var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
1569
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
1570
|
-
var _signer$account;
|
|
1571
|
-
var api, from, to, signer, address, ahAddress, currency, foundAsset, ethAsset, contract, BRIDGE_LOCATION, ERC20_TOKEN_LOCATION, ERC20_TOKEN_LOCATION_REANCHORED, customXcm, apiPjs, assetHubApi, assetHubApiPjs, xcmHash, sender, _yield$Promise$all, _yield$Promise$all2, parachainId, accountNextId, entropy, messageId, xcmOnDest, customXcmOnDest, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, transferFee, createTx, tx;
|
|
1572
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1573
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1574
|
-
case 0:
|
|
1575
|
-
api = _ref.api, from = _ref.from, to = _ref.to, signer = _ref.signer, address = _ref.address, ahAddress = _ref.ahAddress, currency = _ref.currency;
|
|
1576
|
-
if (!('multiasset' in currency)) {
|
|
1577
|
-
_context.next = 3;
|
|
1578
|
-
break;
|
|
1579
|
-
}
|
|
1580
|
-
throw new Error('Multiassets syntax is not supported for Evm transfers');
|
|
1581
|
-
case 3:
|
|
1582
|
-
if (!('multilocation' in currency && sdkCore.isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
1583
|
-
_context.next = 5;
|
|
1584
|
-
break;
|
|
1585
|
-
}
|
|
1586
|
-
throw new Error('Override multilocation is not supported for Evm transfers');
|
|
1587
|
-
case 5:
|
|
1588
|
-
foundAsset = sdkCore.getAssetBySymbolOrId(from, currency, to);
|
|
1589
|
-
if (!(foundAsset === null)) {
|
|
1590
|
-
_context.next = 8;
|
|
1591
|
-
break;
|
|
1592
|
-
}
|
|
1593
|
-
throw new sdkCore.InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
1594
|
-
case 8:
|
|
1595
|
-
if (!(!sdkCore.isForeignAsset(foundAsset) || !foundAsset.multiLocation)) {
|
|
1596
|
-
_context.next = 10;
|
|
1597
|
-
break;
|
|
1598
|
-
}
|
|
1599
|
-
throw new sdkCore.InvalidCurrencyError('Currency must be a foreign asset with valid multi-location');
|
|
1600
|
-
case 10:
|
|
1601
|
-
ethAsset = sdkCore.findAssetByMultiLocation(sdkCore.getOtherAssets('Ethereum'), foundAsset.multiLocation);
|
|
1602
|
-
if (ethAsset) {
|
|
1603
|
-
_context.next = 13;
|
|
1604
|
-
break;
|
|
1605
|
-
}
|
|
1606
|
-
throw new sdkCore.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(foundAsset)));
|
|
1607
|
-
case 13:
|
|
1608
|
-
contract = isEthersSigner(signer) ? new ethers.Contract(xcmInterfacePrecompile, abi, signer) : viem.getContract({
|
|
1609
|
-
abi: abi,
|
|
1610
|
-
address: xcmInterfacePrecompile,
|
|
1611
|
-
client: {
|
|
1612
|
-
"public": viem.createPublicClient({
|
|
1613
|
-
chain: signer.chain,
|
|
1614
|
-
transport: viem.http()
|
|
1615
|
-
}),
|
|
1616
|
-
wallet: signer
|
|
1617
|
-
}
|
|
1618
|
-
});
|
|
1619
|
-
BRIDGE_LOCATION = {
|
|
1620
|
-
parents: 2,
|
|
1621
|
-
interior: {
|
|
1622
|
-
X1: [sdkCore.ETHEREUM_JUNCTION]
|
|
1623
|
-
}
|
|
1624
|
-
};
|
|
1625
|
-
ERC20_TOKEN_LOCATION = {
|
|
1626
|
-
parents: 2,
|
|
1627
|
-
interior: {
|
|
1628
|
-
X2: [{
|
|
1629
|
-
GlobalConsensus: {
|
|
1630
|
-
Ethereum: {
|
|
1631
|
-
chain_id: sdkCore.ETH_CHAIN_ID
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
}, {
|
|
1635
|
-
AccountKey20: {
|
|
1636
|
-
key: foundAsset.assetId
|
|
1637
|
-
}
|
|
1638
|
-
}]
|
|
1639
|
-
}
|
|
1640
|
-
};
|
|
1641
|
-
ERC20_TOKEN_LOCATION_REANCHORED = {
|
|
1642
|
-
parents: 0,
|
|
1643
|
-
interior: {
|
|
1644
|
-
X1: [{
|
|
1645
|
-
AccountKey20: {
|
|
1646
|
-
key: foundAsset.assetId
|
|
1647
|
-
}
|
|
1648
|
-
}]
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
customXcm = [{
|
|
1652
|
-
setAppendix: [{
|
|
1653
|
-
depositAsset: {
|
|
1654
|
-
assets: {
|
|
1655
|
-
Wild: 'All'
|
|
1656
|
-
},
|
|
1657
|
-
beneficiary: {
|
|
1658
|
-
parents: 0,
|
|
1659
|
-
interior: {
|
|
1660
|
-
x1: [{
|
|
1661
|
-
AccountId32: {
|
|
1662
|
-
id: util.u8aToHex(utilCrypto.decodeAddress(ahAddress))
|
|
1663
|
-
}
|
|
1664
|
-
}]
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
}]
|
|
1669
|
-
}, {
|
|
1670
|
-
initiateReserveWithdraw: {
|
|
1671
|
-
assets: {
|
|
1672
|
-
Wild: {
|
|
1673
|
-
AllOf: {
|
|
1674
|
-
id: ERC20_TOKEN_LOCATION,
|
|
1675
|
-
fun: 'Fungible'
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
},
|
|
1679
|
-
reserve: BRIDGE_LOCATION,
|
|
1680
|
-
xcm: [{
|
|
1681
|
-
buyExecution: {
|
|
1682
|
-
fees: {
|
|
1683
|
-
id: ERC20_TOKEN_LOCATION_REANCHORED,
|
|
1684
|
-
// CAUTION: Must use reanchored locations.
|
|
1685
|
-
fun: {
|
|
1686
|
-
Fungible: '1' // Offering 1 unit as fee, but it is returned to the destination address.
|
|
1687
|
-
}
|
|
1688
|
-
},
|
|
1689
|
-
weight_limit: 'Unlimited'
|
|
1690
|
-
}
|
|
1691
|
-
}, {
|
|
1692
|
-
depositAsset: {
|
|
1693
|
-
assets: {
|
|
1694
|
-
Wild: {
|
|
1695
|
-
AllCounted: 1
|
|
1696
|
-
}
|
|
1697
|
-
},
|
|
1698
|
-
beneficiary: {
|
|
1699
|
-
parents: 0,
|
|
1700
|
-
interior: {
|
|
1701
|
-
x1: [{
|
|
1702
|
-
AccountKey20: {
|
|
1703
|
-
key: address
|
|
1704
|
-
}
|
|
1705
|
-
}]
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
}, {
|
|
1710
|
-
setTopic: '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
1711
|
-
}]
|
|
1712
|
-
}
|
|
1713
|
-
}, {
|
|
1714
|
-
setTopic: '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
1715
|
-
}];
|
|
1716
|
-
_context.next = 20;
|
|
1717
|
-
return api.init(from);
|
|
1718
|
-
case 20:
|
|
1719
|
-
apiPjs = api.getApi();
|
|
1720
|
-
_context.next = 23;
|
|
1721
|
-
return api.createApiForNode('AssetHubPolkadot');
|
|
1722
|
-
case 23:
|
|
1723
|
-
assetHubApi = _context.sent;
|
|
1724
|
-
assetHubApiPjs = assetHubApi.getApi(); // Generate an unique messageId and set into `setTopic` for remote track
|
|
1725
|
-
xcmHash = assetHubApiPjs.createType('Xcm', customXcm);
|
|
1726
|
-
if (!isEthersSigner(signer)) {
|
|
1727
|
-
_context.next = 32;
|
|
1728
|
-
break;
|
|
1729
|
-
}
|
|
1730
|
-
_context.next = 29;
|
|
1731
|
-
return signer.getAddress();
|
|
1732
|
-
case 29:
|
|
1733
|
-
_context.t0 = _context.sent;
|
|
1734
|
-
_context.next = 33;
|
|
1735
|
-
break;
|
|
1736
|
-
case 32:
|
|
1737
|
-
_context.t0 = (_signer$account = signer.account) === null || _signer$account === undefined ? undefined : _signer$account.address;
|
|
1738
|
-
case 33:
|
|
1739
|
-
sender = _context.t0;
|
|
1740
|
-
_context.next = 36;
|
|
1741
|
-
return Promise.all([apiPjs.query.parachainInfo.parachainId(), apiPjs.rpc.system.accountNextIndex(sender)]);
|
|
1742
|
-
case 36:
|
|
1743
|
-
_yield$Promise$all = _context.sent;
|
|
1744
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
1745
|
-
parachainId = _yield$Promise$all2[0];
|
|
1746
|
-
accountNextId = _yield$Promise$all2[1];
|
|
1747
|
-
entropy = new Uint8Array([].concat(_toConsumableArray(parachainId.toU8a()), _toConsumableArray(accountNextId.toU8a()), _toConsumableArray(xcmHash.toU8a())));
|
|
1748
|
-
messageId = utilCrypto.blake2AsHex(entropy);
|
|
1749
|
-
if (!(customXcm.length == 2)) {
|
|
1750
|
-
_context.next = 47;
|
|
1751
|
-
break;
|
|
1752
|
-
}
|
|
1753
|
-
customXcm[0].initiateReserveWithdraw.xcm[2].setTopic = messageId;
|
|
1754
|
-
customXcm[1].setTopic = messageId;
|
|
1755
|
-
_context.next = 53;
|
|
1756
|
-
break;
|
|
1757
|
-
case 47:
|
|
1758
|
-
if (!(customXcm.length == 3)) {
|
|
1759
|
-
_context.next = 52;
|
|
1760
|
-
break;
|
|
1761
|
-
}
|
|
1762
|
-
customXcm[1].initiateReserveWithdraw.xcm[2].setTopic = messageId;
|
|
1763
|
-
customXcm[2].setTopic = messageId;
|
|
1764
|
-
_context.next = 53;
|
|
1765
|
-
break;
|
|
1766
|
-
case 52:
|
|
1767
|
-
throw new Error('invalid xcm');
|
|
1768
|
-
case 53:
|
|
1769
|
-
xcmOnDest = assetHubApiPjs.createType('XcmVersionedXcm', {
|
|
1770
|
-
V4: customXcm
|
|
1771
|
-
});
|
|
1772
|
-
customXcmOnDest = xcmOnDest.toHex();
|
|
1773
|
-
_context.next = 57;
|
|
1774
|
-
return sdkCore.getParaEthTransferFees(assetHubApi);
|
|
1775
|
-
case 57:
|
|
1776
|
-
_yield$getParaEthTran = _context.sent;
|
|
1777
|
-
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
1778
|
-
bridgeFee = _yield$getParaEthTran2[0];
|
|
1779
|
-
executionFee = _yield$getParaEthTran2[1];
|
|
1780
|
-
transferFee = (bridgeFee + executionFee).toString(); // Partially inspired by Moonbeam XCM-SDK
|
|
1781
|
-
// https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
|
|
1782
|
-
createTx = function createTx(func, args) {
|
|
1783
|
-
if (isEthersContract(contract)) {
|
|
1784
|
-
return contract[func].apply(contract, _toConsumableArray(args));
|
|
1785
|
-
}
|
|
1786
|
-
return contract.write[func](args);
|
|
1787
|
-
}; // Execute the custom XCM message with the precompile
|
|
1788
|
-
_context.next = 65;
|
|
1789
|
-
return createTx(isEthersSigner(signer) ? 'transferAssetsUsingTypeAndThenAddress((uint8,bytes[]),(address,uint256)[],uint8,uint8,uint8,bytes)' : 'transferAssetsUsingTypeAndThenAddress', [
|
|
1790
|
-
// This represents (1,X1(Parachain(1000)))
|
|
1791
|
-
[1, ['0x00' + util.numberToHex(sdkCore.getParaId('AssetHubPolkadot'), 32).slice(2)]],
|
|
1792
|
-
// Assets including fee and the ERC20 asset, with fee be the first
|
|
1793
|
-
[[XCDOT, transferFee], [ethAsset.assetId, currency.amount]],
|
|
1794
|
-
// The TransferType corresponding to asset being sent, 2 represents `DestinationReserve`
|
|
1795
|
-
2,
|
|
1796
|
-
// index for the fee
|
|
1797
|
-
0,
|
|
1798
|
-
// The TransferType corresponding to fee asset
|
|
1799
|
-
2, customXcmOnDest]);
|
|
1800
|
-
case 65:
|
|
1801
|
-
tx = _context.sent;
|
|
1802
|
-
return _context.abrupt("return", _typeof(tx) === 'object' ? tx.hash : tx);
|
|
1803
|
-
case 67:
|
|
1804
|
-
case "end":
|
|
1805
|
-
return _context.stop();
|
|
1806
|
-
}
|
|
1807
|
-
}, _callee);
|
|
1808
|
-
}));
|
|
1809
|
-
return function transferMoonbeamToEth(_x) {
|
|
1810
|
-
return _ref2.apply(this, arguments);
|
|
1811
|
-
};
|
|
1812
|
-
}();
|
|
1813
|
-
|
|
1814
1494
|
/**
|
|
1815
1495
|
* Builder class for constructing transfers from Ethereum to Polkadot.
|
|
1816
1496
|
*/
|
|
@@ -1912,7 +1592,7 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1912
1592
|
_context.next = 12;
|
|
1913
1593
|
break;
|
|
1914
1594
|
}
|
|
1915
|
-
return _context.abrupt("return", transferMoonbeamToEth(this._options));
|
|
1595
|
+
return _context.abrupt("return", sdkCore.transferMoonbeamToEth(this._options));
|
|
1916
1596
|
case 12:
|
|
1917
1597
|
if (!(this._options.from === 'Moonbeam' || this._options.from === 'Moonriver')) {
|
|
1918
1598
|
_context.next = 16;
|
|
@@ -1996,6 +1676,7 @@ exports.getTransferInfo = getTransferInfo;
|
|
|
1996
1676
|
exports.getTransferableAmount = getTransferableAmount;
|
|
1997
1677
|
exports.send = send;
|
|
1998
1678
|
exports.transferEthToPolkadot = transferEthToPolkadot;
|
|
1679
|
+
exports.verifyEdOnDestination = verifyEdOnDestination;
|
|
1999
1680
|
exports.xcmPallet = transfer;
|
|
2000
1681
|
Object.keys(sdkCore).forEach(function (k) {
|
|
2001
1682
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,9 @@ declare const getMaxForeignTransferableAmount: (options: _paraspell_sdk_core.TGe
|
|
|
113
113
|
declare const getTransferableAmount: (options: _paraspell_sdk_core.TGetTransferableAmountOptionsBase & {
|
|
114
114
|
api?: TPjsApiOrUrl;
|
|
115
115
|
}) => Promise<bigint>;
|
|
116
|
+
declare const verifyEdOnDestination: (options: _paraspell_sdk_core.TVerifyEdOnDestinationOptionsBase & {
|
|
117
|
+
api?: TPjsApiOrUrl;
|
|
118
|
+
}) => Promise<boolean>;
|
|
116
119
|
|
|
117
120
|
declare const assets_Foreign: typeof Foreign;
|
|
118
121
|
declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
@@ -142,8 +145,9 @@ declare const assets_getTransferInfo: typeof getTransferInfo;
|
|
|
142
145
|
declare const assets_getTransferableAmount: typeof getTransferableAmount;
|
|
143
146
|
declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
|
|
144
147
|
declare const assets_isNodeEvm: typeof isNodeEvm;
|
|
148
|
+
declare const assets_verifyEdOnDestination: typeof verifyEdOnDestination;
|
|
145
149
|
declare namespace assets {
|
|
146
|
-
export { assets_Foreign as Foreign, assets_ForeignAbstract as ForeignAbstract, assets_Native as Native, assets_Override as Override, assets_claimAssets as claimAssets, assets_getAllAssetsSymbols as getAllAssetsSymbols, assets_getAssetBalance as getAssetBalance, assets_getAssetBySymbolOrId as getAssetBySymbolOrId, assets_getAssetDecimals as getAssetDecimals, assets_getAssetId as getAssetId, assets_getAssets as getAssets, assets_getAssetsObject as getAssetsObject, assets_getBalanceForeign as getBalanceForeign, assets_getBalanceNative as getBalanceNative, assets_getExistentialDeposit as getExistentialDeposit, assets_getMaxForeignTransferableAmount as getMaxForeignTransferableAmount, assets_getMaxNativeTransferableAmount as getMaxNativeTransferableAmount, assets_getNativeAssetSymbol as getNativeAssetSymbol, assets_getNativeAssets as getNativeAssets, assets_getOriginFeeDetails as getOriginFeeDetails, assets_getOtherAssets as getOtherAssets, assets_getRelayChainSymbol as getRelayChainSymbol, assets_getSupportedAssets as getSupportedAssets, assets_getTNode as getTNode, assets_getTransferInfo as getTransferInfo, assets_getTransferableAmount as getTransferableAmount, assets_hasSupportForAsset as hasSupportForAsset, assets_isNodeEvm as isNodeEvm };
|
|
150
|
+
export { assets_Foreign as Foreign, assets_ForeignAbstract as ForeignAbstract, assets_Native as Native, assets_Override as Override, assets_claimAssets as claimAssets, assets_getAllAssetsSymbols as getAllAssetsSymbols, assets_getAssetBalance as getAssetBalance, assets_getAssetBySymbolOrId as getAssetBySymbolOrId, assets_getAssetDecimals as getAssetDecimals, assets_getAssetId as getAssetId, assets_getAssets as getAssets, assets_getAssetsObject as getAssetsObject, assets_getBalanceForeign as getBalanceForeign, assets_getBalanceNative as getBalanceNative, assets_getExistentialDeposit as getExistentialDeposit, assets_getMaxForeignTransferableAmount as getMaxForeignTransferableAmount, assets_getMaxNativeTransferableAmount as getMaxNativeTransferableAmount, assets_getNativeAssetSymbol as getNativeAssetSymbol, assets_getNativeAssets as getNativeAssets, assets_getOriginFeeDetails as getOriginFeeDetails, assets_getOtherAssets as getOtherAssets, assets_getRelayChainSymbol as getRelayChainSymbol, assets_getSupportedAssets as getSupportedAssets, assets_getTNode as getTNode, assets_getTransferInfo as getTransferInfo, assets_getTransferableAmount as getTransferableAmount, assets_hasSupportForAsset as hasSupportForAsset, assets_isNodeEvm as isNodeEvm, assets_verifyEdOnDestination as verifyEdOnDestination };
|
|
147
151
|
}
|
|
148
152
|
|
|
149
153
|
/**
|
|
@@ -210,4 +214,4 @@ type IFinalBuilderWithOptions = IFinalBuilderWithOptions$1<TPjsApi, Extrinsic>;
|
|
|
210
214
|
|
|
211
215
|
declare const createApiInstanceForNode: (node: TNodeDotKsmWithRelayChains) => Promise<_polkadot_api.ApiPromise>;
|
|
212
216
|
|
|
213
|
-
export { Builder, EvmBuilder, type Extrinsic, GeneralBuilder, type IFinalBuilderWithOptions, type TPjsApi, type TPjsApiOrUrl, approveToken, assets, claimAssets, createApiInstanceForNode, depositToken, getAssetBalance, getBalanceForeign, getBalanceNative, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, getTransferInfo, getTransferableAmount, send, transferEthToPolkadot, transfer as xcmPallet };
|
|
217
|
+
export { Builder, EvmBuilder, type Extrinsic, GeneralBuilder, type IFinalBuilderWithOptions, type TPjsApi, type TPjsApiOrUrl, approveToken, assets, claimAssets, createApiInstanceForNode, depositToken, getAssetBalance, getBalanceForeign, getBalanceNative, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, getTransferInfo, getTransferableAmount, send, transferEthToPolkadot, verifyEdOnDestination, transfer as xcmPallet };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { getParaId, isForeignAsset, InvalidCurrencyError, getAssetBySymbolOrId, isOverrideMultiLocationSpecifier, BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, send as send$1, getDryRun as getDryRun$1, getParaEthTransferFees as getParaEthTransferFees$1, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm,
|
|
1
|
+
import { getParaId, isForeignAsset, InvalidCurrencyError, getAssetBySymbolOrId, isEthersSigner, isOverrideMultiLocationSpecifier, BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, send as send$1, getDryRun as getDryRun$1, getParaEthTransferFees as getParaEthTransferFees$1, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getTransferInfo as getTransferInfo$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, getMaxNativeTransferableAmount as getMaxNativeTransferableAmount$1, getMaxForeignTransferableAmount as getMaxForeignTransferableAmount$1, getTransferableAmount as getTransferableAmount$1, verifyEdOnDestination as verifyEdOnDestination$1, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, GeneralBuilder as GeneralBuilder$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { Context, toPolkadotV2, assetsV2, environment } from '@snowbridge/api';
|
|
4
4
|
import { WETH9__factory } from '@snowbridge/contract-types';
|
|
5
5
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
6
6
|
import { u32 } from '@polkadot/types';
|
|
7
7
|
import { decodeAddress, blake2AsHex } from '@polkadot/util-crypto';
|
|
8
|
-
import { u8aToHex,
|
|
9
|
-
import { Contract } from 'ethers';
|
|
10
|
-
import { getContract, createPublicClient, http } from 'viem';
|
|
8
|
+
import { isHex, u8aToHex, hexToU8a, stringToU8a } from '@polkadot/util';
|
|
11
9
|
|
|
12
10
|
function _arrayLikeToArray(r, a) {
|
|
13
11
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -17,9 +15,6 @@ function _arrayLikeToArray(r, a) {
|
|
|
17
15
|
function _arrayWithHoles(r) {
|
|
18
16
|
if (Array.isArray(r)) return r;
|
|
19
17
|
}
|
|
20
|
-
function _arrayWithoutHoles(r) {
|
|
21
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
22
|
-
}
|
|
23
18
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
24
19
|
try {
|
|
25
20
|
var i = n[a](c),
|
|
@@ -67,9 +62,6 @@ function _defineProperty(e, r, t) {
|
|
|
67
62
|
writable: true
|
|
68
63
|
}) : e[r] = t, e;
|
|
69
64
|
}
|
|
70
|
-
function _iterableToArray(r) {
|
|
71
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
72
|
-
}
|
|
73
65
|
function _iterableToArrayLimit(r, l) {
|
|
74
66
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
75
67
|
if (null != t) {
|
|
@@ -97,9 +89,6 @@ function _iterableToArrayLimit(r, l) {
|
|
|
97
89
|
function _nonIterableRest() {
|
|
98
90
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
91
|
}
|
|
100
|
-
function _nonIterableSpread() {
|
|
101
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
102
|
-
}
|
|
103
92
|
function ownKeys(e, r) {
|
|
104
93
|
var t = Object.keys(e);
|
|
105
94
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -425,9 +414,6 @@ function _regeneratorRuntime() {
|
|
|
425
414
|
function _slicedToArray(r, e) {
|
|
426
415
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
427
416
|
}
|
|
428
|
-
function _toConsumableArray(r) {
|
|
429
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
430
|
-
}
|
|
431
417
|
function _toPrimitive(t, r) {
|
|
432
418
|
if ("object" != typeof t || !t) return t;
|
|
433
419
|
var e = t[Symbol.toPrimitive];
|
|
@@ -442,15 +428,6 @@ function _toPropertyKey(t) {
|
|
|
442
428
|
var i = _toPrimitive(t, "string");
|
|
443
429
|
return "symbol" == typeof i ? i : i + "";
|
|
444
430
|
}
|
|
445
|
-
function _typeof(o) {
|
|
446
|
-
"@babel/helpers - typeof";
|
|
447
|
-
|
|
448
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
449
|
-
return typeof o;
|
|
450
|
-
} : function (o) {
|
|
451
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
452
|
-
}, _typeof(o);
|
|
453
|
-
}
|
|
454
431
|
function _unsupportedIterableToArray(r, a) {
|
|
455
432
|
if (r) {
|
|
456
433
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -478,13 +455,6 @@ var createContext = function createContext(executionUrl, config) {
|
|
|
478
455
|
});
|
|
479
456
|
};
|
|
480
457
|
|
|
481
|
-
var isEthersSigner = function isEthersSigner(signer) {
|
|
482
|
-
return _typeof(signer) === 'object' && signer !== null && 'provider' in signer;
|
|
483
|
-
};
|
|
484
|
-
var isEthersContract = function isEthersContract(contract) {
|
|
485
|
-
return !('abi' in contract);
|
|
486
|
-
};
|
|
487
|
-
|
|
488
458
|
/**
|
|
489
459
|
* Transfers an Ethereum asset to a Polkadot account.
|
|
490
460
|
*
|
|
@@ -895,15 +865,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
895
865
|
}
|
|
896
866
|
return createApiInstance;
|
|
897
867
|
}()
|
|
898
|
-
}, {
|
|
899
|
-
key: "createAccountId",
|
|
900
|
-
value: function createAccountId(address) {
|
|
901
|
-
return this.api.createType('AccountId32', address).toHex();
|
|
902
|
-
}
|
|
903
868
|
}, {
|
|
904
869
|
key: "accountToHex",
|
|
905
870
|
value: function accountToHex(address) {
|
|
906
871
|
var isPrefixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
872
|
+
if (isHex(address)) return address;
|
|
907
873
|
var uint8Array = decodeAddress(address);
|
|
908
874
|
return u8aToHex(uint8Array, -1, isPrefixed);
|
|
909
875
|
}
|
|
@@ -925,6 +891,21 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
925
891
|
var section = mode === BatchMode.BATCH_ALL ? 'batchAll' : 'batch';
|
|
926
892
|
return this.api.tx.utility[section](calls);
|
|
927
893
|
}
|
|
894
|
+
}, {
|
|
895
|
+
key: "objectToHex",
|
|
896
|
+
value: function objectToHex(obj, typeName) {
|
|
897
|
+
return Promise.resolve(this.api.createType(typeName, obj).toHex());
|
|
898
|
+
}
|
|
899
|
+
}, {
|
|
900
|
+
key: "hexToUint8a",
|
|
901
|
+
value: function hexToUint8a(hex) {
|
|
902
|
+
return hexToU8a(hex);
|
|
903
|
+
}
|
|
904
|
+
}, {
|
|
905
|
+
key: "stringToUint8a",
|
|
906
|
+
value: function stringToUint8a(str) {
|
|
907
|
+
return stringToU8a(str);
|
|
908
|
+
}
|
|
928
909
|
}, {
|
|
929
910
|
key: "calculateTransactionFee",
|
|
930
911
|
value: function () {
|
|
@@ -1193,29 +1174,41 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1193
1174
|
return getBalanceForeignAssetsAccount;
|
|
1194
1175
|
}()
|
|
1195
1176
|
}, {
|
|
1196
|
-
key: "
|
|
1177
|
+
key: "getFromRpc",
|
|
1197
1178
|
value: function () {
|
|
1198
|
-
var
|
|
1199
|
-
var response;
|
|
1179
|
+
var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(module, method, key) {
|
|
1180
|
+
var rpcModule, response;
|
|
1200
1181
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1201
1182
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1202
1183
|
case 0:
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1184
|
+
rpcModule = this.api.rpc[module];
|
|
1185
|
+
if (!(!rpcModule || !rpcModule[method])) {
|
|
1186
|
+
_context13.next = 3;
|
|
1187
|
+
break;
|
|
1188
|
+
}
|
|
1189
|
+
throw new Error("RPC method ".concat(module, ".").concat(method, " not available"));
|
|
1190
|
+
case 3:
|
|
1191
|
+
_context13.next = 5;
|
|
1192
|
+
return rpcModule[method](key);
|
|
1193
|
+
case 5:
|
|
1206
1194
|
response = _context13.sent;
|
|
1207
1195
|
return _context13.abrupt("return", response.toHex());
|
|
1208
|
-
case
|
|
1196
|
+
case 7:
|
|
1209
1197
|
case "end":
|
|
1210
1198
|
return _context13.stop();
|
|
1211
1199
|
}
|
|
1212
1200
|
}, _callee13, this);
|
|
1213
1201
|
}));
|
|
1214
|
-
function
|
|
1215
|
-
return
|
|
1202
|
+
function getFromRpc(_x22, _x23, _x24) {
|
|
1203
|
+
return _getFromRpc.apply(this, arguments);
|
|
1216
1204
|
}
|
|
1217
|
-
return
|
|
1205
|
+
return getFromRpc;
|
|
1218
1206
|
}()
|
|
1207
|
+
}, {
|
|
1208
|
+
key: "blake2AsHex",
|
|
1209
|
+
value: function blake2AsHex$1(data) {
|
|
1210
|
+
return blake2AsHex(data);
|
|
1211
|
+
}
|
|
1219
1212
|
}, {
|
|
1220
1213
|
key: "clone",
|
|
1221
1214
|
value: function clone() {
|
|
@@ -1240,7 +1233,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1240
1233
|
}
|
|
1241
1234
|
}, _callee14);
|
|
1242
1235
|
}));
|
|
1243
|
-
function createApiForNode(
|
|
1236
|
+
function createApiForNode(_x25) {
|
|
1244
1237
|
return _createApiForNode.apply(this, arguments);
|
|
1245
1238
|
}
|
|
1246
1239
|
return createApiForNode;
|
|
@@ -1296,7 +1289,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1296
1289
|
}
|
|
1297
1290
|
}, _callee15, this);
|
|
1298
1291
|
}));
|
|
1299
|
-
function getDryRun(
|
|
1292
|
+
function getDryRun(_x26) {
|
|
1300
1293
|
return _getDryRun.apply(this, arguments);
|
|
1301
1294
|
}
|
|
1302
1295
|
return getDryRun;
|
|
@@ -1462,6 +1455,7 @@ var getOriginFeeDetails = createPolkadotJsApiCall(getOriginFeeDetails$1);
|
|
|
1462
1455
|
var getMaxNativeTransferableAmount = createPolkadotJsApiCall(getMaxNativeTransferableAmount$1);
|
|
1463
1456
|
var getMaxForeignTransferableAmount = createPolkadotJsApiCall(getMaxForeignTransferableAmount$1);
|
|
1464
1457
|
var getTransferableAmount = createPolkadotJsApiCall(getTransferableAmount$1);
|
|
1458
|
+
var verifyEdOnDestination = createPolkadotJsApiCall(verifyEdOnDestination$1);
|
|
1465
1459
|
|
|
1466
1460
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1467
1461
|
__proto__: null,
|
|
@@ -1492,324 +1486,10 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1492
1486
|
getTransferInfo: getTransferInfo,
|
|
1493
1487
|
getTransferableAmount: getTransferableAmount,
|
|
1494
1488
|
hasSupportForAsset: hasSupportForAsset,
|
|
1495
|
-
isNodeEvm: isNodeEvm
|
|
1489
|
+
isNodeEvm: isNodeEvm,
|
|
1490
|
+
verifyEdOnDestination: verifyEdOnDestination
|
|
1496
1491
|
});
|
|
1497
1492
|
|
|
1498
|
-
var abi = [
|
|
1499
|
-
{
|
|
1500
|
-
inputs: [
|
|
1501
|
-
{
|
|
1502
|
-
components: [
|
|
1503
|
-
{
|
|
1504
|
-
internalType: "uint8",
|
|
1505
|
-
name: "parents",
|
|
1506
|
-
type: "uint8"
|
|
1507
|
-
},
|
|
1508
|
-
{
|
|
1509
|
-
internalType: "bytes[]",
|
|
1510
|
-
name: "interior",
|
|
1511
|
-
type: "bytes[]"
|
|
1512
|
-
}
|
|
1513
|
-
],
|
|
1514
|
-
internalType: "struct XCM.Location",
|
|
1515
|
-
name: "dest",
|
|
1516
|
-
type: "tuple"
|
|
1517
|
-
},
|
|
1518
|
-
{
|
|
1519
|
-
components: [
|
|
1520
|
-
{
|
|
1521
|
-
internalType: "address",
|
|
1522
|
-
name: "asset",
|
|
1523
|
-
type: "address"
|
|
1524
|
-
},
|
|
1525
|
-
{
|
|
1526
|
-
internalType: "uint256",
|
|
1527
|
-
name: "amount",
|
|
1528
|
-
type: "uint256"
|
|
1529
|
-
}
|
|
1530
|
-
],
|
|
1531
|
-
internalType: "struct XCM.AssetAddressInfo[]",
|
|
1532
|
-
name: "assets",
|
|
1533
|
-
type: "tuple[]"
|
|
1534
|
-
},
|
|
1535
|
-
{
|
|
1536
|
-
internalType: "enum XCM.TransferType",
|
|
1537
|
-
name: "assetsTransferType",
|
|
1538
|
-
type: "uint8"
|
|
1539
|
-
},
|
|
1540
|
-
{
|
|
1541
|
-
internalType: "uint8",
|
|
1542
|
-
name: "remoteFeesIdIndex",
|
|
1543
|
-
type: "uint8"
|
|
1544
|
-
},
|
|
1545
|
-
{
|
|
1546
|
-
internalType: "enum XCM.TransferType",
|
|
1547
|
-
name: "feesTransferType",
|
|
1548
|
-
type: "uint8"
|
|
1549
|
-
},
|
|
1550
|
-
{
|
|
1551
|
-
internalType: "bytes",
|
|
1552
|
-
name: "customXcmOnDest",
|
|
1553
|
-
type: "bytes"
|
|
1554
|
-
}
|
|
1555
|
-
],
|
|
1556
|
-
name: "transferAssetsUsingTypeAndThenAddress",
|
|
1557
|
-
outputs: [
|
|
1558
|
-
],
|
|
1559
|
-
stateMutability: "nonpayable",
|
|
1560
|
-
type: "function"
|
|
1561
|
-
}
|
|
1562
|
-
];
|
|
1563
|
-
|
|
1564
|
-
// https://github.com/moonbeam-foundation/moonbeam/blob/b2b1bde7ced13aad4bd2928effc415c521fd48cb/runtime/moonbeam/src/precompiles.rs#L281
|
|
1565
|
-
var xcmInterfacePrecompile = '0x000000000000000000000000000000000000081A';
|
|
1566
|
-
var XCDOT = '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080';
|
|
1567
|
-
var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
1568
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
1569
|
-
var _signer$account;
|
|
1570
|
-
var api, from, to, signer, address, ahAddress, currency, foundAsset, ethAsset, contract, BRIDGE_LOCATION, ERC20_TOKEN_LOCATION, ERC20_TOKEN_LOCATION_REANCHORED, customXcm, apiPjs, assetHubApi, assetHubApiPjs, xcmHash, sender, _yield$Promise$all, _yield$Promise$all2, parachainId, accountNextId, entropy, messageId, xcmOnDest, customXcmOnDest, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, transferFee, createTx, tx;
|
|
1571
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1572
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1573
|
-
case 0:
|
|
1574
|
-
api = _ref.api, from = _ref.from, to = _ref.to, signer = _ref.signer, address = _ref.address, ahAddress = _ref.ahAddress, currency = _ref.currency;
|
|
1575
|
-
if (!('multiasset' in currency)) {
|
|
1576
|
-
_context.next = 3;
|
|
1577
|
-
break;
|
|
1578
|
-
}
|
|
1579
|
-
throw new Error('Multiassets syntax is not supported for Evm transfers');
|
|
1580
|
-
case 3:
|
|
1581
|
-
if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
1582
|
-
_context.next = 5;
|
|
1583
|
-
break;
|
|
1584
|
-
}
|
|
1585
|
-
throw new Error('Override multilocation is not supported for Evm transfers');
|
|
1586
|
-
case 5:
|
|
1587
|
-
foundAsset = getAssetBySymbolOrId(from, currency, to);
|
|
1588
|
-
if (!(foundAsset === null)) {
|
|
1589
|
-
_context.next = 8;
|
|
1590
|
-
break;
|
|
1591
|
-
}
|
|
1592
|
-
throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
1593
|
-
case 8:
|
|
1594
|
-
if (!(!isForeignAsset(foundAsset) || !foundAsset.multiLocation)) {
|
|
1595
|
-
_context.next = 10;
|
|
1596
|
-
break;
|
|
1597
|
-
}
|
|
1598
|
-
throw new InvalidCurrencyError('Currency must be a foreign asset with valid multi-location');
|
|
1599
|
-
case 10:
|
|
1600
|
-
ethAsset = findAssetByMultiLocation(getOtherAssets('Ethereum'), foundAsset.multiLocation);
|
|
1601
|
-
if (ethAsset) {
|
|
1602
|
-
_context.next = 13;
|
|
1603
|
-
break;
|
|
1604
|
-
}
|
|
1605
|
-
throw new InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(foundAsset)));
|
|
1606
|
-
case 13:
|
|
1607
|
-
contract = isEthersSigner(signer) ? new Contract(xcmInterfacePrecompile, abi, signer) : getContract({
|
|
1608
|
-
abi: abi,
|
|
1609
|
-
address: xcmInterfacePrecompile,
|
|
1610
|
-
client: {
|
|
1611
|
-
"public": createPublicClient({
|
|
1612
|
-
chain: signer.chain,
|
|
1613
|
-
transport: http()
|
|
1614
|
-
}),
|
|
1615
|
-
wallet: signer
|
|
1616
|
-
}
|
|
1617
|
-
});
|
|
1618
|
-
BRIDGE_LOCATION = {
|
|
1619
|
-
parents: 2,
|
|
1620
|
-
interior: {
|
|
1621
|
-
X1: [ETHEREUM_JUNCTION]
|
|
1622
|
-
}
|
|
1623
|
-
};
|
|
1624
|
-
ERC20_TOKEN_LOCATION = {
|
|
1625
|
-
parents: 2,
|
|
1626
|
-
interior: {
|
|
1627
|
-
X2: [{
|
|
1628
|
-
GlobalConsensus: {
|
|
1629
|
-
Ethereum: {
|
|
1630
|
-
chain_id: ETH_CHAIN_ID
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
}, {
|
|
1634
|
-
AccountKey20: {
|
|
1635
|
-
key: foundAsset.assetId
|
|
1636
|
-
}
|
|
1637
|
-
}]
|
|
1638
|
-
}
|
|
1639
|
-
};
|
|
1640
|
-
ERC20_TOKEN_LOCATION_REANCHORED = {
|
|
1641
|
-
parents: 0,
|
|
1642
|
-
interior: {
|
|
1643
|
-
X1: [{
|
|
1644
|
-
AccountKey20: {
|
|
1645
|
-
key: foundAsset.assetId
|
|
1646
|
-
}
|
|
1647
|
-
}]
|
|
1648
|
-
}
|
|
1649
|
-
};
|
|
1650
|
-
customXcm = [{
|
|
1651
|
-
setAppendix: [{
|
|
1652
|
-
depositAsset: {
|
|
1653
|
-
assets: {
|
|
1654
|
-
Wild: 'All'
|
|
1655
|
-
},
|
|
1656
|
-
beneficiary: {
|
|
1657
|
-
parents: 0,
|
|
1658
|
-
interior: {
|
|
1659
|
-
x1: [{
|
|
1660
|
-
AccountId32: {
|
|
1661
|
-
id: u8aToHex(decodeAddress(ahAddress))
|
|
1662
|
-
}
|
|
1663
|
-
}]
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
}]
|
|
1668
|
-
}, {
|
|
1669
|
-
initiateReserveWithdraw: {
|
|
1670
|
-
assets: {
|
|
1671
|
-
Wild: {
|
|
1672
|
-
AllOf: {
|
|
1673
|
-
id: ERC20_TOKEN_LOCATION,
|
|
1674
|
-
fun: 'Fungible'
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
},
|
|
1678
|
-
reserve: BRIDGE_LOCATION,
|
|
1679
|
-
xcm: [{
|
|
1680
|
-
buyExecution: {
|
|
1681
|
-
fees: {
|
|
1682
|
-
id: ERC20_TOKEN_LOCATION_REANCHORED,
|
|
1683
|
-
// CAUTION: Must use reanchored locations.
|
|
1684
|
-
fun: {
|
|
1685
|
-
Fungible: '1' // Offering 1 unit as fee, but it is returned to the destination address.
|
|
1686
|
-
}
|
|
1687
|
-
},
|
|
1688
|
-
weight_limit: 'Unlimited'
|
|
1689
|
-
}
|
|
1690
|
-
}, {
|
|
1691
|
-
depositAsset: {
|
|
1692
|
-
assets: {
|
|
1693
|
-
Wild: {
|
|
1694
|
-
AllCounted: 1
|
|
1695
|
-
}
|
|
1696
|
-
},
|
|
1697
|
-
beneficiary: {
|
|
1698
|
-
parents: 0,
|
|
1699
|
-
interior: {
|
|
1700
|
-
x1: [{
|
|
1701
|
-
AccountKey20: {
|
|
1702
|
-
key: address
|
|
1703
|
-
}
|
|
1704
|
-
}]
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
}, {
|
|
1709
|
-
setTopic: '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
1710
|
-
}]
|
|
1711
|
-
}
|
|
1712
|
-
}, {
|
|
1713
|
-
setTopic: '0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
1714
|
-
}];
|
|
1715
|
-
_context.next = 20;
|
|
1716
|
-
return api.init(from);
|
|
1717
|
-
case 20:
|
|
1718
|
-
apiPjs = api.getApi();
|
|
1719
|
-
_context.next = 23;
|
|
1720
|
-
return api.createApiForNode('AssetHubPolkadot');
|
|
1721
|
-
case 23:
|
|
1722
|
-
assetHubApi = _context.sent;
|
|
1723
|
-
assetHubApiPjs = assetHubApi.getApi(); // Generate an unique messageId and set into `setTopic` for remote track
|
|
1724
|
-
xcmHash = assetHubApiPjs.createType('Xcm', customXcm);
|
|
1725
|
-
if (!isEthersSigner(signer)) {
|
|
1726
|
-
_context.next = 32;
|
|
1727
|
-
break;
|
|
1728
|
-
}
|
|
1729
|
-
_context.next = 29;
|
|
1730
|
-
return signer.getAddress();
|
|
1731
|
-
case 29:
|
|
1732
|
-
_context.t0 = _context.sent;
|
|
1733
|
-
_context.next = 33;
|
|
1734
|
-
break;
|
|
1735
|
-
case 32:
|
|
1736
|
-
_context.t0 = (_signer$account = signer.account) === null || _signer$account === undefined ? undefined : _signer$account.address;
|
|
1737
|
-
case 33:
|
|
1738
|
-
sender = _context.t0;
|
|
1739
|
-
_context.next = 36;
|
|
1740
|
-
return Promise.all([apiPjs.query.parachainInfo.parachainId(), apiPjs.rpc.system.accountNextIndex(sender)]);
|
|
1741
|
-
case 36:
|
|
1742
|
-
_yield$Promise$all = _context.sent;
|
|
1743
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
1744
|
-
parachainId = _yield$Promise$all2[0];
|
|
1745
|
-
accountNextId = _yield$Promise$all2[1];
|
|
1746
|
-
entropy = new Uint8Array([].concat(_toConsumableArray(parachainId.toU8a()), _toConsumableArray(accountNextId.toU8a()), _toConsumableArray(xcmHash.toU8a())));
|
|
1747
|
-
messageId = blake2AsHex(entropy);
|
|
1748
|
-
if (!(customXcm.length == 2)) {
|
|
1749
|
-
_context.next = 47;
|
|
1750
|
-
break;
|
|
1751
|
-
}
|
|
1752
|
-
customXcm[0].initiateReserveWithdraw.xcm[2].setTopic = messageId;
|
|
1753
|
-
customXcm[1].setTopic = messageId;
|
|
1754
|
-
_context.next = 53;
|
|
1755
|
-
break;
|
|
1756
|
-
case 47:
|
|
1757
|
-
if (!(customXcm.length == 3)) {
|
|
1758
|
-
_context.next = 52;
|
|
1759
|
-
break;
|
|
1760
|
-
}
|
|
1761
|
-
customXcm[1].initiateReserveWithdraw.xcm[2].setTopic = messageId;
|
|
1762
|
-
customXcm[2].setTopic = messageId;
|
|
1763
|
-
_context.next = 53;
|
|
1764
|
-
break;
|
|
1765
|
-
case 52:
|
|
1766
|
-
throw new Error('invalid xcm');
|
|
1767
|
-
case 53:
|
|
1768
|
-
xcmOnDest = assetHubApiPjs.createType('XcmVersionedXcm', {
|
|
1769
|
-
V4: customXcm
|
|
1770
|
-
});
|
|
1771
|
-
customXcmOnDest = xcmOnDest.toHex();
|
|
1772
|
-
_context.next = 57;
|
|
1773
|
-
return getParaEthTransferFees$1(assetHubApi);
|
|
1774
|
-
case 57:
|
|
1775
|
-
_yield$getParaEthTran = _context.sent;
|
|
1776
|
-
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
1777
|
-
bridgeFee = _yield$getParaEthTran2[0];
|
|
1778
|
-
executionFee = _yield$getParaEthTran2[1];
|
|
1779
|
-
transferFee = (bridgeFee + executionFee).toString(); // Partially inspired by Moonbeam XCM-SDK
|
|
1780
|
-
// https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
|
|
1781
|
-
createTx = function createTx(func, args) {
|
|
1782
|
-
if (isEthersContract(contract)) {
|
|
1783
|
-
return contract[func].apply(contract, _toConsumableArray(args));
|
|
1784
|
-
}
|
|
1785
|
-
return contract.write[func](args);
|
|
1786
|
-
}; // Execute the custom XCM message with the precompile
|
|
1787
|
-
_context.next = 65;
|
|
1788
|
-
return createTx(isEthersSigner(signer) ? 'transferAssetsUsingTypeAndThenAddress((uint8,bytes[]),(address,uint256)[],uint8,uint8,uint8,bytes)' : 'transferAssetsUsingTypeAndThenAddress', [
|
|
1789
|
-
// This represents (1,X1(Parachain(1000)))
|
|
1790
|
-
[1, ['0x00' + numberToHex(getParaId('AssetHubPolkadot'), 32).slice(2)]],
|
|
1791
|
-
// Assets including fee and the ERC20 asset, with fee be the first
|
|
1792
|
-
[[XCDOT, transferFee], [ethAsset.assetId, currency.amount]],
|
|
1793
|
-
// The TransferType corresponding to asset being sent, 2 represents `DestinationReserve`
|
|
1794
|
-
2,
|
|
1795
|
-
// index for the fee
|
|
1796
|
-
0,
|
|
1797
|
-
// The TransferType corresponding to fee asset
|
|
1798
|
-
2, customXcmOnDest]);
|
|
1799
|
-
case 65:
|
|
1800
|
-
tx = _context.sent;
|
|
1801
|
-
return _context.abrupt("return", _typeof(tx) === 'object' ? tx.hash : tx);
|
|
1802
|
-
case 67:
|
|
1803
|
-
case "end":
|
|
1804
|
-
return _context.stop();
|
|
1805
|
-
}
|
|
1806
|
-
}, _callee);
|
|
1807
|
-
}));
|
|
1808
|
-
return function transferMoonbeamToEth(_x) {
|
|
1809
|
-
return _ref2.apply(this, arguments);
|
|
1810
|
-
};
|
|
1811
|
-
}();
|
|
1812
|
-
|
|
1813
1493
|
/**
|
|
1814
1494
|
* Builder class for constructing transfers from Ethereum to Polkadot.
|
|
1815
1495
|
*/
|
|
@@ -1974,4 +1654,4 @@ var EvmBuilder = function EvmBuilder(provider) {
|
|
|
1974
1654
|
return EvmBuilder$1(pjsApi, provider);
|
|
1975
1655
|
};
|
|
1976
1656
|
|
|
1977
|
-
export { Builder, EvmBuilder, GeneralBuilder, approveToken, assets, claimAssets, createApiInstanceForNode, depositToken, getAssetBalance, getBalanceForeign, getBalanceNative, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, getTransferInfo, getTransferableAmount, send, transferEthToPolkadot, transfer as xcmPallet };
|
|
1657
|
+
export { Builder, EvmBuilder, GeneralBuilder, approveToken, assets, claimAssets, createApiInstanceForNode, depositToken, getAssetBalance, getBalanceForeign, getBalanceNative, getDryRun, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getOriginFeeDetails, getParaEthTransferFees, getTokenBalance, getTransferInfo, getTransferableAmount, send, transferEthToPolkadot, verifyEdOnDestination, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.3",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@snowbridge/contract-types": "^0.1.32",
|
|
28
28
|
"ethers": "^6.13.5",
|
|
29
29
|
"viem": "^2.22.22",
|
|
30
|
-
"@paraspell/sdk-core": "8.5.
|
|
30
|
+
"@paraspell/sdk-core": "8.5.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 15.0 < 16",
|