@paraspell/sdk 14.2.1 → 14.3.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/dist/index.d.ts +21 -11
- package/dist/index.mjs +25 -37
- package/package.json +18 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import { TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, findAssetInfo, getAllAssetsSymbols, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, isChainEvm, TSubstrateChain, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TCustomChainFrom,
|
|
2
|
+
import { TSwapEvent as TSwapEvent$1, Foreign, ForeignAbstract, Native, findAssetInfo, getAllAssetsSymbols, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, isChainEvm, TSubstrateChain, TBuilderOptions, TApiOrUrl, TTransferBaseOptions, GeneralBuilder as GeneralBuilder$1, TCustomChainFrom, TCustomChainInput, TChainAssetsInfo, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
|
+
import { CommonSignerTxCreator } from '@polkadot-api/signers-common';
|
|
4
5
|
import * as polkadot_api from 'polkadot-api';
|
|
5
|
-
import { PolkadotClient, Transaction
|
|
6
|
+
import { PolkadotClient, Transaction } from 'polkadot-api';
|
|
6
7
|
import * as _paraspell_descriptors from '@paraspell/descriptors';
|
|
7
8
|
|
|
8
9
|
type TPapiApi = PolkadotClient;
|
|
9
|
-
type TPapiSigner =
|
|
10
|
-
type TPapiTransaction = Transaction
|
|
10
|
+
type TPapiSigner = CommonSignerTxCreator;
|
|
11
|
+
type TPapiTransaction = Transaction;
|
|
11
12
|
type TSwapEvent = TSwapEvent$1<TPapiApi, TPapiTransaction>;
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -66,8 +67,8 @@ declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
|
|
|
66
67
|
* @param options - Either an existing API instance, a WS URL, or a config object.
|
|
67
68
|
* @returns A new Builder instance.
|
|
68
69
|
*/
|
|
69
|
-
declare const Builder: <const TOpts extends TBuilderOptions<TApiOrUrl<TPapiApi>>>(options?: TOpts) => GeneralBuilder
|
|
70
|
-
type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object, TCustomChain extends string = never> = GeneralBuilder$1<PolkadotClient, TPapiTransaction,
|
|
70
|
+
declare const Builder: <const TOpts extends TBuilderOptions<TApiOrUrl<TPapiApi>>>(options?: TOpts) => GeneralBuilder<object, TCustomChainFrom<TOpts>>;
|
|
71
|
+
type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object, TCustomChain extends string = never> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, CommonSignerTxCreator, T, TCustomChain>;
|
|
71
72
|
|
|
72
73
|
declare const hydrateCustomChain: <TCustomChain extends string>(name: TCustomChain, input: TCustomChainInput) => Promise<TChainAssetsInfo>;
|
|
73
74
|
|
|
@@ -86,10 +87,7 @@ declare const getOriginXcmFee: (options: _paraspell_sdk_core.TGetOriginXcmFeeBas
|
|
|
86
87
|
api?: TApiOrUrl<TPapiApi>;
|
|
87
88
|
}) => Promise<_paraspell_sdk_core.TXcmFeeDetailWithForwardedXcm<boolean>>;
|
|
88
89
|
declare const getXcmFee: <TDisableFallback extends boolean>(options: TGetXcmFeeBaseOptions<TPapiTransaction, TDisableFallback>, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<_paraspell_sdk_core.TGetXcmFeeResult<TDisableFallback, never>>;
|
|
89
|
-
declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<polkadot_api.Transaction<
|
|
90
|
-
parents: number;
|
|
91
|
-
interior: _paraspell_descriptors.XcmV5Junctions;
|
|
92
|
-
} | undefined, Partial<_paraspell_descriptors.AhpExtensions>>>;
|
|
90
|
+
declare const handleSwapExecuteTransfer: (options: TCreateBaseSwapXcmOptions, builderOptions?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<polkadot_api.Transaction<_paraspell_descriptors.Ahp>>;
|
|
93
91
|
|
|
94
92
|
declare const transfer_dryRun: typeof dryRun;
|
|
95
93
|
declare const transfer_dryRunOrigin: typeof dryRunOrigin;
|
|
@@ -111,9 +109,21 @@ declare namespace transfer {
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
declare const createChainClient: (chain: TSubstrateChain, api?: TBuilderOptions<TApiOrUrl<TPapiApi>>) => Promise<polkadot_api.PolkadotClient>;
|
|
112
|
+
declare const getPaymentInfo: (tx: TPapiTransaction, address: string) => Promise<{
|
|
113
|
+
weight: {
|
|
114
|
+
ref_time: bigint;
|
|
115
|
+
proof_size: bigint;
|
|
116
|
+
};
|
|
117
|
+
class: polkadot_api.Enum<{
|
|
118
|
+
Normal: undefined;
|
|
119
|
+
Operational: undefined;
|
|
120
|
+
Mandatory: undefined;
|
|
121
|
+
}>;
|
|
122
|
+
partial_fee: bigint;
|
|
123
|
+
}>;
|
|
114
124
|
|
|
115
125
|
declare const checkAndConvertToNumberOrBigInt: (input: string) => number | bigint;
|
|
116
126
|
declare const transform: (obj: any) => any;
|
|
117
127
|
|
|
118
|
-
export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, transform, transfer as xcmPallet };
|
|
128
|
+
export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getPaymentInfo, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, transform, transfer as xcmPallet };
|
|
119
129
|
export type { GeneralBuilder, TPapiApi, TPapiSigner, TPapiTransaction, TSwapEvent };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
|
|
|
6
6
|
import { sr25519CreateDerive } from '@polkadot-labs/hdkd';
|
|
7
7
|
import { entropyToMiniSecret, mnemonicToEntropy, DEV_PHRASE } from '@polkadot-labs/hdkd-helpers';
|
|
8
8
|
import { AccountId, Binary, getSs58AddressInfo } from 'polkadot-api';
|
|
9
|
-
import {
|
|
9
|
+
import { getTxCreator, getFakeTxCreator } from 'polkadot-api/tx-creator';
|
|
10
10
|
import { blake2b } from '@noble/hashes/blake2.js';
|
|
11
11
|
import { hydration } from '@paraspell/descriptors';
|
|
12
12
|
import { unifyMetadata, decAnyMetadata } from '@polkadot-api/substrate-bindings';
|
|
@@ -419,14 +419,14 @@ var createSr25519Keypair = function createSr25519Keypair(path) {
|
|
|
419
419
|
};
|
|
420
420
|
var createSr25519Signer = function createSr25519Signer(path) {
|
|
421
421
|
var keyPair = createSr25519Keypair(path);
|
|
422
|
-
return
|
|
422
|
+
return getTxCreator(keyPair.publicKey, 'Sr25519', keyPair.sign);
|
|
423
423
|
};
|
|
424
424
|
var resolveEcdsaAddress = function resolveEcdsaAddress(privateKey) {
|
|
425
425
|
return keccak_256(secp256k1.getPublicKey(privateKey, false).slice(1)).slice(-20);
|
|
426
426
|
};
|
|
427
427
|
var createEcdsaSigner = function createEcdsaSigner(privateKey) {
|
|
428
428
|
var publicAddress = resolveEcdsaAddress(privateKey);
|
|
429
|
-
return
|
|
429
|
+
return getTxCreator(publicAddress, 'Ecdsa', function (input) {
|
|
430
430
|
return signEcdsa(input, privateKey);
|
|
431
431
|
});
|
|
432
432
|
};
|
|
@@ -523,9 +523,7 @@ var _transform = function transform(obj) {
|
|
|
523
523
|
return {
|
|
524
524
|
type: key,
|
|
525
525
|
value: {
|
|
526
|
-
network:
|
|
527
|
-
type: 'Any'
|
|
528
|
-
} : undefined,
|
|
526
|
+
network: undefined,
|
|
529
527
|
id: value.id
|
|
530
528
|
}
|
|
531
529
|
};
|
|
@@ -572,9 +570,7 @@ var _transform = function transform(obj) {
|
|
|
572
570
|
return {
|
|
573
571
|
type: key,
|
|
574
572
|
value: {
|
|
575
|
-
network:
|
|
576
|
-
type: 'Any'
|
|
577
|
-
} : undefined,
|
|
573
|
+
network: undefined,
|
|
578
574
|
key: value.key
|
|
579
575
|
}
|
|
580
576
|
};
|
|
@@ -807,12 +803,6 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
807
803
|
var _this$_hydrationApi;
|
|
808
804
|
return (_this$_hydrationApi = this._hydrationApi) !== null && _this$_hydrationApi !== void 0 ? _this$_hydrationApi : this._hydrationApi = this.api.getTypedApi(hydration);
|
|
809
805
|
}
|
|
810
|
-
}, {
|
|
811
|
-
key: "moonbeamApi",
|
|
812
|
-
get: function get() {
|
|
813
|
-
var _this$_moonbeamApi;
|
|
814
|
-
return (_this$_moonbeamApi = this._moonbeamApi) !== null && _this$_moonbeamApi !== void 0 ? _this$_moonbeamApi : this._moonbeamApi = this.api.getUnsafeApi();
|
|
815
|
-
}
|
|
816
806
|
}, {
|
|
817
807
|
key: "accountToHex",
|
|
818
808
|
value: function accountToHex(address) {
|
|
@@ -1097,19 +1087,19 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1097
1087
|
}, {
|
|
1098
1088
|
key: "getPaymentInfo",
|
|
1099
1089
|
value: function () {
|
|
1100
|
-
var
|
|
1101
|
-
var _yield$
|
|
1090
|
+
var _getPaymentInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(tx, address) {
|
|
1091
|
+
var _yield$_getPaymentInf, partial_fee, _yield$_getPaymentInf2, proof_size, ref_time;
|
|
1102
1092
|
return _regenerator().w(function (_context8) {
|
|
1103
1093
|
while (1) switch (_context8.n) {
|
|
1104
1094
|
case 0:
|
|
1105
1095
|
_context8.n = 1;
|
|
1106
|
-
return
|
|
1096
|
+
return getPaymentInfo(tx, address);
|
|
1107
1097
|
case 1:
|
|
1108
|
-
_yield$
|
|
1109
|
-
partial_fee = _yield$
|
|
1110
|
-
_yield$
|
|
1111
|
-
proof_size = _yield$
|
|
1112
|
-
ref_time = _yield$
|
|
1098
|
+
_yield$_getPaymentInf = _context8.v;
|
|
1099
|
+
partial_fee = _yield$_getPaymentInf.partial_fee;
|
|
1100
|
+
_yield$_getPaymentInf2 = _yield$_getPaymentInf.weight;
|
|
1101
|
+
proof_size = _yield$_getPaymentInf2.proof_size;
|
|
1102
|
+
ref_time = _yield$_getPaymentInf2.ref_time;
|
|
1113
1103
|
return _context8.a(2, {
|
|
1114
1104
|
partialFee: partial_fee,
|
|
1115
1105
|
weight: {
|
|
@@ -1120,16 +1110,11 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1120
1110
|
}
|
|
1121
1111
|
}, _callee8);
|
|
1122
1112
|
}));
|
|
1123
|
-
function getPaymentInfo(_x9, _x0) {
|
|
1124
|
-
return
|
|
1113
|
+
function getPaymentInfo$1(_x9, _x0) {
|
|
1114
|
+
return _getPaymentInfo2.apply(this, arguments);
|
|
1125
1115
|
}
|
|
1126
|
-
return getPaymentInfo;
|
|
1116
|
+
return getPaymentInfo$1;
|
|
1127
1117
|
}()
|
|
1128
|
-
}, {
|
|
1129
|
-
key: "getEvmStorage",
|
|
1130
|
-
value: function getEvmStorage(contract, slot) {
|
|
1131
|
-
return this.moonbeamApi.query.EVM.AccountStorages.getKey(contract, slot);
|
|
1132
|
-
}
|
|
1133
1118
|
}, {
|
|
1134
1119
|
key: "getFromRpc",
|
|
1135
1120
|
value: function () {
|
|
@@ -1910,16 +1895,16 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1910
1895
|
key: "signAndSubmit",
|
|
1911
1896
|
value: function () {
|
|
1912
1897
|
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(tx, sender) {
|
|
1913
|
-
var signer, _yield$tx$
|
|
1898
|
+
var signer, _yield$tx$createAndSu, txHash;
|
|
1914
1899
|
return _regenerator().w(function (_context20) {
|
|
1915
1900
|
while (1) switch (_context20.n) {
|
|
1916
1901
|
case 0:
|
|
1917
1902
|
signer = isSenderSigner(sender) ? sender : createDevSigner(sender);
|
|
1918
1903
|
_context20.n = 1;
|
|
1919
|
-
return tx.
|
|
1904
|
+
return tx.createAndSubmit(signer);
|
|
1920
1905
|
case 1:
|
|
1921
|
-
_yield$tx$
|
|
1922
|
-
txHash = _yield$tx$
|
|
1906
|
+
_yield$tx$createAndSu = _context20.v;
|
|
1907
|
+
txHash = _yield$tx$createAndSu.txHash;
|
|
1923
1908
|
return _context20.a(2, txHash);
|
|
1924
1909
|
}
|
|
1925
1910
|
}, _callee20);
|
|
@@ -1940,7 +1925,7 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
|
|
|
1940
1925
|
signer = isSenderSigner(sender) ? sender : createDevSigner(sender);
|
|
1941
1926
|
_context21.p = 1;
|
|
1942
1927
|
_context21.n = 2;
|
|
1943
|
-
return tx.
|
|
1928
|
+
return tx.createAndSubmit(signer);
|
|
1944
1929
|
case 2:
|
|
1945
1930
|
result = _context21.v;
|
|
1946
1931
|
if (result.ok) {
|
|
@@ -2006,6 +1991,9 @@ var findFailingEvent = function findFailingEvent(result) {
|
|
|
2006
1991
|
return event.type === 'Utility' && event.value.type === 'DispatchedAs' && event.value.value.result.success === false;
|
|
2007
1992
|
});
|
|
2008
1993
|
};
|
|
1994
|
+
var getPaymentInfo = function getPaymentInfo(tx, address) {
|
|
1995
|
+
return tx.getPaymentInfo(getFakeTxCreator(address));
|
|
1996
|
+
};
|
|
2009
1997
|
|
|
2010
1998
|
/**
|
|
2011
1999
|
* Retrieves the asset balance for a given account on a specified chain.
|
|
@@ -2161,4 +2149,4 @@ var transfer = /*#__PURE__*/Object.freeze({
|
|
|
2161
2149
|
handleSwapExecuteTransfer: handleSwapExecuteTransfer
|
|
2162
2150
|
});
|
|
2163
2151
|
|
|
2164
|
-
export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, _transform as transform, transfer as xcmPallet };
|
|
2152
|
+
export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getPaymentInfo, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, _transform as transform, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,33 +22,34 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@noble/hashes": "^2.
|
|
26
|
-
"@
|
|
27
|
-
"@polkadot-
|
|
28
|
-
"@polkadot-
|
|
29
|
-
"
|
|
30
|
-
"@
|
|
25
|
+
"@noble/hashes": "^2.3.0",
|
|
26
|
+
"@paraspell/sdk-core": "14.3.0",
|
|
27
|
+
"@polkadot-api/signers-common": "^0.3.0",
|
|
28
|
+
"@polkadot-api/substrate-bindings": "^0.21.0",
|
|
29
|
+
"@polkadot-labs/hdkd": "^0.0.31",
|
|
30
|
+
"@polkadot-labs/hdkd-helpers": "^0.0.33",
|
|
31
|
+
"viem": "^2.55.19"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
34
|
+
"@paraspell/descriptors": "14.3.0",
|
|
35
|
+
"polkadot-api": ">= 3 < 4"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"@acala-network/chopsticks": "^1.5.
|
|
38
|
+
"@acala-network/chopsticks": "^1.5.1",
|
|
38
39
|
"@babel/plugin-syntax-import-attributes": "^7.29.7",
|
|
39
40
|
"@babel/preset-env": "^7.29.7",
|
|
40
41
|
"@codecov/rollup-plugin": "^2.0.1",
|
|
41
|
-
"@noble/curves": "^2.
|
|
42
|
+
"@noble/curves": "^2.3.0",
|
|
42
43
|
"@rollup/plugin-babel": "^7.1.0",
|
|
43
44
|
"@rollup/plugin-json": "^6.1.0",
|
|
44
45
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
45
|
-
"@scure/bip32": "^2.
|
|
46
|
-
"@scure/bip39": "^2.
|
|
47
|
-
"@vitest/coverage-v8": "^4.1.
|
|
46
|
+
"@scure/bip32": "^2.3.0",
|
|
47
|
+
"@scure/bip39": "^2.3.0",
|
|
48
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
48
49
|
"dotenv": "^17.4.2",
|
|
49
|
-
"polkadot-api": "^
|
|
50
|
-
"rollup": "^4.62.
|
|
51
|
-
"rollup-plugin-dts": "^6.
|
|
50
|
+
"polkadot-api": "^3.0.0",
|
|
51
|
+
"rollup": "^4.62.5",
|
|
52
|
+
"rollup-plugin-dts": "^6.5.1"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"compile": "tsc --noEmit",
|