@moonbeam-network/xcm-utils 4.2.3 → 4.2.4
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/build/index.d.mts +45 -0
- package/package.json +2 -2
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { RoundingMode } from 'big.js';
|
|
2
|
+
import { ApiPromise } from '@polkadot/api';
|
|
3
|
+
|
|
4
|
+
declare function isHexString(asset: unknown): boolean;
|
|
5
|
+
declare function isEthAddress(address: string): boolean;
|
|
6
|
+
|
|
7
|
+
declare function formatAssetIdToERC20(id: string): string;
|
|
8
|
+
declare function convertAddressTo32Bytes(address: string): string;
|
|
9
|
+
|
|
10
|
+
declare function toDecimal(number: bigint | number | string, decimals: number, maxDecimal?: number, roundType?: RoundingMode): string;
|
|
11
|
+
declare function toBigInt(amount: bigint | string | number, decimals: number): bigint;
|
|
12
|
+
declare function convertDecimals(number: string | bigint, decimals: number, targetDecimals: number): bigint;
|
|
13
|
+
declare function hasDecimalOverflow(fl: number | string, maxDecimal: number): boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* reference: https://github.com/Moonsong-Labs/xcm-tools/blob/main/scripts/calculate-sovereign-account.ts
|
|
17
|
+
*/
|
|
18
|
+
declare function getSovereignAccountAddresses(paraId: number): {
|
|
19
|
+
generic: string;
|
|
20
|
+
moonbeam: string;
|
|
21
|
+
relay: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* reference: https://github.com/Moonsong-Labs/xcm-tools/blob/main/scripts/calculate-multilocation-derivative-account.ts
|
|
25
|
+
*/
|
|
26
|
+
declare function getMultilocationDerivedAddresses({ paraId, address, parents, }: {
|
|
27
|
+
paraId?: number;
|
|
28
|
+
address: string;
|
|
29
|
+
parents?: 0 | 1 | 2;
|
|
30
|
+
}): {
|
|
31
|
+
address20: `0x${string}`;
|
|
32
|
+
address32: `0x${string}`;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare enum MRLTypes {
|
|
36
|
+
XcmVersionedMultiLocation = "XcmVersionedMultiLocation",
|
|
37
|
+
XcmVersionedLocation = "XcmVersionedLocation",
|
|
38
|
+
XcmRoutingUserAction = "XcmRoutingUserAction",
|
|
39
|
+
VersionedUserAction = "VersionedUserAction"
|
|
40
|
+
}
|
|
41
|
+
declare function getPolkadotApi(ws: string | string[]): Promise<ApiPromise>;
|
|
42
|
+
|
|
43
|
+
declare function getPolkadotAppsUrl(ws: string): string;
|
|
44
|
+
|
|
45
|
+
export { MRLTypes, convertAddressTo32Bytes, convertDecimals, formatAssetIdToERC20, getMultilocationDerivedAddresses, getPolkadotApi, getPolkadotAppsUrl, getSovereignAccountAddresses, hasDecimalOverflow, isEthAddress, isHexString, toBigInt, toDecimal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbeam-network/xcm-utils",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Moonbeam XCM utilities",
|
|
5
5
|
"author": "moonbeam-foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@polkadot/api": "16.5.4",
|
|
44
|
-
"@polkadot/apps-config": "0.
|
|
44
|
+
"@polkadot/apps-config": "0.170.1",
|
|
45
45
|
"@polkadot/util": "14.0.1",
|
|
46
46
|
"@polkadot/util-crypto": "14.0.1"
|
|
47
47
|
},
|