@moonbeam-network/xcm-utils 3.0.0 → 3.0.2

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 CHANGED
@@ -1,9 +1,20 @@
1
- ![Moonbeam](https://docs.moonbeam.network/images/builders/interoperability/xcm/sdk/xcm-sdk-banner.png)
1
+ The Utils package contains the utility functions for the Moonbeam XCM SDK and MRL SDK.
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
+ # Documentation for the Moonbeam XCM SDK
4
4
 
5
- # Documentation
5
+ ## v3 (current)
6
6
 
7
- ## v1 (current)
7
+ ### Usage
8
8
 
9
- - TODO: (coming soon)
9
+ - [XCM SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/example-usage/xcm)
10
+ - [MRL SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/example-usage/mrl)
11
+
12
+ ### References
13
+
14
+ - [XCM SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/reference/xcm)
15
+ - [MRL SDK](https://moonbeam-foundation.github.io/xcm-sdk/latest/reference/mrl)
16
+
17
+ ## v2 (previous)
18
+
19
+ - [usage](https://moonbeam-foundation.github.io/xcm-sdk/v2/example-usage)
20
+ - [references](https://moonbeam-foundation.github.io/xcm-sdk/v2/reference/interfaces)
package/package.json CHANGED
@@ -1,16 +1,7 @@
1
1
  {
2
2
  "name": "@moonbeam-network/xcm-utils",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Moonbeam XCM utilities",
5
- "scripts": {
6
- "build": "tsup",
7
- "dev": "tsup --watch",
8
- "link": "pnpm ln --global",
9
- "typecheck": "tsc --noEmit",
10
- "test": "vitest --run",
11
- "test:watch": "vitest",
12
- "test:update": "vitest -u"
13
- },
14
5
  "author": "moonbeam-foundation",
15
6
  "license": "MIT",
16
7
  "repository": {
@@ -18,12 +9,19 @@
18
9
  "type": "git",
19
10
  "url": "git+https://github.com/moonbeam-foundation/xcm-sdk.git"
20
11
  },
21
- "keywords": ["moonbeam", "moonriver", "xcm", "utils"],
12
+ "keywords": [
13
+ "moonbeam",
14
+ "moonriver",
15
+ "xcm",
16
+ "utils"
17
+ ],
22
18
  "bugs": {
23
19
  "url": "https://github.com/moonbeam-foundation/xcm-sdk/issues"
24
20
  },
25
21
  "homepage": "https://moonbeam-foundation.github.io/xcm-sdk/latest",
26
- "files": ["build"],
22
+ "files": [
23
+ "build"
24
+ ],
27
25
  "type": "module",
28
26
  "exports": {
29
27
  "import": "./build/index.mjs",
@@ -44,5 +42,14 @@
44
42
  "@polkadot/apps-config": "0.146.1",
45
43
  "@polkadot/util": "13.2.3",
46
44
  "@polkadot/util-crypto": "13.2.3"
45
+ },
46
+ "scripts": {
47
+ "build": "tsup",
48
+ "dev": "tsup --watch",
49
+ "link": "pnpm ln --global",
50
+ "typecheck": "tsc --noEmit",
51
+ "test": "vitest --run",
52
+ "test:watch": "vitest",
53
+ "test:update": "vitest -u"
47
54
  }
48
- }
55
+ }
package/build/index.d.mts DELETED
@@ -1,44 +0,0 @@
1
- import { RoundingMode } from 'big.js';
2
- import { ApiPromise } from '@polkadot/api';
3
-
4
- declare function isHexString(asset: unknown): boolean;
5
-
6
- declare function formatAssetIdToERC20(id: string): string;
7
- declare function convertAddressTo32Bytes(address: string): string;
8
-
9
- declare function toDecimal(number: bigint | number | string, decimals: number, maxDecimal?: number, roundType?: RoundingMode): string;
10
- declare function toBigInt(amount: bigint | string | number, decimals: number): bigint;
11
- declare function convertDecimals(number: string | bigint, decimals: number, targetDecimals: number): bigint;
12
- declare function hasDecimalOverflow(fl: number | string, maxDecimal: number): boolean;
13
-
14
- declare enum MRLTypes {
15
- XcmVersionedMultiLocation = "XcmVersionedMultiLocation",
16
- XcmVersionedLocation = "XcmVersionedLocation",
17
- XcmRoutingUserAction = "XcmRoutingUserAction",
18
- VersionedUserAction = "VersionedUserAction"
19
- }
20
- declare function getPolkadotApi(ws: string | string[]): Promise<ApiPromise>;
21
-
22
- declare function getPolkadotAppsUrl(ws: string): string;
23
-
24
- /**
25
- * reference: https://github.com/Moonsong-Labs/xcm-tools/blob/main/scripts/calculate-sovereign-account.ts
26
- */
27
- declare function getSovereignAccountAddresses(paraId: number): {
28
- generic: string;
29
- moonbeam: string;
30
- relay: string;
31
- };
32
- /**
33
- * reference: https://github.com/Moonsong-Labs/xcm-tools/blob/main/scripts/calculate-multilocation-derivative-account.ts
34
- */
35
- declare function getMultilocationDerivedAddresses({ paraId, address, isParents, }: {
36
- paraId?: number;
37
- address: string;
38
- isParents?: boolean;
39
- }): {
40
- address20: `0x${string}`;
41
- address32: `0x${string}`;
42
- };
43
-
44
- export { MRLTypes, convertAddressTo32Bytes, convertDecimals, formatAssetIdToERC20, getMultilocationDerivedAddresses, getPolkadotApi, getPolkadotAppsUrl, getSovereignAccountAddresses, hasDecimalOverflow, isHexString, toBigInt, toDecimal };