@paraspell/sdk 0.0.19 → 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 +68 -12
- package/dist/index.cjs +383 -25
- package/dist/index.d.ts +192 -15
- package/dist/index.mjs +380 -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,25 +42,45 @@ 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
|
|
47
|
+
import { Builder } from '@paraspell/sdk'
|
|
48
|
+
```
|
|
46
49
|
|
|
50
|
+
Old function like import (With assets):
|
|
51
|
+
```js
|
|
47
52
|
// ESM
|
|
48
53
|
import * as paraspell from '@paraspell/sdk'
|
|
49
54
|
|
|
50
55
|
// CommonJS
|
|
51
56
|
const paraspell = require('@paraspell/sdk')
|
|
52
|
-
|
|
53
57
|
```
|
|
54
58
|
|
|
55
59
|
|
|
56
60
|
|
|
57
61
|
## Currently implemented pallets
|
|
62
|
+
XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
|
|
58
63
|
|
|
64
|
+
Builder pattern XCM & HRMP construction
|
|
59
65
|
```ts
|
|
66
|
+
//Transfer tokens from Parachain to Parachain
|
|
67
|
+
Builder(api).from(NODE).to(NODE).currency(CurrencyString).currencyId(currencyId).amount(amount).address(address).build()
|
|
68
|
+
|
|
69
|
+
//Transfer tokens from Relay chain to Parachain
|
|
70
|
+
Builder(api).to(NODE).amount(amount).address(address).build()
|
|
71
|
+
|
|
72
|
+
//Transfer tokens from Parachain to Relay chain
|
|
73
|
+
Builder(api).from(NODE).currency(CurrencyString).currencyId(currencyId).amount(amount).address(address).build()
|
|
74
|
+
|
|
75
|
+
//Close HRMP channels
|
|
76
|
+
Builder(api).from(NODE).closeChannel().inbound(inbound).outbound(outbound).build()
|
|
60
77
|
|
|
61
|
-
//
|
|
78
|
+
//Open HRMP channels
|
|
79
|
+
Builder(api).from(NODE).to(NODE).openChannel().maxSize(maxSize).maxMessageSize(maxMsgSize).build()'
|
|
80
|
+
```
|
|
62
81
|
|
|
82
|
+
Function pattern XCM & HRMP construction
|
|
83
|
+
```ts
|
|
63
84
|
//Transfer tokens from Parachain to Parachain
|
|
64
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)
|
|
65
86
|
|
|
@@ -70,19 +91,16 @@ paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name strin
|
|
|
70
91
|
paraspell.xcmPallet.transferRelayToPara(api: ApiPromise, destination: destination Parachain ID, amount: any, to: destination address string)
|
|
71
92
|
|
|
72
93
|
//hrmp pallet:
|
|
73
|
-
|
|
74
94
|
//Close HRMP channels
|
|
75
95
|
paraspell.closeChannels.closeChannel(api: ApiPromise, origin: origin Parachain ID, inbound: number, outbound: number)
|
|
76
96
|
|
|
77
|
-
|
|
78
97
|
//parasSudoWrapper pallet:
|
|
79
|
-
|
|
80
98
|
//Open HRMP channels
|
|
81
99
|
paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain ID, destination: destination Parachain ID, maxSize: number, maxMessageSize: number)
|
|
100
|
+
```
|
|
101
|
+
Asset pallet contruction:
|
|
82
102
|
|
|
83
|
-
|
|
84
|
-
//Asset pallet
|
|
85
|
-
|
|
103
|
+
```ts
|
|
86
104
|
//Returns assets object from assets.json for particular node including information about native and foreign assets
|
|
87
105
|
paraspell.assets.getAssetsObject(node: TNode)
|
|
88
106
|
|
|
@@ -112,7 +130,42 @@ paraspell.assets.getParaId(node: TNode)
|
|
|
112
130
|
|
|
113
131
|
//Import all compatible nodes as constant:
|
|
114
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()
|
|
115
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)
|
|
166
|
+
|
|
167
|
+
//Sell specific asset from pool
|
|
168
|
+
paraspell.xyk.sell(api: ApiPromise, assetIn: number, assetOut: number, amount: any, maxLimit: any, discount: Bool)
|
|
116
169
|
```
|
|
117
170
|
|
|
118
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)
|
|
@@ -139,8 +192,11 @@ paraspell.NODE_NAMES
|
|
|
139
192
|
|
|
140
193
|
|
|
141
194
|
## Founded by
|
|
195
|
+
[<img width="245" alt="web3 foundation_grants_badge_black" src="https://user-images.githubusercontent.com/55763425/211145923-f7ee2a57-3e63-4b7d-9674-2da9db46b2ee.png">](https://github.com/w3f/Grants-Program/pull/1245)
|
|
196
|
+
[<img width="245" alt="web3 foundation_grants_badge_white (1)" src="https://user-images.githubusercontent.com/55763425/211069914-bbec9e28-7a0d-417b-8149-087b7f04e57e.png">](https://github.com/w3f/Grants-Program/pull/1245)
|
|
197
|
+
|
|
142
198
|
[](https://bsx.fi/)
|
|
143
|
-
|
|
199
|
+
|
|
144
200
|
|
|
145
201
|
|
|
146
202
|
## License
|
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,8 +3784,315 @@ 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
|
+
|
|
3849
|
+
class CloseChannelBuilder {
|
|
3850
|
+
constructor(api, from) {
|
|
3851
|
+
this.api = api;
|
|
3852
|
+
this.from = from;
|
|
3853
|
+
}
|
|
3854
|
+
static create(api, from) {
|
|
3855
|
+
return new CloseChannelBuilder(api, from);
|
|
3856
|
+
}
|
|
3857
|
+
inbound(inbound) {
|
|
3858
|
+
this._inbound = inbound;
|
|
3859
|
+
return this;
|
|
3860
|
+
}
|
|
3861
|
+
outbound(outbound) {
|
|
3862
|
+
this._outbound = outbound;
|
|
3863
|
+
return this;
|
|
3864
|
+
}
|
|
3865
|
+
build() {
|
|
3866
|
+
return closeChannel(this.api, this.from, this._inbound, this._outbound);
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
const CloseChannelBuilder$1 = CloseChannelBuilder;
|
|
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
|
+
|
|
3900
|
+
class OpenChannelBuilder {
|
|
3901
|
+
constructor(api, from, to) {
|
|
3902
|
+
this.api = api;
|
|
3903
|
+
this.from = from;
|
|
3904
|
+
this.to = to;
|
|
3905
|
+
}
|
|
3906
|
+
static create(api, from, to) {
|
|
3907
|
+
return new OpenChannelBuilder(api, from, to);
|
|
3908
|
+
}
|
|
3909
|
+
maxSize(size) {
|
|
3910
|
+
this._maxSize = size;
|
|
3911
|
+
return this;
|
|
3912
|
+
}
|
|
3913
|
+
maxMessageSize(size) {
|
|
3914
|
+
this._maxMessageSize = size;
|
|
3915
|
+
return this;
|
|
3916
|
+
}
|
|
3917
|
+
build() {
|
|
3918
|
+
return openChannel(this.api, this.from, this.to, this._maxSize, this._maxMessageSize);
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
const OpenChannelBuilder$1 = OpenChannelBuilder;
|
|
3922
|
+
|
|
3923
|
+
class RelayToParaBuilder {
|
|
3924
|
+
constructor(api, to) {
|
|
3925
|
+
this.api = api;
|
|
3926
|
+
this.to = to;
|
|
3927
|
+
}
|
|
3928
|
+
static create(api, to) {
|
|
3929
|
+
return new RelayToParaBuilder(api, to);
|
|
3930
|
+
}
|
|
3931
|
+
amount(amount) {
|
|
3932
|
+
this._amount = amount;
|
|
3933
|
+
return this;
|
|
3934
|
+
}
|
|
3935
|
+
address(address) {
|
|
3936
|
+
this._address = address;
|
|
3937
|
+
return this;
|
|
3938
|
+
}
|
|
3939
|
+
build() {
|
|
3940
|
+
return transferRelayToPara(this.api, this.to, this._amount, this._address);
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
const RelayToParaBuilder$1 = RelayToParaBuilder;
|
|
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
|
+
|
|
4003
|
+
class SendBuilder {
|
|
4004
|
+
constructor(api, from, to, currency) {
|
|
4005
|
+
this.api = api;
|
|
4006
|
+
this.from = from;
|
|
4007
|
+
this.to = to;
|
|
4008
|
+
this.currency = currency;
|
|
4009
|
+
}
|
|
4010
|
+
static createParaToRelay(api, from, currency) {
|
|
4011
|
+
return new SendBuilder(api, from, void 0, currency);
|
|
4012
|
+
}
|
|
4013
|
+
static createParaToPara(api, from, to, currency) {
|
|
4014
|
+
return new SendBuilder(api, from, to, currency);
|
|
4015
|
+
}
|
|
4016
|
+
currencyId(currencyId) {
|
|
4017
|
+
this._currencyId = currencyId;
|
|
4018
|
+
return this;
|
|
4019
|
+
}
|
|
4020
|
+
amount(amount) {
|
|
4021
|
+
this._amount = amount;
|
|
4022
|
+
return this;
|
|
4023
|
+
}
|
|
4024
|
+
address(address) {
|
|
4025
|
+
this._address = address;
|
|
4026
|
+
return this;
|
|
4027
|
+
}
|
|
4028
|
+
build() {
|
|
4029
|
+
return send(this.api, this.from, this.currency, this._currencyId, this._amount, this._address, this.to);
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
const SendBuilder$1 = SendBuilder;
|
|
4033
|
+
|
|
4034
|
+
class ToGeneralBuilder {
|
|
4035
|
+
constructor(api, from, to) {
|
|
4036
|
+
this.api = api;
|
|
4037
|
+
this.from = from;
|
|
4038
|
+
this.to = to;
|
|
4039
|
+
}
|
|
4040
|
+
currency(currency) {
|
|
4041
|
+
return SendBuilder$1.createParaToPara(this.api, this.from, this.to, currency);
|
|
4042
|
+
}
|
|
4043
|
+
openChannel() {
|
|
4044
|
+
return OpenChannelBuilder$1.create(this.api, this.from, this.to);
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
class FromGeneralBuilder {
|
|
4048
|
+
constructor(api, from) {
|
|
4049
|
+
this.api = api;
|
|
4050
|
+
this.from = from;
|
|
4051
|
+
}
|
|
4052
|
+
to(node) {
|
|
4053
|
+
return new ToGeneralBuilder(this.api, this.from, node);
|
|
4054
|
+
}
|
|
4055
|
+
currency(currency) {
|
|
4056
|
+
return SendBuilder$1.createParaToRelay(this.api, this.from, currency);
|
|
4057
|
+
}
|
|
4058
|
+
closeChannel() {
|
|
4059
|
+
return CloseChannelBuilder$1.create(this.api, this.from);
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
class GeneralBuilder {
|
|
4063
|
+
constructor(api) {
|
|
4064
|
+
this.api = api;
|
|
4065
|
+
}
|
|
4066
|
+
from(node) {
|
|
4067
|
+
return new FromGeneralBuilder(this.api, node);
|
|
4068
|
+
}
|
|
4069
|
+
to(node) {
|
|
4070
|
+
return RelayToParaBuilder$1.create(this.api, node);
|
|
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
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
function Builder(api) {
|
|
4089
|
+
return new GeneralBuilder(api);
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
exports.Builder = Builder;
|
|
3736
4093
|
exports.NODE_NAMES = NODE_NAMES;
|
|
3737
|
-
exports.assets = index$
|
|
4094
|
+
exports.assets = index$4;
|
|
3738
4095
|
exports.closeChannels = index;
|
|
3739
4096
|
exports.openChannels = index$1;
|
|
3740
|
-
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,27 +90,182 @@ 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
|
|
|
94
|
-
|
|
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
|
+
|
|
199
|
+
interface FinalRelayToParaBuilder$1 {
|
|
200
|
+
build(): Extrinsic | never;
|
|
201
|
+
}
|
|
202
|
+
interface AddressRelayToParaBuilder {
|
|
203
|
+
address(address: string): FinalRelayToParaBuilder$1;
|
|
204
|
+
}
|
|
205
|
+
interface AmountRelayToParaBuilder {
|
|
206
|
+
amount(amount: number): AddressRelayToParaBuilder;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface FinalCloseChannelBuilder {
|
|
210
|
+
build(): Extrinsic;
|
|
211
|
+
}
|
|
212
|
+
interface OutboundCloseChannelBuilder {
|
|
213
|
+
outbound(inbound: number): FinalCloseChannelBuilder;
|
|
214
|
+
}
|
|
215
|
+
interface InboundCloseChannelBuilder {
|
|
216
|
+
inbound(inbound: number): OutboundCloseChannelBuilder;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface FinalOpenChannelBuilder {
|
|
220
|
+
build(): Extrinsic;
|
|
221
|
+
}
|
|
222
|
+
interface MaxMessageSizeOpenChannelBuilder {
|
|
223
|
+
maxMessageSize(size: number): FinalOpenChannelBuilder;
|
|
224
|
+
}
|
|
225
|
+
interface MaxSizeOpenChannelBuilder {
|
|
226
|
+
maxSize(size: number): MaxMessageSizeOpenChannelBuilder;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface FinalRelayToParaBuilder {
|
|
230
|
+
build(): Extrinsic | never;
|
|
231
|
+
}
|
|
232
|
+
interface AddressSendBuilder {
|
|
233
|
+
address(address: string): FinalRelayToParaBuilder;
|
|
234
|
+
}
|
|
235
|
+
interface AmountSendBuilder {
|
|
236
|
+
amount(amount: any): AddressSendBuilder;
|
|
237
|
+
}
|
|
238
|
+
interface CurrencyIdSendBuilder {
|
|
239
|
+
currencyId(currencyId: number): AmountSendBuilder;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare class ToGeneralBuilder {
|
|
243
|
+
private api;
|
|
244
|
+
private from;
|
|
245
|
+
private to;
|
|
246
|
+
constructor(api: ApiPromise, from: TNode, to: TNode);
|
|
247
|
+
currency(currency: string): CurrencyIdSendBuilder;
|
|
248
|
+
openChannel(): MaxSizeOpenChannelBuilder;
|
|
249
|
+
}
|
|
250
|
+
declare class FromGeneralBuilder {
|
|
251
|
+
private api;
|
|
252
|
+
private from;
|
|
253
|
+
constructor(api: ApiPromise, from: TNode);
|
|
254
|
+
to(node: TNode): ToGeneralBuilder;
|
|
255
|
+
currency(currency: string): CurrencyIdSendBuilder;
|
|
256
|
+
closeChannel(): InboundCloseChannelBuilder;
|
|
257
|
+
}
|
|
258
|
+
declare class GeneralBuilder {
|
|
259
|
+
private api;
|
|
260
|
+
constructor(api: ApiPromise);
|
|
261
|
+
from(node: TNode): FromGeneralBuilder;
|
|
262
|
+
to(node: TNode): AmountRelayToParaBuilder;
|
|
263
|
+
addLiquidity(): AssetAAddLiquidityBuilder;
|
|
264
|
+
removeLiquidity(): AssetARemoveLiquidityBuilder;
|
|
265
|
+
buy(): AssetOutBuyBuilder;
|
|
266
|
+
sell(): AssetInSellBuilder;
|
|
267
|
+
createPool(): AssetACreatePoolBuilder;
|
|
268
|
+
}
|
|
269
|
+
declare function Builder(api: ApiPromise): GeneralBuilder;
|
|
270
|
+
|
|
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,4 +3782,309 @@ const index = {
|
|
|
3731
3782
|
closeChannel: closeChannel
|
|
3732
3783
|
};
|
|
3733
3784
|
|
|
3734
|
-
|
|
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
|
+
|
|
3847
|
+
class CloseChannelBuilder {
|
|
3848
|
+
constructor(api, from) {
|
|
3849
|
+
this.api = api;
|
|
3850
|
+
this.from = from;
|
|
3851
|
+
}
|
|
3852
|
+
static create(api, from) {
|
|
3853
|
+
return new CloseChannelBuilder(api, from);
|
|
3854
|
+
}
|
|
3855
|
+
inbound(inbound) {
|
|
3856
|
+
this._inbound = inbound;
|
|
3857
|
+
return this;
|
|
3858
|
+
}
|
|
3859
|
+
outbound(outbound) {
|
|
3860
|
+
this._outbound = outbound;
|
|
3861
|
+
return this;
|
|
3862
|
+
}
|
|
3863
|
+
build() {
|
|
3864
|
+
return closeChannel(this.api, this.from, this._inbound, this._outbound);
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
const CloseChannelBuilder$1 = CloseChannelBuilder;
|
|
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
|
+
|
|
3898
|
+
class OpenChannelBuilder {
|
|
3899
|
+
constructor(api, from, to) {
|
|
3900
|
+
this.api = api;
|
|
3901
|
+
this.from = from;
|
|
3902
|
+
this.to = to;
|
|
3903
|
+
}
|
|
3904
|
+
static create(api, from, to) {
|
|
3905
|
+
return new OpenChannelBuilder(api, from, to);
|
|
3906
|
+
}
|
|
3907
|
+
maxSize(size) {
|
|
3908
|
+
this._maxSize = size;
|
|
3909
|
+
return this;
|
|
3910
|
+
}
|
|
3911
|
+
maxMessageSize(size) {
|
|
3912
|
+
this._maxMessageSize = size;
|
|
3913
|
+
return this;
|
|
3914
|
+
}
|
|
3915
|
+
build() {
|
|
3916
|
+
return openChannel(this.api, this.from, this.to, this._maxSize, this._maxMessageSize);
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
const OpenChannelBuilder$1 = OpenChannelBuilder;
|
|
3920
|
+
|
|
3921
|
+
class RelayToParaBuilder {
|
|
3922
|
+
constructor(api, to) {
|
|
3923
|
+
this.api = api;
|
|
3924
|
+
this.to = to;
|
|
3925
|
+
}
|
|
3926
|
+
static create(api, to) {
|
|
3927
|
+
return new RelayToParaBuilder(api, to);
|
|
3928
|
+
}
|
|
3929
|
+
amount(amount) {
|
|
3930
|
+
this._amount = amount;
|
|
3931
|
+
return this;
|
|
3932
|
+
}
|
|
3933
|
+
address(address) {
|
|
3934
|
+
this._address = address;
|
|
3935
|
+
return this;
|
|
3936
|
+
}
|
|
3937
|
+
build() {
|
|
3938
|
+
return transferRelayToPara(this.api, this.to, this._amount, this._address);
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
const RelayToParaBuilder$1 = RelayToParaBuilder;
|
|
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
|
+
|
|
4001
|
+
class SendBuilder {
|
|
4002
|
+
constructor(api, from, to, currency) {
|
|
4003
|
+
this.api = api;
|
|
4004
|
+
this.from = from;
|
|
4005
|
+
this.to = to;
|
|
4006
|
+
this.currency = currency;
|
|
4007
|
+
}
|
|
4008
|
+
static createParaToRelay(api, from, currency) {
|
|
4009
|
+
return new SendBuilder(api, from, void 0, currency);
|
|
4010
|
+
}
|
|
4011
|
+
static createParaToPara(api, from, to, currency) {
|
|
4012
|
+
return new SendBuilder(api, from, to, currency);
|
|
4013
|
+
}
|
|
4014
|
+
currencyId(currencyId) {
|
|
4015
|
+
this._currencyId = currencyId;
|
|
4016
|
+
return this;
|
|
4017
|
+
}
|
|
4018
|
+
amount(amount) {
|
|
4019
|
+
this._amount = amount;
|
|
4020
|
+
return this;
|
|
4021
|
+
}
|
|
4022
|
+
address(address) {
|
|
4023
|
+
this._address = address;
|
|
4024
|
+
return this;
|
|
4025
|
+
}
|
|
4026
|
+
build() {
|
|
4027
|
+
return send(this.api, this.from, this.currency, this._currencyId, this._amount, this._address, this.to);
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
const SendBuilder$1 = SendBuilder;
|
|
4031
|
+
|
|
4032
|
+
class ToGeneralBuilder {
|
|
4033
|
+
constructor(api, from, to) {
|
|
4034
|
+
this.api = api;
|
|
4035
|
+
this.from = from;
|
|
4036
|
+
this.to = to;
|
|
4037
|
+
}
|
|
4038
|
+
currency(currency) {
|
|
4039
|
+
return SendBuilder$1.createParaToPara(this.api, this.from, this.to, currency);
|
|
4040
|
+
}
|
|
4041
|
+
openChannel() {
|
|
4042
|
+
return OpenChannelBuilder$1.create(this.api, this.from, this.to);
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
class FromGeneralBuilder {
|
|
4046
|
+
constructor(api, from) {
|
|
4047
|
+
this.api = api;
|
|
4048
|
+
this.from = from;
|
|
4049
|
+
}
|
|
4050
|
+
to(node) {
|
|
4051
|
+
return new ToGeneralBuilder(this.api, this.from, node);
|
|
4052
|
+
}
|
|
4053
|
+
currency(currency) {
|
|
4054
|
+
return SendBuilder$1.createParaToRelay(this.api, this.from, currency);
|
|
4055
|
+
}
|
|
4056
|
+
closeChannel() {
|
|
4057
|
+
return CloseChannelBuilder$1.create(this.api, this.from);
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
class GeneralBuilder {
|
|
4061
|
+
constructor(api) {
|
|
4062
|
+
this.api = api;
|
|
4063
|
+
}
|
|
4064
|
+
from(node) {
|
|
4065
|
+
return new FromGeneralBuilder(this.api, node);
|
|
4066
|
+
}
|
|
4067
|
+
to(node) {
|
|
4068
|
+
return RelayToParaBuilder$1.create(this.api, node);
|
|
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
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
function Builder(api) {
|
|
4087
|
+
return new GeneralBuilder(api);
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
export { Builder, NODE_NAMES, index$4 as assets, index as closeChannels, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
|