@paraspell/sdk 1.1.15 → 2.0.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/README.md CHANGED
@@ -112,7 +112,7 @@ Builder(api).from(NODE).to(NODE).currency(CurrencyString||CurrencyID).amount(amo
112
112
  Builder(api).to(NODE).amount(amount).address(address).build()
113
113
 
114
114
  //Transfer tokens from Parachain to Relay chain
115
- Builder(api).from(NODE).currency(CurrencyString||CurrencyID).amount(amount).address(address).build()
115
+ Builder(api).from(NODE).amount(amount).address(address).build()
116
116
 
117
117
  //Close HRMP channels
118
118
  Builder(api).from(NODE).closeChannel().inbound(inbound).outbound(outbound).build()
@@ -130,7 +130,7 @@ Function pattern XCM & HRMP construction
130
130
  paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: CurrencyString||CurrencyID, amount: any, to: destination address string, destination: destination Parachain ID)
131
131
 
132
132
  //Transfer tokens from Parachain to Relay chain
133
- paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: CurrencyString||CurrencyID, amount: any, to: destination address string)
133
+ paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, amount: any, to: destination address string)
134
134
 
135
135
  //Transfer tokens from Relay chain to Parachain
136
136
  paraspell.xcmPallet.transferRelayToPara(api: ApiPromise, destination: destination Parachain ID, amount: any, to: destination address string)
