@paraspell/sdk-pjs 8.7.1 → 8.9.0
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 +7 -4
- package/dist/index.cjs +74 -53
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +75 -54
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
|
|
|
95
95
|
.from(NODE)
|
|
96
96
|
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
|
|
97
97
|
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}})
|
|
98
|
-
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
|
|
98
|
+
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/, /*senderAddress - OPTIONAL - used when origin is AssetHub and feeAsset parameter is provided*/)
|
|
99
99
|
/*.feeAsset({symbol: 'symbol'} || {id: 'id'} || {multilocation: 'multilocation'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
|
|
100
100
|
.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
|
|
101
101
|
.customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
|
|
@@ -288,7 +288,7 @@ getAssetMultiLocation(chainFrom, { symbol: symbol } | { id: assetId })
|
|
|
288
288
|
|
|
289
289
|
### Parachain XCM Pallet queries
|
|
290
290
|
```ts
|
|
291
|
-
import { getDefaultPallet, getSupportedPallets, SUPPORTED_PALLETS } from '@paraspell/sdk-pjs';
|
|
291
|
+
import { getDefaultPallet, getSupportedPallets, getPalletIndex SUPPORTED_PALLETS } from '@paraspell/sdk-pjs';
|
|
292
292
|
|
|
293
293
|
//Retrieve default pallet for specific Parachain
|
|
294
294
|
getDefaultPallet(node: TNode)
|
|
@@ -296,6 +296,9 @@ getDefaultPallet(node: TNode)
|
|
|
296
296
|
// Returns an array of supported pallets for a specific Parachain
|
|
297
297
|
getSupportedPallets(node: TNode)
|
|
298
298
|
|
|
299
|
+
//Returns index of XCM Pallet used by Parachain
|
|
300
|
+
getPalletIndex(node: TNode)
|
|
301
|
+
|
|
299
302
|
// Print all pallets that are currently supported
|
|
300
303
|
console.log(SUPPORTED_PALLETS)
|
|
301
304
|
```
|
|
@@ -355,11 +358,11 @@ await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .
|
|
|
355
358
|
|
|
356
359
|
- Run all core tests and checks using `pnpm runAll`
|
|
357
360
|
|
|
358
|
-
XCM SDK can be tested in [Playground](https://
|
|
361
|
+
XCM SDK can be tested in [Playground](https://playground.paraspell.xyz/xcm-sdk/xcm-transfer).
|
|
359
362
|
|
|
360
363
|
## License
|
|
361
364
|
|
|
362
|
-
Made with 💛 by [ParaSpell✨](https://
|
|
365
|
+
Made with 💛 by [ParaSpell✨](https://paraspell.xyz/)
|
|
363
366
|
|
|
364
367
|
Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/packages/sdk/LICENSE).
|
|
365
368
|
|
package/dist/index.cjs
CHANGED
|
@@ -1128,9 +1128,9 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1128
1128
|
Native: sdkCore.Native,
|
|
1129
1129
|
Override: sdkCore.Override,
|
|
1130
1130
|
claimAssets: claimAssets,
|
|
1131
|
+
findAsset: sdkCore.findAsset,
|
|
1131
1132
|
getAllAssetsSymbols: sdkCore.getAllAssetsSymbols,
|
|
1132
1133
|
getAssetBalance: getAssetBalance,
|
|
1133
|
-
getAssetBySymbolOrId: sdkCore.getAssetBySymbolOrId,
|
|
1134
1134
|
getAssetDecimals: sdkCore.getAssetDecimals,
|
|
1135
1135
|
getAssetId: sdkCore.getAssetId,
|
|
1136
1136
|
getAssets: sdkCore.getAssets,
|
|
@@ -1236,10 +1236,13 @@ var depositToken = /*#__PURE__*/function () {
|
|
|
1236
1236
|
};
|
|
1237
1237
|
}();
|
|
1238
1238
|
|
|
1239
|
-
var createContext = function createContext(executionUrl,
|
|
1239
|
+
var createContext = function createContext(executionUrl, env) {
|
|
1240
|
+
var config = env.config;
|
|
1240
1241
|
return new api$1.Context({
|
|
1242
|
+
environment: env.name,
|
|
1241
1243
|
ethereum: {
|
|
1242
|
-
|
|
1244
|
+
ethChainId: env.ethChainId,
|
|
1245
|
+
ethChains: _defineProperty(_defineProperty({}, sdkCore.ETH_CHAIN_ID.toString(), executionUrl), sdkCore.getParaId('Moonbeam'), 'https://rpc.api.moonbeam.network'),
|
|
1243
1246
|
beacon_url: config.BEACON_HTTP_API
|
|
1244
1247
|
},
|
|
1245
1248
|
polkadot: {
|
|
@@ -1296,7 +1299,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1296
1299
|
}
|
|
1297
1300
|
throw new Error('Snowbridge does not support Viem provider yet.');
|
|
1298
1301
|
case 9:
|
|
1299
|
-
ethAsset = sdkCore.
|
|
1302
|
+
ethAsset = sdkCore.findAsset('Ethereum', currency, to);
|
|
1300
1303
|
if (!(ethAsset === null)) {
|
|
1301
1304
|
_context.next = 12;
|
|
1302
1305
|
break;
|
|
@@ -1304,7 +1307,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1304
1307
|
throw new sdkCore.InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
1305
1308
|
case 12:
|
|
1306
1309
|
env = api$1.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
1307
|
-
context = createContext(provider, env
|
|
1310
|
+
context = createContext(provider, env);
|
|
1308
1311
|
destParaId = sdkCore.getParaId(to);
|
|
1309
1312
|
if (!(!sdkCore.isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
1310
1313
|
_context.next = 17;
|
|
@@ -1345,59 +1348,77 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1345
1348
|
return _context.t0.buildRegistry.call(_context.t0, _context.t7);
|
|
1346
1349
|
case 30:
|
|
1347
1350
|
registry = _context.sent;
|
|
1348
|
-
_context.
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
+
_context.t8 = api$1.toPolkadotV2;
|
|
1352
|
+
_context.t9 = context.gateway();
|
|
1353
|
+
_context.next = 35;
|
|
1354
|
+
return context.assetHub();
|
|
1355
|
+
case 35:
|
|
1356
|
+
_context.t10 = _context.sent;
|
|
1357
|
+
_context.next = 38;
|
|
1358
|
+
return context.parachain(destParaId);
|
|
1359
|
+
case 38:
|
|
1360
|
+
_context.t11 = _context.sent;
|
|
1361
|
+
_context.t12 = {
|
|
1362
|
+
gateway: _context.t9,
|
|
1363
|
+
assetHub: _context.t10,
|
|
1364
|
+
destination: _context.t11
|
|
1365
|
+
};
|
|
1366
|
+
_context.t13 = registry;
|
|
1367
|
+
_context.t14 = ethAsset.assetId;
|
|
1368
|
+
_context.t15 = destParaId;
|
|
1369
|
+
_context.next = 45;
|
|
1370
|
+
return _context.t8.getDeliveryFee.call(_context.t8, _context.t12, _context.t13, _context.t14, _context.t15);
|
|
1371
|
+
case 45:
|
|
1351
1372
|
fee = _context.sent;
|
|
1352
|
-
_context.next =
|
|
1373
|
+
_context.next = 48;
|
|
1353
1374
|
return signer.getAddress();
|
|
1354
|
-
case
|
|
1375
|
+
case 48:
|
|
1355
1376
|
sourceAddress = _context.sent;
|
|
1356
|
-
_context.next =
|
|
1377
|
+
_context.next = 51;
|
|
1357
1378
|
return api$1.toPolkadotV2.createTransfer(registry, sourceAddress, address, ethAsset.assetId, destParaId, BigInt(currency.amount), fee);
|
|
1358
|
-
case
|
|
1379
|
+
case 51:
|
|
1359
1380
|
transfer = _context.sent;
|
|
1360
|
-
_context.
|
|
1361
|
-
_context.
|
|
1362
|
-
_context.
|
|
1363
|
-
_context.next =
|
|
1381
|
+
_context.t16 = api$1.toPolkadotV2;
|
|
1382
|
+
_context.t17 = context.ethereum();
|
|
1383
|
+
_context.t18 = context.gateway();
|
|
1384
|
+
_context.next = 57;
|
|
1364
1385
|
return context.bridgeHub();
|
|
1365
|
-
case
|
|
1366
|
-
_context.
|
|
1367
|
-
_context.next =
|
|
1386
|
+
case 57:
|
|
1387
|
+
_context.t19 = _context.sent;
|
|
1388
|
+
_context.next = 60;
|
|
1368
1389
|
return context.assetHub();
|
|
1369
|
-
case
|
|
1370
|
-
_context.
|
|
1390
|
+
case 60:
|
|
1391
|
+
_context.t20 = _context.sent;
|
|
1371
1392
|
if (!(destParaId !== sdkCore.getParaId('AssetHubPolkadot'))) {
|
|
1372
|
-
_context.next =
|
|
1393
|
+
_context.next = 67;
|
|
1373
1394
|
break;
|
|
1374
1395
|
}
|
|
1375
|
-
_context.next =
|
|
1396
|
+
_context.next = 64;
|
|
1376
1397
|
return context.parachain(destParaId);
|
|
1377
|
-
case
|
|
1378
|
-
_context.
|
|
1379
|
-
_context.next =
|
|
1398
|
+
case 64:
|
|
1399
|
+
_context.t21 = _context.sent;
|
|
1400
|
+
_context.next = 68;
|
|
1380
1401
|
break;
|
|
1381
|
-
case
|
|
1382
|
-
_context.
|
|
1383
|
-
case
|
|
1384
|
-
_context.
|
|
1385
|
-
_context.
|
|
1386
|
-
ethereum: _context.
|
|
1387
|
-
gateway: _context.
|
|
1388
|
-
bridgeHub: _context.
|
|
1389
|
-
assetHub: _context.
|
|
1390
|
-
destParachain: _context.
|
|
1402
|
+
case 67:
|
|
1403
|
+
_context.t21 = undefined;
|
|
1404
|
+
case 68:
|
|
1405
|
+
_context.t22 = _context.t21;
|
|
1406
|
+
_context.t23 = {
|
|
1407
|
+
ethereum: _context.t17,
|
|
1408
|
+
gateway: _context.t18,
|
|
1409
|
+
bridgeHub: _context.t19,
|
|
1410
|
+
assetHub: _context.t20,
|
|
1411
|
+
destParachain: _context.t22
|
|
1391
1412
|
};
|
|
1392
|
-
_context.
|
|
1393
|
-
_context.next =
|
|
1394
|
-
return _context.
|
|
1395
|
-
case
|
|
1413
|
+
_context.t24 = transfer;
|
|
1414
|
+
_context.next = 73;
|
|
1415
|
+
return _context.t16.validateTransfer.call(_context.t16, _context.t23, _context.t24);
|
|
1416
|
+
case 73:
|
|
1396
1417
|
validation = _context.sent;
|
|
1397
1418
|
if (!validation.logs.find(function (l) {
|
|
1398
1419
|
return l.kind == api$1.toPolkadotV2.ValidationKind.Error;
|
|
1399
1420
|
})) {
|
|
1400
|
-
_context.next =
|
|
1421
|
+
_context.next = 76;
|
|
1401
1422
|
break;
|
|
1402
1423
|
}
|
|
1403
1424
|
throw Error("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
|
|
@@ -1405,37 +1426,37 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1405
1426
|
}).map(function (l) {
|
|
1406
1427
|
return l.message;
|
|
1407
1428
|
}).join('\n\n')));
|
|
1408
|
-
case
|
|
1429
|
+
case 76:
|
|
1409
1430
|
tx = transfer.tx;
|
|
1410
|
-
_context.next =
|
|
1431
|
+
_context.next = 79;
|
|
1411
1432
|
return signer.sendTransaction(tx);
|
|
1412
|
-
case
|
|
1433
|
+
case 79:
|
|
1413
1434
|
response = _context.sent;
|
|
1414
|
-
_context.next =
|
|
1435
|
+
_context.next = 82;
|
|
1415
1436
|
return response.wait(1);
|
|
1416
|
-
case
|
|
1437
|
+
case 82:
|
|
1417
1438
|
receipt = _context.sent;
|
|
1418
1439
|
if (receipt) {
|
|
1419
|
-
_context.next =
|
|
1440
|
+
_context.next = 85;
|
|
1420
1441
|
break;
|
|
1421
1442
|
}
|
|
1422
1443
|
throw Error("Transaction ".concat(response.hash, " not included."));
|
|
1423
|
-
case
|
|
1424
|
-
_context.next =
|
|
1444
|
+
case 85:
|
|
1445
|
+
_context.next = 87;
|
|
1425
1446
|
return api$1.toPolkadotV2.getMessageReceipt(receipt);
|
|
1426
|
-
case
|
|
1447
|
+
case 87:
|
|
1427
1448
|
messageReceipt = _context.sent;
|
|
1428
1449
|
if (messageReceipt) {
|
|
1429
|
-
_context.next =
|
|
1450
|
+
_context.next = 90;
|
|
1430
1451
|
break;
|
|
1431
1452
|
}
|
|
1432
1453
|
throw Error("Transaction ".concat(receipt.hash, " did not emit a message."));
|
|
1433
|
-
case
|
|
1454
|
+
case 90:
|
|
1434
1455
|
return _context.abrupt("return", {
|
|
1435
1456
|
response: response,
|
|
1436
1457
|
messageReceipt: messageReceipt
|
|
1437
1458
|
});
|
|
1438
|
-
case
|
|
1459
|
+
case 91:
|
|
1439
1460
|
case "end":
|
|
1440
1461
|
return _context.stop();
|
|
1441
1462
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override,
|
|
2
|
+
import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, TEvmBuilderOptions, TNodeWithRelayChains, TCurrencyInputWithAmount, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions, TNodeDotKsmWithRelayChains } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
4
|
import * as _polkadot_api from '@polkadot/api';
|
|
5
5
|
import { ApiPromise } from '@polkadot/api';
|
|
@@ -75,9 +75,9 @@ declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
|
75
75
|
declare const assets_Native: typeof Native;
|
|
76
76
|
declare const assets_Override: typeof Override;
|
|
77
77
|
declare const assets_claimAssets: typeof claimAssets;
|
|
78
|
+
declare const assets_findAsset: typeof findAsset;
|
|
78
79
|
declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
79
80
|
declare const assets_getAssetBalance: typeof getAssetBalance;
|
|
80
|
-
declare const assets_getAssetBySymbolOrId: typeof getAssetBySymbolOrId;
|
|
81
81
|
declare const assets_getAssetDecimals: typeof getAssetDecimals;
|
|
82
82
|
declare const assets_getAssetId: typeof getAssetId;
|
|
83
83
|
declare const assets_getAssets: typeof getAssets;
|
|
@@ -100,7 +100,7 @@ declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
|
|
|
100
100
|
declare const assets_isNodeEvm: typeof isNodeEvm;
|
|
101
101
|
declare const assets_verifyEdOnDestination: typeof verifyEdOnDestination;
|
|
102
102
|
declare namespace assets {
|
|
103
|
-
export { assets_Foreign as Foreign, assets_ForeignAbstract as ForeignAbstract, assets_Native as Native, assets_Override as Override, assets_claimAssets as claimAssets,
|
|
103
|
+
export { assets_Foreign as Foreign, assets_ForeignAbstract as ForeignAbstract, assets_Native as Native, assets_Override as Override, assets_claimAssets as claimAssets, assets_findAsset as findAsset, assets_getAllAssetsSymbols as getAllAssetsSymbols, assets_getAssetBalance as getAssetBalance, 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 };
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, 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,
|
|
1
|
+
import { BatchMode, createApiInstanceForNode as createApiInstanceForNode$1, getNode, isForeignAsset, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, 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, findAsset, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, getParaId, ETH_CHAIN_ID, InvalidCurrencyError, isEthersSigner, isOverrideMultiLocationSpecifier, validateAddress, transferMoonbeamToEth, transferMoonbeamEvm, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, send as send$1, getDryRun as getDryRun$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
4
4
|
import { u32 } from '@polkadot/types';
|
|
@@ -1127,9 +1127,9 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1127
1127
|
Native: Native,
|
|
1128
1128
|
Override: Override,
|
|
1129
1129
|
claimAssets: claimAssets,
|
|
1130
|
+
findAsset: findAsset,
|
|
1130
1131
|
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
1131
1132
|
getAssetBalance: getAssetBalance,
|
|
1132
|
-
getAssetBySymbolOrId: getAssetBySymbolOrId,
|
|
1133
1133
|
getAssetDecimals: getAssetDecimals,
|
|
1134
1134
|
getAssetId: getAssetId,
|
|
1135
1135
|
getAssets: getAssets,
|
|
@@ -1235,10 +1235,13 @@ var depositToken = /*#__PURE__*/function () {
|
|
|
1235
1235
|
};
|
|
1236
1236
|
}();
|
|
1237
1237
|
|
|
1238
|
-
var createContext = function createContext(executionUrl,
|
|
1238
|
+
var createContext = function createContext(executionUrl, env) {
|
|
1239
|
+
var config = env.config;
|
|
1239
1240
|
return new Context({
|
|
1241
|
+
environment: env.name,
|
|
1240
1242
|
ethereum: {
|
|
1241
|
-
|
|
1243
|
+
ethChainId: env.ethChainId,
|
|
1244
|
+
ethChains: _defineProperty(_defineProperty({}, ETH_CHAIN_ID.toString(), executionUrl), getParaId('Moonbeam'), 'https://rpc.api.moonbeam.network'),
|
|
1242
1245
|
beacon_url: config.BEACON_HTTP_API
|
|
1243
1246
|
},
|
|
1244
1247
|
polkadot: {
|
|
@@ -1295,7 +1298,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1295
1298
|
}
|
|
1296
1299
|
throw new Error('Snowbridge does not support Viem provider yet.');
|
|
1297
1300
|
case 9:
|
|
1298
|
-
ethAsset =
|
|
1301
|
+
ethAsset = findAsset('Ethereum', currency, to);
|
|
1299
1302
|
if (!(ethAsset === null)) {
|
|
1300
1303
|
_context.next = 12;
|
|
1301
1304
|
break;
|
|
@@ -1303,7 +1306,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1303
1306
|
throw new InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
1304
1307
|
case 12:
|
|
1305
1308
|
env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
1306
|
-
context = createContext(provider, env
|
|
1309
|
+
context = createContext(provider, env);
|
|
1307
1310
|
destParaId = getParaId(to);
|
|
1308
1311
|
if (!(!isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
1309
1312
|
_context.next = 17;
|
|
@@ -1344,59 +1347,77 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1344
1347
|
return _context.t0.buildRegistry.call(_context.t0, _context.t7);
|
|
1345
1348
|
case 30:
|
|
1346
1349
|
registry = _context.sent;
|
|
1347
|
-
_context.
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
+
_context.t8 = toPolkadotV2;
|
|
1351
|
+
_context.t9 = context.gateway();
|
|
1352
|
+
_context.next = 35;
|
|
1353
|
+
return context.assetHub();
|
|
1354
|
+
case 35:
|
|
1355
|
+
_context.t10 = _context.sent;
|
|
1356
|
+
_context.next = 38;
|
|
1357
|
+
return context.parachain(destParaId);
|
|
1358
|
+
case 38:
|
|
1359
|
+
_context.t11 = _context.sent;
|
|
1360
|
+
_context.t12 = {
|
|
1361
|
+
gateway: _context.t9,
|
|
1362
|
+
assetHub: _context.t10,
|
|
1363
|
+
destination: _context.t11
|
|
1364
|
+
};
|
|
1365
|
+
_context.t13 = registry;
|
|
1366
|
+
_context.t14 = ethAsset.assetId;
|
|
1367
|
+
_context.t15 = destParaId;
|
|
1368
|
+
_context.next = 45;
|
|
1369
|
+
return _context.t8.getDeliveryFee.call(_context.t8, _context.t12, _context.t13, _context.t14, _context.t15);
|
|
1370
|
+
case 45:
|
|
1350
1371
|
fee = _context.sent;
|
|
1351
|
-
_context.next =
|
|
1372
|
+
_context.next = 48;
|
|
1352
1373
|
return signer.getAddress();
|
|
1353
|
-
case
|
|
1374
|
+
case 48:
|
|
1354
1375
|
sourceAddress = _context.sent;
|
|
1355
|
-
_context.next =
|
|
1376
|
+
_context.next = 51;
|
|
1356
1377
|
return toPolkadotV2.createTransfer(registry, sourceAddress, address, ethAsset.assetId, destParaId, BigInt(currency.amount), fee);
|
|
1357
|
-
case
|
|
1378
|
+
case 51:
|
|
1358
1379
|
transfer = _context.sent;
|
|
1359
|
-
_context.
|
|
1360
|
-
_context.
|
|
1361
|
-
_context.
|
|
1362
|
-
_context.next =
|
|
1380
|
+
_context.t16 = toPolkadotV2;
|
|
1381
|
+
_context.t17 = context.ethereum();
|
|
1382
|
+
_context.t18 = context.gateway();
|
|
1383
|
+
_context.next = 57;
|
|
1363
1384
|
return context.bridgeHub();
|
|
1364
|
-
case
|
|
1365
|
-
_context.
|
|
1366
|
-
_context.next =
|
|
1385
|
+
case 57:
|
|
1386
|
+
_context.t19 = _context.sent;
|
|
1387
|
+
_context.next = 60;
|
|
1367
1388
|
return context.assetHub();
|
|
1368
|
-
case
|
|
1369
|
-
_context.
|
|
1389
|
+
case 60:
|
|
1390
|
+
_context.t20 = _context.sent;
|
|
1370
1391
|
if (!(destParaId !== getParaId('AssetHubPolkadot'))) {
|
|
1371
|
-
_context.next =
|
|
1392
|
+
_context.next = 67;
|
|
1372
1393
|
break;
|
|
1373
1394
|
}
|
|
1374
|
-
_context.next =
|
|
1395
|
+
_context.next = 64;
|
|
1375
1396
|
return context.parachain(destParaId);
|
|
1376
|
-
case
|
|
1377
|
-
_context.
|
|
1378
|
-
_context.next =
|
|
1397
|
+
case 64:
|
|
1398
|
+
_context.t21 = _context.sent;
|
|
1399
|
+
_context.next = 68;
|
|
1379
1400
|
break;
|
|
1380
|
-
case
|
|
1381
|
-
_context.
|
|
1382
|
-
case
|
|
1383
|
-
_context.
|
|
1384
|
-
_context.
|
|
1385
|
-
ethereum: _context.
|
|
1386
|
-
gateway: _context.
|
|
1387
|
-
bridgeHub: _context.
|
|
1388
|
-
assetHub: _context.
|
|
1389
|
-
destParachain: _context.
|
|
1401
|
+
case 67:
|
|
1402
|
+
_context.t21 = undefined;
|
|
1403
|
+
case 68:
|
|
1404
|
+
_context.t22 = _context.t21;
|
|
1405
|
+
_context.t23 = {
|
|
1406
|
+
ethereum: _context.t17,
|
|
1407
|
+
gateway: _context.t18,
|
|
1408
|
+
bridgeHub: _context.t19,
|
|
1409
|
+
assetHub: _context.t20,
|
|
1410
|
+
destParachain: _context.t22
|
|
1390
1411
|
};
|
|
1391
|
-
_context.
|
|
1392
|
-
_context.next =
|
|
1393
|
-
return _context.
|
|
1394
|
-
case
|
|
1412
|
+
_context.t24 = transfer;
|
|
1413
|
+
_context.next = 73;
|
|
1414
|
+
return _context.t16.validateTransfer.call(_context.t16, _context.t23, _context.t24);
|
|
1415
|
+
case 73:
|
|
1395
1416
|
validation = _context.sent;
|
|
1396
1417
|
if (!validation.logs.find(function (l) {
|
|
1397
1418
|
return l.kind == toPolkadotV2.ValidationKind.Error;
|
|
1398
1419
|
})) {
|
|
1399
|
-
_context.next =
|
|
1420
|
+
_context.next = 76;
|
|
1400
1421
|
break;
|
|
1401
1422
|
}
|
|
1402
1423
|
throw Error("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
|
|
@@ -1404,37 +1425,37 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1404
1425
|
}).map(function (l) {
|
|
1405
1426
|
return l.message;
|
|
1406
1427
|
}).join('\n\n')));
|
|
1407
|
-
case
|
|
1428
|
+
case 76:
|
|
1408
1429
|
tx = transfer.tx;
|
|
1409
|
-
_context.next =
|
|
1430
|
+
_context.next = 79;
|
|
1410
1431
|
return signer.sendTransaction(tx);
|
|
1411
|
-
case
|
|
1432
|
+
case 79:
|
|
1412
1433
|
response = _context.sent;
|
|
1413
|
-
_context.next =
|
|
1434
|
+
_context.next = 82;
|
|
1414
1435
|
return response.wait(1);
|
|
1415
|
-
case
|
|
1436
|
+
case 82:
|
|
1416
1437
|
receipt = _context.sent;
|
|
1417
1438
|
if (receipt) {
|
|
1418
|
-
_context.next =
|
|
1439
|
+
_context.next = 85;
|
|
1419
1440
|
break;
|
|
1420
1441
|
}
|
|
1421
1442
|
throw Error("Transaction ".concat(response.hash, " not included."));
|
|
1422
|
-
case
|
|
1423
|
-
_context.next =
|
|
1443
|
+
case 85:
|
|
1444
|
+
_context.next = 87;
|
|
1424
1445
|
return toPolkadotV2.getMessageReceipt(receipt);
|
|
1425
|
-
case
|
|
1446
|
+
case 87:
|
|
1426
1447
|
messageReceipt = _context.sent;
|
|
1427
1448
|
if (messageReceipt) {
|
|
1428
|
-
_context.next =
|
|
1449
|
+
_context.next = 90;
|
|
1429
1450
|
break;
|
|
1430
1451
|
}
|
|
1431
1452
|
throw Error("Transaction ".concat(receipt.hash, " did not emit a message."));
|
|
1432
|
-
case
|
|
1453
|
+
case 90:
|
|
1433
1454
|
return _context.abrupt("return", {
|
|
1434
1455
|
response: response,
|
|
1435
1456
|
messageReceipt: messageReceipt
|
|
1436
1457
|
});
|
|
1437
|
-
case
|
|
1458
|
+
case 91:
|
|
1438
1459
|
case "end":
|
|
1439
1460
|
return _context.stop();
|
|
1440
1461
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@snowbridge/api": "0.1.
|
|
27
|
-
"@snowbridge/contract-types": "0.1.
|
|
26
|
+
"@snowbridge/api": "0.1.44",
|
|
27
|
+
"@snowbridge/contract-types": "0.1.44",
|
|
28
28
|
"ethers": "^6.13.5",
|
|
29
29
|
"viem": "^2.23.5",
|
|
30
|
-
"@paraspell/sdk-core": "8.
|
|
30
|
+
"@paraspell/sdk-core": "8.9.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 15.0 < 16",
|