@paraspell/sdk-pjs 13.5.0 → 13.7.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 +71 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +99 -39
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -317,6 +317,77 @@ const tx = await builder.buildBatch({
|
|
|
317
317
|
await builder.disconnect()
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
+
#### Adding chain and/or assets
|
|
321
|
+
SDK features ability to add custom chain and/or custom assets simply by adding its config to the Builder.
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
const tx = await Builder({
|
|
325
|
+
// Adding custom chain
|
|
326
|
+
customChains: {
|
|
327
|
+
MyChain: {
|
|
328
|
+
paraId: 4242,
|
|
329
|
+
ecosystem: 'Polkadot',
|
|
330
|
+
xcmVersion: Version.V5,
|
|
331
|
+
providers: [{ name: 'Primary', endpoint: 'wss://rpc.mychain.example/ws' }],
|
|
332
|
+
// Everything below is optional — auto-fetched from runtime `system.properties` when omitted
|
|
333
|
+
nativeAssetSymbol: 'MYC',
|
|
334
|
+
nativeAssetDecimals: 12,
|
|
335
|
+
ss58Prefix: 42,
|
|
336
|
+
pallets: {
|
|
337
|
+
nativeAssets: "Balances”,
|
|
338
|
+
otherAssets: "Assets",
|
|
339
|
+
}
|
|
340
|
+
assets: [
|
|
341
|
+
{
|
|
342
|
+
symbol: 'USDC',
|
|
343
|
+
decimals: 6,
|
|
344
|
+
existentialDeposit: 0.1,
|
|
345
|
+
location: {
|
|
346
|
+
parents: 1,
|
|
347
|
+
interior: { X3: [{ Parachain: 1000 }, { PalletInstance: 50 }, {
|
|
348
|
+
GeneralIndex: 1337 }] }
|
|
349
|
+
},
|
|
350
|
+
assetId: '1337'
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
// Adding assets to existing chains
|
|
357
|
+
customAssets: {
|
|
358
|
+
AssetHubPolkadot: [
|
|
359
|
+
{
|
|
360
|
+
symbol: 'MYNEWUSD',
|
|
361
|
+
decimals: 6,
|
|
362
|
+
assetId: '9999',
|
|
363
|
+
existentialDeposit: 0.1,
|
|
364
|
+
location: {
|
|
365
|
+
parents: 0,
|
|
366
|
+
interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 9999 }] }
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
// Replace an existing registry asset that shares the same location
|
|
371
|
+
symbol: 'USDT',
|
|
372
|
+
decimals: 6,
|
|
373
|
+
assetId: '1984',
|
|
374
|
+
existentialDeposit: 0.1,
|
|
375
|
+
location: {
|
|
376
|
+
parents: 0,
|
|
377
|
+
interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 1984 }] }
|
|
378
|
+
},
|
|
379
|
+
forceOverride: true
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
.from('MyChain') // custom chain name — TS-autocompletes
|
|
385
|
+
.to('AssetHubPolkadot') // could be any of the existing or also the new ones added
|
|
386
|
+
.currency({ symbol: 'USDC', amount: amount })
|
|
387
|
+
.recipient(address)
|
|
388
|
+
.build()
|
|
389
|
+
```
|
|
390
|
+
|
|
320
391
|
### Localhost test setup
|
|
321
392
|
|
|
322
393
|
```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { WithApi, TChain, TCurrencyInputWithAmount, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TTransferBaseOptions } from '@paraspell/sdk-core';
|
|
2
|
+
import { WithApi, TChain, TCurrencyInputWithAmount, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TCustomChainFrom, TTransferBaseOptions } 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';
|
|
@@ -171,14 +171,14 @@ declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TPjsEvmBuild
|
|
|
171
171
|
/**
|
|
172
172
|
* Creates a new Builder instance.
|
|
173
173
|
*
|
|
174
|
-
* @param
|
|
174
|
+
* @param options - Either an existing API instance, a WS URL, or a config object.
|
|
175
175
|
* @returns A new Builder instance.
|
|
176
176
|
*/
|
|
177
|
-
declare const Builder:
|
|
178
|
-
type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPjsApi, Extrinsic, TPjsSigner>> = object> = GeneralBuilder$1<TPjsApi, Extrinsic, TPjsSigner, T>;
|
|
177
|
+
declare const Builder: <const TOpts extends TBuilderOptions<TApiOrUrl<TPjsApi>>>(options?: TOpts) => GeneralBuilder$1<_polkadot_api.ApiPromise, Extrinsic, TPjsSigner, object, TCustomChainFrom<TOpts>>;
|
|
178
|
+
type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPjsApi, Extrinsic, TPjsSigner>> = object, TCustomChain extends string = never> = GeneralBuilder$1<TPjsApi, Extrinsic, TPjsSigner, T, TCustomChain>;
|
|
179
179
|
/** @deprecated EvmBuilder is deprecated. Please use the Builder class instead. */
|
|
180
180
|
declare const EvmBuilder: (provider?: AbstractProvider, api?: TBuilderOptions<TApiOrUrl<TPjsApi>>) => EvmBuilderCore<unknown, unknown, unknown, {
|
|
181
|
-
api: _paraspell_sdk_core.PolkadotApi<_polkadot_api.ApiPromise, Extrinsic, TPjsSigner>;
|
|
181
|
+
api: _paraspell_sdk_core.PolkadotApi<_polkadot_api.ApiPromise, Extrinsic, TPjsSigner, never>;
|
|
182
182
|
provider: AbstractProvider | undefined;
|
|
183
183
|
}>;
|
|
184
184
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig,
|
|
1
|
+
import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrowImpl, getChainProvidersImpl, isSenderSigner, PolkadotApi, findAssetInfoOrThrowImpl, hasXcmPaymentApiSupportImpl, resolveModuleError, hasDryRunSupportImpl, RuntimeApiUnavailableError, wrapTxBypass, normalizeLocation, localizeLocation, createAssetId, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOfImpl, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, findAssetInfoOrThrow, assertHasId, getParaId, RoutingResolutionError, abstractDecimals, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { Keyring, WsProvider, ApiPromise } from '@polkadot/api';
|
|
4
4
|
import { u8aConcat, compactToU8a, u8aEq, isHex, u8aToHex, hexToU8a, stringToU8a } from '@polkadot/util';
|
|
@@ -698,6 +698,33 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
698
698
|
var methodFormatted = snakeToCamel(method);
|
|
699
699
|
return Promise.resolve(((_this$api$tx$palletFo = this.api.tx[palletFormatted]) === null || _this$api$tx$palletFo === void 0 ? void 0 : _this$api$tx$palletFo[methodFormatted]) !== undefined);
|
|
700
700
|
}
|
|
701
|
+
}, {
|
|
702
|
+
key: "hasRuntimeApi",
|
|
703
|
+
value: function hasRuntimeApi(runtimeApi) {
|
|
704
|
+
return Promise.resolve(this.api.call[lowercaseFirstLetter(runtimeApi)] !== undefined);
|
|
705
|
+
}
|
|
706
|
+
}, {
|
|
707
|
+
key: "fetchPalletList",
|
|
708
|
+
value: function fetchPalletList() {
|
|
709
|
+
var _this2 = this;
|
|
710
|
+
var entries = this.api.runtimeMetadata.asLatest.pallets.map(function (p) {
|
|
711
|
+
var name = p.name.toString();
|
|
712
|
+
return {
|
|
713
|
+
name: name,
|
|
714
|
+
index: p.index.toNumber(),
|
|
715
|
+
hasExtrinsics: _this2.api.tx[lowercaseFirstLetter(name)] !== undefined
|
|
716
|
+
};
|
|
717
|
+
});
|
|
718
|
+
return Promise.resolve(entries);
|
|
719
|
+
}
|
|
720
|
+
}, {
|
|
721
|
+
key: "isEvmChain",
|
|
722
|
+
value: function isEvmChain() {
|
|
723
|
+
var _types$, _path$includes;
|
|
724
|
+
var types = this.api.runtimeMetadata.asLatest.lookup.types;
|
|
725
|
+
var path = (_types$ = types[0]) === null || _types$ === void 0 ? void 0 : _types$.type.path.toJSON();
|
|
726
|
+
return Promise.resolve((_path$includes = path === null || path === void 0 ? void 0 : path.includes('AccountId20')) !== null && _path$includes !== void 0 ? _path$includes : false);
|
|
727
|
+
}
|
|
701
728
|
}, {
|
|
702
729
|
key: "getFromRpc",
|
|
703
730
|
value: function () {
|
|
@@ -762,7 +789,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
762
789
|
value: function resolveDefaultFeeAsset(_ref5) {
|
|
763
790
|
var chain = _ref5.chain,
|
|
764
791
|
feeAsset = _ref5.feeAsset;
|
|
765
|
-
return feeAsset !== null && feeAsset !== void 0 ? feeAsset :
|
|
792
|
+
return feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrowImpl(chain, this._customCtx);
|
|
766
793
|
}
|
|
767
794
|
}, {
|
|
768
795
|
key: "resolveFeeAsset",
|
|
@@ -798,9 +825,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
798
825
|
case 3:
|
|
799
826
|
return _context8.a(2, {
|
|
800
827
|
isCustomAsset: true,
|
|
801
|
-
asset:
|
|
828
|
+
asset: findAssetInfoOrThrowImpl(chain, {
|
|
802
829
|
id: assetId
|
|
803
|
-
})
|
|
830
|
+
}, undefined, this._customCtx)
|
|
804
831
|
});
|
|
805
832
|
}
|
|
806
833
|
}, _callee8, this);
|
|
@@ -814,13 +841,13 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
814
841
|
key: "getDryRunCall",
|
|
815
842
|
value: function () {
|
|
816
843
|
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
817
|
-
var
|
|
844
|
+
var _this3 = this;
|
|
818
845
|
var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, destParaId, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
|
|
819
846
|
return _regenerator().w(function (_context0) {
|
|
820
847
|
while (1) switch (_context0.p = _context0.n) {
|
|
821
848
|
case 0:
|
|
822
849
|
tx = options.tx, address = options.address, feeAsset = options.feeAsset, chain = options.chain, destination = options.destination, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
|
|
823
|
-
supportsDryRunApi =
|
|
850
|
+
supportsDryRunApi = hasDryRunSupportImpl(chain, this._customCtx);
|
|
824
851
|
if (supportsDryRunApi) {
|
|
825
852
|
_context0.n = 1;
|
|
826
853
|
break;
|
|
@@ -858,13 +885,13 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
858
885
|
resolvedFeeAsset = _context0.v;
|
|
859
886
|
performDryRunCall = /*#__PURE__*/function () {
|
|
860
887
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(includeVersion) {
|
|
861
|
-
var
|
|
888
|
+
var _this3$api$call$dryRu;
|
|
862
889
|
var versionNum;
|
|
863
890
|
return _regenerator().w(function (_context9) {
|
|
864
891
|
while (1) switch (_context9.n) {
|
|
865
892
|
case 0:
|
|
866
893
|
versionNum = Number(version.charAt(1));
|
|
867
|
-
return _context9.a(2, (
|
|
894
|
+
return _context9.a(2, (_this3$api$call$dryRu = _this3.api.call.dryRunApi).dryRunCall.apply(_this3$api$call$dryRu, [basePayload, resolvedTx].concat(_toConsumableArray(includeVersion ? [versionNum] : []))));
|
|
868
895
|
}
|
|
869
896
|
}, _callee9);
|
|
870
897
|
}));
|
|
@@ -1016,7 +1043,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1016
1043
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref8) {
|
|
1017
1044
|
return i.here === null ? 0 : (_ref8 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref8 === void 0 ? void 0 : _ref8.parachain;
|
|
1018
1045
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
1019
|
-
if (!(
|
|
1046
|
+
if (!(hasXcmPaymentApiSupportImpl(chain, this._customCtx) && resultJson.ok.local_xcm && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
|
|
1020
1047
|
_context0.n = 21;
|
|
1021
1048
|
break;
|
|
1022
1049
|
}
|
|
@@ -1192,7 +1219,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1192
1219
|
case 6:
|
|
1193
1220
|
deliveryFeeResJson = (_deliveryFeeRes = deliveryFeeRes) === null || _deliveryFeeRes === void 0 ? void 0 : _deliveryFeeRes.toJSON();
|
|
1194
1221
|
deliveryFeeResolved = deliveryFeeRes && ((_ref9 = (_deliveryFeeResJson$o = (_deliveryFeeResJson$o2 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o2 === void 0 ? void 0 : _deliveryFeeResJson$o2.v4) !== null && _deliveryFeeResJson$o !== void 0 ? _deliveryFeeResJson$o : (_deliveryFeeResJson$o3 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o3 === void 0 ? void 0 : _deliveryFeeResJson$o3.v3) === null || _ref9 === void 0 ? void 0 : _ref9.length) > 0 ? BigInt((_ref0 = (_deliveryFeeResJson$o4 = deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o5 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o5 === void 0 ? void 0 : _deliveryFeeResJson$o5.v4) !== null && _deliveryFeeResJson$o4 !== void 0 ? _deliveryFeeResJson$o4 : deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o6 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o6 === void 0 ? void 0 : _deliveryFeeResJson$o6.v3) === null || _ref0 === void 0 || (_ref0 = _ref0[0]) === null || _ref0 === void 0 || (_ref0 = _ref0.fun) === null || _ref0 === void 0 ? void 0 : _ref0.fungible) : 0n;
|
|
1195
|
-
nativeAsset =
|
|
1222
|
+
nativeAsset = findNativeAssetInfoOrThrowImpl(chain, this._customCtx);
|
|
1196
1223
|
if (!(isAssetXcEqual(asset, nativeAsset) || usedThirdParam)) {
|
|
1197
1224
|
_context10.n = 7;
|
|
1198
1225
|
break;
|
|
@@ -1243,7 +1270,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1243
1270
|
return _context11.a(2, undefined);
|
|
1244
1271
|
case 2:
|
|
1245
1272
|
ahApi = this.clone();
|
|
1246
|
-
assetHubChain = "AssetHub".concat(
|
|
1273
|
+
assetHubChain = "AssetHub".concat(getRelayChainOfImpl(this, chain));
|
|
1247
1274
|
_context11.n = 3;
|
|
1248
1275
|
return ahApi.init(assetHubChain);
|
|
1249
1276
|
case 3:
|
|
@@ -1303,7 +1330,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1303
1330
|
while (1) switch (_context13.n) {
|
|
1304
1331
|
case 0:
|
|
1305
1332
|
originLocation = _ref1.originLocation, xcm = _ref1.xcm, asset = _ref1.asset, chain = _ref1.chain, version = _ref1.version, origin = _ref1.origin;
|
|
1306
|
-
supportsDryRunApi =
|
|
1333
|
+
supportsDryRunApi = hasDryRunSupportImpl(chain, this._customCtx);
|
|
1307
1334
|
if (supportsDryRunApi) {
|
|
1308
1335
|
_context13.n = 1;
|
|
1309
1336
|
break;
|
|
@@ -1339,7 +1366,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1339
1366
|
destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref10) {
|
|
1340
1367
|
return i.Here ? 0 : (_ref10 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref10 === void 0 ? void 0 : _ref10.parachain;
|
|
1341
1368
|
}(Object.values(forwardedXcms[0])[0].interior);
|
|
1342
|
-
if (!(
|
|
1369
|
+
if (!(hasXcmPaymentApiSupportImpl(chain, this._customCtx) && asset)) {
|
|
1343
1370
|
_context13.n = 5;
|
|
1344
1371
|
break;
|
|
1345
1372
|
}
|
|
@@ -1425,6 +1452,39 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1425
1452
|
}
|
|
1426
1453
|
return getBridgeStatus;
|
|
1427
1454
|
}()
|
|
1455
|
+
}, {
|
|
1456
|
+
key: "getConstant",
|
|
1457
|
+
value: function getConstant(pallet, name) {
|
|
1458
|
+
var palletConsts = this.api.consts[lowercaseFirstLetter(pallet)];
|
|
1459
|
+
var value = palletConsts ? palletConsts[lowercaseFirstLetter(name)] : undefined;
|
|
1460
|
+
return Promise.resolve(value !== undefined ? value.toJSON() : undefined);
|
|
1461
|
+
}
|
|
1462
|
+
}, {
|
|
1463
|
+
key: "getSystemProperties",
|
|
1464
|
+
value: function () {
|
|
1465
|
+
var _getSystemProperties = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
1466
|
+
var _props$ss58Format, _props$tokenSymbol, _props$tokenDecimals;
|
|
1467
|
+
var props;
|
|
1468
|
+
return _regenerator().w(function (_context15) {
|
|
1469
|
+
while (1) switch (_context15.n) {
|
|
1470
|
+
case 0:
|
|
1471
|
+
_context15.n = 1;
|
|
1472
|
+
return this.api.rpc.system.properties();
|
|
1473
|
+
case 1:
|
|
1474
|
+
props = _context15.v.toPrimitive();
|
|
1475
|
+
return _context15.a(2, {
|
|
1476
|
+
ss58Format: (_props$ss58Format = props.ss58Format) !== null && _props$ss58Format !== void 0 ? _props$ss58Format : undefined,
|
|
1477
|
+
tokenSymbol: (_props$tokenSymbol = props.tokenSymbol) === null || _props$tokenSymbol === void 0 ? void 0 : _props$tokenSymbol[0],
|
|
1478
|
+
tokenDecimals: (_props$tokenDecimals = props.tokenDecimals) === null || _props$tokenDecimals === void 0 ? void 0 : _props$tokenDecimals[0]
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
}, _callee15, this);
|
|
1482
|
+
}));
|
|
1483
|
+
function getSystemProperties() {
|
|
1484
|
+
return _getSystemProperties.apply(this, arguments);
|
|
1485
|
+
}
|
|
1486
|
+
return getSystemProperties;
|
|
1487
|
+
}()
|
|
1428
1488
|
}, {
|
|
1429
1489
|
key: "disconnect",
|
|
1430
1490
|
value: function disconnect() {
|
|
@@ -1442,7 +1502,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1442
1502
|
if (force) {
|
|
1443
1503
|
void this.api.disconnect();
|
|
1444
1504
|
} else {
|
|
1445
|
-
var key = api === undefined ?
|
|
1505
|
+
var key = api === undefined ? getChainProvidersImpl(this._chain, this._customCtx) : api;
|
|
1446
1506
|
releaseClient(key);
|
|
1447
1507
|
}
|
|
1448
1508
|
}
|
|
@@ -1469,33 +1529,33 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1469
1529
|
}, {
|
|
1470
1530
|
key: "signAndSubmit",
|
|
1471
1531
|
value: function () {
|
|
1472
|
-
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1532
|
+
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(tx, sender) {
|
|
1473
1533
|
var hash, _t8;
|
|
1474
|
-
return _regenerator().w(function (
|
|
1475
|
-
while (1) switch (
|
|
1534
|
+
return _regenerator().w(function (_context16) {
|
|
1535
|
+
while (1) switch (_context16.n) {
|
|
1476
1536
|
case 0:
|
|
1477
1537
|
if (!isSenderSigner(sender)) {
|
|
1478
|
-
|
|
1538
|
+
_context16.n = 2;
|
|
1479
1539
|
break;
|
|
1480
1540
|
}
|
|
1481
|
-
|
|
1541
|
+
_context16.n = 1;
|
|
1482
1542
|
return tx.signAndSend(sender.address, {
|
|
1483
1543
|
signer: sender.signer
|
|
1484
1544
|
});
|
|
1485
1545
|
case 1:
|
|
1486
|
-
_t8 =
|
|
1487
|
-
|
|
1546
|
+
_t8 = _context16.v;
|
|
1547
|
+
_context16.n = 4;
|
|
1488
1548
|
break;
|
|
1489
1549
|
case 2:
|
|
1490
|
-
|
|
1550
|
+
_context16.n = 3;
|
|
1491
1551
|
return tx.signAndSend(createKeyringPair(sender));
|
|
1492
1552
|
case 3:
|
|
1493
|
-
_t8 =
|
|
1553
|
+
_t8 = _context16.v;
|
|
1494
1554
|
case 4:
|
|
1495
1555
|
hash = _t8;
|
|
1496
|
-
return
|
|
1556
|
+
return _context16.a(2, hash.toHex());
|
|
1497
1557
|
}
|
|
1498
|
-
},
|
|
1558
|
+
}, _callee16);
|
|
1499
1559
|
}));
|
|
1500
1560
|
function signAndSubmit(_x28, _x29) {
|
|
1501
1561
|
return _signAndSubmit.apply(this, arguments);
|
|
@@ -1505,27 +1565,27 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1505
1565
|
}, {
|
|
1506
1566
|
key: "signAndSubmitFinalized",
|
|
1507
1567
|
value: function () {
|
|
1508
|
-
var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1509
|
-
var
|
|
1510
|
-
return _regenerator().w(function (
|
|
1511
|
-
while (1) switch (
|
|
1568
|
+
var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(tx, sender) {
|
|
1569
|
+
var _this4 = this;
|
|
1570
|
+
return _regenerator().w(function (_context17) {
|
|
1571
|
+
while (1) switch (_context17.n) {
|
|
1512
1572
|
case 0:
|
|
1513
1573
|
if (!isSenderSigner(sender)) {
|
|
1514
|
-
|
|
1574
|
+
_context17.n = 2;
|
|
1515
1575
|
break;
|
|
1516
1576
|
}
|
|
1517
|
-
|
|
1577
|
+
_context17.n = 1;
|
|
1518
1578
|
return tx.signAsync(sender.address, {
|
|
1519
1579
|
signer: sender.signer
|
|
1520
1580
|
});
|
|
1521
1581
|
case 1:
|
|
1522
|
-
|
|
1582
|
+
_context17.n = 3;
|
|
1523
1583
|
break;
|
|
1524
1584
|
case 2:
|
|
1525
|
-
|
|
1585
|
+
_context17.n = 3;
|
|
1526
1586
|
return tx.signAsync(createKeyringPair(sender));
|
|
1527
1587
|
case 3:
|
|
1528
|
-
return
|
|
1588
|
+
return _context17.a(2, new Promise(function (resolve, reject) {
|
|
1529
1589
|
tx.send(function (_ref14) {
|
|
1530
1590
|
var status = _ref14.status,
|
|
1531
1591
|
dispatchError = _ref14.dispatchError,
|
|
@@ -1533,7 +1593,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1533
1593
|
if (status.isFinalized) {
|
|
1534
1594
|
if (dispatchError !== undefined) {
|
|
1535
1595
|
if (dispatchError.isModule) {
|
|
1536
|
-
var decoded =
|
|
1596
|
+
var decoded = _this4.api.registry.findMetaError(dispatchError.asModule);
|
|
1537
1597
|
var docs = decoded.docs,
|
|
1538
1598
|
name = decoded.name,
|
|
1539
1599
|
section = decoded.section;
|
|
@@ -1550,7 +1610,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1550
1610
|
});
|
|
1551
1611
|
}));
|
|
1552
1612
|
}
|
|
1553
|
-
},
|
|
1613
|
+
}, _callee17);
|
|
1554
1614
|
}));
|
|
1555
1615
|
function signAndSubmitFinalized(_x30, _x31) {
|
|
1556
1616
|
return _signAndSubmitFinalized.apply(this, arguments);
|
|
@@ -2019,11 +2079,11 @@ var EvmBuilder$1 = function EvmBuilder(api, provider) {
|
|
|
2019
2079
|
/**
|
|
2020
2080
|
* Creates a new Builder instance.
|
|
2021
2081
|
*
|
|
2022
|
-
* @param
|
|
2082
|
+
* @param options - Either an existing API instance, a WS URL, or a config object.
|
|
2023
2083
|
* @returns A new Builder instance.
|
|
2024
2084
|
*/
|
|
2025
|
-
var Builder = function Builder(
|
|
2026
|
-
var pjsApi = new PolkadotJsApi(
|
|
2085
|
+
var Builder = function Builder(options) {
|
|
2086
|
+
var pjsApi = new PolkadotJsApi(options);
|
|
2027
2087
|
return Builder$1(pjsApi);
|
|
2028
2088
|
};
|
|
2029
2089
|
/** @deprecated EvmBuilder is deprecated. Please use the Builder class instead. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-pjs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.7.0",
|
|
4
4
|
"description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@snowbridge/api": "^1.
|
|
26
|
-
"@snowbridge/base-types": "^1.
|
|
27
|
-
"@snowbridge/contract-types": "^1.
|
|
28
|
-
"@snowbridge/provider-ethers": "^1.
|
|
29
|
-
"@snowbridge/registry": "^1.
|
|
25
|
+
"@snowbridge/api": "^1.1.6",
|
|
26
|
+
"@snowbridge/base-types": "^1.1.6",
|
|
27
|
+
"@snowbridge/contract-types": "^1.1.6",
|
|
28
|
+
"@snowbridge/provider-ethers": "^1.1.6",
|
|
29
|
+
"@snowbridge/registry": "^1.1.6",
|
|
30
30
|
"ethers": "^6.16.0",
|
|
31
|
-
"viem": "^2.
|
|
32
|
-
"@paraspell/sdk-core": "13.
|
|
31
|
+
"viem": "^2.51.3",
|
|
32
|
+
"@paraspell/sdk-core": "13.7.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@polkadot/api": ">= 16.0 < 17",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"@polkadot/util-crypto": ">= 14"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@babel/plugin-syntax-import-attributes": "^7.
|
|
43
|
-
"@babel/preset-env": "^7.29.
|
|
42
|
+
"@babel/plugin-syntax-import-attributes": "^7.29.7",
|
|
43
|
+
"@babel/preset-env": "^7.29.7",
|
|
44
44
|
"@codecov/rollup-plugin": "^2.0.1",
|
|
45
45
|
"@rollup/plugin-babel": "^7.0.0",
|
|
46
46
|
"@rollup/plugin-json": "^6.1.0",
|
|
47
47
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
48
|
-
"@vitest/coverage-v8": "^4.1.
|
|
49
|
-
"axios": "^1.
|
|
48
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
49
|
+
"axios": "^1.16.1",
|
|
50
50
|
"dotenv": "^17.4.2",
|
|
51
|
-
"rollup": "^4.60.
|
|
51
|
+
"rollup": "^4.60.4",
|
|
52
52
|
"rollup-plugin-dts": "^6.4.1",
|
|
53
53
|
"tslib": "^2.8.1"
|
|
54
54
|
},
|