@paraspell/sdk 3.0.1 → 3.0.3

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
@@ -70,6 +70,8 @@ Builder pattern XCM & HRMP construction
70
70
 
71
71
  ```ts
72
72
  //Transfer tokens from Parachain to Parachain
73
+ //**NOTE** If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add character 'n' the end of currencyID. Eg: .currency(42259045809535163221576417993425387648n) will mean you transfer xcDOT.
74
+
73
75
  Builder(api).from(NODE).to(NODE).currency(CurrencyString||CurrencyID).amount(amount).address(address).build()
74
76
 
75
77
  //Transfer tokens from the Relay chain to Parachain
@@ -89,6 +91,7 @@ Function pattern XCM & HRMP construction
89
91
 
90
92
  ```ts
91
93
  //Transfer tokens from Parachain to Parachain
94
+ //**NOTE** If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add character 'n' the end of currencyID. Eg: currency = 42259045809535163221576417993425387648n will mean you transfer xcDOT.
92
95
  paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: CurrencyString||CurrencyID, amount: any, to: destination address string, destination: destination Parachain ID)
93
96
 
94
97
  //Transfer tokens from Parachain to Relay chain
package/dist/index.cjs CHANGED
@@ -6180,7 +6180,7 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6180
6180
  assetId = asset.assetId;
6181
6181
  return {
6182
6182
  symbol: symbol,
6183
- assetId: assetId ? Number(assetId) : undefined
6183
+ assetId: assetId
6184
6184
  };
6185
6185
  }
6186
6186
  if (relayChainAssetSymbol === symbolOrId) return {
@@ -6192,6 +6192,9 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6192
6192
  // Contains basic call formatting for different XCM Palletss
6193
6193
  var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
6194
6194
  var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
6195
+ if (typeof currencySymbolOrId === 'number' && currencySymbolOrId > Number.MAX_SAFE_INTEGER) {
6196
+ throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
6197
+ }
6195
6198
  var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
6196
6199
  if (destination) {
6197
6200
  var originRelayChainSymbol = getRelayChainSymbol(origin);
@@ -6220,11 +6223,11 @@ function send(api, origin, currencySymbolOrId, amount, to, destination) {
6220
6223
  var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, to) {
6221
6224
  var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6222
6225
  var paraId = getParaId(destination);
6223
- if (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama') {
6224
- // Same for AssetHubPolkadot, AssetHubKusama and Encoiter
6226
+ if (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama' || destination === 'Moonbeam' || destination === 'Moonriver') {
6227
+ // Same for AssetHubPolkadot, AssetHubKusama, Encoiter and Moonbeam
6225
6228
  var _serializedApiCall = {
6226
6229
  module: 'xcmPallet',
6227
- section: 'limitedTeleportAssets',
6230
+ section: destination === 'Moonbeam' || destination === 'Moonriver' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets',
6228
6231
  parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V3, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V3, destination), 0, 'Unlimited']
6229
6232
  };
6230
6233
  if (serializedApiCallEnabled) {
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ declare abstract class ParachainNode {
12
12
  get type(): TRelayChainType;
13
13
  get node(): "AssetHubPolkadot" | "Acala" | "Astar" | "BifrostPolkadot" | "Bitgreen" | "Centrifuge" | "Clover" | "ComposableFinance" | "Darwinia" | "HydraDX" | "Interlay" | "Kylin" | "Litentry" | "Moonbeam" | "Parallel" | "AssetHubKusama" | "Encointer" | "Altair" | "Amplitude" | "Bajun" | "Basilisk" | "BifrostKusama" | "Pioneer" | "Calamari" | "CrustShadow" | "Crab" | "Imbue" | "Integritee" | "InvArchTinker" | "Karura" | "Kintsugi" | "Litmus" | "Mangata" | "Moonriver" | "ParallelHeiko" | "Picasso" | "Quartz" | "Robonomics" | "Shiden" | "Turing" | "Equilibrium" | "Unique" | "Crust" | "Manta" | "Genshiro" | "Nodle" | "OriginTrail" | "Pendulum" | "Polkadex" | "Zeitgeist";
14
14
  get version(): Version;
15
- transfer(api: ApiPromise, currencySymbol: string | undefined, currencyId: number | undefined, amount: any, to: string, destination?: TNode, serializedApiCallEnabled?: boolean): Extrinsic | TSerializedApiCall;
15
+ transfer(api: ApiPromise, currencySymbol: string | undefined, currencyId: string | undefined, amount: any, to: string, destination?: TNode, serializedApiCallEnabled?: boolean): Extrinsic | TSerializedApiCall;
16
16
  }
17
17
 
18
18
  declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Kylin", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Equilibrium", "Unique", "Crust", "Manta", "Genshiro", "Nodle", "OriginTrail", "Pendulum", "Polkadex", "Zeitgeist"];
@@ -56,7 +56,7 @@ type TSerializedApiCall = {
56
56
  type XTokensTransferInput = {
57
57
  api: ApiPromise;
58
58
  currency: string | undefined;
59
- currencyID: number | undefined;
59
+ currencyID: string | undefined;
60
60
  amount: any;
61
61
  addressSelection: any;
62
62
  fees: number;
package/dist/index.mjs CHANGED
@@ -6178,7 +6178,7 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6178
6178
  assetId = asset.assetId;
6179
6179
  return {
6180
6180
  symbol: symbol,
6181
- assetId: assetId ? Number(assetId) : undefined
6181
+ assetId: assetId
6182
6182
  };
6183
6183
  }
6184
6184
  if (relayChainAssetSymbol === symbolOrId) return {
@@ -6190,6 +6190,9 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6190
6190
  // Contains basic call formatting for different XCM Palletss
6191
6191
  var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
6192
6192
  var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
6193
+ if (typeof currencySymbolOrId === 'number' && currencySymbolOrId > Number.MAX_SAFE_INTEGER) {
6194
+ throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
6195
+ }
6193
6196
  var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
6194
6197
  if (destination) {
6195
6198
  var originRelayChainSymbol = getRelayChainSymbol(origin);
@@ -6218,11 +6221,11 @@ function send(api, origin, currencySymbolOrId, amount, to, destination) {
6218
6221
  var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, to) {
6219
6222
  var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6220
6223
  var paraId = getParaId(destination);
6221
- if (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama') {
6222
- // Same for AssetHubPolkadot, AssetHubKusama and Encoiter
6224
+ if (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama' || destination === 'Moonbeam' || destination === 'Moonriver') {
6225
+ // Same for AssetHubPolkadot, AssetHubKusama, Encoiter and Moonbeam
6223
6226
  var _serializedApiCall = {
6224
6227
  module: 'xcmPallet',
6225
- section: 'limitedTeleportAssets',
6228
+ section: destination === 'Moonbeam' || destination === 'Moonriver' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets',
6226
6229
  parameters: [createHeaderPolkadotXCM('RelayToPara', Version.V3, paraId), generateAddressPayload(api, 'RelayToPara', null, to, Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', Version.V3, destination), 0, 'Unlimited']
6227
6230
  };
6228
6231
  if (serializedApiCallEnabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": "@paraspell/sdk",
6
6
  "license": "MIT",