@paraspell/sdk-pjs 12.3.0 → 12.5.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.
Files changed (4) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +21 -90
  3. package/dist/index.mjs +104 -146
  4. package/package.json +7 -5
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ParaSpell
3
+ Copyright (c) 2026 ParaSpell
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
  <h1 align="center">@paraspell/sdk-pjs</h1>
5
- <h4 align="center"> SDK for handling XCM asset transfers across Polkadot and Kusama ecosystems. </h4>
5
+ <h4 align="center"> SDK for handling XCM asset transfers across Polkadot, Kusama, Paseo and Westend ecosystems. </h4>
6
6
  <p align="center">
7
7
  <a href="https://npmjs.com/package/@paraspell/sdk-pjs">
8
8
  <img alt="version" src="https://img.shields.io/npm/v/@paraspell/sdk-pjs?style=flat-square" />
@@ -64,25 +64,21 @@ import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk-pjs'; //Only ne
64
64
 
65
65
  ## Implementation
66
66
 
67
- ```
68
- NOTES:
69
- - Local transfers are now available for every currency and every chain. To try them, simply use the same origin and destination parameters.
70
- - Transfer info queries are now all in the Builder pattern and don't require any imports other than the builder.
71
- - You can now query Ethereum asset balances on Ethereum via balance query
72
- - The Builder() now accepts an optional configuration object (To enhance localhost experience and testing). This object can contain apiOverrides and a development flag. More information in the "Localhost test setup" section.
73
- - V10 > V11 Migration guide https://paraspell.github.io/docs/migration/v10-to-v11.html
74
- - Brand new asset decimal abstraction introduced. It can be turned on in Builder config. Will be turned on by default in next major release.
75
- ```
67
+ > [!NOTE]
68
+ > - Local transfers are now available for every currency and every chain. To try them, simply use the same origin and destination parameters.
69
+ > - Transfer info queries are now all in the Builder pattern and don't require any imports other than the builder.
70
+ > - You can now query Ethereum asset balances on Ethereum via balance query
71
+ > - The Builder() now accepts an optional configuration object (To enhance localhost experience and testing). This object can contain apiOverrides and a development flag. More information in the "Localhost test setup" section.
72
+ > - Brand new asset decimal abstraction introduced. It can be turned on in Builder config. Will be turned on by default in next major release.
73
+ >
74
+ > **Latest news:**
75
+ > - V11 > V12 Migration guide https://paraspell.github.io/docs/migration/v11-to-v12.html
76
76
 
77
- ```
78
- Latest news:
79
- - V11 > V12 Migration guide https://paraspell.github.io/docs/migration/v11-to-v12.html
80
- ```
81
77
 
82
78
  ### Sending XCM
83
79
  For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
84
80
 
85
- #### Transfer assets from Parachain to Parachain
81
+ #### Transfer assets from Substrate to Substrate
86
82
 
