@paraspell/sdk 0.0.20 → 0.0.21
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 +51 -20
- package/dist/index.cjs +241 -25
- package/dist/index.d.ts +125 -15
- package/dist/index.mjs +239 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
# @paraspell/sdk
|
|
3
|
+

|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
@@ -12,9 +13,9 @@
|
|
|
12
13
|
|
|
13
14
|
SDK For XCM & XCMP handling made with ❤️ by ParaSpell✨. It is no longer necessary to construct calls manually. @paraspell/sdk handles this for you. Feel free to become magician and try your paraSPELLS 🧙✨.
|
|
14
15
|
|
|
15
|
-
##### Currently supporting 42 Polkadot & Kusama nodes list [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/
|
|
16
|
+
##### Currently supporting 42 Polkadot & Kusama nodes list [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supporxxtedNodes.md).
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
### Check out our brand new Wiki documentation! [Wiki docs](https://paraspell.github.io/docs/)
|
|
18
19
|
|
|
19
20
|
## Usage
|
|
20
21
|
|
|
@@ -41,32 +42,27 @@ pnpm install @paraspell/sdk
|
|
|
41
42
|
|
|
42
43
|
##### Importing package to your project:
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
If you wish to use XCM, HRMP, XYK Pallets only you can import Builder like this:
|
|
45
46
|
```js
|
|
46
|
-
/////////NEW BUILDER STYLE IMPORT///////////
|
|
47
|
-
|
|
48
47
|
import { Builder } from '@paraspell/sdk'
|
|
48
|
+
```
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Old function like import (With assets):
|
|
51
|
+
```js
|
|
52
52
|
// ESM
|
|
53
53
|
import * as paraspell from '@paraspell/sdk'
|
|
54
54
|
|
|
55
55
|
// CommonJS
|
|
56
56
|
const paraspell = require('@paraspell/sdk')
|
|
57
|
-
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
|
|
61
60
|
|
|
62
61
|
## Currently implemented pallets
|
|
62
|
+
XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
|
|
63
63
|
|
|
64
|
+
Builder pattern XCM & HRMP construction
|
|
64
65
|
```ts
|
|
65
|
-
|
|
66
|
-
//XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
|
|
67
|
-
|
|
68
|
-
//////////NEW BUILDER PATTERN XCM & HRMP CONSTRUCTION//////////
|
|
69
|
-
|
|
70
66
|
//Transfer tokens from Parachain to Parachain
|
|
71
67
|
Builder(api).from(NODE).to(NODE).currency(CurrencyString).currencyId(currencyId).amount(amount).address(address).build()
|
|
72
68
|
|
|
@@ -80,10 +76,11 @@ Builder(api).from(NODE).currency(CurrencyString).currencyId(currencyId).amount(a
|
|
|
80
76
|
Builder(api).from(NODE).closeChannel().inbound(inbound).outbound(outbound).build()
|
|
81
77
|
|
|
82
78
|
//Open HRMP channels
|
|
83
|
-
Builder(api).from(NODE).to(NODE).openChannel().maxSize(maxSize).maxMessageSize(maxMsgSize).build()
|
|
84
|
-
|
|
85
|
-
///////////OLD STYLE XCM & HRMP CONSTRUCTION//////////////
|
|
79
|
+
Builder(api).from(NODE).to(NODE).openChannel().maxSize(maxSize).maxMessageSize(maxMsgSize).build()'
|
|
80
|
+
```
|
|
86
81
|
|
|
82
|
+
Function pattern XCM & HRMP construction
|
|
83
|
+
```ts
|
|
87
84
|
//Transfer tokens from Parachain to Parachain
|
|
88
85
|
paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name string, currency: currency symbol string, currencyID: number (If applicable), amount: any, to: destination address string, destination: destination Parachain ID)
|
|
89
86
|
|
|
@@ -100,11 +97,10 @@ paraspell.closeChannels.closeChannel(api: ApiPromise, origin: origin Parachain
|
|
|
100
97
|
//parasSudoWrapper pallet:
|
|
101
98
|
//Open HRMP channels
|
|
102
99
|
paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain ID, destination: destination Parachain ID, maxSize: number, maxMessageSize: number)
|
|
100
|
+
```
|
|
101
|
+
Asset pallet contruction:
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//Asset pallet
|
|
107
|
-
|
|
103
|
+
```ts
|
|
108
104
|
//Returns assets object from assets.json for particular node including information about native and foreign assets
|
|
109
105
|
paraspell.assets.getAssetsObject(node: TNode)
|
|
110
106
|
|
|
@@ -134,7 +130,42 @@ paraspell.assets.getParaId(node: TNode)
|
|
|
134
130
|
|
|
135
131
|
//Import all compatible nodes as constant:
|
|
136
132
|
paraspell.NODE_NAMES
|
|
133
|
+
```
|
|
134
|
+
Basilisk XYK pallet contruction
|
|
135
|
+
|
|
136
|
+
Builder patternn XYK construction
|
|
137
|
+
```ts
|
|
138
|
+
//Add liquidity to specific pool
|
|
139
|
+
Builder(api).addLiquidity().assetA(assetA).assetB(assetB).amountA(amountA).amountBMaxLimit(maxLimit).build()
|
|
140
|
+
|
|
141
|
+
//Remove liquidity from specific pool
|
|
142
|
+
Builder(api).removeLiquidity().assetA(assetA).assetB(assetB).liquidityAmount(liquidity).build()
|
|
143
|
+
|
|
144
|
+
//Create pool
|
|
145
|
+
Builder(api).createPool().assetA(assetA).amountA(amountA).assetB(assetB).amountB(amountB).build()
|
|
146
|
+
|
|
147
|
+
//Buy specific asset from pool
|
|
148
|
+
Builder(api).buy().assetOut(out).assetIn(in).amount(amount).maxLimit(maxLimit).discount(discount).build()
|
|
149
|
+
|
|
150
|
+
//Sell specific asset from pool
|
|
151
|
+
Builder(api).sell().assetIn(in).assetOut(out).amount(amount).maxLimit(maxLimit).discount(discount).build()
|
|
152
|
+
```
|
|
153
|
+
Function pattern XYK contruction
|
|
154
|
+
```ts
|
|
155
|
+
//Add liquidity to specific pool
|
|
156
|
+
paraspell.xyk.addLiquidity(api: ApiPromise, assetA: number, assetB: number, amountA: any, amountBMaxLimit: any)
|
|
157
|
+
|
|
158
|
+
//Remove liquidity from specific pool
|
|
159
|
+
paraspell.xyk.removeLiquidity(api: ApiPromise, assetA: number, assetB: number, liquidityAmount: any)
|
|
160
|
+
|
|
161
|
+
//Create pool
|
|
162
|
+
paraspell.xyk.createPool(api: ApiPromise, assetA: number, amountA: any, assetB: number, amountB: any)
|
|
163
|
+
|
|
164
|
+
//Buy specific asset from pool
|
|
165
|
+
paraspell.xyk.buy(api: ApiPromise, assetOut: number, assetIn: number, amount: any, maxLimit: any, discount: Bool)
|
|
137
166
|
|
|
167
|
+
//Sell specific asset from pool
|
|
168
|
+
paraspell.xyk.sell(api: ApiPromise, assetIn: number, assetOut: number, amount: any, maxLimit: any, discount: Bool)
|
|
138
169
|
```
|
|
139
170
|
|
|
140
171
|
##### Example of usage can be found in the UI repository [here](https://github.com/paraspell/ui) or in the Astarot repository [here](https://github.com/paraspell/astarot)
|
package/dist/index.cjs
CHANGED
|
@@ -3509,40 +3509,39 @@ const assets = {
|
|
|
3509
3509
|
const assetsMap = {
|
|
3510
3510
|
__proto__: null,
|
|
3511
3511
|
Acala: Acala,
|
|
3512
|
-
Astar: Astar,
|
|
3513
|
-
BifrostPolkadot: BifrostPolkadot,
|
|
3514
|
-
Bitgreen: Bitgreen,
|
|
3515
|
-
Centrifuge: Centrifuge,
|
|
3516
|
-
Clover: Clover,
|
|
3517
|
-
ComposableFinance: ComposableFinance,
|
|
3518
|
-
Darwinia: Darwinia,
|
|
3519
|
-
HydraDX: HydraDX,
|
|
3520
|
-
Interlay: Interlay,
|
|
3521
|
-
Kylin: Kylin,
|
|
3522
|
-
Litentry: Litentry,
|
|
3523
|
-
Moonbeam: Moonbeam,
|
|
3524
|
-
Parallel: Parallel,
|
|
3525
|
-
Statemint: Statemint,
|
|
3526
3512
|
Altair: Altair,
|
|
3527
3513
|
Amplitude: Amplitude,
|
|
3514
|
+
Astar: Astar,
|
|
3528
3515
|
Bajun: Bajun,
|
|
3529
3516
|
Basilisk: Basilisk,
|
|
3530
3517
|
BifrostKusama: BifrostKusama,
|
|
3518
|
+
BifrostPolkadot: BifrostPolkadot,
|
|
3519
|
+
Bitgreen: Bitgreen,
|
|
3531
3520
|
Calamari: Calamari,
|
|
3521
|
+
Centrifuge: Centrifuge,
|
|
3522
|
+
Clover: Clover,
|
|
3523
|
+
ComposableFinance: ComposableFinance,
|
|
3532
3524
|
Crab: Crab,
|
|
3533
3525
|
CrustShadow: CrustShadow,
|
|
3526
|
+
Darwinia: Darwinia,
|
|
3534
3527
|
Dorafactory: Dorafactory,
|
|
3535
3528
|
Encointer: Encointer,
|
|
3529
|
+
HydraDX: HydraDX,
|
|
3536
3530
|
Imbue: Imbue,
|
|
3537
3531
|
Integritee: Integritee,
|
|
3532
|
+
Interlay: Interlay,
|
|
3538
3533
|
InvArchTinker: InvArchTinker,
|
|
3539
|
-
Kico: Kico,
|
|
3540
3534
|
Karura: Karura,
|
|
3535
|
+
Kico: Kico,
|
|
3541
3536
|
Kintsugi: Kintsugi,
|
|
3537
|
+
Kylin: Kylin,
|
|
3542
3538
|
Listen: Listen,
|
|
3539
|
+
Litentry: Litentry,
|
|
3543
3540
|
Litmus: Litmus,
|
|
3544
3541
|
Mangata: Mangata,
|
|
3542
|
+
Moonbeam: Moonbeam,
|
|
3545
3543
|
Moonriver: Moonriver,
|
|
3544
|
+
Parallel: Parallel,
|
|
3546
3545
|
ParallelHeiko: ParallelHeiko,
|
|
3547
3546
|
Picasso: Picasso,
|
|
3548
3547
|
Pichiu: Pichiu,
|
|
@@ -3551,6 +3550,7 @@ const assetsMap = {
|
|
|
3551
3550
|
Robonomics: Robonomics,
|
|
3552
3551
|
Shiden: Shiden,
|
|
3553
3552
|
Statemine: Statemine,
|
|
3553
|
+
Statemint: Statemint,
|
|
3554
3554
|
Turing: Turing,
|
|
3555
3555
|
default: assets
|
|
3556
3556
|
};
|
|
@@ -3597,17 +3597,17 @@ function getParaId(node) {
|
|
|
3597
3597
|
return getAssetsObject(node).paraId;
|
|
3598
3598
|
}
|
|
3599
3599
|
|
|
3600
|
-
const index$
|
|
3600
|
+
const index$4 = {
|
|
3601
3601
|
__proto__: null,
|
|
3602
|
-
|
|
3602
|
+
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
3603
|
+
getAssetDecimals: getAssetDecimals,
|
|
3603
3604
|
getAssetId: getAssetId,
|
|
3604
|
-
|
|
3605
|
+
getAssetsObject: getAssetsObject,
|
|
3605
3606
|
getNativeAssets: getNativeAssets,
|
|
3606
3607
|
getOtherAssets: getOtherAssets,
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
getParaId: getParaId
|
|
3608
|
+
getParaId: getParaId,
|
|
3609
|
+
getRelayChainSymbol: getRelayChainSymbol,
|
|
3610
|
+
hasSupportForAsset: hasSupportForAsset
|
|
3611
3611
|
};
|
|
3612
3612
|
|
|
3613
3613
|
class InvalidCurrencyError extends Error {
|
|
@@ -3702,12 +3702,63 @@ function transferRelayToPara(api, destination, amount, to) {
|
|
|
3702
3702
|
);
|
|
3703
3703
|
}
|
|
3704
3704
|
|
|
3705
|
-
const index$
|
|
3705
|
+
const index$3 = {
|
|
3706
3706
|
__proto__: null,
|
|
3707
3707
|
send: send,
|
|
3708
3708
|
transferRelayToPara: transferRelayToPara
|
|
3709
3709
|
};
|
|
3710
3710
|
|
|
3711
|
+
function addLiquidity(api, assetA, assetB, amountA, amountBMaxLimit) {
|
|
3712
|
+
return api.tx.xyk.addLiquidity(
|
|
3713
|
+
assetA,
|
|
3714
|
+
assetB,
|
|
3715
|
+
amountA,
|
|
3716
|
+
amountBMaxLimit
|
|
3717
|
+
);
|
|
3718
|
+
}
|
|
3719
|
+
function buy(api, assetOut, assetIn, amount, maxLimit, discount) {
|
|
3720
|
+
return api.tx.xyk.buy(
|
|
3721
|
+
assetOut,
|
|
3722
|
+
assetIn,
|
|
3723
|
+
amount,
|
|
3724
|
+
maxLimit,
|
|
3725
|
+
discount
|
|
3726
|
+
);
|
|
3727
|
+
}
|
|
3728
|
+
function createPool(api, assetA, amountA, assetB, amountB) {
|
|
3729
|
+
return api.tx.xyk.createPool(
|
|
3730
|
+
assetA,
|
|
3731
|
+
amountA,
|
|
3732
|
+
assetB,
|
|
3733
|
+
amountB
|
|
3734
|
+
);
|
|
3735
|
+
}
|
|
3736
|
+
function removeLiquidity(api, assetA, assetB, liquidityAmount) {
|
|
3737
|
+
return api.tx.xyk.removeLiquidity(
|
|
3738
|
+
assetA,
|
|
3739
|
+
assetB,
|
|
3740
|
+
liquidityAmount
|
|
3741
|
+
);
|
|
3742
|
+
}
|
|
3743
|
+
function sell(api, assetIn, assetOut, amount, maxLimit, discount) {
|
|
3744
|
+
return api.tx.xyk.sell(
|
|
3745
|
+
assetIn,
|
|
3746
|
+
assetOut,
|
|
3747
|
+
amount,
|
|
3748
|
+
maxLimit,
|
|
3749
|
+
discount
|
|
3750
|
+
);
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
const index$2 = {
|
|
3754
|
+
__proto__: null,
|
|
3755
|
+
addLiquidity: addLiquidity,
|
|
3756
|
+
buy: buy,
|
|
3757
|
+
createPool: createPool,
|
|
3758
|
+
removeLiquidity: removeLiquidity,
|
|
3759
|
+
sell: sell
|
|
3760
|
+
};
|
|
3761
|
+
|
|
3711
3762
|
function openChannel(api, origin, destination, maxSize, maxMessageSize) {
|
|
3712
3763
|
return api.tx.sudo.sudo(
|
|
3713
3764
|
api.tx.parasSudoWrapper.sudoEstablishHrmpChannel(
|
|
@@ -3733,6 +3784,68 @@ const index = {
|
|
|
3733
3784
|
closeChannel: closeChannel
|
|
3734
3785
|
};
|
|
3735
3786
|
|
|
3787
|
+
class AddLiquidityBuilder {
|
|
3788
|
+
constructor(api) {
|
|
3789
|
+
this.api = api;
|
|
3790
|
+
}
|
|
3791
|
+
static create(api) {
|
|
3792
|
+
return new AddLiquidityBuilder(api);
|
|
3793
|
+
}
|
|
3794
|
+
assetA(assetA) {
|
|
3795
|
+
this._assetA = assetA;
|
|
3796
|
+
return this;
|
|
3797
|
+
}
|
|
3798
|
+
assetB(assetB) {
|
|
3799
|
+
this._assetB = assetB;
|
|
3800
|
+
return this;
|
|
3801
|
+
}
|
|
3802
|
+
amountA(amountA) {
|
|
3803
|
+
this._amountA = amountA;
|
|
3804
|
+
return this;
|
|
3805
|
+
}
|
|
3806
|
+
amountBMaxLimit(amountBMaxLimit) {
|
|
3807
|
+
this._amountBMaxLimit = amountBMaxLimit;
|
|
3808
|
+
return this;
|
|
3809
|
+
}
|
|
3810
|
+
build() {
|
|
3811
|
+
return addLiquidity(this.api, this._assetA, this._assetB, this._amountA, this._amountBMaxLimit);
|
|
3812
|
+
}
|
|
3813
|
+
}
|
|
3814
|
+
const AddLiquidityBuilder$1 = AddLiquidityBuilder;
|
|
3815
|
+
|
|
3816
|
+
class BuyBuilder {
|
|
3817
|
+
constructor(api) {
|
|
3818
|
+
this.api = api;
|
|
3819
|
+
}
|
|
3820
|
+
static create(api) {
|
|
3821
|
+
return new BuyBuilder(api);
|
|
3822
|
+
}
|
|
3823
|
+
assetOut(assetOut) {
|
|
3824
|
+
this._assetOut = assetOut;
|
|
3825
|
+
return this;
|
|
3826
|
+
}
|
|
3827
|
+
assetIn(assetIn) {
|
|
3828
|
+
this._assetIn = assetIn;
|
|
3829
|
+
return this;
|
|
3830
|
+
}
|
|
3831
|
+
amount(amount) {
|
|
3832
|
+
this._amount = amount;
|
|
3833
|
+
return this;
|
|
3834
|
+
}
|
|
3835
|
+
maxLimit(maxLimit) {
|
|
3836
|
+
this._maxLimit = maxLimit;
|
|
3837
|
+
return this;
|
|
3838
|
+
}
|
|
3839
|
+
discount(discount) {
|
|
3840
|
+
this._discount = discount;
|
|
3841
|
+
return this;
|
|
3842
|
+
}
|
|
3843
|
+
build() {
|
|
3844
|
+
return buy(this.api, this._assetOut, this._assetIn, this._amount, this._maxLimit, this._discount);
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
const BuyBuilder$1 = BuyBuilder;
|
|
3848
|
+
|
|
3736
3849
|
class CloseChannelBuilder {
|
|
3737
3850
|
constructor(api, from) {
|
|
3738
3851
|
this.api = api;
|
|
@@ -3755,6 +3868,35 @@ class CloseChannelBuilder {
|
|
|
3755
3868
|
}
|
|
3756
3869
|
const CloseChannelBuilder$1 = CloseChannelBuilder;
|
|
3757
3870
|
|
|
3871
|
+
class CreatePoolBuilder {
|
|
3872
|
+
constructor(api) {
|
|
3873
|
+
this.api = api;
|
|
3874
|
+
}
|
|
3875
|
+
static create(api) {
|
|
3876
|
+
return new CreatePoolBuilder(api);
|
|
3877
|
+
}
|
|
3878
|
+
assetA(assetA) {
|
|
3879
|
+
this._assetA = assetA;
|
|
3880
|
+
return this;
|
|
3881
|
+
}
|
|
3882
|
+
amountA(amountA) {
|
|
3883
|
+
this._amountA = amountA;
|
|
3884
|
+
return this;
|
|
3885
|
+
}
|
|
3886
|
+
assetB(assetB) {
|
|
3887
|
+
this._assetB = assetB;
|
|
3888
|
+
return this;
|
|
3889
|
+
}
|
|
3890
|
+
amountB(amountB) {
|
|
3891
|
+
this._amountB = amountB;
|
|
3892
|
+
return this;
|
|
3893
|
+
}
|
|
3894
|
+
build() {
|
|
3895
|
+
return createPool(this.api, this._assetA, this._amountA, this._assetB, this._amountB);
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
const CreatePoolBuilder$1 = CreatePoolBuilder;
|
|
3899
|
+
|
|
3758
3900
|
class OpenChannelBuilder {
|
|
3759
3901
|
constructor(api, from, to) {
|
|
3760
3902
|
this.api = api;
|
|
@@ -3800,6 +3942,64 @@ class RelayToParaBuilder {
|
|
|
3800
3942
|
}
|
|
3801
3943
|
const RelayToParaBuilder$1 = RelayToParaBuilder;
|
|
3802
3944
|
|
|
3945
|
+
class RemoveLiquidityBuilder {
|
|
3946
|
+
constructor(api) {
|
|
3947
|
+
this.api = api;
|
|
3948
|
+
}
|
|
3949
|
+
static create(api) {
|
|
3950
|
+
return new RemoveLiquidityBuilder(api);
|
|
3951
|
+
}
|
|
3952
|
+
assetA(assetA) {
|
|
3953
|
+
this._assetA = assetA;
|
|
3954
|
+
return this;
|
|
3955
|
+
}
|
|
3956
|
+
assetB(assetB) {
|
|
3957
|
+
this._assetB = assetB;
|
|
3958
|
+
return this;
|
|
3959
|
+
}
|
|
3960
|
+
liquidityAmount(liquidityAmount) {
|
|
3961
|
+
this._liquidityAmount = liquidityAmount;
|
|
3962
|
+
return this;
|
|
3963
|
+
}
|
|
3964
|
+
build() {
|
|
3965
|
+
return removeLiquidity(this.api, this._assetA, this._assetB, this._liquidityAmount);
|
|
3966
|
+
}
|
|
3967
|
+
}
|
|
3968
|
+
const RemoveLiquidityBuilder$1 = RemoveLiquidityBuilder;
|
|
3969
|
+
|
|
3970
|
+
class SellBuilder {
|
|
3971
|
+
constructor(api) {
|
|
3972
|
+
this.api = api;
|
|
3973
|
+
}
|
|
3974
|
+
static create(api) {
|
|
3975
|
+
return new SellBuilder(api);
|
|
3976
|
+
}
|
|
3977
|
+
assetIn(assetIn) {
|
|
3978
|
+
this._assetIn = assetIn;
|
|
3979
|
+
return this;
|
|
3980
|
+
}
|
|
3981
|
+
assetOut(assetOut) {
|
|
3982
|
+
this._assetOut = assetOut;
|
|
3983
|
+
return this;
|
|
3984
|
+
}
|
|
3985
|
+
amount(amount) {
|
|
3986
|
+
this._amount = amount;
|
|
3987
|
+
return this;
|
|
3988
|
+
}
|
|
3989
|
+
maxLimit(maxLimit) {
|
|
3990
|
+
this._maxLimit = maxLimit;
|
|
3991
|
+
return this;
|
|
3992
|
+
}
|
|
3993
|
+
discount(discount) {
|
|
3994
|
+
this._discount = discount;
|
|
3995
|
+
return this;
|
|
3996
|
+
}
|
|
3997
|
+
build() {
|
|
3998
|
+
return sell(this.api, this._assetIn, this._assetOut, this._amount, this._maxLimit, this._discount);
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
const SellBuilder$1 = SellBuilder;
|
|
4002
|
+
|
|
3803
4003
|
class SendBuilder {
|
|
3804
4004
|
constructor(api, from, to, currency) {
|
|
3805
4005
|
this.api = api;
|
|
@@ -3869,6 +4069,21 @@ class GeneralBuilder {
|
|
|
3869
4069
|
to(node) {
|
|
3870
4070
|
return RelayToParaBuilder$1.create(this.api, node);
|
|
3871
4071
|
}
|
|
4072
|
+
addLiquidity() {
|
|
4073
|
+
return AddLiquidityBuilder$1.create(this.api);
|
|
4074
|
+
}
|
|
4075
|
+
removeLiquidity() {
|
|
4076
|
+
return RemoveLiquidityBuilder$1.create(this.api);
|
|
4077
|
+
}
|
|
4078
|
+
buy() {
|
|
4079
|
+
return BuyBuilder$1.create(this.api);
|
|
4080
|
+
}
|
|
4081
|
+
sell() {
|
|
4082
|
+
return SellBuilder$1.create(this.api);
|
|
4083
|
+
}
|
|
4084
|
+
createPool() {
|
|
4085
|
+
return CreatePoolBuilder$1.create(this.api);
|
|
4086
|
+
}
|
|
3872
4087
|
}
|
|
3873
4088
|
function Builder(api) {
|
|
3874
4089
|
return new GeneralBuilder(api);
|
|
@@ -3876,7 +4091,8 @@ function Builder(api) {
|
|
|
3876
4091
|
|
|
3877
4092
|
exports.Builder = Builder;
|
|
3878
4093
|
exports.NODE_NAMES = NODE_NAMES;
|
|
3879
|
-
exports.assets = index$
|
|
4094
|
+
exports.assets = index$4;
|
|
3880
4095
|
exports.closeChannels = index;
|
|
3881
4096
|
exports.openChannels = index$1;
|
|
3882
|
-
exports.xcmPallet = index$
|
|
4097
|
+
exports.xcmPallet = index$3;
|
|
4098
|
+
exports.xyk = index$2;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,16 +27,38 @@ type TNodeAssets = {
|
|
|
27
27
|
};
|
|
28
28
|
type TAssetJsonMap = Record<TNode, TNodeAssets>;
|
|
29
29
|
type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
|
|
30
|
+
type Bool = 'Yes' | 'No';
|
|
30
31
|
|
|
31
32
|
declare function send(api: ApiPromise, origin: TNode, currency: string, currencyID: number, amount: any, to: string, destination?: TNode): Extrinsic;
|
|
32
33
|
declare function transferRelayToPara(api: ApiPromise, destination: TNode, amount: any, to: string): Extrinsic | never;
|
|
33
34
|
|
|
34
|
-
declare const index$
|
|
35
|
-
declare const index$
|
|
35
|
+
declare const index$4_send: typeof send;
|
|
36
|
+
declare const index$4_transferRelayToPara: typeof transferRelayToPara;
|
|
37
|
+
declare namespace index$4 {
|
|
38
|
+
export {
|
|
39
|
+
index$4_send as send,
|
|
40
|
+
index$4_transferRelayToPara as transferRelayToPara,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare function addLiquidity(api: ApiPromise, assetA: number, assetB: number, amountA: any, amountBMaxLimit: any): Extrinsic;
|
|
45
|
+
declare function buy(api: ApiPromise, assetOut: number, assetIn: number, amount: any, maxLimit: any, discount: Bool): Extrinsic;
|
|
46
|
+
declare function createPool(api: ApiPromise, assetA: number, amountA: any, assetB: number, amountB: any): Extrinsic;
|
|
47
|
+
declare function removeLiquidity(api: ApiPromise, assetA: number, assetB: number, liquidityAmount: any): Extrinsic;
|
|
48
|
+
declare function sell(api: ApiPromise, assetIn: number, assetOut: number, amount: any, maxLimit: any, discount: Bool): Extrinsic;
|
|
49
|
+
|
|
50
|
+
declare const index$3_addLiquidity: typeof addLiquidity;
|
|
51
|
+
declare const index$3_buy: typeof buy;
|
|
52
|
+
declare const index$3_createPool: typeof createPool;
|
|
53
|
+
declare const index$3_removeLiquidity: typeof removeLiquidity;
|
|
54
|
+
declare const index$3_sell: typeof sell;
|
|
36
55
|
declare namespace index$3 {
|
|
37
56
|
export {
|
|
38
|
-
index$
|
|
39
|
-
index$
|
|
57
|
+
index$3_addLiquidity as addLiquidity,
|
|
58
|
+
index$3_buy as buy,
|
|
59
|
+
index$3_createPool as createPool,
|
|
60
|
+
index$3_removeLiquidity as removeLiquidity,
|
|
61
|
+
index$3_sell as sell,
|
|
40
62
|
};
|
|
41
63
|
}
|
|
42
64
|
|
|
@@ -68,29 +90,112 @@ declare function hasSupportForAsset(node: TNode, symbol: string): boolean;
|
|
|
68
90
|
declare function getAssetDecimals(node: TNode, symbol: string): number | null;
|
|
69
91
|
declare function getParaId(node: TNode): number;
|
|
70
92
|
|
|
71
|
-
declare const
|
|
93
|
+
declare const index_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
94
|
+
declare const index_getAssetDecimals: typeof getAssetDecimals;
|
|
72
95
|
declare const index_getAssetId: typeof getAssetId;
|
|
73
|
-
declare const
|
|
96
|
+
declare const index_getAssetsObject: typeof getAssetsObject;
|
|
74
97
|
declare const index_getNativeAssets: typeof getNativeAssets;
|
|
75
98
|
declare const index_getOtherAssets: typeof getOtherAssets;
|
|
76
|
-
declare const index_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
77
|
-
declare const index_hasSupportForAsset: typeof hasSupportForAsset;
|
|
78
|
-
declare const index_getAssetDecimals: typeof getAssetDecimals;
|
|
79
99
|
declare const index_getParaId: typeof getParaId;
|
|
100
|
+
declare const index_getRelayChainSymbol: typeof getRelayChainSymbol;
|
|
101
|
+
declare const index_hasSupportForAsset: typeof hasSupportForAsset;
|
|
80
102
|
declare namespace index {
|
|
81
103
|
export {
|
|
82
|
-
|
|
104
|
+
index_getAllAssetsSymbols as getAllAssetsSymbols,
|
|
105
|
+
index_getAssetDecimals as getAssetDecimals,
|
|
83
106
|
index_getAssetId as getAssetId,
|
|
84
|
-
|
|
107
|
+
index_getAssetsObject as getAssetsObject,
|
|
85
108
|
index_getNativeAssets as getNativeAssets,
|
|
86
109
|
index_getOtherAssets as getOtherAssets,
|
|
87
|
-
index_getAllAssetsSymbols as getAllAssetsSymbols,
|
|
88
|
-
index_hasSupportForAsset as hasSupportForAsset,
|
|
89
|
-
index_getAssetDecimals as getAssetDecimals,
|
|
90
110
|
index_getParaId as getParaId,
|
|
111
|
+
index_getRelayChainSymbol as getRelayChainSymbol,
|
|
112
|
+
index_hasSupportForAsset as hasSupportForAsset,
|
|
91
113
|
};
|
|
92
114
|
}
|
|
93
115
|
|
|
116
|
+
interface FinalCreatePoolBuilder {
|
|
117
|
+
build(): Extrinsic;
|
|
118
|
+
}
|
|
119
|
+
interface AmountBCreatePoolBuilder {
|
|
120
|
+
amountB(amountB: number): FinalCreatePoolBuilder;
|
|
121
|
+
}
|
|
122
|
+
interface AssetBCreatePoolBuilder {
|
|
123
|
+
assetB(assetB: number): AmountBCreatePoolBuilder;
|
|
124
|
+
}
|
|
125
|
+
interface AmountACreatePoolBuilder {
|
|
126
|
+
amountA(amountA: number): AssetBCreatePoolBuilder;
|
|
127
|
+
}
|
|
128
|
+
interface AssetACreatePoolBuilder {
|
|
129
|
+
assetA(assetA: number): AmountACreatePoolBuilder;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface FinalSellBuilder {
|
|
133
|
+
build(): Extrinsic;
|
|
134
|
+
}
|
|
135
|
+
interface DiscountSellBuilder {
|
|
136
|
+
discount(discount: Bool): FinalSellBuilder;
|
|
137
|
+
}
|
|
138
|
+
interface MaxLimitSellBuilder {
|
|
139
|
+
maxLimit(maxLimit: number): DiscountSellBuilder;
|
|
140
|
+
}
|
|
141
|
+
interface AmountSellBuilder {
|
|
142
|
+
amount(amount: number): MaxLimitSellBuilder;
|
|
143
|
+
}
|
|
144
|
+
interface AssetOutSellBuilder {
|
|
145
|
+
assetOut(assetOut: number): AmountSellBuilder;
|
|
146
|
+
}
|
|
147
|
+
interface AssetInSellBuilder {
|
|
148
|
+
assetIn(assetIn: number): AssetOutSellBuilder;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface FinalBuyBuilder {
|
|
152
|
+
build(): Extrinsic;
|
|
153
|
+
}
|
|
154
|
+
interface DiscountBuyBuilder {
|
|
155
|
+
discount(discount: Bool): FinalBuyBuilder;
|
|
156
|
+
}
|
|
157
|
+
interface MaxLimitBuyBuilder {
|
|
158
|
+
maxLimit(maxLimit: number): DiscountBuyBuilder;
|
|
159
|
+
}
|
|
160
|
+
interface AmountBuyBuilder {
|
|
161
|
+
amount(amount: number): MaxLimitBuyBuilder;
|
|
162
|
+
}
|
|
163
|
+
interface AssetInBuyBuilder {
|
|
164
|
+
assetIn(assetIn: number): AmountBuyBuilder;
|
|
165
|
+
}
|
|
166
|
+
interface AssetOutBuyBuilder {
|
|
167
|
+
assetOut(assetOut: number): AssetInBuyBuilder;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface FinalRemoveLiquidityBuilder {
|
|
171
|
+
build(): Extrinsic;
|
|
172
|
+
}
|
|
173
|
+
interface LiquidityAmountRemoveLiquidityBuilder {
|
|
174
|
+
liquidityAmount(liquidityAmount: number): FinalRemoveLiquidityBuilder;
|
|
175
|
+
}
|
|
176
|
+
interface AssetBRemoveLiquidityBuilder {
|
|
177
|
+
assetB(assetB: number): LiquidityAmountRemoveLiquidityBuilder;
|
|
178
|
+
}
|
|
179
|
+
interface AssetARemoveLiquidityBuilder {
|
|
180
|
+
assetA(assetA: number): AssetBRemoveLiquidityBuilder;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface FinalAddLiquidityBuilder {
|
|
184
|
+
build(): Extrinsic;
|
|
185
|
+
}
|
|
186
|
+
interface AmountBMaxLimitAddLiquidityBuilder {
|
|
187
|
+
amountBMaxLimit(amountBMaxLimit: number): FinalAddLiquidityBuilder;
|
|
188
|
+
}
|
|
189
|
+
interface AmountAAddLiquidityBuilder {
|
|
190
|
+
amountA(amountA: number): AmountBMaxLimitAddLiquidityBuilder;
|
|
191
|
+
}
|
|
192
|
+
interface AssetBAddLiquidityBuilder {
|
|
193
|
+
assetB(assetB: number): AmountAAddLiquidityBuilder;
|
|
194
|
+
}
|
|
195
|
+
interface AssetAAddLiquidityBuilder {
|
|
196
|
+
assetA(assetA: number): AssetBAddLiquidityBuilder;
|
|
197
|
+
}
|
|
198
|
+
|
|
94
199
|
interface FinalRelayToParaBuilder$1 {
|
|
95
200
|
build(): Extrinsic | never;
|
|
96
201
|
}
|
|
@@ -155,7 +260,12 @@ declare class GeneralBuilder {
|
|
|
155
260
|
constructor(api: ApiPromise);
|
|
156
261
|
from(node: TNode): FromGeneralBuilder;
|
|
157
262
|
to(node: TNode): AmountRelayToParaBuilder;
|
|
263
|
+
addLiquidity(): AssetAAddLiquidityBuilder;
|
|
264
|
+
removeLiquidity(): AssetARemoveLiquidityBuilder;
|
|
265
|
+
buy(): AssetOutBuyBuilder;
|
|
266
|
+
sell(): AssetInSellBuilder;
|
|
267
|
+
createPool(): AssetACreatePoolBuilder;
|
|
158
268
|
}
|
|
159
269
|
declare function Builder(api: ApiPromise): GeneralBuilder;
|
|
160
270
|
|
|
161
|
-
export { Builder, Extrinsic, ExtrinsicFunction, NODE_NAMES, TAssetDetails, TAssetJsonMap, TNativeAssetDetails, TNode, TNodeAssets, TNodeDetails, TPalletType, TRelayChainType, TScenario, UpdateFunction, index as assets, index$1 as closeChannels, index$2 as openChannels, index$
|
|
271
|
+
export { Bool, Builder, Extrinsic, ExtrinsicFunction, NODE_NAMES, TAssetDetails, TAssetJsonMap, TNativeAssetDetails, TNode, TNodeAssets, TNodeDetails, TPalletType, TRelayChainType, TScenario, UpdateFunction, index as assets, index$1 as closeChannels, index$2 as openChannels, index$4 as xcmPallet, index$3 as xyk };
|
package/dist/index.mjs
CHANGED
|
@@ -3507,40 +3507,39 @@ const assets = {
|
|
|
3507
3507
|
const assetsMap = {
|
|
3508
3508
|
__proto__: null,
|
|
3509
3509
|
Acala: Acala,
|
|
3510
|
-
Astar: Astar,
|
|
3511
|
-
BifrostPolkadot: BifrostPolkadot,
|
|
3512
|
-
Bitgreen: Bitgreen,
|
|
3513
|
-
Centrifuge: Centrifuge,
|
|
3514
|
-
Clover: Clover,
|
|
3515
|
-
ComposableFinance: ComposableFinance,
|
|
3516
|
-
Darwinia: Darwinia,
|
|
3517
|
-
HydraDX: HydraDX,
|
|
3518
|
-
Interlay: Interlay,
|
|
3519
|
-
Kylin: Kylin,
|
|
3520
|
-
Litentry: Litentry,
|
|
3521
|
-
Moonbeam: Moonbeam,
|
|
3522
|
-
Parallel: Parallel,
|
|
3523
|
-
Statemint: Statemint,
|
|
3524
3510
|
Altair: Altair,
|
|
3525
3511
|
Amplitude: Amplitude,
|
|
3512
|
+
Astar: Astar,
|
|
3526
3513
|
Bajun: Bajun,
|
|
3527
3514
|
Basilisk: Basilisk,
|
|
3528
3515
|
BifrostKusama: BifrostKusama,
|
|
3516
|
+
BifrostPolkadot: BifrostPolkadot,
|
|
3517
|
+
Bitgreen: Bitgreen,
|
|
3529
3518
|
Calamari: Calamari,
|
|
3519
|
+
Centrifuge: Centrifuge,
|
|
3520
|
+
Clover: Clover,
|
|
3521
|
+
ComposableFinance: ComposableFinance,
|
|
3530
3522
|
Crab: Crab,
|
|
3531
3523
|
CrustShadow: CrustShadow,
|
|
3524
|
+
Darwinia: Darwinia,
|
|
3532
3525
|
Dorafactory: Dorafactory,
|
|
3533
3526
|
Encointer: Encointer,
|
|
3527
|
+
HydraDX: HydraDX,
|
|
3534
3528
|
Imbue: Imbue,
|
|
3535
3529
|
Integritee: Integritee,
|
|
3530
|
+
Interlay: Interlay,
|
|
3536
3531
|
InvArchTinker: InvArchTinker,
|
|
3537
|
-
Kico: Kico,
|
|
3538
3532
|
Karura: Karura,
|
|
3533
|
+
Kico: Kico,
|
|
3539
3534
|
Kintsugi: Kintsugi,
|
|
3535
|
+
Kylin: Kylin,
|
|
3540
3536
|
Listen: Listen,
|
|
3537
|
+
Litentry: Litentry,
|
|
3541
3538
|
Litmus: Litmus,
|
|
3542
3539
|
Mangata: Mangata,
|
|
3540
|
+
Moonbeam: Moonbeam,
|
|
3543
3541
|
Moonriver: Moonriver,
|
|
3542
|
+
Parallel: Parallel,
|
|
3544
3543
|
ParallelHeiko: ParallelHeiko,
|
|
3545
3544
|
Picasso: Picasso,
|
|
3546
3545
|
Pichiu: Pichiu,
|
|
@@ -3549,6 +3548,7 @@ const assetsMap = {
|
|
|
3549
3548
|
Robonomics: Robonomics,
|
|
3550
3549
|
Shiden: Shiden,
|
|
3551
3550
|
Statemine: Statemine,
|
|
3551
|
+
Statemint: Statemint,
|
|
3552
3552
|
Turing: Turing,
|
|
3553
3553
|
default: assets
|
|
3554
3554
|
};
|
|
@@ -3595,17 +3595,17 @@ function getParaId(node) {
|
|
|
3595
3595
|
return getAssetsObject(node).paraId;
|
|
3596
3596
|
}
|
|
3597
3597
|
|
|
3598
|
-
const index$
|
|
3598
|
+
const index$4 = {
|
|
3599
3599
|
__proto__: null,
|
|
3600
|
-
|
|
3600
|
+
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
3601
|
+
getAssetDecimals: getAssetDecimals,
|
|
3601
3602
|
getAssetId: getAssetId,
|
|
3602
|
-
|
|
3603
|
+
getAssetsObject: getAssetsObject,
|
|
3603
3604
|
getNativeAssets: getNativeAssets,
|
|
3604
3605
|
getOtherAssets: getOtherAssets,
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
getParaId: getParaId
|
|
3606
|
+
getParaId: getParaId,
|
|
3607
|
+
getRelayChainSymbol: getRelayChainSymbol,
|
|
3608
|
+
hasSupportForAsset: hasSupportForAsset
|
|
3609
3609
|
};
|
|
3610
3610
|
|
|
3611
3611
|
class InvalidCurrencyError extends Error {
|
|
@@ -3700,12 +3700,63 @@ function transferRelayToPara(api, destination, amount, to) {
|
|
|
3700
3700
|
);
|
|
3701
3701
|
}
|
|
3702
3702
|
|
|
3703
|
-
const index$
|
|
3703
|
+
const index$3 = {
|
|
3704
3704
|
__proto__: null,
|
|
3705
3705
|
send: send,
|
|
3706
3706
|
transferRelayToPara: transferRelayToPara
|
|
3707
3707
|
};
|
|
3708
3708
|
|
|
3709
|
+
function addLiquidity(api, assetA, assetB, amountA, amountBMaxLimit) {
|
|
3710
|
+
return api.tx.xyk.addLiquidity(
|
|
3711
|
+
assetA,
|
|
3712
|
+
assetB,
|
|
3713
|
+
amountA,
|
|
3714
|
+
amountBMaxLimit
|
|
3715
|
+
);
|
|
3716
|
+
}
|
|
3717
|
+
function buy(api, assetOut, assetIn, amount, maxLimit, discount) {
|
|
3718
|
+
return api.tx.xyk.buy(
|
|
3719
|
+
assetOut,
|
|
3720
|
+
assetIn,
|
|
3721
|
+
amount,
|
|
3722
|
+
maxLimit,
|
|
3723
|
+
discount
|
|
3724
|
+
);
|
|
3725
|
+
}
|
|
3726
|
+
function createPool(api, assetA, amountA, assetB, amountB) {
|
|
3727
|
+
return api.tx.xyk.createPool(
|
|
3728
|
+
assetA,
|
|
3729
|
+
amountA,
|
|
3730
|
+
assetB,
|
|
3731
|
+
amountB
|
|
3732
|
+
);
|
|
3733
|
+
}
|
|
3734
|
+
function removeLiquidity(api, assetA, assetB, liquidityAmount) {
|
|
3735
|
+
return api.tx.xyk.removeLiquidity(
|
|
3736
|
+
assetA,
|
|
3737
|
+
assetB,
|
|
3738
|
+
liquidityAmount
|
|
3739
|
+
);
|
|
3740
|
+
}
|
|
3741
|
+
function sell(api, assetIn, assetOut, amount, maxLimit, discount) {
|
|
3742
|
+
return api.tx.xyk.sell(
|
|
3743
|
+
assetIn,
|
|
3744
|
+
assetOut,
|
|
3745
|
+
amount,
|
|
3746
|
+
maxLimit,
|
|
3747
|
+
discount
|
|
3748
|
+
);
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3751
|
+
const index$2 = {
|
|
3752
|
+
__proto__: null,
|
|
3753
|
+
addLiquidity: addLiquidity,
|
|
3754
|
+
buy: buy,
|
|
3755
|
+
createPool: createPool,
|
|
3756
|
+
removeLiquidity: removeLiquidity,
|
|
3757
|
+
sell: sell
|
|
3758
|
+
};
|
|
3759
|
+
|
|
3709
3760
|
function openChannel(api, origin, destination, maxSize, maxMessageSize) {
|
|
3710
3761
|
return api.tx.sudo.sudo(
|
|
3711
3762
|
api.tx.parasSudoWrapper.sudoEstablishHrmpChannel(
|
|
@@ -3731,6 +3782,68 @@ const index = {
|
|
|
3731
3782
|
closeChannel: closeChannel
|
|
3732
3783
|
};
|
|
3733
3784
|
|
|
3785
|
+
class AddLiquidityBuilder {
|
|
3786
|
+
constructor(api) {
|
|
3787
|
+
this.api = api;
|
|
3788
|
+
}
|
|
3789
|
+
static create(api) {
|
|
3790
|
+
return new AddLiquidityBuilder(api);
|
|
3791
|
+
}
|
|
3792
|
+
assetA(assetA) {
|
|
3793
|
+
this._assetA = assetA;
|
|
3794
|
+
return this;
|
|
3795
|
+
}
|
|
3796
|
+
assetB(assetB) {
|
|
3797
|
+
this._assetB = assetB;
|
|
3798
|
+
return this;
|
|
3799
|
+
}
|
|
3800
|
+
amountA(amountA) {
|
|
3801
|
+
this._amountA = amountA;
|
|
3802
|
+
return this;
|
|
3803
|
+
}
|
|
3804
|
+
amountBMaxLimit(amountBMaxLimit) {
|
|
3805
|
+
this._amountBMaxLimit = amountBMaxLimit;
|
|
3806
|
+
return this;
|
|
3807
|
+
}
|
|
3808
|
+
build() {
|
|
3809
|
+
return addLiquidity(this.api, this._assetA, this._assetB, this._amountA, this._amountBMaxLimit);
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
const AddLiquidityBuilder$1 = AddLiquidityBuilder;
|
|
3813
|
+
|
|
3814
|
+
class BuyBuilder {
|
|
3815
|
+
constructor(api) {
|
|
3816
|
+
this.api = api;
|
|
3817
|
+
}
|
|
3818
|
+
static create(api) {
|
|
3819
|
+
return new BuyBuilder(api);
|
|
3820
|
+
}
|
|
3821
|
+
assetOut(assetOut) {
|
|
3822
|
+
this._assetOut = assetOut;
|
|
3823
|
+
return this;
|
|
3824
|
+
}
|
|
3825
|
+
assetIn(assetIn) {
|
|
3826
|
+
this._assetIn = assetIn;
|
|
3827
|
+
return this;
|
|
3828
|
+
}
|
|
3829
|
+
amount(amount) {
|
|
3830
|
+
this._amount = amount;
|
|
3831
|
+
return this;
|
|
3832
|
+
}
|
|
3833
|
+
maxLimit(maxLimit) {
|
|
3834
|
+
this._maxLimit = maxLimit;
|
|
3835
|
+
return this;
|
|
3836
|
+
}
|
|
3837
|
+
discount(discount) {
|
|
3838
|
+
this._discount = discount;
|
|
3839
|
+
return this;
|
|
3840
|
+
}
|
|
3841
|
+
build() {
|
|
3842
|
+
return buy(this.api, this._assetOut, this._assetIn, this._amount, this._maxLimit, this._discount);
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
const BuyBuilder$1 = BuyBuilder;
|
|
3846
|
+
|
|
3734
3847
|
class CloseChannelBuilder {
|
|
3735
3848
|
constructor(api, from) {
|
|
3736
3849
|
this.api = api;
|
|
@@ -3753,6 +3866,35 @@ class CloseChannelBuilder {
|
|
|
3753
3866
|
}
|
|
3754
3867
|
const CloseChannelBuilder$1 = CloseChannelBuilder;
|
|
3755
3868
|
|
|
3869
|
+
class CreatePoolBuilder {
|
|
3870
|
+
constructor(api) {
|
|
3871
|
+
this.api = api;
|
|
3872
|
+
}
|
|
3873
|
+
static create(api) {
|
|
3874
|
+
return new CreatePoolBuilder(api);
|
|
3875
|
+
}
|
|
3876
|
+
assetA(assetA) {
|
|
3877
|
+
this._assetA = assetA;
|
|
3878
|
+
return this;
|
|
3879
|
+
}
|
|
3880
|
+
amountA(amountA) {
|
|
3881
|
+
this._amountA = amountA;
|
|
3882
|
+
return this;
|
|
3883
|
+
}
|
|
3884
|
+
assetB(assetB) {
|
|
3885
|
+
this._assetB = assetB;
|
|
3886
|
+
return this;
|
|
3887
|
+
}
|
|
3888
|
+
amountB(amountB) {
|
|
3889
|
+
this._amountB = amountB;
|
|
3890
|
+
return this;
|
|
3891
|
+
}
|
|
3892
|
+
build() {
|
|
3893
|
+
return createPool(this.api, this._assetA, this._amountA, this._assetB, this._amountB);
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
const CreatePoolBuilder$1 = CreatePoolBuilder;
|
|
3897
|
+
|
|
3756
3898
|
class OpenChannelBuilder {
|
|
3757
3899
|
constructor(api, from, to) {
|
|
3758
3900
|
this.api = api;
|
|
@@ -3798,6 +3940,64 @@ class RelayToParaBuilder {
|
|
|
3798
3940
|
}
|
|
3799
3941
|
const RelayToParaBuilder$1 = RelayToParaBuilder;
|
|
3800
3942
|
|
|
3943
|
+
class RemoveLiquidityBuilder {
|
|
3944
|
+
constructor(api) {
|
|
3945
|
+
this.api = api;
|
|
3946
|
+
}
|
|
3947
|
+
static create(api) {
|
|
3948
|
+
return new RemoveLiquidityBuilder(api);
|
|
3949
|
+
}
|
|
3950
|
+
assetA(assetA) {
|
|
3951
|
+
this._assetA = assetA;
|
|
3952
|
+
return this;
|
|
3953
|
+
}
|
|
3954
|
+
assetB(assetB) {
|
|
3955
|
+
this._assetB = assetB;
|
|
3956
|
+
return this;
|
|
3957
|
+
}
|
|
3958
|
+
liquidityAmount(liquidityAmount) {
|
|
3959
|
+
this._liquidityAmount = liquidityAmount;
|
|
3960
|
+
return this;
|
|
3961
|
+
}
|
|
3962
|
+
build() {
|
|
3963
|
+
return removeLiquidity(this.api, this._assetA, this._assetB, this._liquidityAmount);
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
const RemoveLiquidityBuilder$1 = RemoveLiquidityBuilder;
|
|
3967
|
+
|
|
3968
|
+
class SellBuilder {
|
|
3969
|
+
constructor(api) {
|
|
3970
|
+
this.api = api;
|
|
3971
|
+
}
|
|
3972
|
+
static create(api) {
|
|
3973
|
+
return new SellBuilder(api);
|
|
3974
|
+
}
|
|
3975
|
+
assetIn(assetIn) {
|
|
3976
|
+
this._assetIn = assetIn;
|
|
3977
|
+
return this;
|
|
3978
|
+
}
|
|
3979
|
+
assetOut(assetOut) {
|
|
3980
|
+
this._assetOut = assetOut;
|
|
3981
|
+
return this;
|
|
3982
|
+
}
|
|
3983
|
+
amount(amount) {
|
|
3984
|
+
this._amount = amount;
|
|
3985
|
+
return this;
|
|
3986
|
+
}
|
|
3987
|
+
maxLimit(maxLimit) {
|
|
3988
|
+
this._maxLimit = maxLimit;
|
|
3989
|
+
return this;
|
|
3990
|
+
}
|
|
3991
|
+
discount(discount) {
|
|
3992
|
+
this._discount = discount;
|
|
3993
|
+
return this;
|
|
3994
|
+
}
|
|
3995
|
+
build() {
|
|
3996
|
+
return sell(this.api, this._assetIn, this._assetOut, this._amount, this._maxLimit, this._discount);
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
const SellBuilder$1 = SellBuilder;
|
|
4000
|
+
|
|
3801
4001
|
class SendBuilder {
|
|
3802
4002
|
constructor(api, from, to, currency) {
|
|
3803
4003
|
this.api = api;
|
|
@@ -3867,9 +4067,24 @@ class GeneralBuilder {
|
|
|
3867
4067
|
to(node) {
|
|
3868
4068
|
return RelayToParaBuilder$1.create(this.api, node);
|
|
3869
4069
|
}
|
|
4070
|
+
addLiquidity() {
|
|
4071
|
+
return AddLiquidityBuilder$1.create(this.api);
|
|
4072
|
+
}
|
|
4073
|
+
removeLiquidity() {
|
|
4074
|
+
return RemoveLiquidityBuilder$1.create(this.api);
|
|
4075
|
+
}
|
|
4076
|
+
buy() {
|
|
4077
|
+
return BuyBuilder$1.create(this.api);
|
|
4078
|
+
}
|
|
4079
|
+
sell() {
|
|
4080
|
+
return SellBuilder$1.create(this.api);
|
|
4081
|
+
}
|
|
4082
|
+
createPool() {
|
|
4083
|
+
return CreatePoolBuilder$1.create(this.api);
|
|
4084
|
+
}
|
|
3870
4085
|
}
|
|
3871
4086
|
function Builder(api) {
|
|
3872
4087
|
return new GeneralBuilder(api);
|
|
3873
4088
|
}
|
|
3874
4089
|
|
|
3875
|
-
export { Builder, NODE_NAMES, index$
|
|
4090
|
+
export { Builder, NODE_NAMES, index$4 as assets, index as closeChannels, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
|