@paraspell/sdk-pjs 12.8.3 → 12.8.4

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 CHANGED
@@ -46,21 +46,17 @@ pnpm | npm install || yarn add @paraspell/sdk-pjs
46
46
 
47
47
  ### Importing package to your project
48
48
 
49
- Builder pattern:
49
+ Named import:
50
50
  ```ts
51
51
  import { Builder } from '@paraspell/sdk-pjs'
52
52
  ```
53
53
 
54
- Other patterns:
54
+ Default import:
55
55
  ```ts
56
56
  // ESM
57
57
  import * as paraspell from '@paraspell/sdk-pjs'
58
58
  ```
59
59
 
60
- Interaction with further asset symbol abstraction:
61
- ```ts
62
- import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk-pjs'; //Only needed when advanced asset symbol selection is used. PJS version.
63
- ```
64
60
 
65
61
  ## Implementation
66
62
 
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { SubmittableExtrinsic, Signer } from '@polkadot/api/types';
7
7
  import * as ethers from 'ethers';
8
8
  import { Signer as Signer$1, AbstractProvider } from 'ethers';
9
9
  import { WalletClient } from 'viem';
10
- import * as _snowbridge_api_dist_toPolkadot_v2 from '@snowbridge/api/dist/toPolkadot_v2';
10
+ import { toPolkadotV2 } from '@snowbridge/api';
11
11
 
12
12
  type TPjsApi = ApiPromise;
13
13
  type TPjsApiOrUrl = TApiOrUrl<TPjsApi>;
@@ -183,7 +183,7 @@ declare class EvmBuilderCore<TApi, TRes, TSigner, T extends Partial<TPjsEvmBuild
183
183
  * @returns A new Builder instance.
184
184
  */
185
185
  declare const Builder: (api?: TBuilderOptions<TPjsApiOrUrl>) => GeneralBuilder$1<_polkadot_api.ApiPromise, Extrinsic, TPjsSigner, object>;
186
- type GeneralBuilder<T extends Partial<TSendBaseOptions<Extrinsic>> = object> = GeneralBuilder$1<TPjsApi, Extrinsic, TPjsSigner, T>;
186
+ type GeneralBuilder<T extends Partial<TSendBaseOptions<TPjsApi, Extrinsic, TPjsSigner>> = object> = GeneralBuilder$1<TPjsApi, Extrinsic, TPjsSigner, T>;
187
187
  declare const EvmBuilder: (provider?: AbstractProvider, api?: TBuilderOptions<TPjsApiOrUrl>) => EvmBuilderCore<unknown, unknown, unknown, {
188
188
  api: _paraspell_sdk_core.IPolkadotApi<_polkadot_api.ApiPromise, Extrinsic, TPjsSigner>;
189
189
  provider: AbstractProvider | undefined;
@@ -199,28 +199,30 @@ declare const depositToken: (signer: Signer$1, amount: bigint, symbol: string) =
199
199
  receipt: ethers.ContractTransactionReceipt | null;
200
200
  }>;
201
201
 
202
- declare const getTokenBalance: (signer: Signer$1, symbol: string) => Promise<bigint>;
203
-
204
202
  /**
205
- * Transfers assets from parachain to another parachain or from/to relay chain.
206
- * @param options - The transfer options.
207
- * @returns An extrinsic to be signed and sent.
203
+ * Transfers an Ethereum asset to a Polkadot account.
204
+ *
205
+ * @param provider - The Ethereum provider instance to interact with the Ethereum network.
206
+ * @param options - The options for the transfer.
207
+ *
208
+ * @returns A Promise that resolves to an object containing the result and the plan of the transfer.
209
+ *
210
+ * @throws Will throw an error if the transfer validation fails or if the transfer cannot be completed.
208
211
  */
209
- declare const send: (options: _paraspell_sdk_core.TSendBaseOptions<Extrinsic> & {
210
- isAmountAll: boolean;
211
- } & {
212
- api?: TPjsApiOrUrl;
213
- }) => Promise<Extrinsic>;
212
+ declare const transferEthToPolkadot$1: <TApi, TRes, TSigner>({ api, provider, signer, address, to, currency }: TPjsEvmBuilderOptions<TApi, TRes, TSigner>) => Promise<{
213
+ response: ethers.TransactionResponse;
214
+ messageReceipt: toPolkadotV2.MessageReceipt;
215
+ }>;
216
+
217
+ declare const getTokenBalance: (signer: Signer$1, symbol: string) => Promise<bigint>;
218
+
214
219
  declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<Extrinsic> & {
215
220
  api?: TPjsApiOrUrl;
216
221
  }) => Promise<_paraspell_sdk_core.TDryRunResult>;
217
222
  declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<Extrinsic> & {
218
223
  api?: TPjsApiOrUrl;
219
224
  }) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
