@galacticcouncil/xc-cfg 0.1.0 → 0.2.0
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.cjs +1 -1
- package/build/index.mjs +1 -1
- package/build/types/builders/extrinsics/xcm/builder/buildERC20TransferFromPara.d.ts +2 -131
- package/build/types/builders/extrinsics/xcm/builder/buildParaERC20Received.d.ts +2 -76
- package/build/types/builders/extrinsics/xcm/builder/const.d.ts +6 -1
- package/build/types/builders/extrinsics/xcm/polkadotXcm.utils.d.ts +174 -228
- package/build/types/builders/extrinsics/xcm/types.d.ts +0 -4
- package/build/types/builders/extrinsics/xcm/utils/account.d.ts +16 -10
- package/build/types/builders/extrinsics/xcm/utils/guard.d.ts +1 -3
- package/build/types/builders/extrinsics/xcm/utils/instructions.d.ts +22 -36
- package/build/types/builders/extrinsics/xcm/utils/location.d.ts +5 -7
- package/build/types/builders/extrinsics/xcm/xTokens.utils.d.ts +17 -5
- package/build/types/builders/extrinsics/xcm/xTransfer.utils.d.ts +9 -2
- package/build/types/builders/extrinsics/xcm/xcmPallet.utils.d.ts +17 -5
- package/build/types/clients/base.d.ts +9 -4
- package/build/types/clients/chain/assethub.d.ts +3 -3
- package/build/types/clients/chain/hydration.d.ts +4 -1
- package/package.json +3 -3
- package/build/types/utils/xcm-encoder.d.ts +0 -86
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { XcmV3Junction } from '@galacticcouncil/descriptors';
|
|
1
2
|
import { Parachain } from '@galacticcouncil/xc-core';
|
|
2
3
|
export declare const toDest: (destination: Parachain, account: any) => {
|
|
3
4
|
parents: number;
|
|
4
5
|
interior: {
|
|
5
|
-
|
|
6
|
+
type: "X2";
|
|
7
|
+
value: import("polkadot-api").FixedSizeArray<2, XcmV3Junction>;
|
|
8
|
+
} & {
|
|
9
|
+
type: "X2";
|
|
6
10
|
};
|
|
7
11
|
};
|
|
8
12
|
export declare const toAsset: (assetLocation: object, amount: any) => {
|
|
9
13
|
id: object;
|
|
10
14
|
fun: {
|
|
11
|
-
|
|
15
|
+
type: "Fungible";
|
|
16
|
+
value: bigint;
|
|
17
|
+
} & {
|
|
18
|
+
type: "Fungible";
|
|
12
19
|
};
|
|
13
20
|
};
|
|
@@ -1,24 +1,36 @@
|
|
|
1
|
+
import { XcmV3Junction } from '@galacticcouncil/descriptors';
|
|
1
2
|
import { Parachain } from '@galacticcouncil/xc-core';
|
|
2
3
|
import { XcmVersion } from './types';
|
|
3
4
|
export declare const toDest: (version: XcmVersion, destination: Parachain) => {
|
|
4
|
-
|
|
5
|
+
type: XcmVersion;
|
|
6
|
+
value: {
|
|
5
7
|
parents: number;
|
|
6
8
|
interior: {
|
|
7
|
-
|
|
9
|
+
type: "X1";
|
|
10
|
+
value: XcmV3Junction;
|
|
11
|
+
} & {
|
|
12
|
+
type: "X1";
|
|
8
13
|
};
|
|
9
14
|
};
|
|
10
15
|
};
|
|
11
16
|
export declare const toAsset: (assetLocation: object, amount: any) => {
|
|
12
17
|
id: object;
|
|
13
18
|
fun: {
|
|
14
|
-
|
|
19
|
+
type: "Fungible";
|
|
20
|
+
value: bigint;
|
|
21
|
+
} & {
|
|
22
|
+
type: "Fungible";
|
|
15
23
|
};
|
|
16
24
|
};
|
|
17
25
|
export declare const toBeneficiary: (version: XcmVersion, account: any) => {
|
|
18
|
-
|
|
26
|
+
type: XcmVersion;
|
|
27
|
+
value: {
|
|
19
28
|
parents: number;
|
|
20
29
|
interior: {
|
|
21
|
-
|
|
30
|
+
type: "X1";
|
|
31
|
+
value: XcmV3Junction;
|
|
32
|
+
} & {
|
|
33
|
+
type: "X1";
|
|
22
34
|
};
|
|
23
35
|
};
|
|
24
36
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { ChainDefinition, TypedApi } from 'polkadot-api';
|
|
1
2
|
import { Asset, Parachain } from '@galacticcouncil/xc-core';
|
|
2
|
-
|
|
3
|
+
import { hub, XcmV4Instruction } from '@galacticcouncil/descriptors';
|
|
4
|
+
export declare class BaseClient<C extends ChainDefinition = typeof hub> {
|
|
3
5
|
readonly chain: Parachain;
|
|
4
|
-
|
|
6
|
+
protected descriptor: C;
|
|
7
|
+
constructor(chain: Parachain, descriptor?: C);
|
|
8
|
+
get client(): import("polkadot-api").PolkadotClient;
|
|
9
|
+
api(): TypedApi<C>;
|
|
10
|
+
private get refApi();
|
|
5
11
|
getSystemAccountBalance(address: string): Promise<bigint>;
|
|
6
|
-
|
|
7
|
-
calculateDestinationFee(xcm: any, asset: Asset): Promise<bigint>;
|
|
12
|
+
calculateDestinationFee(xcm: XcmV4Instruction[], asset: Asset): Promise<bigint>;
|
|
8
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Asset, Parachain } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { XcmV4Instruction, Hub } from '@galacticcouncil/descriptors';
|
|
2
3
|
import { BaseClient } from '../base';
|
|
3
|
-
export declare class AssethubClient extends BaseClient {
|
|
4
|
+
export declare class AssethubClient extends BaseClient<Hub> {
|
|
4
5
|
constructor(chain: Parachain);
|
|
5
6
|
checkIfSufficient(asset: Asset): Promise<boolean>;
|
|
6
7
|
checkIfFrozen(address: string, asset: Asset): Promise<boolean>;
|
|
@@ -8,6 +9,5 @@ export declare class AssethubClient extends BaseClient {
|
|
|
8
9
|
getBridgeDeliveryFee(options?: {
|
|
9
10
|
defaultFee: bigint;
|
|
10
11
|
}): Promise<bigint>;
|
|
11
|
-
calculateDeliveryFee(xcm:
|
|
12
|
-
calculateDestinationFee(xcm: any, asset: Asset): Promise<bigint>;
|
|
12
|
+
calculateDeliveryFee(xcm: XcmV4Instruction[], destParachainId: number): Promise<bigint>;
|
|
13
13
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Asset, Parachain } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { hydration } from '@galacticcouncil/descriptors';
|
|
2
3
|
import { BaseClient } from '../base';
|
|
3
|
-
export declare class HydrationClient extends BaseClient {
|
|
4
|
+
export declare class HydrationClient extends BaseClient<typeof hydration> {
|
|
4
5
|
constructor(chain: Parachain);
|
|
5
6
|
checkIfSufficient(asset: Asset): Promise<boolean>;
|
|
6
7
|
getFeeAsset(address: string): Promise<string>;
|
|
7
8
|
getAssetBalance(address: string, asset: string): Promise<bigint>;
|
|
9
|
+
getSystemAccountBalance(address: string): Promise<bigint>;
|
|
10
|
+
getTokensAccountsBalance(address: string, asset: string): Promise<bigint>;
|
|
8
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacticcouncil/xc-cfg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Cross-chain hydradx & basilisk dapp configuration",
|
|
5
5
|
"author": "GalacticCouncil",
|
|
6
6
|
"repository": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"test": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest --silent"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@galacticcouncil/xc-core": "^0.
|
|
34
|
+
"@galacticcouncil/xc-core": "^0.2.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@galacticcouncil/sdk-next": "
|
|
37
|
+
"@galacticcouncil/sdk-next": ">=0.19.0 <1.0.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { XcmV4Instruction, XcmV3Junctions } from '@galacticcouncil/descriptors';
|
|
2
|
-
/**
|
|
3
|
-
* XCM Encoder utility for converting plain JavaScript objects
|
|
4
|
-
* to PAPI-compatible encoded structures.
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* This class provides two sets of encoding methods:
|
|
8
|
-
*
|
|
9
|
-
* **For Typed API (chains with descriptors like Hydration):**
|
|
10
|
-
* - Use methods without suffix: `encodeXcm()`, `encodeAssetId()`, etc.
|
|
11
|
-
* - These use chain-specific type descriptors from @galacticcouncil/descriptors
|
|
12
|
-
* - Use when calling typed API methods on chains with custom descriptors
|
|
13
|
-
*
|
|
14
|
-
* **For Unsafe API (chains like Asset Hub):**
|
|
15
|
-
* - Use methods with "ForUnsafeApi" suffix: `encodeXcmForUnsafeApi()`, etc.
|
|
16
|
-
* - These return generic { type, value } enum structures
|
|
17
|
-
* - Use when calling `getUnsafeApi()` or working with chains without descriptors
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Typed API (Hydration)
|
|
21
|
-
* const versionedXcm = XcmEncoder.encodeXcm(xcm);
|
|
22
|
-
* await api.apis.XcmPaymentApi.query_xcm_weight(versionedXcm);
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // Unsafe API (Asset Hub)
|
|
26
|
-
* const versionedXcm = XcmEncoder.encodeXcmForUnsafeApi(xcm);
|
|
27
|
-
* await unsafeApi.apis.XcmPaymentApi.query_xcm_weight(versionedXcm);
|
|
28
|
-
*/
|
|
29
|
-
export declare class XcmEncoder {
|
|
30
|
-
static encodeXcm(plainXcm: any): {
|
|
31
|
-
type: "V4";
|
|
32
|
-
value: XcmV4Instruction[];
|
|
33
|
-
} & {
|
|
34
|
-
type: "V4";
|
|
35
|
-
};
|
|
36
|
-
static encodeAssetId(location: any): {
|
|
37
|
-
type: "V4";
|
|
38
|
-
value: {
|
|
39
|
-
parents: number;
|
|
40
|
-
interior: XcmV3Junctions;
|
|
41
|
-
};
|
|
42
|
-
} & {
|
|
43
|
-
type: "V4";
|
|
44
|
-
};
|
|
45
|
-
static encodeVersionedLocation(location: any): {
|
|
46
|
-
type: "V4";
|
|
47
|
-
value: {
|
|
48
|
-
parents: number;
|
|
49
|
-
interior: XcmV3Junctions;
|
|
50
|
-
};
|
|
51
|
-
} & {
|
|
52
|
-
type: "V4";
|
|
53
|
-
};
|
|
54
|
-
static encodeLocation(location: any): any;
|
|
55
|
-
/**
|
|
56
|
-
* Encodes XCM for unsafe API calls.
|
|
57
|
-
* Returns generic { type, value } enum structures instead of typed descriptors.
|
|
58
|
-
*/
|
|
59
|
-
static encodeXcmForUnsafeApi(plainXcm: any): {
|
|
60
|
-
type: string;
|
|
61
|
-
value: any;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Encodes asset ID for unsafe API calls.
|
|
65
|
-
*/
|
|
66
|
-
static encodeAssetIdForUnsafeApi(location: any): {
|
|
67
|
-
type: string;
|
|
68
|
-
value: any;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Encodes versioned location for unsafe API calls.
|
|
72
|
-
*/
|
|
73
|
-
static encodeVersionedLocationForUnsafeApi(location: any): {
|
|
74
|
-
type: string;
|
|
75
|
-
value: any;
|
|
76
|
-
};
|
|
77
|
-
static encodeLocationForUnsafeApi(location: any): any;
|
|
78
|
-
private static encodeInstructionsCore;
|
|
79
|
-
private static encodeLocationCore;
|
|
80
|
-
private static encodeJunctionCore;
|
|
81
|
-
private static encodeNetworkIdCore;
|
|
82
|
-
private static encodeAssetCore;
|
|
83
|
-
private static encodeAssetFilterCore;
|
|
84
|
-
private static encodeWeightLimitCore;
|
|
85
|
-
private static encodeInstructionCore;
|
|
86
|
-
}
|