@moonbeam-network/xcm-sdk 1.0.0-dev.163 → 1.0.0-dev.165
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 +19 -31
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The Moonbeam XCM SDK enables developers to easily transfer assets between chains, either between parachains or between a parachain and the relay chain, within 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.
|
|
2
2
|
|
|
3
|
-
The XCM SDK offers helper functions
|
|
3
|
+
The XCM SDK offers helper functions that provide a very simple interface to execute XCM transfers between chains in the Polkadot/Kusama ecosystem. In addition, the XCM config package allows any parachain project to add their information in a standard way, so they can be immediately supported by the XCM SDK.
|
|
4
4
|
|
|
5
5
|
# Documentation
|
|
6
6
|
|
|
@@ -15,40 +15,30 @@ npm i @moonbeam-network/xcm-sdk
|
|
|
15
15
|
:warning: You need to have peer dependencies of SDK installed as well.
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm i @polkadot/api @polkadot/
|
|
18
|
+
npm i @polkadot/api @polkadot/util-crypto
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
# Usage
|
|
22
22
|
|
|
23
|
-
The following sections contain basic examples of how to work with the XCM SDK to build transfer data to transfer an asset from one chain to another and how to submit the transfer. For a detailed overview on how to use
|
|
23
|
+
The following sections contain basic examples of how to work with the XCM SDK to build transfer data to transfer an asset from one chain to another and how to submit the transfer. For a detailed overview on how to use it, please refer to the [XCM SDK docs](https://moonbeam-foundation.github.io/xcm-sdk/latest/example-usage/xcm).
|
|
24
24
|
|
|
25
25
|
## Build XCM Transfer Data
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
28
|
import { Sdk } from '@moonbeam-network/xcm-sdk';
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Or via the getTransferData function
|
|
43
|
-
const dataViaGetTransferDataMethod = await getTransferData({
|
|
44
|
-
destinationAddress: 'INSERT_DESTINATION_ADDRESS',
|
|
45
|
-
destinationKeyOrChain: 'INSERT_DESTINATION_CHAIN',
|
|
46
|
-
evmSigner?: 'INSERT_EVM_SIGNER',
|
|
47
|
-
keyOrAsset: 'INSERT_ASSET',
|
|
48
|
-
polkadotSigner?: 'INSERT_POLKADOT_SIGNER',
|
|
49
|
-
sourceAddress: 'INSERT_SOURCE_ADDRESS',
|
|
50
|
-
sourceKeyOrChain: 'INSERT_SOURCE_CHAIN',
|
|
51
|
-
});
|
|
30
|
+
const transferData = async () => {
|
|
31
|
+
const transferData = await Sdk()
|
|
32
|
+
.setAsset(INSERT_ASSET)
|
|
33
|
+
.setSource(INSERT_SOURCE_CHAIN)
|
|
34
|
+
.setDestination(INSERT_DESTINATION_CHAIN)
|
|
35
|
+
.setAddresses({
|
|
36
|
+
sourceAddress: INSERT_SOURCE_ADDRESS,
|
|
37
|
+
destinationAddress: INSERT_DESTINATION_ADDRESS,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
fromPolkadot();
|
|
52
42
|
```
|
|
53
43
|
|
|
54
44
|
## Transfer
|
|
@@ -56,7 +46,7 @@ const dataViaGetTransferDataMethod = await getTransferData({
|
|
|
56
46
|
```js
|
|
57
47
|
...
|
|
58
48
|
|
|
59
|
-
const hash = await
|
|
49
|
+
const hash = await transferData.transfer(INSERT_TRANSFER_AMOUNT, { INSERT_SIGNERS });
|
|
60
50
|
```
|
|
61
51
|
|
|
62
52
|
# Examples
|
|
@@ -76,10 +66,11 @@ pnpm run start
|
|
|
76
66
|
|
|
77
67
|
# Contributing
|
|
78
68
|
|
|
69
|
+
First fork the repository and clone it.
|
|
70
|
+
|
|
79
71
|
```bash
|
|
80
|
-
git clone git@github.com:
|
|
72
|
+
git clone git@github.com:YOUR_GITHUB_USERNAME/xcm-sdk.git
|
|
81
73
|
pnpm install
|
|
82
|
-
pnpm run dev
|
|
83
74
|
```
|
|
84
75
|
|
|
85
76
|
Optionally, you can install the `pre-commit` hook to run the linter and tests before committing:
|
|
@@ -99,9 +90,6 @@ pnpm run test
|
|
|
99
90
|
## Acceptance tests
|
|
100
91
|
|
|
101
92
|
```bash
|
|
102
|
-
cp .env.example .env
|
|
103
|
-
# add private key and suri to .env file
|
|
104
|
-
|
|
105
93
|
pnpm run test:acc
|
|
106
94
|
```
|
|
107
95
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbeam-network/xcm-sdk",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.165",
|
|
4
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": "moonbeam-foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"types": "./build/index.d.ts",
|
|
35
35
|
"main": "./build/index.mjs",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@moonbeam-network/xcm-builder": "1.0.0-dev.
|
|
38
|
-
"@moonbeam-network/xcm-config": "1.0.0-dev.
|
|
39
|
-
"@moonbeam-network/xcm-types": "1.0.0-dev.
|
|
40
|
-
"@moonbeam-network/xcm-utils": "1.0.0-dev.
|
|
37
|
+
"@moonbeam-network/xcm-builder": "1.0.0-dev.165",
|
|
38
|
+
"@moonbeam-network/xcm-config": "1.0.0-dev.165",
|
|
39
|
+
"@moonbeam-network/xcm-types": "1.0.0-dev.165",
|
|
40
|
+
"@moonbeam-network/xcm-utils": "1.0.0-dev.165",
|
|
41
41
|
"big.js": "^6.2.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|