@paraspell/sdk-pjs 8.0.1 → 8.0.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/dist/index.cjs +70 -37
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +71 -38
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -457,19 +457,6 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
var findEthAsset = function findEthAsset(currency) {
|
|
461
|
-
var ethAssets = sdkCore.getOtherAssets('Ethereum');
|
|
462
|
-
var ethAsset = 'symbol' in currency ? ethAssets.find(function (asset) {
|
|
463
|
-
return asset.symbol === currency.symbol;
|
|
464
|
-
}) : ethAssets.find(function (asset) {
|
|
465
|
-
return asset.assetId === currency.id;
|
|
466
|
-
});
|
|
467
|
-
if (!ethAsset) {
|
|
468
|
-
throw new sdkCore.InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " is not supported for Ethereum transfers"));
|
|
469
|
-
}
|
|
470
|
-
return ethAsset;
|
|
471
|
-
};
|
|
472
|
-
|
|
473
460
|
var createContext = /*#__PURE__*/function () {
|
|
474
461
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(executionUrl, config) {
|
|
475
462
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -528,45 +515,68 @@ var isEthersSigner = function isEthersSigner(signer) {
|
|
|
528
515
|
*/
|
|
529
516
|
var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
530
517
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
531
|
-
var _ethAsset$assetId;
|
|
532
518
|
var provider, signer, address, to, currency, ethAsset, env, context, destParaId, plan, result;
|
|
533
519
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
534
520
|
while (1) switch (_context.prev = _context.next) {
|
|
535
521
|
case 0:
|
|
536
522
|
provider = _ref.provider, signer = _ref.signer, address = _ref.address, to = _ref.to, currency = _ref.currency;
|
|
537
|
-
if (
|
|
523
|
+
if (!('multiasset' in currency)) {
|
|
538
524
|
_context.next = 3;
|
|
539
525
|
break;
|
|
540
526
|
}
|
|
541
|
-
throw new Error('
|
|
527
|
+
throw new Error('Multiassets syntax is not supported for Evm transfers');
|
|
542
528
|
case 3:
|
|
543
|
-
if (
|
|
529
|
+
if (!('multilocation' in currency && sdkCore.isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
544
530
|
_context.next = 5;
|
|
545
531
|
break;
|
|
546
532
|
}
|
|
547
|
-
throw new Error('
|
|
533
|
+
throw new Error('Override multilocation is not supported for Evm transfers');
|
|
548
534
|
case 5:
|
|
549
|
-
|
|
535
|
+
if (provider) {
|
|
536
|
+
_context.next = 7;
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
throw new Error('provider parameter is required for Snowbridge transfers.');
|
|
540
|
+
case 7:
|
|
541
|
+
if (isEthersSigner(signer)) {
|
|
542
|
+
_context.next = 9;
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
throw new Error('Snowbridge does not support Viem provider yet.');
|
|
546
|
+
case 9:
|
|
547
|
+
ethAsset = sdkCore.getAssetBySymbolOrId('Ethereum', currency, to);
|
|
548
|
+
if (!(ethAsset === null)) {
|
|
549
|
+
_context.next = 12;
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
throw new sdkCore.InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
553
|
+
case 12:
|
|
550
554
|
env = api.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
551
|
-
_context.next =
|
|
555
|
+
_context.next = 15;
|
|
552
556
|
return createContext(provider, env.config);
|
|
553
|
-
case
|
|
557
|
+
case 15:
|
|
554
558
|
context = _context.sent;
|
|
555
559
|
destParaId = sdkCore.getParaId(to);
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
560
|
+
if (!(!sdkCore.isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
561
|
+
_context.next = 19;
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
throw new sdkCore.InvalidCurrencyError('Selected asset has no asset id');
|
|
565
|
+
case 19:
|
|
566
|
+
_context.next = 21;
|
|
567
|
+
return api.toPolkadot.validateSend(context, signer, address, ethAsset.assetId, destParaId, BigInt(currency.amount), 0n);
|
|
568
|
+
case 21:
|
|
559
569
|
plan = _context.sent;
|
|
560
570
|
checkPlanFailure(plan);
|
|
561
|
-
_context.next =
|
|
571
|
+
_context.next = 25;
|
|
562
572
|
return api.toPolkadot.send(context, signer, plan);
|
|
563
|
-
case
|
|
573
|
+
case 25:
|
|
564
574
|
result = _context.sent;
|
|
565
575
|
return _context.abrupt("return", {
|
|
566
576
|
result: result,
|
|
567
577
|
plan: plan
|
|
568
578
|
});
|
|
569
|
-
case
|
|
579
|
+
case 27:
|
|
570
580
|
case "end":
|
|
571
581
|
return _context.stop();
|
|
572
582
|
}
|
|
@@ -579,18 +589,35 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
579
589
|
|
|
580
590
|
var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
581
591
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
582
|
-
var _ethAsset$assetId;
|
|
583
592
|
var currency, to, address, destAddress, ethAsset, env, EXECUTION_URL, context, destParaId, signer, plan;
|
|
584
593
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
585
594
|
while (1) switch (_context.prev = _context.next) {
|
|
586
595
|
case 0:
|
|
587
596
|
currency = _ref.currency, to = _ref.to, address = _ref.address, destAddress = _ref.destAddress;
|
|
588
|
-
|
|
597
|
+
if (!('multiasset' in currency)) {
|
|
598
|
+
_context.next = 3;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
throw new Error('Multiassets syntax is not supported for Evm transfers');
|
|
602
|
+
case 3:
|
|
603
|
+
if (!('multilocation' in currency && sdkCore.isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
604
|
+
_context.next = 5;
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
throw new Error('Override multilocation is not supported for Evm transfers');
|
|
608
|
+
case 5:
|
|
609
|
+
ethAsset = sdkCore.getAssetBySymbolOrId('Ethereum', currency, to);
|
|
610
|
+
if (!(ethAsset === null)) {
|
|
611
|
+
_context.next = 8;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
throw new sdkCore.InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
615
|
+
case 8:
|
|
589
616
|
env = api.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
590
617
|
EXECUTION_URL = 'https://eth.llamarpc.com';
|
|
591
|
-
_context.next =
|
|
618
|
+
_context.next = 12;
|
|
592
619
|
return createContext(EXECUTION_URL, env.config);
|
|
593
|
-
case
|
|
620
|
+
case 12:
|
|
594
621
|
context = _context.sent;
|
|
595
622
|
destParaId = sdkCore.getParaId(to);
|
|
596
623
|
signer = {
|
|
@@ -598,17 +625,23 @@ var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
|
598
625
|
return Promise.resolve(address);
|
|
599
626
|
}
|
|
600
627
|
};
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
628
|
+
if (!(!sdkCore.isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
629
|
+
_context.next = 17;
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
632
|
+
throw new sdkCore.InvalidCurrencyError('Selected asset has no asset id');
|
|
633
|
+
case 17:
|
|
634
|
+
_context.next = 19;
|
|
635
|
+
return api.toPolkadot.validateSend(context, signer, destAddress, ethAsset.assetId, destParaId, BigInt(currency.amount), 0n);
|
|
636
|
+
case 19:
|
|
604
637
|
plan = _context.sent;
|
|
605
638
|
checkPlanFailure(plan);
|
|
606
639
|
if (plan.success) {
|
|
607
|
-
_context.next =
|
|
640
|
+
_context.next = 23;
|
|
608
641
|
break;
|
|
609
642
|
}
|
|
610
643
|
throw new Error('Failed to validate send');
|
|
611
|
-
case
|
|
644
|
+
case 23:
|
|
612
645
|
return _context.abrupt("return", {
|
|
613
646
|
token: plan.success.token,
|
|
614
647
|
destinationParaId: plan.success.destinationParaId,
|
|
@@ -616,7 +649,7 @@ var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
|
616
649
|
amount: plan.success.amount,
|
|
617
650
|
fee: plan.success.fee
|
|
618
651
|
});
|
|
619
|
-
case
|
|
652
|
+
case 24:
|
|
620
653
|
case "end":
|
|
621
654
|
return _context.stop();
|
|
622
655
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { TApiOrUrl, TSerializeEthTransferOptions, TSerializedEthTransfer, TEvmBuilderOptions, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, TOptionalEvmBuilderOptions, IPolkadotApi,
|
|
2
|
+
import { TApiOrUrl, TSerializeEthTransferOptions, TSerializedEthTransfer, TEvmBuilderOptions, Foreign, ForeignAbstract, Native, Override, getAllAssetsSymbols, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTNode, hasSupportForAsset, isNodeEvm, TOptionalEvmBuilderOptions, IPolkadotApi, TNodeDotKsmWithRelayChains, TCurrencyInputWithAmount, GeneralBuilder as GeneralBuilder$1, IFinalBuilderWithOptions as IFinalBuilderWithOptions$1 } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
4
|
import * as _snowbridge_api_dist_toPolkadot from '@snowbridge/api/dist/toPolkadot';
|
|
5
5
|
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
6
6
|
import * as _polkadot_api from '@polkadot/api';
|
|
7
7
|
import { ApiPromise } from '@polkadot/api';
|
|
8
8
|
import { AbstractProvider, Signer } from 'ethers';
|
|
9
|
+
import { WalletClient } from 'viem';
|
|
9
10
|
|
|
10
11
|
type TPjsApi = ApiPromise;
|
|
11
12
|
type TPjsApiOrUrl = TApiOrUrl<TPjsApi>;
|
|
@@ -143,14 +144,14 @@ declare class EvmBuilderClass<TApi, TRes> {
|
|
|
143
144
|
* @param node - The Polkadot node to which the transfer will be made.
|
|
144
145
|
* @returns An instance of EvmBuilder
|
|
145
146
|
*/
|
|
146
|
-
to(node:
|
|
147
|
+
to(node: TNodeDotKsmWithRelayChains): this;
|
|
147
148
|
/**
|
|
148
149
|
* Specifies the currency to transfer.
|
|
149
150
|
*
|
|
150
151
|
* @param currency - The currency to be transferred.
|
|
151
152
|
* @returns An instance of EvmBuilder
|
|
152
153
|
*/
|
|
153
|
-
currency(currency:
|
|
154
|
+
currency(currency: TCurrencyInputWithAmount): this;
|
|
154
155
|
/**
|
|
155
156
|
* Specifies the recipient address on Polkadot.
|
|
156
157
|
*
|
|
@@ -164,7 +165,7 @@ declare class EvmBuilderClass<TApi, TRes> {
|
|
|
164
165
|
* @param signer - The Ethereum signer to authorize the transfer.
|
|
165
166
|
* @returns An instance of EvmBuilder
|
|
166
167
|
*/
|
|
167
|
-
signer(signer: Signer): this;
|
|
168
|
+
signer(signer: Signer | WalletClient): this;
|
|
168
169
|
/**
|
|
169
170
|
* Builds and executes the transfer from Ethereum to Polkadot.
|
|
170
171
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getParaId, isForeignAsset, InvalidCurrencyError, getAssetBySymbolOrId, isOverrideMultiLocationSpecifier, createApiInstanceForNode as createApiInstanceForNode$1, getNode, computeFeeFromDryRunPjs, resolveModuleError, getAssetsObject, send as send$1, getDryRun as getDryRun$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, transferMoonbeamEvm, Builder as Builder$1, GeneralBuilder as GeneralBuilder$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { contextFactory, toPolkadot, environment } from '@snowbridge/api';
|
|
4
4
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
@@ -456,19 +456,6 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
var findEthAsset = function findEthAsset(currency) {
|
|
460
|
-
var ethAssets = getOtherAssets('Ethereum');
|
|
461
|
-
var ethAsset = 'symbol' in currency ? ethAssets.find(function (asset) {
|
|
462
|
-
return asset.symbol === currency.symbol;
|
|
463
|
-
}) : ethAssets.find(function (asset) {
|
|
464
|
-
return asset.assetId === currency.id;
|
|
465
|
-
});
|
|
466
|
-
if (!ethAsset) {
|
|
467
|
-
throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(currency), " is not supported for Ethereum transfers"));
|
|
468
|
-
}
|
|
469
|
-
return ethAsset;
|
|
470
|
-
};
|
|
471
|
-
|
|
472
459
|
var createContext = /*#__PURE__*/function () {
|
|
473
460
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(executionUrl, config) {
|
|
474
461
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -527,45 +514,68 @@ var isEthersSigner = function isEthersSigner(signer) {
|
|
|
527
514
|
*/
|
|
528
515
|
var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
529
516
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
530
|
-
var _ethAsset$assetId;
|
|
531
517
|
var provider, signer, address, to, currency, ethAsset, env, context, destParaId, plan, result;
|
|
532
518
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
533
519
|
while (1) switch (_context.prev = _context.next) {
|
|
534
520
|
case 0:
|
|
535
521
|
provider = _ref.provider, signer = _ref.signer, address = _ref.address, to = _ref.to, currency = _ref.currency;
|
|
536
|
-
if (
|
|
522
|
+
if (!('multiasset' in currency)) {
|
|
537
523
|
_context.next = 3;
|
|
538
524
|
break;
|
|
539
525
|
}
|
|
540
|
-
throw new Error('
|
|
526
|
+
throw new Error('Multiassets syntax is not supported for Evm transfers');
|
|
541
527
|
case 3:
|
|
542
|
-
if (
|
|
528
|
+
if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
543
529
|
_context.next = 5;
|
|
544
530
|
break;
|
|
545
531
|
}
|
|
546
|
-
throw new Error('
|
|
532
|
+
throw new Error('Override multilocation is not supported for Evm transfers');
|
|
547
533
|
case 5:
|
|
548
|
-
|
|
534
|
+
if (provider) {
|
|
535
|
+
_context.next = 7;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
throw new Error('provider parameter is required for Snowbridge transfers.');
|
|
539
|
+
case 7:
|
|
540
|
+
if (isEthersSigner(signer)) {
|
|
541
|
+
_context.next = 9;
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
throw new Error('Snowbridge does not support Viem provider yet.');
|
|
545
|
+
case 9:
|
|
546
|
+
ethAsset = getAssetBySymbolOrId('Ethereum', currency, to);
|
|
547
|
+
if (!(ethAsset === null)) {
|
|
548
|
+
_context.next = 12;
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
throw new InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
552
|
+
case 12:
|
|
549
553
|
env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
550
|
-
_context.next =
|
|
554
|
+
_context.next = 15;
|
|
551
555
|
return createContext(provider, env.config);
|
|
552
|
-
case
|
|
556
|
+
case 15:
|
|
553
557
|
context = _context.sent;
|
|
554
558
|
destParaId = getParaId(to);
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
559
|
+
if (!(!isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
560
|
+
_context.next = 19;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
throw new InvalidCurrencyError('Selected asset has no asset id');
|
|
564
|
+
case 19:
|
|
565
|
+
_context.next = 21;
|
|
566
|
+
return toPolkadot.validateSend(context, signer, address, ethAsset.assetId, destParaId, BigInt(currency.amount), 0n);
|
|
567
|
+
case 21:
|
|
558
568
|
plan = _context.sent;
|
|
559
569
|
checkPlanFailure(plan);
|
|
560
|
-
_context.next =
|
|
570
|
+
_context.next = 25;
|
|
561
571
|
return toPolkadot.send(context, signer, plan);
|
|
562
|
-
case
|
|
572
|
+
case 25:
|
|
563
573
|
result = _context.sent;
|
|
564
574
|
return _context.abrupt("return", {
|
|
565
575
|
result: result,
|
|
566
576
|
plan: plan
|
|
567
577
|
});
|
|
568
|
-
case
|
|
578
|
+
case 27:
|
|
569
579
|
case "end":
|
|
570
580
|
return _context.stop();
|
|
571
581
|
}
|
|
@@ -578,18 +588,35 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
578
588
|
|
|
579
589
|
var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
580
590
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
581
|
-
var _ethAsset$assetId;
|
|
582
591
|
var currency, to, address, destAddress, ethAsset, env, EXECUTION_URL, context, destParaId, signer, plan;
|
|
583
592
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
584
593
|
while (1) switch (_context.prev = _context.next) {
|
|
585
594
|
case 0:
|
|
586
595
|
currency = _ref.currency, to = _ref.to, address = _ref.address, destAddress = _ref.destAddress;
|
|
587
|
-
|
|
596
|
+
if (!('multiasset' in currency)) {
|
|
597
|
+
_context.next = 3;
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
throw new Error('Multiassets syntax is not supported for Evm transfers');
|
|
601
|
+
case 3:
|
|
602
|
+
if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
|
|
603
|
+
_context.next = 5;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
throw new Error('Override multilocation is not supported for Evm transfers');
|
|
607
|
+
case 5:
|
|
608
|
+
ethAsset = getAssetBySymbolOrId('Ethereum', currency, to);
|
|
609
|
+
if (!(ethAsset === null)) {
|
|
610
|
+
_context.next = 8;
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
throw new InvalidCurrencyError("Origin node Ethereum does not support currency ".concat(JSON.stringify(currency), "."));
|
|
614
|
+
case 8:
|
|
588
615
|
env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
589
616
|
EXECUTION_URL = 'https://eth.llamarpc.com';
|
|
590
|
-
_context.next =
|
|
617
|
+
_context.next = 12;
|
|
591
618
|
return createContext(EXECUTION_URL, env.config);
|
|
592
|
-
case
|
|
619
|
+
case 12:
|
|
593
620
|
context = _context.sent;
|
|
594
621
|
destParaId = getParaId(to);
|
|
595
622
|
signer = {
|
|
@@ -597,17 +624,23 @@ var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
|
597
624
|
return Promise.resolve(address);
|
|
598
625
|
}
|
|
599
626
|
};
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
627
|
+
if (!(!isForeignAsset(ethAsset) || ethAsset.assetId === undefined)) {
|
|
628
|
+
_context.next = 17;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
throw new InvalidCurrencyError('Selected asset has no asset id');
|
|
632
|
+
case 17:
|
|
633
|
+
_context.next = 19;
|
|
634
|
+
return toPolkadot.validateSend(context, signer, destAddress, ethAsset.assetId, destParaId, BigInt(currency.amount), 0n);
|
|
635
|
+
case 19:
|
|
603
636
|
plan = _context.sent;
|
|
604
637
|
checkPlanFailure(plan);
|
|
605
638
|
if (plan.success) {
|
|
606
|
-
_context.next =
|
|
639
|
+
_context.next = 23;
|
|
607
640
|
break;
|
|
608
641
|
}
|
|
609
642
|
throw new Error('Failed to validate send');
|
|
610
|
-
case
|
|
643
|
+
case 23:
|
|
611
644
|
return _context.abrupt("return", {
|
|
612
645
|
token: plan.success.token,
|
|
613
646
|
destinationParaId: plan.success.destinationParaId,
|
|
@@ -615,7 +648,7 @@ var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
|
615
648
|
amount: plan.success.amount,
|
|
616
649
|
fee: plan.success.fee
|
|
617
650
|
});
|
|
618
|
-
case
|
|
651
|
+
case 24:
|
|
619
652
|
case "end":
|
|
620
653
|
return _context.stop();
|
|
621
654
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
14
15
|
"import": "./dist/index.mjs",
|
|
15
|
-
"require": "./dist/index.cjs"
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"main": "dist/index.cjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@snowbridge/api": "^0.1.25",
|
|
27
27
|
"ethers": "^6.13.4",
|
|
28
28
|
"viem": "^2.21.58",
|
|
29
|
-
"@paraspell/sdk-core": "8.0.
|
|
29
|
+
"@paraspell/sdk-core": "8.0.3"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@polkadot/api": ">= 15.0 < 16",
|