@moonbeam-network/xcm-sdk 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/README.md +46 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,18 +1,22 @@
1
1
  ![Moonbeam](https://docs.moonbeam.network/images/builders/interoperability/xcm/sdk/xcm-sdk-banner.png)
2
2
 
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.
3
+ 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.
4
+
5
+ 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
6
 
5
7
  # Documentation
6
8
 
7
9
  ## v1 (current)
8
10
 
9
- - TODO: (coming soon)
11
+ - [readme](https://github.com/PureStake/xcm-sdk/tree/main)
12
+ - [usage](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v1/xcm-sdk/)
13
+ - [reference](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v1/reference/)
10
14
 
11
15
  ## v0 (previous)
12
16
 
13
17
  - [readme](https://github.com/PureStake/xcm-sdk/tree/v0)
14
- - [usage](https://docs.moonbeam.network/builders/xcm/xcm-sdk/xcm-sdk/)
15
- - [references](https://docs.moonbeam.network/builders/xcm/xcm-sdk/reference/)
18
+ - [usage](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v0/xcm-sdk/)
19
+ - [reference](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v0/reference/)
16
20
 
17
21
  # Installation
18
22
 
@@ -28,7 +32,44 @@ npm i @polkadot/api @polkadot/api-augment @polkadot/types @polkadot/util @polkad
28
32
 
29
33
  # Usage
30
34
 
31
- - TODO: (coming soon) - in the meantime, see examples below
35
+ 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 each method, including a reference to the parameters and returned data of each method exposed by the SDK, please refer to the [XCM SDK v1 docs](https://docs.moonbeam.network/builders/interoperability/xcm/xcm-sdk/v1/).
36
+
37
+ ## Build XCM Transfer Data
38
+
39
+ ```js
40
+ import { Sdk } from '@moonbeam-network/xcm-sdk';
41
+
42
+ const { assets, getTransferData } = Sdk();
43
+
44
+ // You can build the XCM transfer data via the assets function
45
+ const dataViaAssetsMethod = await assets()
46
+ .asset('INSERT_ASSET')
47
+ .source('INSERT_SOURCE_CHAIN')
48
+ .destination('INSERT_DESTINATION_CHAIN')
49
+ .accounts('INSERT_SOURCE_ADDRESS', 'INSERT_DESTINATION_ADDRESS', {
50
+ ethersSigner?: 'INSERT_ETHERS_SIGNER',
51
+ polkadotSigner?: 'INSERT_POLKADOT_SIGNER',
52
+ });
53
+
54
+ // Or via the getTransferData function
55
+ const dataViaGetTransferDataMethod = await getTransferData({
56
+ destinationAddress: 'INSERT_DESTINATION_ADDRESS',
57
+ destinationKeyOrChain: 'INSERT_DESTINATION_CHAIN',
58
+ ethersSigner?: 'INSERT_ETHERS_SIGNER',
59
+ keyOrAsset: 'INSERT_ASSET',
60
+ polkadotSigner?: 'INSERT_POLKADOT_SIGNER',
61
+ sourceAddress: 'INSERT_SOURCE_ADDRESS',
62
+ sourceKeyOrChain: 'INSERT_SOURCE_CHAIN',
63
+ });
64
+ ```
65
+
66
+ ## Transfer
67
+
68
+ ```js
69
+ ...
70
+
71
+ const hash = await dataViaGetTransferDataMethod.transfer('INSERT_TRANSFER_AMOUNT');
72
+ ```
32
73
 
33
74
  # Examples
34
75
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moonbeam-network/xcm-sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
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
  "scripts": {
6
6
  "build": "tsup",
@@ -48,7 +48,7 @@
48
48
  "main": "./build/index.cjs",
49
49
  "dependencies": {
50
50
  "@moonbeam-network/xcm-builder": "1.0.5",
51
- "@moonbeam-network/xcm-config": "1.0.8",
51
+ "@moonbeam-network/xcm-config": "1.0.9",
52
52
  "@moonbeam-network/xcm-types": "1.0.1",
53
53
  "@moonbeam-network/xcm-utils": "1.0.2",
54
54
  "big.js": "^6.2.1"