@decentro-dev/polkadot-sufficient-assets 0.0.1
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/LICENSE +201 -0
- package/README.md +60 -0
- package/package.json +99 -0
- package/packages/client/README.md +333 -0
- package/packages/client/dist/chain-specs/ksmcc3/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/ksmcc3/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/ksmcc3/index.js +2 -0
- package/packages/client/dist/chain-specs/ksmcc3/index.mjs +2 -0
- package/packages/client/dist/chain-specs/ksmcc3_asset_hub/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/ksmcc3_asset_hub/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/ksmcc3_asset_hub/index.js +2 -0
- package/packages/client/dist/chain-specs/ksmcc3_asset_hub/index.mjs +2 -0
- package/packages/client/dist/chain-specs/paseo/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/paseo/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/paseo/index.js +2 -0
- package/packages/client/dist/chain-specs/paseo/index.mjs +2 -0
- package/packages/client/dist/chain-specs/paseo_asset_hub/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/paseo_asset_hub/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/paseo_asset_hub/index.js +2 -0
- package/packages/client/dist/chain-specs/paseo_asset_hub/index.mjs +2 -0
- package/packages/client/dist/chain-specs/polkadot/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/polkadot/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/polkadot/index.js +2 -0
- package/packages/client/dist/chain-specs/polkadot/index.mjs +2 -0
- package/packages/client/dist/chain-specs/polkadot_asset_hub/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/polkadot_asset_hub/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/polkadot_asset_hub/index.js +2 -0
- package/packages/client/dist/chain-specs/polkadot_asset_hub/index.mjs +2 -0
- package/packages/client/dist/chain-specs/rococo_v2_2/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/rococo_v2_2/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/rococo_v2_2/index.js +2 -0
- package/packages/client/dist/chain-specs/rococo_v2_2/index.mjs +2 -0
- package/packages/client/dist/chain-specs/rococo_v2_2_asset_hub/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/rococo_v2_2_asset_hub/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/rococo_v2_2_asset_hub/index.js +2 -0
- package/packages/client/dist/chain-specs/rococo_v2_2_asset_hub/index.mjs +2 -0
- package/packages/client/dist/chain-specs/westend2/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/westend2/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/westend2/index.js +2 -0
- package/packages/client/dist/chain-specs/westend2/index.mjs +2 -0
- package/packages/client/dist/chain-specs/westend2_asset_hub/index.d.mts +1 -0
- package/packages/client/dist/chain-specs/westend2_asset_hub/index.d.ts +1 -0
- package/packages/client/dist/chain-specs/westend2_asset_hub/index.js +2 -0
- package/packages/client/dist/chain-specs/westend2_asset_hub/index.mjs +2 -0
- package/packages/client/dist/index.d.mts +106 -0
- package/packages/client/dist/index.d.ts +106 -0
- package/packages/client/dist/index.js +2 -0
- package/packages/client/dist/index.mjs +2 -0
- package/packages/client/dist/smoldot/from-node-worker/index.d.mts +1 -0
- package/packages/client/dist/smoldot/from-node-worker/index.d.ts +1 -0
- package/packages/client/dist/smoldot/from-node-worker/index.js +2 -0
- package/packages/client/dist/smoldot/from-node-worker/index.mjs +2 -0
- package/packages/client/dist/smoldot/from-worker/index.d.mts +1 -0
- package/packages/client/dist/smoldot/from-worker/index.d.ts +1 -0
- package/packages/client/dist/smoldot/from-worker/index.js +2 -0
- package/packages/client/dist/smoldot/from-worker/index.mjs +2 -0
- package/packages/client/dist/smoldot/index.d.mts +14 -0
- package/packages/client/dist/smoldot/index.d.ts +14 -0
- package/packages/client/dist/smoldot/index.js +2 -0
- package/packages/client/dist/smoldot/index.mjs +2 -0
- package/packages/client/dist/smoldot/worker/index.d.mts +1 -0
- package/packages/client/dist/smoldot/worker/index.d.ts +1 -0
- package/packages/client/dist/smoldot/worker/index.js +2 -0
- package/packages/client/dist/smoldot/worker/index.mjs +2 -0
- package/packages/core/.papi/descriptors/dist/common-types.d.ts +21274 -0
- package/packages/core/.papi/descriptors/dist/descriptors-EQXQJ7SL.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/descriptors.d.ts +11 -0
- package/packages/core/.papi/descriptors/dist/hdx.d.ts +366 -0
- package/packages/core/.papi/descriptors/dist/hdx_metadata-XH2Y6EGQ.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/hdx_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/index.d.mts +24579 -0
- package/packages/core/.papi/descriptors/dist/index.d.ts +23 -0
- package/packages/core/.papi/descriptors/dist/index.js +1 -0
- package/packages/core/.papi/descriptors/dist/index.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/kah.d.ts +434 -0
- package/packages/core/.papi/descriptors/dist/kah_metadata-OCBL5LAN.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/kah_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/kusama.d.ts +291 -0
- package/packages/core/.papi/descriptors/dist/kusama_metadata-TGJ43LLG.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/kusama_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/metadataTypes-MIM6CGSL.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/metadataTypes.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/pah.d.ts +434 -0
- package/packages/core/.papi/descriptors/dist/pah_metadata-JG7F7QDO.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/pah_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/paseo.d.ts +291 -0
- package/packages/core/.papi/descriptors/dist/paseo_metadata-5VVMOYKO.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/paseo_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/paseoah.d.ts +242 -0
- package/packages/core/.papi/descriptors/dist/paseoah_metadata-KVQKFE5R.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/paseoah_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/polkadot.d.ts +291 -0
- package/packages/core/.papi/descriptors/dist/polkadot_metadata-ASE5745E.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/polkadot_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/rah.d.ts +434 -0
- package/packages/core/.papi/descriptors/dist/rah_metadata-FL7L2MWD.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/rah_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/rococo.d.ts +291 -0
- package/packages/core/.papi/descriptors/dist/rococo_metadata-CHYQZIV5.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/rococo_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/wah.d.ts +434 -0
- package/packages/core/.papi/descriptors/dist/wah_metadata-M2H6IX7C.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/wah_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/dist/westend.d.ts +291 -0
- package/packages/core/.papi/descriptors/dist/westend_metadata-IAM3KHRQ.mjs +1 -0
- package/packages/core/.papi/descriptors/dist/westend_metadata.d.ts +2 -0
- package/packages/core/.papi/descriptors/package.json +24 -0
- package/packages/core/.papi/metadata/hdx.scale +0 -0
- package/packages/core/.papi/metadata/kah.scale +0 -0
- package/packages/core/.papi/metadata/kusama.scale +0 -0
- package/packages/core/.papi/metadata/pah.scale +0 -0
- package/packages/core/.papi/metadata/paseo.scale +0 -0
- package/packages/core/.papi/metadata/paseoah.scale +0 -0
- package/packages/core/.papi/metadata/polkadot.scale +0 -0
- package/packages/core/.papi/metadata/rah.scale +0 -0
- package/packages/core/.papi/metadata/rococo.scale +0 -0
- package/packages/core/.papi/metadata/wah.scale +0 -0
- package/packages/core/.papi/metadata/westend.scale +0 -0
- package/packages/core/.papi/polkadot-api.json +50 -0
- package/packages/core/dist/index.d.mts +676 -0
- package/packages/core/dist/index.d.ts +676 -0
- package/packages/core/dist/index.js +1 -0
- package/packages/core/dist/index.mjs +1 -0
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
import * as _polkadot_api_descriptors from '@polkadot-api/descriptors';
|
|
2
|
+
import { hdx, pah, kah, rah, wah, paseoah, polkadot, kusama, rococo, westend, paseo, HdxCalls, XcmVersionedAssets, XcmV3Junctions, XcmV3Junction, MultiAddress } from '@polkadot-api/descriptors';
|
|
3
|
+
export * from '@polkadot-api/descriptors';
|
|
4
|
+
import * as polkadot_api from 'polkadot-api';
|
|
5
|
+
import { PolkadotClient, TypedApi, ChainDefinition, SS58String } from 'polkadot-api';
|
|
6
|
+
import { Client } from 'polkadot-api/smoldot';
|
|
7
|
+
import { InjectedPolkadotAccount as InjectedPolkadotAccount$1 } from 'polkadot-api/pjs-signer';
|
|
8
|
+
|
|
9
|
+
type DescriptorsRelayType = {
|
|
10
|
+
polkadot: typeof polkadot;
|
|
11
|
+
kusama: typeof kusama;
|
|
12
|
+
rococo: typeof rococo;
|
|
13
|
+
westend: typeof westend;
|
|
14
|
+
paseo: typeof paseo;
|
|
15
|
+
};
|
|
16
|
+
type DescriptorsAssetHubType = {
|
|
17
|
+
pah: typeof pah;
|
|
18
|
+
kah: typeof kah;
|
|
19
|
+
rah: typeof rah;
|
|
20
|
+
wah: typeof wah;
|
|
21
|
+
paseoah: typeof paseoah;
|
|
22
|
+
};
|
|
23
|
+
type DescriptorsParaType = {
|
|
24
|
+
hdx: typeof hdx;
|
|
25
|
+
};
|
|
26
|
+
declare const DESCRIPTORS_RELAY: DescriptorsRelayType;
|
|
27
|
+
declare const DESCRIPTORS_ASSET_HUB: DescriptorsAssetHubType;
|
|
28
|
+
declare const DESCRIPTORS_PARA: DescriptorsParaType;
|
|
29
|
+
declare const DESCRIPTORS_ALL: {
|
|
30
|
+
hdx: typeof hdx;
|
|
31
|
+
pah: typeof pah;
|
|
32
|
+
kah: typeof kah;
|
|
33
|
+
rah: typeof rah;
|
|
34
|
+
wah: typeof wah;
|
|
35
|
+
paseoah: typeof paseoah;
|
|
36
|
+
polkadot: typeof polkadot;
|
|
37
|
+
kusama: typeof kusama;
|
|
38
|
+
rococo: typeof rococo;
|
|
39
|
+
westend: typeof westend;
|
|
40
|
+
paseo: typeof paseo;
|
|
41
|
+
};
|
|
42
|
+
type DescriptorsAssetHub = typeof DESCRIPTORS_ASSET_HUB;
|
|
43
|
+
type DescriptorsRelay = typeof DESCRIPTORS_RELAY;
|
|
44
|
+
type DescriptorsPara = typeof DESCRIPTORS_PARA;
|
|
45
|
+
type DescriptorsAll = DescriptorsRelay & DescriptorsAssetHub & DescriptorsPara;
|
|
46
|
+
type ChainIdAssetHub = keyof DescriptorsAssetHub;
|
|
47
|
+
type ChainIdRelay = keyof DescriptorsRelay;
|
|
48
|
+
type ChainIdPara = keyof DescriptorsParaType;
|
|
49
|
+
type KnowChainId = ChainIdRelay | ChainIdAssetHub | ChainIdPara;
|
|
50
|
+
type UnKnowChainId = string & {};
|
|
51
|
+
type ChainId = KnowChainId | UnKnowChainId;
|
|
52
|
+
declare const isChainIdAssetHub: (id: unknown) => id is ChainIdAssetHub;
|
|
53
|
+
declare const isChainIdRelay: (id: unknown) => id is ChainIdRelay;
|
|
54
|
+
type Descriptors<Id extends KnowChainId> = DescriptorsAll[Id];
|
|
55
|
+
declare const getDescriptors: (id: ChainId) => Descriptors<KnowChainId> | undefined;
|
|
56
|
+
type Chain = {
|
|
57
|
+
id: ChainId;
|
|
58
|
+
name: string;
|
|
59
|
+
specName: string;
|
|
60
|
+
wsUrls: string[];
|
|
61
|
+
relay: ChainIdRelay | null;
|
|
62
|
+
chainId: number | null;
|
|
63
|
+
logo: string;
|
|
64
|
+
type: 'system' | 'relay' | 'para';
|
|
65
|
+
blockExplorerUrl: string | null;
|
|
66
|
+
};
|
|
67
|
+
type ChainRelay = Chain & {
|
|
68
|
+
chainId: null;
|
|
69
|
+
};
|
|
70
|
+
type ChainAssetHub = Chain & {
|
|
71
|
+
chainId: 1000;
|
|
72
|
+
};
|
|
73
|
+
declare const getChainById: <T extends Chain>(id: ChainId, chains: Chain[]) => T;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Determines if a chain is a relay chain based
|
|
77
|
+
* @param Chain
|
|
78
|
+
* @returns boolean
|
|
79
|
+
*/
|
|
80
|
+
declare const isRelayChain: (chain: Chain) => chain is ChainRelay;
|
|
81
|
+
/**
|
|
82
|
+
* Determines if a chain is a system chain based on the value of its chainId being strictly greater than 0 and less than 2000
|
|
83
|
+
* @param chainId
|
|
84
|
+
* @returns boolean
|
|
85
|
+
*/
|
|
86
|
+
declare const isSystemChain: (chain: Chain) => chain is ChainAssetHub;
|
|
87
|
+
/**
|
|
88
|
+
* Determines if a chain is a parachain based on the value of its chainId being strictly greater than or equal to 2000
|
|
89
|
+
* @param Chain
|
|
90
|
+
* @returns boolean
|
|
91
|
+
*/
|
|
92
|
+
declare const isParachain: (chain: Chain) => boolean;
|
|
93
|
+
declare const parseLocationStrToLocation: (locationStr: string) => any;
|
|
94
|
+
/**
|
|
95
|
+
* Determines if the dest chain is a Global Consensus origin based on the value of its dest location
|
|
96
|
+
* @param destLocation
|
|
97
|
+
* @returns boolean
|
|
98
|
+
*/
|
|
99
|
+
declare const chainDestIsBridge: (destLocation: any) => boolean;
|
|
100
|
+
|
|
101
|
+
interface Register {
|
|
102
|
+
}
|
|
103
|
+
type ResolvedRegister = {
|
|
104
|
+
config: Register extends {
|
|
105
|
+
config: infer config extends Config;
|
|
106
|
+
} ? config : Config;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type SmoldotClient = Client;
|
|
110
|
+
type Assign_<T, U> = {
|
|
111
|
+
[K in keyof T as K extends keyof U ? (U[K] extends void ? never : K) : K]: K extends keyof U ? U[K] : T[K];
|
|
112
|
+
};
|
|
113
|
+
type Assign<T, U> = Assign_<T, U> & U;
|
|
114
|
+
type StringWithDefault = 'DEFAULT' & (string | {});
|
|
115
|
+
|
|
116
|
+
declare const createChain: <const chain extends Chain>(chain: chain) => Assign<Chain, chain>;
|
|
117
|
+
|
|
118
|
+
declare const polkadotChain: Assign<Chain, {
|
|
119
|
+
readonly id: "polkadot";
|
|
120
|
+
readonly name: "Polkadot";
|
|
121
|
+
readonly specName: "polkadot";
|
|
122
|
+
readonly wsUrls: ["wss://polkadot-rpc.dwellir.com"];
|
|
123
|
+
readonly relay: "polkadot";
|
|
124
|
+
readonly type: "relay";
|
|
125
|
+
readonly chainId: null;
|
|
126
|
+
readonly logo: "./chains/dot.svg";
|
|
127
|
+
readonly blockExplorerUrl: "https://polkadot.subscan.io";
|
|
128
|
+
}>;
|
|
129
|
+
declare const polkadotAssetHubChain: Assign<Chain, {
|
|
130
|
+
readonly id: "pah";
|
|
131
|
+
readonly name: "Polkadot Asset Hub";
|
|
132
|
+
readonly specName: "asset-hub-polkadot";
|
|
133
|
+
readonly wsUrls: ["wss://polkadot-asset-hub-rpc.polkadot.io/"];
|
|
134
|
+
readonly relay: "polkadot";
|
|
135
|
+
readonly type: "system";
|
|
136
|
+
readonly chainId: 1000;
|
|
137
|
+
readonly logo: "./chains/pah.svg";
|
|
138
|
+
readonly blockExplorerUrl: "https://assethub-polkadot.subscan.io";
|
|
139
|
+
}>;
|
|
140
|
+
declare const kusamaChain: Assign<Chain, {
|
|
141
|
+
readonly id: "kusama";
|
|
142
|
+
readonly name: "Kusama";
|
|
143
|
+
readonly specName: "kusama";
|
|
144
|
+
readonly wsUrls: ["wss://kusama-rpc.polkadot.io"];
|
|
145
|
+
readonly relay: "kusama";
|
|
146
|
+
readonly type: "relay";
|
|
147
|
+
readonly chainId: null;
|
|
148
|
+
readonly logo: "./chains/ksm.svg";
|
|
149
|
+
readonly blockExplorerUrl: "https://kusama.subscan.io";
|
|
150
|
+
}>;
|
|
151
|
+
declare const kusamaAssetHubChain: Assign<Chain, {
|
|
152
|
+
readonly id: "kah";
|
|
153
|
+
readonly name: "Kusama Asset Hub";
|
|
154
|
+
readonly specName: "asset-hub-kusama";
|
|
155
|
+
readonly wsUrls: ["wss://kusama-asset-hub-rpc.polkadot.io"];
|
|
156
|
+
readonly relay: "kusama";
|
|
157
|
+
readonly type: "system";
|
|
158
|
+
readonly chainId: 1000;
|
|
159
|
+
readonly logo: "./chains/kah.svg";
|
|
160
|
+
readonly blockExplorerUrl: "https://assethub-kusama.subscan.io";
|
|
161
|
+
}>;
|
|
162
|
+
declare const rococoChain: Assign<Chain, {
|
|
163
|
+
readonly id: "rococo";
|
|
164
|
+
readonly name: "Rococo";
|
|
165
|
+
readonly specName: "rococo";
|
|
166
|
+
readonly wsUrls: ["wss://rococo-rpc.polkadot.io"];
|
|
167
|
+
readonly relay: "rococo";
|
|
168
|
+
readonly type: "relay";
|
|
169
|
+
readonly chainId: null;
|
|
170
|
+
readonly logo: "./chains/roc.svg";
|
|
171
|
+
readonly blockExplorerUrl: "https://rococo.subscan.io";
|
|
172
|
+
}>;
|
|
173
|
+
declare const rococoAssetHubChain: Assign<Chain, {
|
|
174
|
+
readonly id: "rah";
|
|
175
|
+
readonly name: "Rococo Asset Hub";
|
|
176
|
+
readonly specName: "asset-hub-rococo";
|
|
177
|
+
readonly wsUrls: ["wss://rococo-asset-hub-rpc.polkadot.io"];
|
|
178
|
+
readonly relay: "rococo";
|
|
179
|
+
readonly type: "system";
|
|
180
|
+
readonly chainId: 1000;
|
|
181
|
+
readonly logo: "./chains/rah.svg";
|
|
182
|
+
readonly blockExplorerUrl: "https://assethub-rococo.subscan.io";
|
|
183
|
+
}>;
|
|
184
|
+
declare const westendChain: Assign<Chain, {
|
|
185
|
+
readonly id: "westend";
|
|
186
|
+
readonly name: "Westend";
|
|
187
|
+
readonly specName: "westend";
|
|
188
|
+
readonly wsUrls: ["wss://westend-rpc.polkadot.io"];
|
|
189
|
+
readonly relay: "westend";
|
|
190
|
+
readonly type: "relay";
|
|
191
|
+
readonly chainId: null;
|
|
192
|
+
readonly logo: "./chains/wnd.svg";
|
|
193
|
+
readonly blockExplorerUrl: "https://westend.subscan.io";
|
|
194
|
+
readonly xcmExtrinsic: "limited_teleport_assets";
|
|
195
|
+
}>;
|
|
196
|
+
declare const westendAssetHubChain: Assign<Chain, {
|
|
197
|
+
readonly id: "wah";
|
|
198
|
+
readonly name: "Westend Asset Hub";
|
|
199
|
+
readonly specName: "asset-hub-westend";
|
|
200
|
+
readonly wsUrls: ["wss://westend-asset-hub-rpc.polkadot.io"];
|
|
201
|
+
readonly relay: "westend";
|
|
202
|
+
readonly type: "system";
|
|
203
|
+
readonly chainId: 1000;
|
|
204
|
+
readonly logo: "./chains/wah.svg";
|
|
205
|
+
readonly blockExplorerUrl: "https://assethub-westend.subscan.io";
|
|
206
|
+
}>;
|
|
207
|
+
declare const paseoChain: Assign<Chain, {
|
|
208
|
+
readonly id: "paseo";
|
|
209
|
+
readonly name: "Paseo";
|
|
210
|
+
readonly specName: "paseo-testnet";
|
|
211
|
+
readonly wsUrls: ["wss://paseo.dotters.network"];
|
|
212
|
+
readonly relay: "paseo";
|
|
213
|
+
readonly type: "relay";
|
|
214
|
+
readonly chainId: null;
|
|
215
|
+
readonly logo: "./chains/pas.svg";
|
|
216
|
+
readonly blockExplorerUrl: "https://paseo.subscan.io";
|
|
217
|
+
}>;
|
|
218
|
+
declare const paseoAssetHubChain: Assign<Chain, {
|
|
219
|
+
readonly id: "paseoah";
|
|
220
|
+
readonly name: "Paseo Asset Hub";
|
|
221
|
+
readonly specName: "asset-hub-paseo";
|
|
222
|
+
readonly wsUrls: ["wss://asset-hub-paseo-rpc.dwellir.com"];
|
|
223
|
+
readonly relay: "paseo";
|
|
224
|
+
readonly type: "system";
|
|
225
|
+
readonly chainId: 1000;
|
|
226
|
+
readonly logo: "./chains/pah.svg";
|
|
227
|
+
readonly blockExplorerUrl: "https://assethub-paseo.subscan.io";
|
|
228
|
+
}>;
|
|
229
|
+
declare const hydration: Assign<Chain, {
|
|
230
|
+
readonly id: "hdx";
|
|
231
|
+
readonly name: "Hydration";
|
|
232
|
+
readonly specName: "hydradx";
|
|
233
|
+
readonly wsUrls: ["wss://hydration-rpc.n.dwellir.com/", "wss://rpc.hydradx.cloud", "wss://hydradx-rpc.dwellir.com", "wss://rpc.helikon.io/hydradx", "wss://hydration.dotters.network"];
|
|
234
|
+
readonly relay: "polkadot";
|
|
235
|
+
readonly chainId: 2034;
|
|
236
|
+
readonly logo: "./chains/pah.svg";
|
|
237
|
+
readonly blockExplorerUrl: "https://hydration.subscan.io";
|
|
238
|
+
readonly type: "para";
|
|
239
|
+
}>;
|
|
240
|
+
|
|
241
|
+
declare const knowChains_hydration: typeof hydration;
|
|
242
|
+
declare const knowChains_kusamaAssetHubChain: typeof kusamaAssetHubChain;
|
|
243
|
+
declare const knowChains_kusamaChain: typeof kusamaChain;
|
|
244
|
+
declare const knowChains_paseoAssetHubChain: typeof paseoAssetHubChain;
|
|
245
|
+
declare const knowChains_paseoChain: typeof paseoChain;
|
|
246
|
+
declare const knowChains_polkadotAssetHubChain: typeof polkadotAssetHubChain;
|
|
247
|
+
declare const knowChains_polkadotChain: typeof polkadotChain;
|
|
248
|
+
declare const knowChains_rococoAssetHubChain: typeof rococoAssetHubChain;
|
|
249
|
+
declare const knowChains_rococoChain: typeof rococoChain;
|
|
250
|
+
declare const knowChains_westendAssetHubChain: typeof westendAssetHubChain;
|
|
251
|
+
declare const knowChains_westendChain: typeof westendChain;
|
|
252
|
+
declare namespace knowChains {
|
|
253
|
+
export { knowChains_hydration as hydration, knowChains_kusamaAssetHubChain as kusamaAssetHubChain, knowChains_kusamaChain as kusamaChain, knowChains_paseoAssetHubChain as paseoAssetHubChain, knowChains_paseoChain as paseoChain, knowChains_polkadotAssetHubChain as polkadotAssetHubChain, knowChains_polkadotChain as polkadotChain, knowChains_rococoAssetHubChain as rococoAssetHubChain, knowChains_rococoChain as rococoChain, knowChains_westendAssetHubChain as westendAssetHubChain, knowChains_westendChain as westendChain };
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
type ClientOptions = {
|
|
257
|
+
lightClients?: {
|
|
258
|
+
enable: boolean;
|
|
259
|
+
smoldot: SmoldotClient;
|
|
260
|
+
chainSpecs: Partial<Record<ChainId, string>>;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
declare const getClientCacheId: (chainId: ChainId, { lightClients }: ClientOptions) => string;
|
|
264
|
+
declare const CLIENTS_CACHE: Map<string, Promise<PolkadotClient>>;
|
|
265
|
+
declare const getClient: (chainId: ChainId, chains: Chain[], options: ClientOptions) => Promise<PolkadotClient>;
|
|
266
|
+
declare const getRelayChainClient: (chain: ChainRelay, options: ClientOptions) => Promise<PolkadotClient>;
|
|
267
|
+
declare const getParaChainClient: (chain: Chain, options: ClientOptions) => Promise<PolkadotClient>;
|
|
268
|
+
|
|
269
|
+
type LightClients = ClientOptions['lightClients'];
|
|
270
|
+
type ApiBase<Id extends ChainId> = Id extends KnowChainId ? TypedApi<Descriptors<Id>> : TypedApi<ChainDefinition>;
|
|
271
|
+
type Api<Id extends ChainId> = ApiBase<Id> & {
|
|
272
|
+
chainId: Id;
|
|
273
|
+
chain: Chain;
|
|
274
|
+
waitReady: Promise<void>;
|
|
275
|
+
};
|
|
276
|
+
declare const isApiAssetHub: (api: Api<ChainId>) => api is Api<ChainIdAssetHub>;
|
|
277
|
+
declare const isApiRelay: (api: Api<ChainId>) => api is Api<ChainIdRelay>;
|
|
278
|
+
declare const getApiInner: <Id extends ChainId>(chainId: ChainId, lightClients: LightClients, chains: Chain[]) => Promise<Api<Id>>;
|
|
279
|
+
declare const getApi: <Id extends ChainId, Papi = Api<Id>>(id: Id, chains: Chain[] | undefined, waitReady: boolean | undefined, lightClients: LightClients) => Promise<Papi>;
|
|
280
|
+
|
|
281
|
+
type AssetPallet = 'assets' | 'system' | 'balances' | 'tokens' | 'ormlTokens';
|
|
282
|
+
type XTokenVersionedAsset = HdxCalls['XTokens']['transfer_multiasset']['asset'];
|
|
283
|
+
type Token = {
|
|
284
|
+
readonly assetId?: number;
|
|
285
|
+
readonly decimals: number;
|
|
286
|
+
readonly symbol: string;
|
|
287
|
+
readonly name: string;
|
|
288
|
+
readonly logo?: string;
|
|
289
|
+
readonly isSufficient: boolean;
|
|
290
|
+
readonly type?: 'asset' | 'native' | 'custom' | 'foreign-asset';
|
|
291
|
+
readonly location?: (plancks: bigint, originChain: Chain, destChain: Chain) => XcmVersionedAssets | XTokenVersionedAsset;
|
|
292
|
+
/**
|
|
293
|
+
* * Specific the xcm extrinsic to use for execute xcm transaction
|
|
294
|
+
*/
|
|
295
|
+
readonly xcmExtrinsic?: (originChain: Chain, destChain: Chain) => 'limited_reserve_transfer_assets' | 'limited_teleport_assets' | 'reserve_transfer_assets' | 'teleport_assets' | 'XTokens.transfer_multiasset' | 'XTokens.transfer' | 'transfer_asset';
|
|
296
|
+
/**
|
|
297
|
+
* * Specific the pallet to query and transfer asset
|
|
298
|
+
*/
|
|
299
|
+
assetPallet?: Record<string, AssetPallet>;
|
|
300
|
+
/**
|
|
301
|
+
* * Id to query balance of asset with key is chain id *[id] in Chain* and value is the asset id to query
|
|
302
|
+
*/
|
|
303
|
+
assetIds?: Record<string, string | number>;
|
|
304
|
+
/**
|
|
305
|
+
* * Amount to add when source account or destination account reach to minimum amount (Existential Deposit)
|
|
306
|
+
* * Default is: 0.2 for all chain
|
|
307
|
+
* * Example minEd: {"pah" : 0.1}
|
|
308
|
+
*/
|
|
309
|
+
minEd?: Record<string, string | number>;
|
|
310
|
+
};
|
|
311
|
+
declare const createToken: <const token extends Token>(token: token) => Assign<Token, token>;
|
|
312
|
+
|
|
313
|
+
declare const getExistentialDeposit: (token: Token, api: Api<ChainId>) => Promise<bigint>;
|
|
314
|
+
|
|
315
|
+
type _Subscription = {
|
|
316
|
+
unsubscribe: () => void;
|
|
317
|
+
};
|
|
318
|
+
type Subscription = _Subscription | null;
|
|
319
|
+
declare const subscribeTokenBalance: (api?: Api<ChainId>, token?: Token, address?: string, cb?: (balance: bigint) => void) => Subscription | undefined;
|
|
320
|
+
declare const getTokenBalance: (api?: Api<ChainId>, token?: Token, address?: string) => Promise<bigint | null | undefined>;
|
|
321
|
+
|
|
322
|
+
declare const tokens: {
|
|
323
|
+
WND: Assign<Token, {
|
|
324
|
+
readonly type: "native";
|
|
325
|
+
readonly decimals: 12;
|
|
326
|
+
readonly symbol: "WND";
|
|
327
|
+
readonly name: "Westend";
|
|
328
|
+
readonly logo: "./img/tokens/WND.svg";
|
|
329
|
+
readonly isSufficient: true;
|
|
330
|
+
}>;
|
|
331
|
+
ROC: Assign<Token, {
|
|
332
|
+
readonly type: "native";
|
|
333
|
+
readonly decimals: 12;
|
|
334
|
+
readonly symbol: "ROC";
|
|
335
|
+
readonly name: "Rococo";
|
|
336
|
+
readonly logo: "./img/tokens/ROC.svg";
|
|
337
|
+
readonly isSufficient: true;
|
|
338
|
+
}>;
|
|
339
|
+
KSM: Assign<Token, {
|
|
340
|
+
readonly type: "native";
|
|
341
|
+
readonly decimals: 12;
|
|
342
|
+
readonly symbol: "KSM";
|
|
343
|
+
readonly name: "Kusama";
|
|
344
|
+
readonly logo: "./img/tokens/KSM.svg";
|
|
345
|
+
readonly isSufficient: true;
|
|
346
|
+
}>;
|
|
347
|
+
KSM_PAH: Assign<Token, {
|
|
348
|
+
readonly type: "native";
|
|
349
|
+
readonly decimals: 12;
|
|
350
|
+
readonly symbol: "KSM";
|
|
351
|
+
readonly name: "Kusama";
|
|
352
|
+
readonly logo: "./img/tokens/KSM.svg";
|
|
353
|
+
readonly isSufficient: true;
|
|
354
|
+
}>;
|
|
355
|
+
DOT: Assign<Token, {
|
|
356
|
+
readonly type: "native";
|
|
357
|
+
readonly decimals: 10;
|
|
358
|
+
readonly symbol: "DOT";
|
|
359
|
+
readonly name: "Polkadot";
|
|
360
|
+
readonly logo: "./img/tokens/DOT.svg";
|
|
361
|
+
readonly isSufficient: true;
|
|
362
|
+
}>;
|
|
363
|
+
PAS: Assign<Token, {
|
|
364
|
+
readonly type: "native";
|
|
365
|
+
readonly decimals: 10;
|
|
366
|
+
readonly symbol: "PAS";
|
|
367
|
+
readonly name: "Paseo";
|
|
368
|
+
readonly logo: "./img/tokens/PAS.svg";
|
|
369
|
+
readonly isSufficient: true;
|
|
370
|
+
}>;
|
|
371
|
+
USDC: Assign<Token, {
|
|
372
|
+
readonly type: "asset";
|
|
373
|
+
readonly assetId: 1337;
|
|
374
|
+
readonly decimals: 6;
|
|
375
|
+
readonly symbol: "USDC";
|
|
376
|
+
readonly name: "USDC Coin";
|
|
377
|
+
readonly logo: "./img/tokens/USDC.svg";
|
|
378
|
+
readonly isSufficient: true;
|
|
379
|
+
}>;
|
|
380
|
+
WND_USDC: Assign<Token, {
|
|
381
|
+
readonly type: "asset";
|
|
382
|
+
readonly assetId: 31337;
|
|
383
|
+
readonly decimals: 6;
|
|
384
|
+
readonly symbol: "USDC";
|
|
385
|
+
readonly name: "USDC Coin";
|
|
386
|
+
readonly logo: "./img/tokens/USDC.svg";
|
|
387
|
+
readonly isSufficient: true;
|
|
388
|
+
}>;
|
|
389
|
+
USDT: Assign<Token, {
|
|
390
|
+
readonly type: "asset";
|
|
391
|
+
readonly assetId: 1984;
|
|
392
|
+
readonly decimals: 6;
|
|
393
|
+
readonly symbol: "USDT";
|
|
394
|
+
readonly name: "Tether USD";
|
|
395
|
+
readonly logo: "./img/tokens/USDT.svg";
|
|
396
|
+
readonly isSufficient: true;
|
|
397
|
+
}>;
|
|
398
|
+
USDT_HDX: Assign<Token, {
|
|
399
|
+
readonly type: "asset";
|
|
400
|
+
readonly assetId: 10;
|
|
401
|
+
readonly decimals: 6;
|
|
402
|
+
readonly symbol: "USDT";
|
|
403
|
+
readonly name: "Tether USD";
|
|
404
|
+
readonly logo: "./img/tokens/USDT.svg";
|
|
405
|
+
readonly isSufficient: true;
|
|
406
|
+
}>;
|
|
407
|
+
HDX: Assign<Token, {
|
|
408
|
+
readonly type: "native";
|
|
409
|
+
readonly decimals: 12;
|
|
410
|
+
readonly symbol: "HDX";
|
|
411
|
+
readonly name: "HDX";
|
|
412
|
+
readonly logo: "./img/tokens/HDX.svg";
|
|
413
|
+
readonly isSufficient: true;
|
|
414
|
+
}>;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
type XcmV3Multilocation = {
|
|
418
|
+
parents: number;
|
|
419
|
+
interior: XcmV3Junctions;
|
|
420
|
+
};
|
|
421
|
+
type Pair = Pick<Token, 'type' | 'assetId' | 'location'>;
|
|
422
|
+
declare const getTokenIdFromXcmV3Multilocation: (chainId: ChainId, multilocation: XcmV3Multilocation) => Pair | null;
|
|
423
|
+
|
|
424
|
+
declare const getFeeAssetLocation: (feeToken: Token, chainId: ChainId) => {
|
|
425
|
+
parents: number;
|
|
426
|
+
interior: {
|
|
427
|
+
type: "X2";
|
|
428
|
+
value: polkadot_api.FixedSizeArray<2, XcmV3Junction>;
|
|
429
|
+
} & {
|
|
430
|
+
type: "X2";
|
|
431
|
+
};
|
|
432
|
+
} | undefined;
|
|
433
|
+
declare const getAssetConvertPlancks: (api: Api<ChainIdAssetHub>, params: {
|
|
434
|
+
plancks?: bigint;
|
|
435
|
+
tokenIn?: Token;
|
|
436
|
+
tokenOut?: Token;
|
|
437
|
+
nativeToken?: Token;
|
|
438
|
+
}) => Promise<bigint | undefined>;
|
|
439
|
+
|
|
440
|
+
declare const getTransferExtrinsic: (api: Api<ChainId>, token: Token, amount: string, dest: SS58String) => polkadot_api.Transaction<{
|
|
441
|
+
dest: MultiAddress;
|
|
442
|
+
value: bigint;
|
|
443
|
+
}, "Balances", "transfer_keep_alive", {
|
|
444
|
+
parents: number;
|
|
445
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
446
|
+
} | undefined> | polkadot_api.Transaction<{
|
|
447
|
+
dest: SS58String;
|
|
448
|
+
amount: bigint;
|
|
449
|
+
currency_id: number;
|
|
450
|
+
}, "Tokens", "transfer", void | undefined> | polkadot_api.Transaction<{
|
|
451
|
+
id: number;
|
|
452
|
+
target: MultiAddress;
|
|
453
|
+
amount: bigint;
|
|
454
|
+
}, "Assets", "transfer", {
|
|
455
|
+
parents: number;
|
|
456
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
457
|
+
} | undefined> | null;
|
|
458
|
+
|
|
459
|
+
declare const getXcmTransferExtrinsic: (api: Api<ChainId>, token: Token, amount: string, address: SS58String, destChain: Chain) => polkadot_api.Transaction<{
|
|
460
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
461
|
+
amount: bigint;
|
|
462
|
+
dest_weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
463
|
+
currency_id: number;
|
|
464
|
+
}, "XTokens", "transfer", void | undefined> | polkadot_api.Transaction<{
|
|
465
|
+
asset: polkadot_api.Enum<{
|
|
466
|
+
V2: {
|
|
467
|
+
id: _polkadot_api_descriptors.XcmV2MultiassetAssetId;
|
|
468
|
+
fun: _polkadot_api_descriptors.XcmV2MultiassetFungibility;
|
|
469
|
+
};
|
|
470
|
+
V3: {
|
|
471
|
+
id: _polkadot_api_descriptors.XcmV3MultiassetAssetId;
|
|
472
|
+
fun: _polkadot_api_descriptors.XcmV3MultiassetFungibility;
|
|
473
|
+
};
|
|
474
|
+
V4: {
|
|
475
|
+
id: {
|
|
476
|
+
parents: number;
|
|
477
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
478
|
+
};
|
|
479
|
+
fun: _polkadot_api_descriptors.XcmV3MultiassetFungibility;
|
|
480
|
+
};
|
|
481
|
+
}>;
|
|
482
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
483
|
+
dest_weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
484
|
+
}, "XTokens", "transfer_multiasset", void | undefined> | polkadot_api.Transaction<{
|
|
485
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
486
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
487
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
488
|
+
fee_asset_item: number;
|
|
489
|
+
weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
490
|
+
}, "PolkadotXcm", "limited_reserve_transfer_assets", {
|
|
491
|
+
parents: number;
|
|
492
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
493
|
+
} | undefined> | polkadot_api.Transaction<{
|
|
494
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
495
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
496
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
497
|
+
fee_asset_item: number;
|
|
498
|
+
weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
499
|
+
}, "XcmPallet", "limited_reserve_transfer_assets", void | undefined> | polkadot_api.Transaction<{
|
|
500
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
501
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
502
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
503
|
+
fee_asset_item: number;
|
|
504
|
+
weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
505
|
+
}, "PolkadotXcm", "transfer_assets", {
|
|
506
|
+
parents: number;
|
|
507
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
508
|
+
} | undefined> | polkadot_api.Transaction<{
|
|
509
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
510
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
511
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
512
|
+
fee_asset_item: number;
|
|
513
|
+
weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
514
|
+
}, "XcmPallet", "transfer_assets", void | undefined> | polkadot_api.Transaction<{
|
|
515
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
516
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
517
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
518
|
+
fee_asset_item: number;
|
|
519
|
+
weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
520
|
+
}, "PolkadotXcm", "limited_teleport_assets", {
|
|
521
|
+
parents: number;
|
|
522
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
523
|
+
} | undefined> | polkadot_api.Transaction<{
|
|
524
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
525
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
526
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
527
|
+
fee_asset_item: number;
|
|
528
|
+
weight_limit: _polkadot_api_descriptors.XcmV3WeightLimit;
|
|
529
|
+
}, "XcmPallet", "limited_teleport_assets", void | undefined> | polkadot_api.Transaction<{
|
|
530
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
531
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
532
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
533
|
+
fee_asset_item: number;
|
|
534
|
+
}, "PolkadotXcm", "teleport_assets", {
|
|
535
|
+
parents: number;
|
|
536
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
537
|
+
} | undefined> | polkadot_api.Transaction<{
|
|
538
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
539
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
540
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
541
|
+
fee_asset_item: number;
|
|
542
|
+
}, "XcmPallet", "teleport_assets", void | undefined> | polkadot_api.Transaction<{
|
|
543
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
544
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
545
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
546
|
+
fee_asset_item: number;
|
|
547
|
+
}, "PolkadotXcm", "reserve_transfer_assets", {
|
|
548
|
+
parents: number;
|
|
549
|
+
interior: _polkadot_api_descriptors.XcmV3Junctions;
|
|
550
|
+
} | undefined> | polkadot_api.Transaction<{
|
|
551
|
+
dest: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
552
|
+
beneficiary: _polkadot_api_descriptors.XcmVersionedLocation;
|
|
553
|
+
assets: _polkadot_api_descriptors.XcmVersionedAssets;
|
|
554
|
+
fee_asset_item: number;
|
|
555
|
+
}, "XcmPallet", "reserve_transfer_assets", void | undefined>;
|
|
556
|
+
|
|
557
|
+
type InjectedPolkadotAccount = InjectedPolkadotAccount$1 & {
|
|
558
|
+
wallet: string;
|
|
559
|
+
};
|
|
560
|
+
declare class Wallet {
|
|
561
|
+
static _instance: Wallet | null;
|
|
562
|
+
private store;
|
|
563
|
+
private accountStore;
|
|
564
|
+
constructor();
|
|
565
|
+
get isConnected(): boolean;
|
|
566
|
+
static get instance(): Wallet;
|
|
567
|
+
setStoreKey(walletStoreKey: string, accountStoreKey: string): void;
|
|
568
|
+
get currentAccountId(): {
|
|
569
|
+
wallet: string;
|
|
570
|
+
address: string;
|
|
571
|
+
} | null;
|
|
572
|
+
get connectedWalletIds(): string[];
|
|
573
|
+
setCurrentAccountId(wallet: string, address: string): void;
|
|
574
|
+
getInjectedWalletIds(): string[];
|
|
575
|
+
connect(walletId: string): Promise<void>;
|
|
576
|
+
disconnect(walletId: string): Promise<void>;
|
|
577
|
+
getAllConnectedAccounts(): Promise<InjectedPolkadotAccount[]>;
|
|
578
|
+
subscribeAccounts(cb: (accounts: InjectedPolkadotAccount[]) => void): Promise<void>;
|
|
579
|
+
}
|
|
580
|
+
declare const wallet: Wallet;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* * Currently we only support 1 chain only, We will update it later
|
|
584
|
+
*/
|
|
585
|
+
|
|
586
|
+
type TokenConfig = {
|
|
587
|
+
token: Token;
|
|
588
|
+
feeTokens: Token[];
|
|
589
|
+
};
|
|
590
|
+
type Config<Chains extends readonly [Chain] = readonly [Chain]> = {
|
|
591
|
+
readonly sourceChains: Chains;
|
|
592
|
+
readonly lightClients?: LightClients;
|
|
593
|
+
readonly tokens?: Partial<Record<Chains[number]['id'], TokenConfig>>;
|
|
594
|
+
readonly useXcmTransfer?: boolean;
|
|
595
|
+
readonly destinationChains?: Chain[];
|
|
596
|
+
readonly destinationAddress?: string;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* Creates a configuration object.
|
|
600
|
+
* @param config - The configuration object.
|
|
601
|
+
* @returns The configuration object.
|
|
602
|
+
*/
|
|
603
|
+
declare const createConfig: <Chains extends readonly [Chain]>(config: Config<Chains>) => Config<Chains>;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Formats a number into a compact string representation with a specified number of significant digits.
|
|
607
|
+
*
|
|
608
|
+
* @param num - The number to format, which can be a string, number, or null. If null or undefined, returns an empty string.
|
|
609
|
+
* @param digits - The number of significant digits to include in the formatted output. Defaults to 4.
|
|
610
|
+
*
|
|
611
|
+
* @returns A string representing the compact format of the number. If the number is zero, returns '0'. If the number is
|
|
612
|
+
* smaller than the minimum displayable value based on the number of significant digits, returns a string in the format
|
|
613
|
+
* `< minDisplayable>`.
|
|
614
|
+
*
|
|
615
|
+
* @throws An error if the input is not a valid number.
|
|
616
|
+
*/
|
|
617
|
+
declare const formatDecimals: (num?: string | number | null, digits?: number) => string;
|
|
618
|
+
/**
|
|
619
|
+
* Format a raw balance from a chain into a string, including decimal notation.
|
|
620
|
+
*
|
|
621
|
+
* @param rawBalance The raw balance from the chain, as a string, number, or bigint. If not provided, returns '0'.
|
|
622
|
+
* @param decimals The number of decimal places to use when formatting. Defaults to 10.
|
|
623
|
+
*
|
|
624
|
+
* @returns The formatted balance as a string.
|
|
625
|
+
*
|
|
626
|
+
*/
|
|
627
|
+
declare const formatUnits: (rawBalance?: string | number | bigint | null, decimals?: number) => string;
|
|
628
|
+
/**
|
|
629
|
+
* Format a raw balance from a chain into a compact string representation with a specified number of significant digits.
|
|
630
|
+
// Split the display string into integer and fraction parts based on the decimals.
|
|
631
|
+
*
|
|
632
|
+
|
|
633
|
+
// Remove trailing zeros from the fraction part.
|
|
634
|
+
* @param rawBalance The raw balance from the chain, as a string, number, or bigint. If not provided, returns '0'.
|
|
635
|
+
|
|
636
|
+
// Return the formatted balance with appropriate negative sign and decimal point.
|
|
637
|
+
* @param decimals The number of decimal places to use when formatting. Defaults to 10.
|
|
638
|
+
* @param digits The number of significant digits to include in the formatted output. Defaults to 4.
|
|
639
|
+
*
|
|
640
|
+
* @returns A string representing the compact format of the balance. If the number is zero, returns '0'. If the number is
|
|
641
|
+
* smaller than the minimum displayable value based on the number of significant digits, returns a string in the format
|
|
642
|
+
* `< minDisplayable>`.
|
|
643
|
+
*
|
|
644
|
+
* @throws An error if the input is not a valid number.
|
|
645
|
+
*/
|
|
646
|
+
declare const formatBalance: (rawBalance?: string | number | bigint | null, decimals?: number, digits?: number) => string;
|
|
647
|
+
/**
|
|
648
|
+
* Parse a string value into a raw balance, as a bigint.
|
|
649
|
+
*
|
|
650
|
+
* @param value The value to parse, as a string. If not provided, returns 0n.
|
|
651
|
+
* @param decimals The number of decimal places to use when parsing. Defaults to 10.
|
|
652
|
+
*
|
|
653
|
+
* @returns The parsed raw balance as a bigint.
|
|
654
|
+
*
|
|
655
|
+
* @throws {Error} If the value is not a valid number.
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* parseUnits('1000000000', 12) // 1000000000000n
|
|
659
|
+
* parseUnits('1000000000', 10) // 10000000000n
|
|
660
|
+
* parseUnits('1000000000', 4) // 100000000n
|
|
661
|
+
*/
|
|
662
|
+
declare function parseUnits(value: string, decimals?: number): bigint;
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Check if a given string input is a valid integer.
|
|
666
|
+
*
|
|
667
|
+
* @param val
|
|
668
|
+
*/
|
|
669
|
+
declare const isNumber: (val: string) => boolean;
|
|
670
|
+
|
|
671
|
+
declare const isValidAddress: (address: SS58String | string) => address is SS58String;
|
|
672
|
+
|
|
673
|
+
declare const getAssetIdByChain: (token: Token, chainId: ChainId) => string | undefined;
|
|
674
|
+
declare const getAssetPalletByChain: (token: Token, chainId: ChainId) => AssetPallet | undefined;
|
|
675
|
+
|
|
676
|
+
export { type Api, type AssetPallet, type Assign, CLIENTS_CACHE, type Chain, type ChainAssetHub, type ChainId, type ChainIdAssetHub, type ChainIdPara, type ChainIdRelay, type ChainRelay, type ClientOptions, type Config, DESCRIPTORS_ALL, type Descriptors, type DescriptorsAll, type InjectedPolkadotAccount, type KnowChainId, type LightClients, type Register, type ResolvedRegister, type SmoldotClient, type StringWithDefault, type Token, type TokenConfig, Wallet, type XTokenVersionedAsset, chainDestIsBridge, knowChains as chains, createChain, createConfig, createToken, formatBalance, formatDecimals, formatUnits, getApi, getApiInner, getAssetConvertPlancks, getAssetIdByChain, getAssetPalletByChain, getChainById, getClient, getClientCacheId, getDescriptors, getExistentialDeposit, getFeeAssetLocation, getParaChainClient, getRelayChainClient, getTokenBalance, getTokenIdFromXcmV3Multilocation, getTransferExtrinsic, getXcmTransferExtrinsic, isApiAssetHub, isApiRelay, isChainIdAssetHub, isChainIdRelay, isNumber, isParachain, isRelayChain, isSystemChain, isValidAddress, parseLocationStrToLocation, parseUnits, subscribeTokenBalance, tokens, wallet };
|