220
- declare const transferEthToPolkadot: (options: Omit<TPjsEvmBuilderOptions<TPjsApi, Extrinsic, TPjsSigner>, "api">) => Promise<{
221
- response: ethers.TransactionResponse;
222
- messageReceipt: _snowbridge_api_dist_toPolkadot_v2.MessageReceipt;
223
- }>;
225
+ declare const transferEthToPolkadot: (options: Omit<TPjsEvmBuilderOptions<TPjsApi, Extrinsic, TPjsSigner>, "api">) => ReturnType<typeof transferEthToPolkadot$1>;
224
226
  declare const getParaEthTransferFees: (api?: TPjsApiOrUrl) => Promise<[bigint, bigint]>;
225
227
  /**
226
228
  * Gets the Ethereum bridge status.
@@ -234,7 +236,6 @@ declare const transfer_dryRunOrigin: typeof dryRunOrigin;
234
236
  declare const transfer_getBridgeStatus: typeof getBridgeStatus;
235
237
  declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
236
238
  declare const transfer_getTokenBalance: typeof getTokenBalance;
237
- declare const transfer_send: typeof send;
238
239
  declare const transfer_transferEthToPolkadot: typeof transferEthToPolkadot;
239
240
  declare namespace transfer {
240
241
  export {
@@ -245,12 +246,11 @@ declare namespace transfer {
245
246
  transfer_getBridgeStatus as getBridgeStatus,
246
247
  transfer_getParaEthTransferFees as getParaEthTransferFees,
247
248
  transfer_getTokenBalance as getTokenBalance,
248
- transfer_send as send,
249
249
  transfer_transferEthToPolkadot as transferEthToPolkadot,
250
250
  };
251
251
  }
252
252
 
253
253
  declare const createChainClient: (chain: TSubstrateChain, builderOptions?: TBuilderOptions<TPjsApiOrUrl>) => Promise<_polkadot_api.ApiPromise>;
254
254
 
255
- export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, getTokenBalance, send, transferEthToPolkadot, transfer as xcmPallet };
255
+ export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, getTokenBalance, transferEthToPolkadot, transfer as xcmPallet };
256
256
  export type { Extrinsic, GeneralBuilder, TPjsApi, TPjsApiOrUrl, TPjsEvmBuilderOptions, TPjsSigner };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getEvmPrivateKeyHex, createClientCache, createClientPoolHelpers, isConfig, getChainProviders, BatchMode, findNativeAssetInfoOrThrow, isSenderSigner, MissingChainApiError, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, computeFeeFromDryRunPjs, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, 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, 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, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
1
+ import { getEvmPrivateKeyHex, createClientCache, createClientPoolHelpers, isConfig, getChainProviders, BatchMode, findNativeAssetInfoOrThrow, isSenderSigner, MissingChainApiError, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, computeFeeFromDryRunPjs, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, addXcmVersionHeader, isAssetXcEqual, RELAY_LOCATION, getRelayChainOf, 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, 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 { isHex, u8aToHex, hexToU8a, stringToU8a } from '@polkadot/util';
@@ -300,6 +300,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
300
300
  this._config = config;
301
301
  }
302
302
  return _createClass(PolkadotJsApi, [{
303
+ key: "getType",
304
+ value: function getType() {
305
+ return 'PJS';
306
+ }
307
+ }, {
303
308
  key: "getConfig",
304
309
  value: function getConfig() {
305
310
  return this._config;
@@ -1853,12 +1858,6 @@ var EvmBuilder = function EvmBuilder(provider, api) {
1853
1858
  return EvmBuilder$1(pjsApi, provider);
1854
1859
  };
1855
1860
 
1856
- /**
1857
- * Transfers assets from parachain to another parachain or from/to relay chain.
1858
- * @param options - The transfer options.
1859
- * @returns An extrinsic to be signed and sent.
1860
- */
1861
- var send = createPolkadotJsApiCall(send$1);
1862
1861
  var dryRun = createPolkadotJsApiCall(dryRun$1);
1863
1862
  var dryRunOrigin = createPolkadotJsApiCall(dryRunOrigin$1);
1864
1863
  var transferEthToPolkadot = function transferEthToPolkadot(options) {
@@ -1912,8 +1911,7 @@ var transfer = /*#__PURE__*/Object.freeze({
1912
1911
  getBridgeStatus: getBridgeStatus,
1913
1912
  getParaEthTransferFees: getParaEthTransferFees,
1914
1913
  getTokenBalance: getTokenBalance,
1915
- send: send,
1916
1914
  transferEthToPolkadot: transferEthToPolkadot
1917
1915
  });
1918
1916
 
1919
- export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, getTokenBalance, send, transferEthToPolkadot, transfer as xcmPallet };
1917
+ export { Builder, EvmBuilder, approveToken, assets, claimAssets, convertSs58, createChainClient, depositToken, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, getTokenBalance, transferEthToPolkadot, transfer as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "12.8.3",
3
+ "version": "12.8.4",
4
4
  "description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "@snowbridge/base-types": "^0.3.2",
28
28
  "@snowbridge/contract-types": "^0.3.2",
29
29
  "@snowbridge/registry": "^0.3.2",
30
- "ethers": "6.16.0",
30
+ "ethers": "6.15.0",
31
31
  "viem": "2.46.3",
32
- "@paraspell/sdk-core": "12.8.3"
32
+ "@paraspell/sdk-core": "12.8.4"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@polkadot/api": ">= 16.0 < 17",