87
83
  ```ts
88
84
  const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
@@ -104,75 +100,7 @@ await builder.disconnect()
104
100
  /*
105
101
  EXAMPLE:
106
102
  const builder = Builder()
107
- .from('Acala')
108
- .to('Astar')
109
- .currency({
110
- symbol: 'ACA',
111
- amount: '1000000000'
112
- })
113
- .address(address)
114
-
115
- const tx = await builder.build()
116
-
117
- //Disconnect API after TX
118
- await builder.disconnect()
119
- */
120
- ```
121
-
122
- #### Transfer assets from the Relay chain to the Parachain
123
-
124
- ```ts
125
- const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
126
- .from(TRelaychain) // Kusama | Polkadot | Westend | Paseo
127
- .to(TChain/*,customParaId - optional*/ | Location object)
128
- .currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
129
- .address(address | Location object)
130
- /*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
131
- .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some chain but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
132
-
133
- const tx = await builder.build()
134
-
135
- //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
136
- await builder.disconnect()
137
-
138
- /*
139
- EXAMPLE:
140
- const builder = await Builder()
141
- .from('Polkadot')
142
- .to('Astar')
143
- .currency({
144
- symbol: 'DOT',
145
- amount: '1000000000'
146
- })
147
- .address(address)
148
-
149
- const tx = await builder.build()
150
-
151
- //Disconnect API after TX
152
- await builder.disconnect()
153
- */
154
- ```
155
-
156
- #### Transfer assets from Parachain to Relay chain
157
-
158
- ```ts
159
- const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
160
- .from(TSubstrateChain)
161
- .to(TRelaychain) // Kusama | Polkadot | Westend | Paseo
162
- .currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
163
- .address(address | Location object)
164
- /*.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
165
- .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some chain but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
166
-
167
- const tx = await builder.build()
168
-
169
- //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
170
- await builder.disconnect()
171
-
172
- /*
173
- EXAMPLE:
174
- const builder = await Builder()
175
- .from('Astar')
103
+ .from('AssetHubPolkadot')
176
104
  .to('Polkadot')
177
105
  .currency({
178
106
  symbol: 'DOT',
@@ -533,7 +461,8 @@ console.log(SUPPORTED_PALLETS)
533
461
 
534
462
  - Run all core tests and checks using `pnpm runAll`
535
463
 
536
- XCM SDK can be tested in [Playground](https://playground.paraspell.xyz/xcm-sdk/xcm-transfer).
464
+ > [!NOTE]
465
+ > XCM SDK can be tested in [Playground](https://playground.paraspell.xyz/xcm-sdk/xcm-transfer).
537
466
 
538
467
  ## Contribute to XCM Tools and earn rewards 💰
539
468
 
@@ -553,8 +482,10 @@ Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/p
553
482
 
554
483
  ## Supported by
555
484
 
556
- <div>
557
- <div align="center" style="margin-top: 20px;">
558
- <img width="750" alt="version" src="https://github.com/user-attachments/assets/29e4b099-d90c-46d6-a3ce-94edfbda003c" />
559
- </div>
560
- </div>
485
+ <p align="center">
486
+ <picture>
487
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_transparent.png">
488
+ <source media="(prefers-color-scheme: light)" srcset="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_w3f_standard.png">
489
+ <img width="750" alt="Shows a black logo in light color mode and a white one in dark color mode." src="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_w3f_standard.png">
490
+ </picture>
491
+ </p>
package/dist/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
- import { getEvmPrivateKeyHex, createClientCache, createClientPoolHelpers, isConfig, getChainProviders, BatchMode, findNativeAssetInfoOrThrow, MissingChainApiError, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, computeFeeFromDryRunPjs, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, addXcmVersionHeader, Version, 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, getParaId, ETH_MAINNET_CHAIN_ID, RoutingResolutionError, abstractDecimals, assertHasId, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$1, Builder as Builder$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, 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, MissingChainApiError, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, computeFeeFromDryRunPjs, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, addXcmVersionHeader, Version, 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, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, getBridgeStatus as getBridgeStatus$1, send as send$1, 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';
5
5
  import { decodeAddress, blake2AsHex, validateAddress } from '@polkadot/util-crypto';
6
- import { environment, Context, toPolkadotV2, assetsV2 } from '@snowbridge/api';
7
6
  import { WETH9__factory } from '@snowbridge/contract-types';
7
+ import { environmentFor, assetRegistryFor } from '@snowbridge/registry';
8
+ import { Context, toPolkadotV2 } from '@snowbridge/api';
8
9
 
9
10
  var createKeyringPair = function createKeyringPair(path) {
10
11
  var evmPrivateKey = getEvmPrivateKeyHex(path);
@@ -1409,28 +1410,23 @@ var convertSs58 = function convertSs58(address, chain) {
1409
1410
 
1410
1411
  var approveToken = /*#__PURE__*/function () {
1411
1412
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signer, amount, symbol) {
1412
- var env, contract, weth9, result, receipt;
1413
+ var _environmentFor, gatewayContract, asset, weth9, result, receipt;
1413
1414
  return _regenerator().w(function (_context) {
1414
1415
  while (1) switch (_context.n) {
1415
1416
  case 0:
1416
- env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
1417
- contract = env.locations[0].erc20tokensReceivable.find(function (t) {
1418
- return t.id === symbol;
1419
- });
1420
- if (contract) {
1421
- _context.n = 1;
1422
- break;
1423
- }
1424
- throw new UnsupportedOperationError("Token ".concat(symbol, " not supported"));
1417
+ _environmentFor = environmentFor('polkadot_mainnet'), gatewayContract = _environmentFor.gatewayContract;
1418
+ asset = findAssetInfoOrThrow('Ethereum', {
1419
+ symbol: symbol
1420
+ }, null);
1421
+ assertHasId(asset);
1422
+ weth9 = WETH9__factory.connect(asset.assetId, signer);
1423
+ _context.n = 1;
1424
+ return weth9.approve(gatewayContract, amount);
1425
1425
  case 1:
1426
- weth9 = WETH9__factory.connect(contract.address, signer);
1427
- _context.n = 2;
1428
- return weth9.approve(env.config.GATEWAY_CONTRACT, amount);
1429
- case 2:
1430
1426
  result = _context.v;
1431
- _context.n = 3;
1427
+ _context.n = 2;
1432
1428
  return result.wait();
1433
- case 3:
1429
+ case 2:
1434
1430
  receipt = _context.v;
1435
1431
  return _context.a(2, {
1436
1432
  result: result,
@@ -1446,30 +1442,24 @@ var approveToken = /*#__PURE__*/function () {
1446
1442
 
1447
1443
  var depositToken = /*#__PURE__*/function () {
1448
1444
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signer, amount, symbol) {
1449
- var env, contract, weth9, result, receipt;
1445
+ var asset, weth9, result, receipt;
1450
1446
  return _regenerator().w(function (_context) {
1451
1447
  while (1) switch (_context.n) {
1452
1448
  case 0:
1453
- env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
1454
- contract = env.locations[0].erc20tokensReceivable.find(function (t) {
1455
- return t.id === symbol;
1456
- });
1457
- if (contract) {
1458
- _context.n = 1;
1459
- break;
1460
- }
1461
- throw new UnsupportedOperationError("Token ".concat(symbol, " not supported"));
1462
- case 1:
1463
- weth9 = WETH9__factory.connect(contract.address, signer);
1464
- _context.n = 2;
1449
+ asset = findAssetInfoOrThrow('Ethereum', {
1450
+ symbol: symbol
1451
+ }, null);
1452
+ assertHasId(asset);
1453
+ weth9 = WETH9__factory.connect(asset.assetId, signer);
1454
+ _context.n = 1;
1465
1455
  return weth9.deposit({
1466
1456
  value: amount
1467
1457
  });
1468
- case 2:
1458
+ case 1:
1469
1459
  result = _context.v;
1470
- _context.n = 3;
1460
+ _context.n = 2;
1471
1461
  return result.wait();
1472
- case 3:
1462
+ case 2:
1473
1463
  receipt = _context.v;
1474
1464
  return _context.a(2, {
1475
1465
  result: result,
@@ -1484,26 +1474,25 @@ var depositToken = /*#__PURE__*/function () {
1484
1474
  }();
1485
1475
 
1486
1476
  var createContext = function createContext(executionUrl, env) {
1487
- var config = env.config;
1488
- return new Context({
1489
- environment: env.name,
1490
- graphqlApiUrl: config.GRAPHQL_API_URL,
1491
- ethereum: {
1492
- ethChainId: env.ethChainId,
1493
- ethChains: _defineProperty(_defineProperty({}, ETH_MAINNET_CHAIN_ID.toString(), executionUrl), getParaId('Moonbeam'), 'https://rpc.api.moonbeam.network'),
1494
- beacon_url: config.BEACON_HTTP_API
1477
+ var isStringProvider = typeof executionUrl === 'string';
1478
+ var context = new Context(_objectSpread2(_objectSpread2({}, env), {}, {
1479
+ assetOverrides: {
1480
+ '3369': [{
1481
+ token: '0xba41ddf06b7ffd89d1267b5a93bfef2424eb2003',
1482
+ name: 'Mythos',
1483
+ minimumBalance: 10000000000000000n,
1484
+ symbol: 'MYTH',
1485
+ decimals: 18,
1486
+ isSufficient: true
1487
+ }]
1495
1488
  },
1496
- polkadot: {
1497
- assetHubParaId: config.ASSET_HUB_PARAID,
1498
- bridgeHubParaId: config.BRIDGE_HUB_PARAID,
1499
- parachains: config.PARACHAINS,
1500
- relaychain: config.RELAY_CHAIN_URL
1489
+ precompiles: {
1490
+ '2004': '0x000000000000000000000000000000000000081A'
1501
1491
  },
1502
- appContracts: {
1503
- gateway: config.GATEWAY_CONTRACT,
1504
- beefy: config.BEEFY_CONTRACT
1505
- }
1506
- });
1492
+ ethereumChains: _objectSpread2(_objectSpread2({}, isStringProvider ? _defineProperty({}, env.ethChainId.toString(), executionUrl) : {}), {}, _defineProperty({}, getParaId('Moonbeam'), 'https://rpc.api.moonbeam.network'))
1493
+ }));
1494
+ if (!isStringProvider) context.setEthProvider(env.ethChainId, executionUrl);
1495
+ return context;
1507
1496
  };
1508
1497
 
1509
1498
  /**
@@ -1518,7 +1507,7 @@ var createContext = function createContext(executionUrl, env) {
1518
1507
  */
1519
1508
  var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1520
1509
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
1521
- var api, provider, signer, address, to, currency, ethAsset, amount, env, context, destParaId, overrides, registry, fee, sourceAddress, transfer, validation, tx, response, receipt, messageReceipt, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13;
1510
+ var api, provider, signer, address, to, currency, ethAsset, amount, env, context, destParaId, registry, fee, sourceAddress, transfer, validation, tx, response, receipt, messageReceipt, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1;
1522
1511
  return _regenerator().w(function (_context) {
1523
1512
  while (1) switch (_context.n) {
1524
1513
  case 0:
@@ -1549,101 +1538,76 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1549
1538
  case 4:
1550
1539
  ethAsset = findAssetInfoOrThrow('Ethereum', currency, to);
1551
1540
  amount = abstractDecimals(currency.amount, ethAsset.decimals, api);
1552
- env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
1541
+ env = environmentFor('polkadot_mainnet');
1553
1542
  context = createContext(provider, env);
1554
1543
  destParaId = getParaId(to);
1555
1544
  assertHasId(ethAsset);
1556
- overrides = {
1557
- precompiles: {
1558
- '2004': '0x000000000000000000000000000000000000081A'
1559
- },
1560
- assetOverrides: {
1561
- '3369': [{
1562
- token: '0xba41ddf06b7ffd89d1267b5a93bfef2424eb2003',
1563
- name: 'Mythos',
1564
- minimumBalance: 10000000000000000n,
1565
- symbol: 'MYTH',
1566
- decimals: 18,
1567
- isSufficient: true
1568
- }]
1569
- }
1570
- };
1571
- _t = assetsV2;
1572
- _t2 = _objectSpread2;
1573
- _t3 = _objectSpread2;
1574
- _t4 = {};
1545
+ registry = assetRegistryFor('polkadot_mainnet');
1546
+ _t = toPolkadotV2;
1547
+ _t2 = context.gateway();
1575
1548
  _context.n = 5;
1576
- return assetsV2.fromContext(context);
1549
+ return context.assetHub();
1577
1550
  case 5:
1551
+ _t3 = _context.v;
1578
1552
  _context.n = 6;
1579
- return _t.buildRegistry.call(_t, _t2(_t3(_t4, _context.v), overrides));
1553
+ return context.parachain(destParaId);
1580
1554
  case 6:
1581
- registry = _context.v;
1582
- _t5 = toPolkadotV2;
1583
- _t6 = context.gateway();
1555
+ _t4 = _context.v;
1584
1556
  _context.n = 7;
1585
- return context.assetHub();
1557
+ return _t.getDeliveryFee.call(_t, {
1558
+ gateway: _t2,
1559
+ assetHub: _t3,
1560
+ destination: _t4
1561
+ }, registry, ethAsset.assetId, destParaId);
1586
1562
  case 7:
1587
- _t7 = _context.v;
1563
+ fee = _context.v;
1588
1564
  _context.n = 8;
1589
- return context.parachain(destParaId);
1565
+ return signer.getAddress();
1590
1566
  case 8:
1591
- _t8 = _context.v;
1567
+ sourceAddress = _context.v;
1592
1568
  _context.n = 9;
1593
- return _t5.getDeliveryFee.call(_t5, {
1594
- gateway: _t6,
1595
- assetHub: _t7,
1596
- destination: _t8
1597
- }, registry, ethAsset.assetId, destParaId);
1569
+ return toPolkadotV2.createTransfer(registry, sourceAddress, address, ethAsset.assetId, destParaId, amount, fee);
1598
1570
  case 9:
1599
- fee = _context.v;
1571
+ transfer = _context.v;
1572
+ _t5 = toPolkadotV2;
1573
+ _t6 = context.ethereum();
1574
+ _t7 = context.gateway();
1600
1575
  _context.n = 10;
1601
- return signer.getAddress();
1576
+ return context.bridgeHub();
1602
1577
  case 10:
1603
- sourceAddress = _context.v;
1578
+ _t8 = _context.v;
1604
1579
  _context.n = 11;
1605
- return toPolkadotV2.createTransfer(registry, sourceAddress, address, ethAsset.assetId, destParaId, amount, fee);
1606
- case 11:
1607
- transfer = _context.v;
1608
- _t9 = toPolkadotV2;
1609
- _t0 = context.ethereum();
1610
- _t1 = context.gateway();
1611
- _context.n = 12;
1612
- return context.bridgeHub();
1613
- case 12:
1614
- _t10 = _context.v;
1615
- _context.n = 13;
1616
1580
  return context.assetHub();
1617
- case 13:
1618
- _t11 = _context.v;
1581
+ case 11:
1582
+ _t9 = _context.v;
1619
1583
  if (!(destParaId !== getParaId('AssetHubPolkadot'))) {
1620
- _context.n = 15;
1584
+ _context.n = 13;
1621
1585
  break;
1622
1586
  }
1623
- _context.n = 14;
1587
+ _context.n = 12;
1624
1588
  return context.parachain(destParaId);
1625
- case 14:
1626
- _t12 = _context.v;
1627
- _context.n = 16;
1589
+ case 12:
1590
+ _t0 = _context.v;
1591
+ _context.n = 14;
1628
1592
  break;
1629
- case 15:
1630
- _t12 = undefined;
1631
- case 16:
1632
- _t13 = _t12;
1633
- _context.n = 17;
1634
- return _t9.validateTransfer.call(_t9, {
1635
- ethereum: _t0,
1636
- gateway: _t1,
1637
- bridgeHub: _t10,
1638
- assetHub: _t11,
1639
- destParachain: _t13
1593
+ case 13:
1594
+ _t0 = undefined;
1595
+ case 14:
1596
+ _t1 = _t0;
1597
+ _context.n = 15;
1598
+ return _t5.validateTransfer.call(_t5, {
1599
+ ethereum: _t6,
1600
+ gateway: _t7,
1601
+ bridgeHub: _t8,
1602
+ assetHub: _t9,
1603
+ destParachain: _t1
1640
1604
  }, transfer);
1641
- case 17:
1605
+ case 15:
1642
1606
  validation = _context.v;
1643
1607
  if (!validation.logs.find(function (l) {
1644
1608
  return l.kind == toPolkadotV2.ValidationKind.Error;
1645
1609
  })) {
1646
- _context.n = 18;
1610
+ _context.n = 16;
1647
1611
  break;
1648
1612
  }
1649
1613
  throw new RoutingResolutionError("Validation failed with following errors: \n\n ".concat(validation.logs.filter(function (l) {
@@ -1651,32 +1615,32 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1651
1615
  }).map(function (l) {
1652
1616
  return l.message;
1653
1617
  }).join('\n\n')));
1654
- case 18:
1618
+ case 16:
1655
1619
  tx = transfer.tx;
1656
- _context.n = 19;
1620
+ _context.n = 17;
1657
1621
  return signer.sendTransaction(tx);
1658
- case 19:
1622
+ case 17:
1659
1623
  response = _context.v;
1660
- _context.n = 20;
1624
+ _context.n = 18;
1661
1625
  return response.wait(1);
1662
- case 20:
1626
+ case 18:
1663
1627
  receipt = _context.v;
1664
1628
  if (receipt) {
1665
- _context.n = 21;
1629
+ _context.n = 19;
1666
1630
  break;
1667
1631
  }
1668
1632
  throw new RoutingResolutionError("Transaction ".concat(response.hash, " not included."));
1669
- case 21:
1670
- _context.n = 22;
1633
+ case 19:
1634
+ _context.n = 20;
1671
1635
  return toPolkadotV2.getMessageReceipt(receipt);
1672
- case 22:
1636
+ case 20:
1673
1637
  messageReceipt = _context.v;
1674
1638
  if (messageReceipt) {
1675
- _context.n = 23;
1639
+ _context.n = 21;
1676
1640
  break;
1677
1641
  }
1678
1642
  throw new RoutingResolutionError("Transaction ".concat(receipt.hash, " did not emit a message."));
1679
- case 23:
1643
+ case 21:
1680
1644
  return _context.a(2, {
1681
1645
  response: response,
1682
1646
  messageReceipt: messageReceipt
@@ -1691,24 +1655,18 @@ var transferEthToPolkadot$1 = /*#__PURE__*/function () {
1691
1655
 
1692
1656
  var getTokenBalance = /*#__PURE__*/function () {
1693
1657
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signer, symbol) {
1694
- var env, contract, weth9, address;
1658
+ var asset, weth9, address;
1695
1659
  return _regenerator().w(function (_context) {
1696
1660
  while (1) switch (_context.n) {
1697
1661
  case 0:
1698
- env = environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
1699
- contract = env.locations[0].erc20tokensReceivable.find(function (t) {
1700
- return t.id === symbol;
1701
- });
1702
- if (contract) {
1703
- _context.n = 1;
1704
- break;
1705
- }
1706
- throw new UnsupportedOperationError("Token ".concat(symbol, " not supported"));
1707
- case 1:
1708
- weth9 = WETH9__factory.connect(contract.address, signer);
1709
- _context.n = 2;
1662
+ asset = findAssetInfoOrThrow('Ethereum', {
1663
+ symbol: symbol
1664
+ }, null);
1665
+ assertHasId(asset);
1666
+ weth9 = WETH9__factory.connect(asset.assetId, signer);
1667
+ _context.n = 1;
1710
1668
  return signer.getAddress();
1711
- case 2:
1669
+ case 1:
1712
1670
  address = _context.v;
1713
1671
  return _context.a(2, weth9.balanceOf(address));
1714
1672
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "12.3.0",
3
+ "version": "12.5.0",
4
4
  "description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,11 +23,13 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@snowbridge/api": "0.2.20",
27
- "@snowbridge/contract-types": "0.2.20",
26
+ "@snowbridge/api": "0.3.2",
27
+ "@snowbridge/base-types": "^0.3.2",
28
+ "@snowbridge/contract-types": "0.3.2",
29
+ "@snowbridge/registry": "^0.3.2",
28
30
  "ethers": "6.15.0",
29
- "viem": "2.40.3",
30
- "@paraspell/sdk-core": "12.3.0"
31
+ "viem": "2.45.0",
32
+ "@paraspell/sdk-core": "12.5.0"
31
33
  },
32
34
  "peerDependencies": {
33
35
  "@polkadot/api": ">= 16.0 < 17",