@moonbeam-network/xcm-sdk 0.0.24 → 0.0.25
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 +15 -10
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem. With the SDK, you don't need to worry about determining the multilocation of the origin or destination assets or which extrinsics are used on which networks to send XCM transfers. To deposit or withdraw assets, you simply define the asset and origin chain you want to deposit from or withdraw back to, along with the sending account's signer, and the amount to send.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Documentation
|
|
6
|
+
|
|
7
|
+
- [usage](https://docs.moonbeam.network/builders/xcm/xcm-sdk/xcm-sdk/)
|
|
8
|
+
- [references](https://docs.moonbeam.network/builders/xcm/xcm-sdk/reference/)
|
|
9
|
+
|
|
10
|
+
# Installation
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
13
|
npm i @moonbeam-network/xcm-config @moonbeam-network/xcm-sdk
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
# Usage
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
## Init
|
|
14
19
|
|
|
15
20
|
```typescript
|
|
16
21
|
import { init } from '@moonbeam-network/xcm-sdk';
|
|
@@ -24,14 +29,14 @@ const { moonbeam } = init({
|
|
|
24
29
|
});
|
|
25
30
|
```
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
## Accounts
|
|
28
33
|
|
|
29
34
|
```typescript
|
|
30
35
|
const moonbeamAddress = '0xeF46c7649270C912704fB09B75097f6E32208b85';
|
|
31
36
|
const substrateAddress = '5DG5Fn3ww3KPza1RLoap6QJNzQfEvRebxypDGp35YuMX5y2K';
|
|
32
37
|
```
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
## Deposit
|
|
35
40
|
|
|
36
41
|
```typescript
|
|
37
42
|
// moonbeam.symbols is a list of asset symbols that you can deposit/withdraw
|
|
@@ -48,7 +53,7 @@ const { min, send } = await from(chains[0]).get(
|
|
|
48
53
|
await send(min, (event) => console.log(event));
|
|
49
54
|
```
|
|
50
55
|
|
|
51
|
-
|
|
56
|
+
## Withdraw
|
|
52
57
|
|
|
53
58
|
```typescript
|
|
54
59
|
const { chains, to } = moonbeam.withdraw(moonbeam.symbols[0]);
|
|
@@ -62,7 +67,7 @@ const { min, send } = await to(chains[0]).get(
|
|
|
62
67
|
await send(min, (event) => console.log(event));
|
|
63
68
|
```
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
## Get balances
|
|
66
71
|
|
|
67
72
|
```typescript
|
|
68
73
|
const unsubscribe = await moonbeam.subscribeToAssetsBalanceInfo(
|
|
@@ -83,7 +88,7 @@ const unsubscribe = await moonbeam.subscribeToAssetsBalanceInfo(
|
|
|
83
88
|
unsubscribe();
|
|
84
89
|
```
|
|
85
90
|
|
|
86
|
-
|
|
91
|
+
# Examples
|
|
87
92
|
|
|
88
93
|
- [simple](https://github.com/PureStake/xcm-sdk/blob/main/packages/sdk/examples/simple)
|
|
89
94
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbeam-network/xcm-sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.25",
|
|
4
|
+
"description": "The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem",
|
|
5
5
|
"author": "PureStake",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"main": "./build/cjs/src/index.js",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@moonbeam-network/api-augment": "^0.1700.0",
|
|
41
|
-
"@moonbeam-network/xcm-config": "^0.0.
|
|
41
|
+
"@moonbeam-network/xcm-config": "^0.0.25",
|
|
42
42
|
"@polkadot/api": "^9.1.1",
|
|
43
43
|
"@polkadot/types": "^9.1.1",
|
|
44
44
|
"@polkadot/util": "^10.1.3",
|