@paraspell/sdk 14.0.0 → 14.1.0-rc.1

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 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, TTransferBaseOptions, TCustomChainInput, TChainAssetsInfo, TGetXcmFeeBaseOptions, TCreateBaseSwapXcmOptions } 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, 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, PolkadotSigner } from 'polkadot-api';
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 = PolkadotSigner;
10
- type TPapiTransaction = Transaction<any, any>;
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$1<PolkadotClient, TPapiTransaction, PolkadotSigner, object, TCustomChainFrom<TOpts>>;
70
- type GeneralBuilder<T extends Partial<TTransferBaseOptions<TPapiApi, TPapiTransaction, TPapiSigner>> = object, TCustomChain extends string = never> = GeneralBuilder$1<PolkadotClient, TPapiTransaction, PolkadotSigner, T, TCustomChain>;
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 { getPolkadotSigner } from 'polkadot-api/signer';
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 getPolkadotSigner(keyPair.publicKey, 'Sr25519', keyPair.sign);
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 getPolkadotSigner(publicAddress, 'Ecdsa', function (input) {
429
+ return getTxCreator(publicAddress, 'Ecdsa', function (input) {
430
430
  return signEcdsa(input, privateKey);
431
431
  });
432
432
  };
@@ -1097,19 +1097,19 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1097
1097
  }, {
1098
1098
  key: "getPaymentInfo",
1099
1099
  value: function () {
1100
- var _getPaymentInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(tx, address) {
1101
- var _yield$tx$getPaymentI, partial_fee, _yield$tx$getPaymentI2, proof_size, ref_time;
1100
+ var _getPaymentInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(tx, address) {
1101
+ var _yield$_getPaymentInf, partial_fee, _yield$_getPaymentInf2, proof_size, ref_time;
1102
1102
  return _regenerator().w(function (_context8) {
1103
1103
  while (1) switch (_context8.n) {
1104
1104
  case 0:
1105
1105
  _context8.n = 1;
1106
- return tx.getPaymentInfo(address);
1106
+ return getPaymentInfo(tx, address);
1107
1107
  case 1:
1108
- _yield$tx$getPaymentI = _context8.v;
1109
- partial_fee = _yield$tx$getPaymentI.partial_fee;
1110
- _yield$tx$getPaymentI2 = _yield$tx$getPaymentI.weight;
1111
- proof_size = _yield$tx$getPaymentI2.proof_size;
1112
- ref_time = _yield$tx$getPaymentI2.ref_time;
1108
+ _yield$_getPaymentInf = _context8.v;
1109
+ partial_fee = _yield$_getPaymentInf.partial_fee;
1110
+ _yield$_getPaymentInf2 = _yield$_getPaymentInf.weight;
1111
+ proof_size = _yield$_getPaymentInf2.proof_size;
1112
+ ref_time = _yield$_getPaymentInf2.ref_time;
1113
1113
  return _context8.a(2, {
1114
1114
  partialFee: partial_fee,
1115
1115
  weight: {
@@ -1120,10 +1120,10 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1120
1120
  }
1121
1121
  }, _callee8);
1122
1122
  }));
1123
- function getPaymentInfo(_x9, _x0) {
1124
- return _getPaymentInfo.apply(this, arguments);
1123
+ function getPaymentInfo$1(_x9, _x0) {
1124
+ return _getPaymentInfo2.apply(this, arguments);
1125
1125
  }
1126
- return getPaymentInfo;
1126
+ return getPaymentInfo$1;
1127
1127
  }()
1128
1128
  }, {
1129
1129
  key: "getEvmStorage",
@@ -1909,16 +1909,16 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1909
1909
  key: "signAndSubmit",
1910
1910
  value: function () {
1911
1911
  var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(tx, sender) {
1912
- var signer, _yield$tx$signAndSubm, txHash;
1912
+ var signer, _yield$tx$createAndSu, txHash;
1913
1913
  return _regenerator().w(function (_context20) {
1914
1914
  while (1) switch (_context20.n) {
1915
1915
  case 0:
1916
1916
  signer = isSenderSigner(sender) ? sender : createDevSigner(sender);
1917
1917
  _context20.n = 1;
1918
- return tx.signAndSubmit(signer);
1918
+ return tx.createAndSubmit(signer);
1919
1919
  case 1:
1920
- _yield$tx$signAndSubm = _context20.v;
1921
- txHash = _yield$tx$signAndSubm.txHash;
1920
+ _yield$tx$createAndSu = _context20.v;
1921
+ txHash = _yield$tx$createAndSu.txHash;
1922
1922
  return _context20.a(2, txHash);
1923
1923
  }
1924
1924
  }, _callee20);
@@ -1938,9 +1938,9 @@ var PapiApi = /*#__PURE__*/function (_PolkadotApi) {
1938
1938
  case 0:
1939
1939
  signer = isSenderSigner(sender) ? sender : createDevSigner(sender);
1940
1940
  return _context21.a(2, new Promise(function (resolve, reject) {
1941
- tx.signSubmitAndWatch(signer).subscribe({
1941
+ tx.createSubmitAndWatch(signer).subscribe({
1942
1942
  next: function next(event) {
1943
- if (event.type === 'finalized' || event.type === 'txBestBlocksState' && event.found) {
1943
+ if (event.type === 'finalized' || event.type === 'inBestBlock') {
1944
1944
  if (!event.ok) {
1945
1945
  reject(new SubmitTransactionError(JSON.stringify(event.dispatchError.value)));
1946
1946
  } else {
@@ -2003,6 +2003,9 @@ var findFailingEvent = function findFailingEvent(result) {
2003
2003
  return event.type === 'Utility' && event.value.type === 'DispatchedAs' && event.value.value.result.success === false;
2004
2004
  });
2005
2005
  };
2006
+ var getPaymentInfo = function getPaymentInfo(tx, address) {
2007
+ return tx.getPaymentInfo(getFakeTxCreator(address));
2008
+ };
2006
2009
 
2007
2010
  /**
2008
2011
  * Retrieves the asset balance for a given account on a specified chain.
@@ -2158,4 +2161,4 @@ var transfer = /*#__PURE__*/Object.freeze({
2158
2161
  handleSwapExecuteTransfer: handleSwapExecuteTransfer
2159
2162
  });
2160
2163
 
2161
- export { Builder, assets, checkAndConvertToNumberOrBigInt, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getOriginXcmFee, getParaEthTransferFees, getXcmFee, handleSwapExecuteTransfer, hydrateCustomChain, _transform as transform, transfer as xcmPallet };
2164
+ 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.0.0",
3
+ "version": "14.1.0-rc.1",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,15 +23,16 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@noble/hashes": "^2.2.0",
26
- "@polkadot-api/substrate-bindings": "^0.20.3",
26
+ "@polkadot-api/signers-common": "0.3.0-rc.3",
27
+ "@polkadot-api/substrate-bindings": "0.21.0-rc.1",
27
28
  "@polkadot-labs/hdkd": "^0.0.28",
28
29
  "@polkadot-labs/hdkd-helpers": "^0.0.30",
29
30
  "viem": "^2.53.1",
30
- "@paraspell/sdk-core": "14.0.0"
31
+ "@paraspell/sdk-core": "14.1.0-rc.1"
31
32
  },
32
33
  "peerDependencies": {
33
- "polkadot-api": ">= 2 < 3",
34
- "@paraspell/descriptors": "14.0.0"
34
+ "polkadot-api": "3.0.0-rc.5",
35
+ "@paraspell/descriptors": "14.1.0-rc.1"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@acala-network/chopsticks": "^1.5.0",
@@ -47,7 +48,8 @@
47
48
  "@vitest/coverage-v8": "^4.1.9",
48
49
  "dotenv": "^17.4.2",
49
50
  "rollup": "^4.62.2",
50
- "rollup-plugin-dts": "^6.4.1"
51
+ "rollup-plugin-dts": "^6.4.1",
52
+ "polkadot-api": "3.0.0-rc.5"
51
53
  },
52
54
  "scripts": {
53
55
  "compile": "tsc --noEmit",