@paraspell/sdk 0.0.18 → 0.0.20
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 +36 -4
- package/dist/index.cjs +1479 -560
- package/dist/index.d.ts +85 -9
- package/dist/index.mjs +1479 -561
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,11 @@ pnpm install @paraspell/sdk
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
|
+
/////////NEW BUILDER STYLE IMPORT///////////
|
|
47
|
+
|
|
48
|
+
import { Builder } from '@paraspell/sdk'
|
|
49
|
+
|
|
50
|
+
/////////OLD STYLE IMPORT & IMPORT FOR ASSET PALLET//////////
|
|
46
51
|
|
|
47
52
|
// ESM
|
|
48
53
|
import * as paraspell from '@paraspell/sdk'
|
|
@@ -60,6 +65,25 @@ const paraspell = require('@paraspell/sdk')
|
|
|
60
65
|
|
|
61
66
|
//XCM pallet (Combined xTokens, polkadotXCM, ormlXTokens, XcmPallet & relayerXCM):
|
|
62
67
|
|
|
68
|
+
//////////NEW BUILDER PATTERN XCM & HRMP CONSTRUCTION//////////
|
|
69
|
+
|
|
70
|
+
//Transfer tokens from Parachain to Parachain
|
|
71
|
+
Builder(api).from(NODE).to(NODE).currency(CurrencyString).currencyId(currencyId).amount(amount).address(address).build()
|
|
72
|
+
|
|
73
|
+
//Transfer tokens from Relay chain to Parachain
|
|
74
|
+
Builder(api).to(NODE).amount(amount).address(address).build()
|
|
75
|
+
|
|
76
|
+
//Transfer tokens from Parachain to Relay chain
|
|
77
|
+
Builder(api).from(NODE).currency(CurrencyString).currencyId(currencyId).amount(amount).address(address).build()
|
|
78
|
+
|
|
79
|
+
//Close HRMP channels
|
|
80
|
+
Builder(api).from(NODE).closeChannel().inbound(inbound).outbound(outbound).build()
|
|
81
|
+
|
|
82
|
+
//Open HRMP channels
|
|
83
|
+
Builder(api).from(NODE).to(NODE).openChannel().maxSize(maxSize).maxMessageSize(maxMsgSize).build()
|
|
84
|
+
|
|
85
|
+
///////////OLD STYLE XCM & HRMP CONSTRUCTION//////////////
|
|
86
|
+
|
|
63
87
|
//Transfer tokens from Parachain to Parachain
|
|
64
88
|
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
89
|
|
|
@@ -70,16 +94,14 @@ paraspell.xcmPallet.send(api: ApiPromise, origin: origin Parachain name strin
|
|
|
70
94
|
paraspell.xcmPallet.transferRelayToPara(api: ApiPromise, destination: destination Parachain ID, amount: any, to: destination address string)
|
|
71
95
|
|
|
72
96
|
//hrmp pallet:
|
|
73
|
-
|
|
74
97
|
//Close HRMP channels
|
|
75
98
|
paraspell.closeChannels.closeChannel(api: ApiPromise, origin: origin Parachain ID, inbound: number, outbound: number)
|
|
76
99
|
|
|
77
|
-
|
|
78
100
|
//parasSudoWrapper pallet:
|
|
79
|
-
|
|
80
101
|
//Open HRMP channels
|
|
81
102
|
paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain ID, destination: destination Parachain ID, maxSize: number, maxMessageSize: number)
|
|
82
103
|
|
|
104
|
+
////////ASSET PALLET CONSTRUCTION UNCHANGED////////
|
|
83
105
|
|
|
84
106
|
//Asset pallet
|
|
85
107
|
|
|
@@ -104,8 +126,15 @@ paraspell.assets.getAllAssetsSymbols(node: TNode)
|
|
|
104
126
|
//Checks if node supports particular asset. (Both native and foreign assets are searched). Returns boolean
|
|
105
127
|
paraspell.assets.hasSupportForAsset(node: TNode, symbol: string)
|
|
106
128
|
|
|
129
|
+
//Get decimals for specific asset
|
|
130
|
+
paraspell.assets.getAssetDecimals(node: TNode, symbol: string)
|
|
131
|
+
|
|
132
|
+
//Get specific node id
|
|
133
|
+
paraspell.assets.getParaId(node: TNode)
|
|
134
|
+
|
|
107
135
|
//Import all compatible nodes as constant:
|
|
108
136
|
paraspell.NODE_NAMES
|
|
137
|
+
|
|
109
138
|
```
|
|
110
139
|
|
|
111
140
|
##### 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)
|
|
@@ -132,8 +161,11 @@ paraspell.NODE_NAMES
|
|
|
132
161
|
|
|
133
162
|
|
|
134
163
|
## Founded by
|
|
164
|
+
[<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)
|
|
165
|
+
[<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)
|
|
166
|
+
|
|
135
167
|
[](https://bsx.fi/)
|
|
136
|
-
|
|
168
|
+
|
|
137
169
|
|
|
138
170
|
|
|
139
171
|
## License
|