@paraspell/sdk-pjs 11.14.9 → 12.0.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 +5 -31
- package/dist/index.d.ts +5 -39
- package/dist/index.mjs +21 -55
- package/package.json +2 -2
- package/dist/index.cjs +0 -1763
package/README.md
CHANGED
|
@@ -55,9 +55,6 @@ Other patterns:
|
|
|
55
55
|
```ts
|
|
56
56
|
// ESM
|
|
57
57
|
import * as paraspell from '@paraspell/sdk-pjs'
|
|
58
|
-
|
|
59
|
-
// CommonJS
|
|
60
|
-
const paraspell = require('@paraspell/sdk-pjs')
|
|
61
58
|
```
|
|
62
59
|
|
|
63
60
|
Interaction with further asset symbol abstraction:
|
|
@@ -73,12 +70,13 @@ NOTES:
|
|
|
73
70
|
- Transfer info queries are now all in the Builder pattern and don't require any imports other than the builder.
|
|
74
71
|
- You can now query Ethereum asset balances on Ethereum via balance query
|
|
75
72
|
- The Builder() now accepts an optional configuration object (To enhance localhost experience and testing). This object can contain apiOverrides and a development flag. More information in the "Localhost test setup" section.
|
|
73
|
+
- V10 > V11 Migration guide https://paraspell.github.io/docs/migration/v10-to-v11.html
|
|
74
|
+
- Brand new asset decimal abstraction introduced. It can be turned on in Builder config. Will be turned on by default in next major release.
|
|
76
75
|
```
|
|
77
76
|
|
|
78
77
|
```
|
|
79
78
|
Latest news:
|
|
80
|
-
-
|
|
81
|
-
- Brand new asset decimal abstraction introduced. It can be turned on in Builder config. Will be turned on by default in next major release.
|
|
79
|
+
- V11 > V12 Migration guide https://paraspell.github.io/docs/migration/v11-to-v12.html
|
|
82
80
|
```
|
|
83
81
|
|
|
84
82
|
### Sending XCM
|
|
@@ -382,7 +380,6 @@ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
382
380
|
|
|
383
381
|
#### XCM Fee (Origin and Dest.)
|
|
384
382
|
|
|
385
|
-
##### More accurate query using DryRun
|
|
386
383
|
```ts
|
|
387
384
|
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
388
385
|
.from(ORIGIN_CHAIN)
|
|
@@ -394,20 +391,8 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
394
391
|
.getXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of a DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin or Destination chain do not support DryRun out of the box.
|
|
395
392
|
```
|
|
396
393
|
|
|
397
|
-
##### Less accurate query using Payment info
|
|
398
|
-
```ts
|
|
399
|
-
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
400
|
-
.from(ORIGIN_CHAIN)
|
|
401
|
-
.to(DESTINATION_CHAIN)
|
|
402
|
-
.currency(CURRENCY)
|
|
403
|
-
.address(RECIPIENT_ADDRESS)
|
|
404
|
-
.senderAddress(SENDER_ADDRESS)
|
|
405
|
-
.getXcmFeeEstimate()
|
|
406
|
-
```
|
|
407
|
-
|
|
408
394
|
#### XCM Fee (Origin only)
|
|
409
395
|
|
|
410
|
-
##### More accurate query using DryRun
|
|
411
396
|
```ts
|
|
412
397
|
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
413
398
|
.from(ORIGIN_CHAIN)
|
|
@@ -419,23 +404,12 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
419
404
|
.getOriginXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of a DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin do not support DryRun out of the box.
|
|
420
405
|
```
|
|
421
406
|
|
|
422
|
-
##### Less accurate query using Payment info
|
|
423
|
-
```ts
|
|
424
|
-
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
425
|
-
.from(ORIGIN_CHAIN)
|
|
426
|
-
.to(DESTINATION_CHAIN)
|
|
427
|
-
.currency(CURRENCY)
|
|
428
|
-
.address(RECIPIENT_ADDRESS)
|
|
429
|
-
.senderAddress(SENDER_ADDRESS)
|
|
430
|
-
.getOriginXcmFeeEstimate()
|
|
431
|
-
```
|
|
432
|
-
|
|
433
407
|
#### Asset balance
|
|
434
408
|
```ts
|
|
435
|
-
import {
|
|
409
|
+
import { getBalance } from "@paraspell/sdk-pjs";
|
|
436
410
|
|
|
437
411
|
//Retrieves the asset balance for a given account on a specified chain (You do not need to specify if it is native or foreign).
|
|
438
|
-
const balance = await
|
|
412
|
+
const balance = await getBalance({address, chain, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {location: AssetLocationString | AssetLocationJson}*/, api /* api/ws_url_string optional */});
|
|
439
413
|
```
|
|
440
414
|
|
|
441
415
|
#### Ethereum bridge fees
|
package/dist/index.d.ts
CHANGED
|
@@ -42,31 +42,13 @@ type TPjsEvmBuilderOptions<TApi, TRes> = WithApi<TEvmBuilderOptionsBase, TApi, T
|
|
|
42
42
|
provider?: AbstractProvider;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves the native balance for a given account on a specified chain.
|
|
47
|
-
*
|
|
48
|
-
* @returns The native balance as a bigint.
|
|
49
|
-
*/
|
|
50
|
-
declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeOptionsBase & {
|
|
51
|
-
api?: TPjsApiOrUrl;
|
|
52
|
-
}) => Promise<bigint>;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieves the balance of a foreign asset for a given account on a specified chain.
|
|
55
|
-
*
|
|
56
|
-
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
57
|
-
*/
|
|
58
|
-
declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceCommonOptions & {
|
|
59
|
-
currency: _paraspell_sdk_core.TCurrencyCore;
|
|
60
|
-
} & {
|
|
61
|
-
api?: TPjsApiOrUrl;
|
|
62
|
-
}) => Promise<bigint>;
|
|
63
45
|
/**
|
|
64
46
|
* Retrieves the asset balance for a given account on a specified chain.
|
|
65
47
|
*
|
|
66
48
|
* @returns The asset balance as a bigint.
|
|
67
49
|
*/
|
|
68
|
-
declare const
|
|
69
|
-
currency
|
|
50
|
+
declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions & {
|
|
51
|
+
currency?: _paraspell_sdk_core.TCurrencyCore;
|
|
70
52
|
} & {
|
|
71
53
|
api?: TPjsApiOrUrl;
|
|
72
54
|
}) => Promise<bigint>;
|
|
@@ -78,16 +60,6 @@ declare const getAssetBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOp
|
|
|
78
60
|
declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase & {
|
|
79
61
|
api?: TPjsApiOrUrl;
|
|
80
62
|
}) => Promise<Extrinsic>;
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
83
|
-
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
84
|
-
* where `builder` is an instance of `Builder()`. Will be removed in v12
|
|
85
|
-
* For more details, please refer to the documentation:
|
|
86
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
87
|
-
*/
|
|
88
|
-
declare const getOriginFeeDetails: (options: _paraspell_sdk_core.TGetOriginFeeDetailsOptionsBase & {
|
|
89
|
-
api?: TPjsApiOrUrl;
|
|
90
|
-
}) => Promise<_paraspell_sdk_core.TOriginFeeDetails>;
|
|
91
63
|
|
|
92
64
|
declare const assets_Foreign: typeof Foreign;
|
|
93
65
|
declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
@@ -96,17 +68,14 @@ declare const assets_Override: typeof Override;
|
|
|
96
68
|
declare const assets_claimAssets: typeof claimAssets;
|
|
97
69
|
declare const assets_findAssetInfo: typeof findAssetInfo;
|
|
98
70
|
declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
99
|
-
declare const assets_getAssetBalance: typeof getAssetBalance;
|
|
100
71
|
declare const assets_getAssetDecimals: typeof getAssetDecimals;
|
|
101
72
|
declare const assets_getAssetId: typeof getAssetId;
|
|
102
73
|
declare const assets_getAssets: typeof getAssets;
|
|
103
74
|
declare const assets_getAssetsObject: typeof getAssetsObject;
|
|
104
|
-
declare const
|
|
105
|
-
declare const assets_getBalanceNative: typeof getBalanceNative;
|
|
75
|
+
declare const assets_getBalance: typeof getBalance;
|
|
106
76
|
declare const assets_getExistentialDeposit: typeof getExistentialDeposit;
|
|
107
77
|
declare const assets_getNativeAssetSymbol: typeof getNativeAssetSymbol;
|
|
108
78
|
declare const assets_getNativeAssets: typeof getNativeAssets;
|
|
109
|
-
declare const assets_getOriginFeeDetails: typeof getOriginFeeDetails;
|
|
110
79
|
declare const assets_getOtherAssets: typeof getOtherAssets;
|
|
111
80
|
declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
|
|
112
81
|
declare const assets_getSupportedAssets: typeof getSupportedAssets;
|
|
@@ -122,17 +91,14 @@ declare namespace assets {
|
|
|
122
91
|
assets_claimAssets as claimAssets,
|
|
123
92
|
assets_findAssetInfo as findAssetInfo,
|
|
124
93
|
assets_getAllAssetsSymbols as getAllAssetsSymbols,
|
|
125
|
-
assets_getAssetBalance as getAssetBalance,
|
|
126
94
|
assets_getAssetDecimals as getAssetDecimals,
|
|
127
95
|
assets_getAssetId as getAssetId,
|
|
128
96
|
assets_getAssets as getAssets,
|
|
129
97
|
assets_getAssetsObject as getAssetsObject,
|
|
130
|
-
|
|
131
|
-
assets_getBalanceNative as getBalanceNative,
|
|
98
|
+
assets_getBalance as getBalance,
|
|
132
99
|
assets_getExistentialDeposit as getExistentialDeposit,
|
|
133
100
|
assets_getNativeAssetSymbol as getNativeAssetSymbol,
|
|
134
101
|
assets_getNativeAssets as getNativeAssets,
|
|
135
|
-
assets_getOriginFeeDetails as getOriginFeeDetails,
|
|
136
102
|
assets_getOtherAssets as getOtherAssets,
|
|
137
103
|
assets_getRelayChainSymbol as getRelayChainSymbol,
|
|
138
104
|
assets_getSupportedAssets as getSupportedAssets,
|
|
@@ -282,5 +248,5 @@ declare namespace transfer {
|
|
|
282
248
|
|
|
283
249
|
declare const createChainClient: (chain: TSubstrateChain, builderOptions?: TBuilderOptions<TPjsApiOrUrl>) => Promise<_polkadot_api.ApiPromise>;
|
|
284
250
|
|
|
285
|
-
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin,
|
|
251
|
+
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, getTokenBalance, send, transferEthToPolkadot, transfer as xcmPallet };
|
|
286
252
|
export type { Extrinsic, GeneralBuilder, TPjsApi, TPjsApiOrUrl, TPjsEvmBuilderOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isConfig, BatchMode, MissingChainApiError, getChainProviders,
|
|
1
|
+
import { isConfig, BatchMode, MissingChainApiError, getChainProviders, UnsupportedOperationError, computeFeeFromDryRunPjs, findNativeAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, isAssetXcEqual, addXcmVersionHeader, Version, createChainClient as createChainClient$1, getBalance as getBalance$1, claimAssets as claimAssets$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, getParaId, ETH_CHAIN_ID, RoutingResolutionError, findAssetInfoOrThrow, abstractDecimals, assertHasId, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$1, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { WsProvider, ApiPromise } from '@polkadot/api';
|
|
4
4
|
import { isHex, u8aToHex, hexToU8a, stringToU8a } from '@polkadot/util';
|
|
@@ -534,7 +534,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
534
534
|
_context7.n = 1;
|
|
535
535
|
break;
|
|
536
536
|
}
|
|
537
|
-
throw new
|
|
537
|
+
throw new UnsupportedOperationError("RPC method ".concat(module, ".").concat(method, " not available"));
|
|
538
538
|
case 1:
|
|
539
539
|
_context7.n = 2;
|
|
540
540
|
return rpcModule[method](key);
|
|
@@ -585,7 +585,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
585
585
|
value: function () {
|
|
586
586
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
587
587
|
var _this = this;
|
|
588
|
-
var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset,
|
|
588
|
+
var tx, address, feeAsset, chain, destination, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, usedAsset, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, nativeAsset, hasLocation, destParaId, xcmFee, executionFee, fee, _t, _t2, _t3;
|
|
589
589
|
return _regenerator().w(function (_context0) {
|
|
590
590
|
while (1) switch (_context0.p = _context0.n) {
|
|
591
591
|
case 0:
|
|
@@ -595,7 +595,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
595
595
|
_context0.n = 1;
|
|
596
596
|
break;
|
|
597
597
|
}
|
|
598
|
-
throw new
|
|
598
|
+
throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
|
|
599
599
|
case 1:
|
|
600
600
|
DEFAULT_XCM_VERSION = 3;
|
|
601
601
|
basePayload = useRootOrigin ? {
|
|
@@ -624,7 +624,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
624
624
|
case 4:
|
|
625
625
|
resolvedTx = _t;
|
|
626
626
|
usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrow(chain);
|
|
627
|
-
usedSymbol = usedAsset.symbol;
|
|
628
627
|
performDryRunCall = /*#__PURE__*/function () {
|
|
629
628
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(includeVersion) {
|
|
630
629
|
var _this$api$call$dryRun;
|
|
@@ -704,7 +703,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
704
703
|
return _context0.a(2, {
|
|
705
704
|
success: false,
|
|
706
705
|
failureReason: msg,
|
|
707
|
-
currency: usedSymbol,
|
|
708
706
|
asset: usedAsset
|
|
709
707
|
});
|
|
710
708
|
case 9:
|
|
@@ -734,7 +732,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
734
732
|
success: false,
|
|
735
733
|
failureReason: failureErr.failureReason,
|
|
736
734
|
failureSubReason: failureErr.failureSubReason,
|
|
737
|
-
currency: usedSymbol,
|
|
738
735
|
asset: usedAsset
|
|
739
736
|
});
|
|
740
737
|
case 13:
|
|
@@ -746,7 +743,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
746
743
|
success: false,
|
|
747
744
|
failureReason: failureErr.failureReason || 'Unknown error',
|
|
748
745
|
failureSubReason: failureErr.failureSubReason,
|
|
749
|
-
currency: usedSymbol,
|
|
750
746
|
asset: usedAsset
|
|
751
747
|
});
|
|
752
748
|
case 14:
|
|
@@ -776,7 +772,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
776
772
|
return _context0.a(2, Promise.resolve({
|
|
777
773
|
success: true,
|
|
778
774
|
fee: xcmFee,
|
|
779
|
-
currency: usedSymbol,
|
|
780
775
|
asset: usedAsset,
|
|
781
776
|
weight: weight,
|
|
782
777
|
forwardedXcms: forwardedXcms,
|
|
@@ -791,7 +786,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
791
786
|
return _context0.a(2, {
|
|
792
787
|
success: true,
|
|
793
788
|
fee: fee,
|
|
794
|
-
currency: usedSymbol,
|
|
795
789
|
asset: usedAsset,
|
|
796
790
|
weight: weight,
|
|
797
791
|
forwardedXcms: forwardedXcms,
|
|
@@ -901,7 +895,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
901
895
|
value: function () {
|
|
902
896
|
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(_ref7) {
|
|
903
897
|
var _ref9, _ref0, _ref1;
|
|
904
|
-
var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson,
|
|
898
|
+
var originLocation, xcm, asset, chain, origin, supportsDryRunApi, response, result, resultJson, isSuccess, error, failureReason, forwardedXcms, actualWeight, weight, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, feeEvent, feeAmount, fee;
|
|
905
899
|
return _regenerator().w(function (_context11) {
|
|
906
900
|
while (1) switch (_context11.n) {
|
|
907
901
|
case 0:
|
|
@@ -911,7 +905,7 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
911
905
|
_context11.n = 1;
|
|
912
906
|
break;
|
|
913
907
|
}
|
|
914
|
-
throw new
|
|
908
|
+
throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
|
|
915
909
|
case 1:
|
|
916
910
|
_context11.n = 2;
|
|
917
911
|
return this.api.call.dryRunApi.dryRunXcm(originLocation, xcm);
|
|
@@ -919,7 +913,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
919
913
|
response = _context11.v;
|
|
920
914
|
result = response.toHuman();
|
|
921
915
|
resultJson = response.toJSON();
|
|
922
|
-
symbol = asset.symbol;
|
|
923
916
|
isSuccess = result.Ok && result.Ok.executionResult.Complete;
|
|
924
917
|
if (isSuccess) {
|
|
925
918
|
_context11.n = 3;
|
|
@@ -930,7 +923,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
930
923
|
return _context11.a(2, {
|
|
931
924
|
success: false,
|
|
932
925
|
failureReason: failureReason,
|
|
933
|
-
currency: symbol,
|
|
934
926
|
asset: asset
|
|
935
927
|
});
|
|
936
928
|
case 3:
|
|
@@ -958,7 +950,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
958
950
|
return _context11.a(2, {
|
|
959
951
|
success: true,
|
|
960
952
|
fee: _fee,
|
|
961
|
-
currency: symbol,
|
|
962
953
|
asset: asset,
|
|
963
954
|
weight: weight,
|
|
964
955
|
forwardedXcms: forwardedXcms,
|
|
@@ -988,7 +979,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
988
979
|
return _context11.a(2, Promise.resolve({
|
|
989
980
|
success: false,
|
|
990
981
|
failureReason: 'Cannot determine destination fee. No Issued event found',
|
|
991
|
-
currency: symbol,
|
|
992
982
|
asset: asset
|
|
993
983
|
}));
|
|
994
984
|
case 6:
|
|
@@ -997,7 +987,6 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
997
987
|
return _context11.a(2, {
|
|
998
988
|
success: true,
|
|
999
989
|
fee: fee,
|
|
1000
|
-
currency: symbol,
|
|
1001
990
|
asset: asset,
|
|
1002
991
|
weight: weight,
|
|
1003
992
|
forwardedXcms: forwardedXcms,
|
|
@@ -1124,38 +1113,18 @@ var isEthersSigner = function isEthersSigner(signer) {
|
|
|
1124
1113
|
return _typeof(signer) === 'object' && signer !== null && 'provider' in signer;
|
|
1125
1114
|
};
|
|
1126
1115
|
|
|
1127
|
-
/**
|
|
1128
|
-
* Retrieves the native balance for a given account on a specified chain.
|
|
1129
|
-
*
|
|
1130
|
-
* @returns The native balance as a bigint.
|
|
1131
|
-
*/
|
|
1132
|
-
var getBalanceNative = createPolkadotJsApiCall(getBalanceNative$1);
|
|
1133
|
-
/**
|
|
1134
|
-
* Retrieves the balance of a foreign asset for a given account on a specified chain.
|
|
1135
|
-
*
|
|
1136
|
-
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
1137
|
-
*/
|
|
1138
|
-
var getBalanceForeign = createPolkadotJsApiCall(getBalance);
|
|
1139
1116
|
/**
|
|
1140
1117
|
* Retrieves the asset balance for a given account on a specified chain.
|
|
1141
1118
|
*
|
|
1142
1119
|
* @returns The asset balance as a bigint.
|
|
1143
1120
|
*/
|
|
1144
|
-
var
|
|
1121
|
+
var getBalance = createPolkadotJsApiCall(getBalance$1);
|
|
1145
1122
|
/**
|
|
1146
1123
|
* Claims assets from a parachain.
|
|
1147
1124
|
*
|
|
1148
1125
|
* @returns An extrinsic representing the claim transaction.
|
|
1149
1126
|
*/
|
|
1150
1127
|
var claimAssets = createPolkadotJsApiCall(claimAssets$1);
|
|
1151
|
-
/**
|
|
1152
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
1153
|
-
* Please use `builder.getOriginXcmFee()` or `builder.getOriginXcmFeeEstimate()` instead,
|
|
1154
|
-
* where `builder` is an instance of `Builder()`. Will be removed in v12
|
|
1155
|
-
* For more details, please refer to the documentation:
|
|
1156
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
1157
|
-
*/
|
|
1158
|
-
var getOriginFeeDetails = createPolkadotJsApiCall(getOriginFeeDetails$1);
|
|
1159
1128
|
|
|
1160
1129
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1161
1130
|
__proto__: null,
|
|
@@ -1166,17 +1135,14 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1166
1135
|
claimAssets: claimAssets,
|
|
1167
1136
|
findAssetInfo: findAssetInfo,
|
|
1168
1137
|
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
1169
|
-
getAssetBalance: getAssetBalance,
|
|
1170
1138
|
getAssetDecimals: getAssetDecimals,
|
|
1171
1139
|
getAssetId: getAssetId,
|
|
1172
1140
|
getAssets: getAssets,
|
|
1173
1141
|
getAssetsObject: getAssetsObject,
|
|
1174
|
-
|
|
1175
|
-
getBalanceNative: getBalanceNative,
|
|
1142
|
+
getBalance: getBalance,
|
|
1176
1143
|
getExistentialDeposit: getExistentialDeposit,
|
|
1177
1144
|
getNativeAssetSymbol: getNativeAssetSymbol,
|
|
1178
1145
|
getNativeAssets: getNativeAssets,
|
|
1179
|
-
getOriginFeeDetails: getOriginFeeDetails,
|
|
1180
1146
|
getOtherAssets: getOtherAssets,
|
|
1181
1147
|
getRelayChainSymbol: getRelayChainSymbol,
|
|
1182
1148
|
getSupportedAssets: getSupportedAssets,
|
|
@@ -1204,7 +1170,7 @@ var approveToken = /*#__PURE__*/function () {
|
|
|
1204
1170
|
_context.n = 1;
|
|
1205
1171
|
break;
|
|
1206
1172
|
}
|
|
1207
|
-
throw new
|
|
1173
|
+
throw new UnsupportedOperationError("Token ".concat(symbol, " not supported"));
|
|
1208
1174
|
case 1:
|
|
1209
1175
|
weth9 = WETH9__factory.connect(contract.address, signer);
|
|
1210
1176
|
_context.n = 2;
|
|
@@ -1241,7 +1207,7 @@ var depositToken = /*#__PURE__*/function () {
|
|
|
1241
1207
|
_context.n = 1;
|
|
1242
1208
|
break;
|
|
1243
1209
|
}
|
|
1244
|
-
throw new
|
|
1210
|
+
throw new UnsupportedOperationError("Token ".concat(symbol, " not supported"));
|
|
1245
1211
|
case 1:
|
|
1246
1212
|
weth9 = WETH9__factory.connect(contract.address, signer);
|
|
1247
1213
|
_context.n = 2;
|
|
@@ -1310,25 +1276,25 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1310
1276
|
_context.n = 1;
|
|
1311
1277
|
break;
|
|
1312
1278
|
}
|
|
1313
|
-
throw new
|
|
1279
|
+
throw new UnsupportedOperationError('Multi-assets are not yet supported for EVM transfers');
|
|
1314
1280
|
case 1:
|
|
1315
1281
|
if (!('location' in currency && isOverrideLocationSpecifier(currency.location))) {
|
|
1316
1282
|
_context.n = 2;
|
|
1317
1283
|
break;
|
|
1318
1284
|
}
|
|
1319
|
-
throw new
|
|
1285
|
+
throw new UnsupportedOperationError('Override location is not supported for EVM transfers');
|
|
1320
1286
|
case 2:
|
|
1321
1287
|
if (provider) {
|
|
1322
1288
|
_context.n = 3;
|
|
1323
1289
|
break;
|
|
1324
1290
|
}
|
|
1325
|
-
throw new
|
|
1291
|
+
throw new MissingParameterError('provider', 'provider parameter is required for Snowbridge transfers.');
|
|
1326
1292
|
case 3:
|
|
1327
1293
|
if (isEthersSigner(signer)) {
|
|
1328
1294
|
_context.n = 4;
|
|
1329
1295
|
break;
|
|
1330
1296
|
}
|
|
1331
|
-
throw new
|
|
1297
|
+
throw new UnsupportedOperationError('Snowbridge does not support Viem provider yet.');
|
|
1332
1298
|
case 4:
|
|
1333
1299
|
ethAsset = findAssetInfoOrThrow('Ethereum', currency, to);
|
|
1334
1300
|
amount = abstractDecimals(currency.amount, ethAsset.decimals, api);
|
|
@@ -1429,7 +1395,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1429
1395
|
_context.n = 18;
|
|
1430
1396
|
break;
|
|
1431
1397
|
}
|
|
1432
|
-
throw new
|
|
1398
|
+
throw new RoutingResolutionError("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
|
|
1433
1399
|
return l.kind == toPolkadotV2.ValidationKind.Error;
|
|
1434
1400
|
}).map(function (l) {
|
|
1435
1401
|
return l.message;
|
|
@@ -1448,7 +1414,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1448
1414
|
_context.n = 21;
|
|
1449
1415
|
break;
|
|
1450
1416
|
}
|
|
1451
|
-
throw new
|
|
1417
|
+
throw new RoutingResolutionError("Transaction ".concat(response.hash, " not included."));
|
|
1452
1418
|
case 21:
|
|
1453
1419
|
_context.n = 22;
|
|
1454
1420
|
return toPolkadotV2.getMessageReceipt(receipt);
|
|
@@ -1458,7 +1424,7 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
|
1458
1424
|
_context.n = 23;
|
|
1459
1425
|
break;
|
|
1460
1426
|
}
|
|
1461
|
-
throw new
|
|
1427
|
+
throw new RoutingResolutionError("Transaction ".concat(receipt.hash, " did not emit a message."));
|
|
1462
1428
|
case 23:
|
|
1463
1429
|
return _context.a(2, {
|
|
1464
1430
|
response: response,
|
|
@@ -1486,7 +1452,7 @@ var getTokenBalance = /*#__PURE__*/function () {
|
|
|
1486
1452
|
_context.n = 1;
|
|
1487
1453
|
break;
|
|
1488
1454
|
}
|
|
1489
|
-
throw new
|
|
1455
|
+
throw new UnsupportedOperationError("Token ".concat(symbol, " not supported"));
|
|
1490
1456
|
case 1:
|
|
1491
1457
|
weth9 = WETH9__factory.connect(contract.address, signer);
|
|
1492
1458
|
_context.n = 2;
|
|
@@ -1605,7 +1571,7 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1605
1571
|
_context.n = 1;
|
|
1606
1572
|
break;
|
|
1607
1573
|
}
|
|
1608
|
-
throw new
|
|
1574
|
+
throw new UnsupportedOperationError('Ethers signer is not supported for Moonbeam to Ethereum transfers.');
|
|
1609
1575
|
case 1:
|
|
1610
1576
|
return _context.a(2, transferMoonbeamToEth(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1611
1577
|
signer: signer
|
|
@@ -1619,7 +1585,7 @@ var EvmBuilderCore = /*#__PURE__*/function () {
|
|
|
1619
1585
|
_context.n = 3;
|
|
1620
1586
|
break;
|
|
1621
1587
|
}
|
|
1622
|
-
throw new
|
|
1588
|
+
throw new UnsupportedOperationError('Ethers signer is not supported for Moonbeam to Ethereum transfers.');
|
|
1623
1589
|
case 3:
|
|
1624
1590
|
return _context.a(2, transferMoonbeamEvm(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
1625
1591
|
signer: signer
|
|
@@ -1734,4 +1700,4 @@ var transfer = /*#__PURE__*/Object.freeze({
|
|
|
1734
1700
|
transferEthToPolkadot: transferEthToPolkadot
|
|
1735
1701
|
});
|
|
1736
1702
|
|
|
1737
|
-
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin,
|
|
1703
|
+
export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, getTokenBalance, send, transferEthToPolkadot, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
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.2.17",
|
|
28
28
|
"ethers": "^6.15.0",
|
|
29
29
|
"viem": "^2.40.3",
|
|
30
|
-
"@paraspell/sdk-core": "
|
|
30
|
+
"@paraspell/sdk-core": "12.0.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@polkadot/api": ">= 16.0 < 17",
|