package/dist/index.cjs CHANGED
@@ -3781,7 +3781,7 @@ var Acala$1 = /*#__PURE__*/function (_ParachainNode) {
3781
3781
  var _super = _createSuper(Acala);
3782
3782
  function Acala() {
3783
3783
  _classCallCheck(this, Acala);
3784
- return _super.call(this, 'Acala', 'acala', 'polkadot', exports.Version.V1);
3784
+ return _super.call(this, 'Acala', 'acala', 'polkadot', exports.Version.V3);
3785
3785
  }
3786
3786
  _createClass(Acala, [{
3787
3787
  key: "transferXTokens",
@@ -5729,15 +5729,15 @@ var SellBuilder = /*#__PURE__*/function () {
5729
5729
  return SellBuilder;
5730
5730
  }();
5731
5731
 
5732
- var SendBuilder = /*#__PURE__*/function () {
5733
- function SendBuilder(api, from, to, currency) {
5734
- _classCallCheck(this, SendBuilder);
5732
+ var ParaToParaBuilder = /*#__PURE__*/function () {
5733
+ function ParaToParaBuilder(api, from, to, currency) {
5734
+ _classCallCheck(this, ParaToParaBuilder);
5735
5735
  this.api = api;
5736
5736
  this.from = from;
5737
5737
  this.to = to;
5738
5738
  this.currency = currency;
5739
5739
  }
5740
- _createClass(SendBuilder, [{
5740
+ _createClass(ParaToParaBuilder, [{
5741
5741
  key: "amount",
5742
5742
  value: function amount(_amount) {
5743
5743
  this._amount = _amount;
@@ -5760,17 +5760,46 @@ var SendBuilder = /*#__PURE__*/function () {
5760
5760
  return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
5761
5761
  }
5762
5762
  }], [{
5763
- key: "createParaToRelay",
5764
- value: function createParaToRelay(api, from, currency) {
5765
- return new SendBuilder(api, from, undefined, currency);
5766
- }
5767
- }, {
5768
5763
  key: "createParaToPara",
5769
5764
  value: function createParaToPara(api, from, to, currency) {
5770
- return new SendBuilder(api, from, to, currency);
5765
+ return new ParaToParaBuilder(api, from, to, currency);
5771
5766
  }
5772
5767
  }]);
5773
- return SendBuilder;
5768
+ return ParaToParaBuilder;
5769
+ }();
5770
+
5771
+ var ParaToRelayBuilder = /*#__PURE__*/function () {
5772
+ function ParaToRelayBuilder(api, from, amount) {
5773
+ _classCallCheck(this, ParaToRelayBuilder);
5774
+ this.api = api;
5775
+ this.from = from;
5776
+ this.amount = amount;
5777
+ }
5778
+ _createClass(ParaToRelayBuilder, [{
5779
+ key: "address",
5780
+ value: function address(_address) {
5781
+ this._address = _address;
5782
+ return this;
5783
+ }
5784
+ }, {
5785
+ key: "build",
5786
+ value: function build() {
5787
+ var currency = getRelayChainSymbol(this.from);
5788
+ return send(this.api, this.from, currency, this.amount, this._address);
5789
+ }
5790
+ }, {
5791
+ key: "buildSerializedApiCall",
5792
+ value: function buildSerializedApiCall() {
5793
+ var currency = getRelayChainSymbol(this.from);
5794
+ return sendSerializedApiCall(this.api, this.from, currency, this.amount, this._address);
5795
+ }
5796
+ }], [{
5797
+ key: "create",
5798
+ value: function create(api, from, amount) {
5799
+ return new ParaToRelayBuilder(api, from, amount);
5800
+ }
5801
+ }]);
5802
+ return ParaToRelayBuilder;
5774
5803
  }();
5775
5804
 
5776
5805
  var ToGeneralBuilder = /*#__PURE__*/function () {
@@ -5783,7 +5812,7 @@ var ToGeneralBuilder = /*#__PURE__*/function () {
5783
5812
  _createClass(ToGeneralBuilder, [{
5784
5813
  key: "currency",
5785
5814
  value: function currency(_currency) {
5786
- return SendBuilder.createParaToPara(this.api, this.from, this.to, _currency);
5815
+ return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency);
5787
5816
  }
5788
5817
  }, {
5789
5818
  key: "openChannel",
@@ -5805,9 +5834,9 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
5805
5834
  return new ToGeneralBuilder(this.api, this.from, node);
5806
5835
  }
5807
5836
  }, {
5808
- key: "currency",
5809
- value: function currency(_currency2) {
5810
- return SendBuilder.createParaToRelay(this.api, this.from, _currency2);
5837
+ key: "amount",
5838
+ value: function amount(_amount) {
5839
+ return ParaToRelayBuilder.create(this.api, this.from, _amount);
5811
5840
  }
5812
5841
  }, {
5813
5842
  key: "closeChannel",
package/dist/index.d.ts CHANGED
@@ -247,17 +247,6 @@ interface AssetAAddLiquidityBuilder {
247
247
  assetA(assetA: number): AssetBAddLiquidityBuilder;
248
248
  }
249
249
 
250
- interface FinalRelayToParaBuilder$1 {
251
- build(): Extrinsic | never;
252
- buildSerializedApiCall(): TSerializedApiCall;
253
- }
254
- interface AddressRelayToParaBuilder {
255
- address(address: string): FinalRelayToParaBuilder$1;
256
- }
257
- interface AmountRelayToParaBuilder {
258
- amount(amount: number): AddressRelayToParaBuilder;
259
- }
260
-
261
250
  interface FinalCloseChannelBuilder {
262
251
  build(): Extrinsic;
263
252
  }
@@ -278,23 +267,12 @@ interface MaxSizeOpenChannelBuilder {
278
267
  maxSize(size: number): MaxMessageSizeOpenChannelBuilder;
279
268
  }
280
269
 
281
- interface FinalRelayToParaBuilder {
282
- build(): Extrinsic | never;
283
- buildSerializedApiCall(): TSerializedApiCall;
284
- }
285
- interface AddressSendBuilder {
286
- address(address: string): FinalRelayToParaBuilder;
287
- }
288
- interface AmountSendBuilder {
289
- amount(amount: any): AddressSendBuilder;
290
- }
291
-
292
270
  declare class ToGeneralBuilder {
293
271
  private api;
294
272
  private from;
295
273
  private to;
296
274
  constructor(api: ApiPromise, from: TNode, to: TNode);
297
- currency(currency: string | number | bigint): AmountSendBuilder;
275
+ currency(currency: string | number | bigint): AmountBuilder;
298
276
  openChannel(): MaxSizeOpenChannelBuilder;
299
277
  }
300
278
  declare class FromGeneralBuilder {
@@ -302,14 +280,14 @@ declare class FromGeneralBuilder {
302
280
  private from;
303
281
  constructor(api: ApiPromise, from: TNode);
304
282
  to(node: TNode): ToGeneralBuilder;
305
- currency(currency: string | number | bigint): AmountSendBuilder;
283
+ amount(amount: any): AddressBuilder;
306
284
  closeChannel(): InboundCloseChannelBuilder;
307
285
  }
308
286
  declare class GeneralBuilder {
309
287
  private api;
310
288
  constructor(api: ApiPromise);
311
289
  from(node: TNode): FromGeneralBuilder;
312
- to(node: TNode): AmountRelayToParaBuilder;
290
+ to(node: TNode): AmountBuilder;
313
291
  addLiquidity(): AssetAAddLiquidityBuilder;
314
292
  removeLiquidity(): AssetARemoveLiquidityBuilder;
315
293
  buy(): AssetOutBuyBuilder;
@@ -317,6 +295,16 @@ declare class GeneralBuilder {
317
295
  createPool(): AssetACreatePoolBuilder;
318
296
  }
319
297
  declare function Builder(api: ApiPromise): GeneralBuilder;
298
+ interface FinalBuilder {
299
+ build(): Extrinsic | never;
300
+ buildSerializedApiCall(): TSerializedApiCall;
301
+ }
302
+ interface AddressBuilder {
303
+ address(address: string): FinalBuilder;
304
+ }
305
+ interface AmountBuilder {
306
+ amount(amount: any): AddressBuilder;
307
+ }
320
308
 
321
309
  declare const getDefaultPallet: (node: TNode) => TPallet;
322
310
  declare const getSupportedPallets: (node: TNode) => TPallet[];
package/dist/index.mjs CHANGED
@@ -3779,7 +3779,7 @@ var Acala$1 = /*#__PURE__*/function (_ParachainNode) {
3779
3779
  var _super = _createSuper(Acala);
3780
3780
  function Acala() {
3781
3781
  _classCallCheck(this, Acala);
3782
- return _super.call(this, 'Acala', 'acala', 'polkadot', Version.V1);
3782
+ return _super.call(this, 'Acala', 'acala', 'polkadot', Version.V3);
3783
3783
  }
3784
3784
  _createClass(Acala, [{
3785
3785
  key: "transferXTokens",
@@ -5727,15 +5727,15 @@ var SellBuilder = /*#__PURE__*/function () {
5727
5727
  return SellBuilder;
5728
5728
  }();
5729
5729
 
5730
- var SendBuilder = /*#__PURE__*/function () {
5731
- function SendBuilder(api, from, to, currency) {
5732
- _classCallCheck(this, SendBuilder);
5730
+ var ParaToParaBuilder = /*#__PURE__*/function () {
5731
+ function ParaToParaBuilder(api, from, to, currency) {
5732
+ _classCallCheck(this, ParaToParaBuilder);
5733
5733
  this.api = api;
5734
5734
  this.from = from;
5735
5735
  this.to = to;
5736
5736
  this.currency = currency;
5737
5737
  }
5738
- _createClass(SendBuilder, [{
5738
+ _createClass(ParaToParaBuilder, [{
5739
5739
  key: "amount",
5740
5740
  value: function amount(_amount) {
5741
5741
  this._amount = _amount;
@@ -5758,17 +5758,46 @@ var SendBuilder = /*#__PURE__*/function () {
5758
5758
  return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
5759
5759
  }
5760
5760
  }], [{
5761
- key: "createParaToRelay",
5762
- value: function createParaToRelay(api, from, currency) {
5763
- return new SendBuilder(api, from, undefined, currency);
5764
- }
5765
- }, {
5766
5761
  key: "createParaToPara",
5767
5762
  value: function createParaToPara(api, from, to, currency) {
5768
- return new SendBuilder(api, from, to, currency);
5763
+ return new ParaToParaBuilder(api, from, to, currency);
5769
5764
  }
5770
5765
  }]);
5771
- return SendBuilder;
5766
+ return ParaToParaBuilder;
5767
+ }();
5768
+
5769
+ var ParaToRelayBuilder = /*#__PURE__*/function () {
5770
+ function ParaToRelayBuilder(api, from, amount) {
5771
+ _classCallCheck(this, ParaToRelayBuilder);
5772
+ this.api = api;
5773
+ this.from = from;
5774
+ this.amount = amount;
5775
+ }
5776
+ _createClass(ParaToRelayBuilder, [{
5777
+ key: "address",
5778
+ value: function address(_address) {
5779
+ this._address = _address;
5780
+ return this;
5781
+ }
5782
+ }, {
5783
+ key: "build",
5784
+ value: function build() {
5785
+ var currency = getRelayChainSymbol(this.from);
5786
+ return send(this.api, this.from, currency, this.amount, this._address);
5787
+ }
5788
+ }, {
5789
+ key: "buildSerializedApiCall",
5790
+ value: function buildSerializedApiCall() {
5791
+ var currency = getRelayChainSymbol(this.from);
5792
+ return sendSerializedApiCall(this.api, this.from, currency, this.amount, this._address);
5793
+ }
5794
+ }], [{
5795
+ key: "create",
5796
+ value: function create(api, from, amount) {
5797
+ return new ParaToRelayBuilder(api, from, amount);
5798
+ }
5799
+ }]);
5800
+ return ParaToRelayBuilder;
5772
5801
  }();
5773
5802
 
5774
5803
  var ToGeneralBuilder = /*#__PURE__*/function () {
@@ -5781,7 +5810,7 @@ var ToGeneralBuilder = /*#__PURE__*/function () {
5781
5810
  _createClass(ToGeneralBuilder, [{
5782
5811
  key: "currency",
5783
5812
  value: function currency(_currency) {
5784
- return SendBuilder.createParaToPara(this.api, this.from, this.to, _currency);
5813
+ return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency);
5785
5814
  }
5786
5815
  }, {
5787
5816
  key: "openChannel",
@@ -5803,9 +5832,9 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
5803
5832
  return new ToGeneralBuilder(this.api, this.from, node);
5804
5833
  }
5805
5834
  }, {
5806
- key: "currency",
5807
- value: function currency(_currency2) {
5808
- return SendBuilder.createParaToRelay(this.api, this.from, _currency2);
5835
+ key: "amount",
5836
+ value: function amount(_amount) {
5837
+ return ParaToRelayBuilder.create(this.api, this.from, _amount);
5809
5838
  }
5810
5839
  }, {
5811
5840
  key: "closeChannel",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "1.1.15",
3
+ "version": "2.0.1",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": "@paraspell/sdk",
6
6
  "license": "MIT",