@paraspell/sdk-core 13.4.1 → 13.6.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/dist/index.d.ts +1536 -1390
- package/dist/index.mjs +5675 -5284
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import * as _paraspell_sdk_common from '@paraspell/sdk-common';
|
|
|
2
2
|
import { TSubstrateChain, TChain, Version, TRelaychain, TParachain, TLocation, TExternalChain, TJunction, Parents, TJunctions } from '@paraspell/sdk-common';
|
|
3
3
|
export * from '@paraspell/sdk-common';
|
|
4
4
|
import * as _paraspell_assets from '@paraspell/assets';
|
|
5
|
-
import { TAssetInfo, WithAmount, TAsset,
|
|
5
|
+
import { TChainAssetsInfo, TAssetInfo, TCurrencyInput, WithAmount, TAsset, TCurrencyInputWithAmount, TCustomAssetInfo, TCustomCtx, TCustomAssetsMap, TCurrencyCore, TAmount, TAssetWithFee, WithComplexAmount, TAssetInfoWithId } from '@paraspell/assets';
|
|
6
6
|
export * from '@paraspell/assets';
|
|
7
|
-
import { TPallet, TAssetsPallet } from '@paraspell/pallets';
|
|
7
|
+
import { TPallet, TPalletEntry, TAssetsPallet, TCustomChainPallets, TCrosschainPallet } from '@paraspell/pallets';
|
|
8
8
|
export * from '@paraspell/pallets';
|
|
9
|
-
import { WalletClient, formatUnits as formatUnits$1, parseUnits as parseUnits$1 } from 'viem';
|
|
9
|
+
import { WalletClient, TransactionSerializableEIP1559, Address, formatUnits as formatUnits$1, parseUnits as parseUnits$1 } from 'viem';
|
|
10
10
|
|
|
11
11
|
type WithApi<TBase, TApi, TRes, TSigner> = TBase & {
|
|
12
12
|
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
@@ -37,11 +37,18 @@ type ClientCache<T> = {
|
|
|
37
37
|
};
|
|
38
38
|
declare const API_TYPES: readonly ["PAPI", "PJS", "DEDOT"];
|
|
39
39
|
type TApiType = (typeof API_TYPES)[number];
|
|
40
|
+
type TRuntimeApi = 'DryRunApi' | 'XcmPaymentApi';
|
|
41
|
+
type TSystemProperties = {
|
|
42
|
+
ss58Format?: number;
|
|
43
|
+
tokenSymbol?: string;
|
|
44
|
+
tokenDecimals?: number;
|
|
45
|
+
};
|
|
40
46
|
|
|
41
|
-
declare abstract class PolkadotApi<TApi, TRes, TSigner> {
|
|
47
|
+
declare abstract class PolkadotApi<TApi, TRes, TSigner, TCustomChain extends string = never> {
|
|
42
48
|
_api?: TApi;
|
|
43
|
-
_chain?: TSubstrateChain;
|
|
49
|
+
_chain?: TSubstrateChain | TCustomChain;
|
|
44
50
|
readonly _config?: TBuilderOptions<TApiOrUrl<TApi>>;
|
|
51
|
+
readonly _customCtx: TFullCustomCtx;
|
|
45
52
|
_ttlMs: number;
|
|
46
53
|
_disconnectAllowed: boolean;
|
|
47
54
|
abstract readonly type: TApiType;
|
|
@@ -50,7 +57,22 @@ declare abstract class PolkadotApi<TApi, TRes, TSigner> {
|
|
|
50
57
|
set disconnectAllowed(allowed: boolean);
|
|
51
58
|
get disconnectAllowed(): boolean;
|
|
52
59
|
get config(): TBuilderOptions<TApiOrUrl<TApi>> | undefined;
|
|
53
|
-
|
|
60
|
+
getAssetsObject(chain: TChain): TChainAssetsInfo;
|
|
61
|
+
getAssets(chain: TChain): TAssetInfo[];
|
|
62
|
+
getNativeAssets(chain: TChain): TAssetInfo[];
|
|
63
|
+
getOtherAssets(chain: TChain): TAssetInfo[];
|
|
64
|
+
findAssetInfo(chain: TChain, currency: TCurrencyInput, destination?: TChain | null): TAssetInfo | null;
|
|
65
|
+
findAssetInfoOrThrow(chain: TChain, currency: TCurrencyInput, destination?: TChain | null): TAssetInfo;
|
|
66
|
+
findAssetInfoOnDest(origin: TChain, destination: TChain, currency: TCurrencyInput, originAsset?: TAssetInfo | null): TAssetInfo | null;
|
|
67
|
+
findAssetOnDestOrThrow(origin: TChain, destination: TChain, currency: TCurrencyInput): TAssetInfo;
|
|
68
|
+
findNativeAssetInfo(chain: TChain): TAssetInfo | null;
|
|
69
|
+
findNativeAssetInfoOrThrow(chain: TChain): TAssetInfo;
|
|
70
|
+
isChainEvm(chain: TChain): boolean;
|
|
71
|
+
getNativeAssetSymbol(chain: TChain): string;
|
|
72
|
+
getRelayChainSymbol(chain: TChain): string;
|
|
73
|
+
hasDryRunSupport(chain: TChain): boolean;
|
|
74
|
+
hasXcmPaymentApiSupport(chain: TChain): boolean;
|
|
75
|
+
init(chain: TChain | TCustomChain, clientTtlMs?: number): Promise<void>;
|
|
54
76
|
abstract leaseClient(wsUrl: TUrl, ttlMs: number): Promise<TApi>;
|
|
55
77
|
abstract accountToHex(address: string, isPrefixed?: boolean): string;
|
|
56
78
|
abstract accountToUint8a(address: string): Uint8Array;
|
|
@@ -68,6 +90,9 @@ declare abstract class PolkadotApi<TApi, TRes, TSigner> {
|
|
|
68
90
|
abstract getMethod(tx: TRes): string;
|
|
69
91
|
abstract getTypeThenAssetCount(tx: TRes): number | undefined;
|
|
70
92
|
abstract hasMethod(pallet: TPallet, method: string): Promise<boolean>;
|
|
93
|
+
abstract hasRuntimeApi(runtimeApi: TRuntimeApi): Promise<boolean>;
|
|
94
|
+
abstract fetchPalletList(): Promise<TPalletEntry[]>;
|
|
95
|
+
abstract isEvmChain(): Promise<boolean>;
|
|
71
96
|
abstract getPaymentInfo(tx: TRes, address: string): Promise<{
|
|
72
97
|
partialFee: bigint;
|
|
73
98
|
weight: TWeight;
|
|
@@ -77,8 +102,8 @@ declare abstract class PolkadotApi<TApi, TRes, TSigner> {
|
|
|
77
102
|
abstract getEvmStorage(contract: string, slot: string): Promise<string>;
|
|
78
103
|
abstract getFromRpc(module: string, method: string, key: string): Promise<string>;
|
|
79
104
|
abstract blake2AsHex(data: Uint8Array): string;
|
|
80
|
-
abstract clone(): PolkadotApi<TApi, TRes, TSigner>;
|
|
81
|
-
abstract createApiForChain(chain: TSubstrateChain): Promise<PolkadotApi<TApi, TRes, TSigner>>;
|
|
105
|
+
abstract clone(): PolkadotApi<TApi, TRes, TSigner, TCustomChain>;
|
|
106
|
+
abstract createApiForChain(chain: TSubstrateChain): Promise<PolkadotApi<TApi, TRes, TSigner, TCustomChain>>;
|
|
82
107
|
abstract getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunChainResult>;
|
|
83
108
|
abstract getDryRunXcm(options: TDryRunXcmBaseOptions<TRes>): Promise<TDryRunChainResult>;
|
|
84
109
|
abstract getBridgeStatus(): Promise<TBridgeStatus>;
|
|
@@ -88,14 +113,16 @@ declare abstract class PolkadotApi<TApi, TRes, TSigner> {
|
|
|
88
113
|
abstract deriveAddress(sender: TSender<TSigner>): string;
|
|
89
114
|
abstract signAndSubmit(tx: TRes, sender: TSender<TSigner>): Promise<string>;
|
|
90
115
|
abstract signAndSubmitFinalized(tx: TRes, sender: TSender<TSigner>): Promise<string>;
|
|
116
|
+
abstract getSystemProperties(): Promise<TSystemProperties>;
|
|
117
|
+
private maybeHydrateCustomChain;
|
|
91
118
|
}
|
|
92
119
|
|
|
93
|
-
declare abstract class Chain<TApi, TRes, TSigner> {
|
|
120
|
+
declare abstract class Chain<TApi, TRes, TSigner, TCustomChain extends string = never> {
|
|
94
121
|
private readonly _chain;
|
|
95
122
|
private readonly _info;
|
|
96
123
|
private readonly _ecosystem;
|
|
97
124
|
private readonly _version;
|
|
98
|
-
constructor(chain: TSubstrateChain, info: string, ecosystem: TRelaychain, version: Version);
|
|
125
|
+
constructor(chain: TSubstrateChain | TCustomChain, info: string, ecosystem: TRelaychain, version: Version);
|
|
99
126
|
get info(): string;
|
|
100
127
|
get ecosystem(): TRelaychain;
|
|
101
128
|
get chain(): TSubstrateChain;
|
|
@@ -106,17 +133,16 @@ declare abstract class Chain<TApi, TRes, TSigner> {
|
|
|
106
133
|
throwIfTempDisabled(options: TTransferInternalOptions<TApi, TRes, TSigner>, destChain?: TChain): void;
|
|
107
134
|
isSendingTempDisabled(_options: TTransferInternalOptions<TApi, TRes, TSigner>): boolean;
|
|
108
135
|
isReceivingTempDisabled(_scenario: TScenario): boolean;
|
|
109
|
-
canReceiveFrom(_origin: TChain): boolean;
|
|
110
|
-
shouldUseNativeAssetTeleport({ assetInfo: asset, to }: TTransferInternalOptions<TApi, TRes, TSigner>): boolean;
|
|
111
|
-
createAsset(asset: WithAmount<TAssetInfo>, version: Version): TAsset;
|
|
112
|
-
getNativeAssetSymbol(): string;
|
|
136
|
+
canReceiveFrom(_origin: TChain | TCustomChain): boolean;
|
|
137
|
+
shouldUseNativeAssetTeleport({ api, assetInfo: asset, to }: TTransferInternalOptions<TApi, TRes, TSigner>): boolean;
|
|
138
|
+
createAsset(api: PolkadotApi<TApi, TRes, TSigner>, asset: WithAmount<TAssetInfo>, version: Version): TAsset;
|
|
139
|
+
getNativeAssetSymbol(api: PolkadotApi<TApi, TRes, TSigner>): string;
|
|
113
140
|
transferLocal(options: TTransferInternalOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
114
141
|
transferLocalNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
115
142
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
116
|
-
protected transferToEthereum<TApi, TRes, TSigner>(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>, useOnlyDepositInstruction?: boolean): Promise<TRes>;
|
|
117
143
|
getBalanceNative(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
118
|
-
getCustomCurrencyId(_asset: TAssetInfo): unknown;
|
|
119
|
-
getBalanceForeign
|
|
144
|
+
getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner>, _asset: TAssetInfo): unknown;
|
|
145
|
+
getBalanceForeign(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
120
146
|
getBalance(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
121
147
|
}
|
|
122
148
|
|
|
@@ -126,7 +152,7 @@ declare class Acala<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> impl
|
|
|
126
152
|
isRelayToParaEnabled(): boolean;
|
|
127
153
|
transferLocalNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
128
154
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
129
|
-
getCustomCurrencyId(asset: TAssetInfo): TForeignOrTokenAsset;
|
|
155
|
+
getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): TForeignOrTokenAsset;
|
|
130
156
|
getBalance(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
131
157
|
}
|
|
132
158
|
|
|
@@ -150,7 +176,6 @@ declare class AssetHubKusama<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSig
|
|
|
150
176
|
|
|
151
177
|
declare class AssetHubPolkadot<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
152
178
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
153
|
-
handleEthBridgeNativeTransfer<TApi, TRes, TSigner>(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
154
179
|
transferPolkadotXCM(options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
155
180
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
156
181
|
getBalanceForeign<TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo): Promise<bigint>;
|
|
@@ -186,7 +211,7 @@ declare class Basilisk<TApi, TRes, TSigner> extends Hydration<TApi, TRes, TSigne
|
|
|
186
211
|
|
|
187
212
|
declare class BifrostPolkadot<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
188
213
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
189
|
-
getCustomCurrencyId(asset: TAssetInfo): {
|
|
214
|
+
getCustomCurrencyId(api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): {
|
|
190
215
|
Native: string;
|
|
191
216
|
VToken?: undefined;
|
|
192
217
|
Token?: undefined;
|
|
@@ -261,7 +286,7 @@ declare class BridgeHubWestend<TApi, TRes, TSigner> extends BridgeHubPolkadot<TA
|
|
|
261
286
|
|
|
262
287
|
declare class Centrifuge<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IXTokensTransfer<TApi, TRes, TSigner> {
|
|
263
288
|
constructor();
|
|
264
|
-
getCustomCurrencyId(asset: TAssetInfo): "Native" | {
|
|
289
|
+
getCustomCurrencyId(api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): "Native" | {
|
|
265
290
|
ForeignAsset: number;
|
|
266
291
|
};
|
|
267
292
|
transferXTokens(input: TXTokensTransferOptions<TApi, TRes, TSigner>): TRes;
|
|
@@ -354,7 +379,7 @@ declare class HydrationPaseo<TApi, TRes, TSigner> extends Hydration<TApi, TRes,
|
|
|
354
379
|
|
|
355
380
|
declare class Interlay<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IXTokensTransfer<TApi, TRes, TSigner> {
|
|
356
381
|
constructor();
|
|
357
|
-
getCustomCurrencyId(asset: TAssetInfo): TForeignOrTokenAsset;
|
|
382
|
+
getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): TForeignOrTokenAsset;
|
|
358
383
|
transferXTokens(input: TXTokensTransferOptions<TApi, TRes, TSigner>): TRes;
|
|
359
384
|
transferLocalNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
360
385
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
@@ -363,7 +388,7 @@ declare class Interlay<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> i
|
|
|
363
388
|
|
|
364
389
|
declare class Jamton<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
365
390
|
constructor();
|
|
366
|
-
getCustomCurrencyId(asset: TAssetInfo): {
|
|
391
|
+
getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): {
|
|
367
392
|
Native: number;
|
|
368
393
|
ForeignAsset?: undefined;
|
|
369
394
|
} | {
|
|
@@ -379,7 +404,7 @@ declare class Karura<TApi, TRes, TSigner> extends Acala<TApi, TRes, TSigner> {
|
|
|
379
404
|
|
|
380
405
|
declare class Kintsugi<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IXTokensTransfer<TApi, TRes, TSigner> {
|
|
381
406
|
constructor();
|
|
382
|
-
getCustomCurrencyId(asset: TAssetInfo): TForeignOrTokenAsset;
|
|
407
|
+
getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): TForeignOrTokenAsset;
|
|
383
408
|
transferXTokens(input: TXTokensTransferOptions<TApi, TRes, TSigner>): TRes;
|
|
384
409
|
transferLocalNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
385
410
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
@@ -395,16 +420,6 @@ declare class Kusama<TApi, TRes, TSigner> extends Polkadot<TApi, TRes, TSigner>
|
|
|
395
420
|
constructor();
|
|
396
421
|
}
|
|
397
422
|
|
|
398
|
-
declare class Laos<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
399
|
-
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
400
|
-
transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
401
|
-
isRelayToParaEnabled(): boolean;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
declare class LaosPaseo<TApi, TRes, TSigner> extends Laos<TApi, TRes, TSigner> {
|
|
405
|
-
constructor();
|
|
406
|
-
}
|
|
407
|
-
|
|
408
423
|
declare class Moonbeam<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
409
424
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
410
425
|
transferPolkadotXCM(options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
@@ -448,7 +463,7 @@ declare class Peaq<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> imple
|
|
|
448
463
|
|
|
449
464
|
declare class Pendulum<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IXTokensTransfer<TApi, TRes, TSigner> {
|
|
450
465
|
constructor();
|
|
451
|
-
getCustomCurrencyId(asset: TAssetInfo): TXcmAsset;
|
|
466
|
+
getCustomCurrencyId(api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): TXcmAsset;
|
|
452
467
|
transferXTokens(input: TXTokensTransferOptions<TApi, TRes, TSigner>): TRes;
|
|
453
468
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
454
469
|
}
|
|
@@ -511,7 +526,7 @@ declare class Xode<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> imple
|
|
|
511
526
|
|
|
512
527
|
declare class Zeitgeist<TApi, TRes, TSigner> extends Chain<TApi, TRes, TSigner> implements IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
513
528
|
constructor(chain?: TParachain, info?: string, ecosystem?: TRelaychain, version?: Version);
|
|
514
|
-
getCustomCurrencyId(asset: TAssetInfo): TZeitgeistAsset | TXcmForeignAsset;
|
|
529
|
+
getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner>, asset: TAssetInfo): TZeitgeistAsset | TXcmForeignAsset;
|
|
515
530
|
transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>): Promise<TRes>;
|
|
516
531
|
canReceiveFrom(origin: TChain): boolean;
|
|
517
532
|
transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner>): TRes;
|
|
@@ -560,7 +575,6 @@ declare const chains: <TApi, TRes, TSigner>() => {
|
|
|
560
575
|
Karura: Karura<TApi, TRes, TSigner>;
|
|
561
576
|
Kintsugi: Kintsugi<TApi, TRes, TSigner>;
|
|
562
577
|
Moonriver: Moonriver<TApi, TRes, TSigner>;
|
|
563
|
-
Laos: Laos<TApi, TRes, TSigner>;
|
|
564
578
|
Quartz: Quartz<TApi, TRes, TSigner>;
|
|
565
579
|
PeopleKusama: PeopleKusama<TApi, TRes, TSigner>;
|
|
566
580
|
Shiden: Shiden<TApi, TRes, TSigner>;
|
|
@@ -582,7 +596,6 @@ declare const chains: <TApi, TRes, TSigner>() => {
|
|
|
582
596
|
BifrostPaseo: BifrostPaseo<TApi, TRes, TSigner>;
|
|
583
597
|
HeimaPaseo: HeimaPaseo<TApi, TRes, TSigner>;
|
|
584
598
|
HydrationPaseo: HydrationPaseo<TApi, TRes, TSigner>;
|
|
585
|
-
LaosPaseo: LaosPaseo<TApi, TRes, TSigner>;
|
|
586
599
|
NeuroWebPaseo: NeuroWebPaseo<TApi, TRes, TSigner>;
|
|
587
600
|
ZeitgeistPaseo: ZeitgeistPaseo<TApi, TRes, TSigner>;
|
|
588
601
|
};
|
|
@@ -601,834 +614,114 @@ declare const TRANSACT_ORIGINS: readonly ["Native", "SovereignAccount", "Superus
|
|
|
601
614
|
*/
|
|
602
615
|
declare const EXCHANGE_CHAINS: readonly ["AssetHubPolkadot", "AssetHubKusama", "AssetHubPaseo", "AssetHubWestend", "Hydration", "Karura", "Acala", "BifrostKusama", "BifrostPolkadot"];
|
|
603
616
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
currency: TCurrencyInputWithAmount;
|
|
614
|
-
version?: Version;
|
|
615
|
-
feeAsset?: TCurrencyInput;
|
|
616
|
-
swapConfig?: TSwapConfig;
|
|
617
|
-
useRootOrigin?: boolean;
|
|
618
|
-
bypassOptions?: TBypassOptions;
|
|
619
|
-
};
|
|
620
|
-
type TDryRunOptions<TApi, TRes, TSigner> = WithApi<TDryRunBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
621
|
-
type TDryRunCallBaseOptions<TRes> = {
|
|
617
|
+
/**
|
|
618
|
+
* Builder class for constructing asset claim transactions.
|
|
619
|
+
*
|
|
620
|
+
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
621
|
+
*/
|
|
622
|
+
declare class AssetClaimBuilder<TApi, TRes, TSigner, T extends Partial<TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>> = object> {
|
|
623
|
+
readonly api: PolkadotApi<TApi, TRes, TSigner>;
|
|
624
|
+
readonly _options: T;
|
|
625
|
+
constructor(api: PolkadotApi<TApi, TRes, TSigner>, options?: T);
|
|
622
626
|
/**
|
|
623
|
-
*
|
|
627
|
+
* Specifies the assets to be claimed.
|
|
628
|
+
*
|
|
629
|
+
* @param assets - An array of assets to claim in a multi-asset format.
|
|
630
|
+
* @returns An instance of Builder
|
|
624
631
|
*/
|
|
625
|
-
|
|
632
|
+
currency(currency: TAssetClaimOptionsBase['currency']): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
633
|
+
currency: TAssetClaimOptionsBase['currency'];
|
|
634
|
+
}>;
|
|
626
635
|
/**
|
|
627
|
-
*
|
|
636
|
+
* Sets the sender address.
|
|
637
|
+
*
|
|
638
|
+
* @param address - The sender address.
|
|
639
|
+
* @returns
|
|
628
640
|
*/
|
|
629
|
-
|
|
641
|
+
sender(sender: TSender<TSigner>): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
642
|
+
sender: string;
|
|
643
|
+
}>;
|
|
630
644
|
/**
|
|
631
|
-
*
|
|
645
|
+
* Specifies the account address on which the assets will be claimed.
|
|
646
|
+
*
|
|
647
|
+
* @param address - The destination account address.
|
|
648
|
+
* @returns An instance of Builder
|
|
632
649
|
*/
|
|
633
|
-
|
|
650
|
+
address(address: TAddress): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
651
|
+
address: TAddress;
|
|
652
|
+
}>;
|
|
634
653
|
/**
|
|
635
|
-
*
|
|
654
|
+
* Sets the XCM version to be used for the asset claim.
|
|
655
|
+
*
|
|
656
|
+
* @param version - The XCM version.
|
|
657
|
+
* @returns An instance of Builder
|
|
636
658
|
*/
|
|
637
|
-
|
|
659
|
+
xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
660
|
+
version: Version;
|
|
661
|
+
}>;
|
|
638
662
|
/**
|
|
639
|
-
*
|
|
663
|
+
* Builds and returns the asset claim extrinsic.
|
|
664
|
+
*
|
|
665
|
+
* @returns A Promise that resolves to the asset claim extrinsic.
|
|
640
666
|
*/
|
|
641
|
-
|
|
667
|
+
build(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase>): Promise<TRes>;
|
|
668
|
+
signAndSubmit(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>>): Promise<string>;
|
|
642
669
|
/**
|
|
643
|
-
*
|
|
670
|
+
* Returns the API instance used by the builder.
|
|
671
|
+
*
|
|
672
|
+
* @returns The API instance.
|
|
644
673
|
*/
|
|
645
|
-
|
|
646
|
-
asset: WithAmount<TAssetInfo>;
|
|
647
|
-
bypassOptions?: TBypassOptions;
|
|
648
|
-
feeAsset?: TAssetInfo;
|
|
649
|
-
};
|
|
650
|
-
type TDryRunBypassOptions<TApi, TRes, TSigner> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin' | 'destination'>, TApi, TRes, TSigner>;
|
|
651
|
-
type TDryRunCallOptions<TApi, TRes, TSigner> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
652
|
-
type TDryRunXcmBaseOptions<TRes> = {
|
|
653
|
-
originLocation: any;
|
|
674
|
+
getApi(): TApi;
|
|
654
675
|
/**
|
|
655
|
-
*
|
|
676
|
+
* Disconnects the API.
|
|
677
|
+
*
|
|
678
|
+
* @returns A Promise that resolves when the API is disconnected.
|
|
656
679
|
*/
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
680
|
+
disconnect(): Promise<void>;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
declare class BatchTransactionManager<TApi, TRes, TSigner> {
|
|
684
|
+
transactionOptions: TBatchedTransferOptions<TApi, TRes, TSigner>[];
|
|
685
|
+
addTransaction(options: TBatchedTransferOptions<TApi, TRes, TSigner>): void;
|
|
686
|
+
isEmpty(): boolean;
|
|
687
|
+
buildBatch(api: PolkadotApi<TApi, TRes, TSigner>, from: TSubstrateChain, options?: TBatchOptions): Promise<TRes>;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
|
|
692
|
+
*/
|
|
693
|
+
declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>> = object, TCustomChain extends string = never> {
|
|
694
|
+
readonly batchManager: BatchTransactionManager<TApi, TRes, TSigner>;
|
|
695
|
+
readonly api: PolkadotApi<TApi, TRes, TSigner>;
|
|
696
|
+
readonly _options: T;
|
|
697
|
+
constructor(api: PolkadotApi<TApi, TRes, TSigner>, batchManager: BatchTransactionManager<TApi, TRes, TSigner>, options?: T);
|
|
660
698
|
/**
|
|
661
|
-
*
|
|
699
|
+
* Specifies the origin chain for the transaction.
|
|
700
|
+
*
|
|
701
|
+
* @param chain - The chain from which the transaction originates.
|
|
702
|
+
* @returns An instance of Builder
|
|
662
703
|
*/
|
|
663
|
-
chain:
|
|
704
|
+
from(chain: TChain | TCustomChain): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
705
|
+
from: TChain;
|
|
706
|
+
}, TCustomChain>;
|
|
664
707
|
/**
|
|
665
|
-
*
|
|
708
|
+
* Specifies the destination chain for the transaction.
|
|
709
|
+
*
|
|
710
|
+
* @param chain - The chain to which the transaction is sent.
|
|
711
|
+
* @param paraIdTo - (Optional) The parachain ID of the destination chain.
|
|
712
|
+
* @returns An instance of Builder
|
|
666
713
|
*/
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
};
|
|
679
|
-
type TDryRunChainSuccess = TDryRunResBase & {
|
|
680
|
-
success: true;
|
|
681
|
-
fee: bigint;
|
|
682
|
-
weight?: TWeight;
|
|
683
|
-
forwardedXcms: any;
|
|
684
|
-
destParaId?: number;
|
|
685
|
-
};
|
|
686
|
-
type TDryRunChainFailure = TDryRunResBase & {
|
|
687
|
-
success: false;
|
|
688
|
-
failureReason: string;
|
|
689
|
-
failureSubReason?: string;
|
|
690
|
-
};
|
|
691
|
-
type TDryRunChainResult = TDryRunChainSuccess | TDryRunChainFailure;
|
|
692
|
-
type THopInfo = {
|
|
693
|
-
chain: TChain;
|
|
694
|
-
result: TDryRunChainResult;
|
|
695
|
-
};
|
|
696
|
-
type TChainEndpoint = 'origin' | 'destination' | TChain;
|
|
697
|
-
type TDryRunResult = {
|
|
698
|
-
failureReason?: string;
|
|
699
|
-
failureSubReason?: string;
|
|
700
|
-
failureChain?: TChainEndpoint;
|
|
701
|
-
origin: TDryRunChainResult;
|
|
702
|
-
destination?: TDryRunChainResult;
|
|
703
|
-
hops: THopInfo[];
|
|
704
|
-
};
|
|
705
|
-
type TResolveHopParams<TApi, TRes, TSigner> = {
|
|
706
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
707
|
-
tx: TRes;
|
|
708
|
-
originChain: TSubstrateChain;
|
|
709
|
-
currentChain: TSubstrateChain;
|
|
710
|
-
destination: TDestination;
|
|
711
|
-
asset: TAssetInfo;
|
|
712
|
-
currency: TCurrencyInputWithAmount;
|
|
713
|
-
swapConfig?: TSwapConfig;
|
|
714
|
-
hasPassedExchange: boolean;
|
|
715
|
-
};
|
|
716
|
-
type HopProcessParams<TApi, TRes, TSigner> = {
|
|
717
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
718
|
-
currentChain: TSubstrateChain;
|
|
719
|
-
currentOrigin: TSubstrateChain;
|
|
720
|
-
currentAsset: TAssetInfo;
|
|
721
|
-
forwardedXcms: any;
|
|
722
|
-
hasPassedExchange: boolean;
|
|
723
|
-
isDestination: boolean;
|
|
724
|
-
};
|
|
725
|
-
type HopTraversalConfig<TApi, TRes, TSigner, THopResult> = {
|
|
726
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
727
|
-
origin: TSubstrateChain;
|
|
728
|
-
destination: TChain;
|
|
729
|
-
currency: TCurrencyCore;
|
|
730
|
-
initialForwardedXcms: any;
|
|
731
|
-
initialDestParaId: number | undefined;
|
|
732
|
-
swapConfig?: TSwapConfig;
|
|
733
|
-
processHop: (params: HopProcessParams<TApi, TRes, TSigner>) => Promise<THopResult>;
|
|
734
|
-
shouldContinue: (hopResult: THopResult) => boolean;
|
|
735
|
-
extractNextHopData: (hopResult: THopResult) => {
|
|
736
|
-
forwardedXcms: any;
|
|
737
|
-
destParaId: number | undefined;
|
|
738
|
-
};
|
|
739
|
-
};
|
|
740
|
-
type HopTraversalResult<THopResult> = {
|
|
741
|
-
hops: Array<{
|
|
742
|
-
chain: TSubstrateChain;
|
|
743
|
-
result: THopResult;
|
|
744
|
-
}>;
|
|
745
|
-
destination?: THopResult;
|
|
746
|
-
lastProcessedChain?: TSubstrateChain;
|
|
747
|
-
};
|
|
748
|
-
type TBypassOptions = {
|
|
749
|
-
mintFeeAssets?: boolean;
|
|
750
|
-
sentAssetMintMode?: 'preview' | 'bypass';
|
|
751
|
-
};
|
|
752
|
-
declare enum XTokensError {
|
|
753
|
-
AssetHasNoReserve = "AssetHasNoReserve",
|
|
754
|
-
NotCrossChainTransfer = "NotCrossChainTransfer",
|
|
755
|
-
InvalidDest = "InvalidDest",
|
|
756
|
-
NotCrossChainTransferableCurrency = "NotCrossChainTransferableCurrency",
|
|
757
|
-
UnweighableMessage = "UnweighableMessage",
|
|
758
|
-
XcmExecutionFailed = "XcmExecutionFailed",
|
|
759
|
-
CannotReanchor = "CannotReanchor",
|
|
760
|
-
InvalidAncestry = "InvalidAncestry",
|
|
761
|
-
InvalidAsset = "InvalidAsset",
|
|
762
|
-
DestinationNotInvertible = "DestinationNotInvertible",
|
|
763
|
-
BadVersion = "BadVersion",
|
|
764
|
-
DistinctReserveForAssetAndFee = "DistinctReserveForAssetAndFee",
|
|
765
|
-
ZeroFee = "ZeroFee",
|
|
766
|
-
ZeroAmount = "ZeroAmount",
|
|
767
|
-
TooManyAssetsBeingSent = "TooManyAssetsBeingSent",
|
|
768
|
-
AssetIndexNonExistent = "AssetIndexNonExistent",
|
|
769
|
-
FeeNotEnough = "FeeNotEnough",
|
|
770
|
-
NotSupportedLocation = "NotSupportedLocation",
|
|
771
|
-
MinXcmFeeNotDefined = "MinXcmFeeNotDefined",
|
|
772
|
-
RateLimited = "RateLimited"
|
|
773
|
-
}
|
|
774
|
-
declare enum PolkadotXcmError {
|
|
775
|
-
Unreachable = "Unreachable",
|
|
776
|
-
SendFailure = "SendFailure",
|
|
777
|
-
Filtered = "Filtered",
|
|
778
|
-
UnweighableMessage = "UnweighableMessage",
|
|
779
|
-
DestinationNotInvertible = "DestinationNotInvertible",
|
|
780
|
-
Empty = "Empty",
|
|
781
|
-
CannotReanchor = "CannotReanchor",
|
|
782
|
-
TooManyAssets = "TooManyAssets",
|
|
783
|
-
InvalidOrigin = "InvalidOrigin",
|
|
784
|
-
BadVersion = "BadVersion",
|
|
785
|
-
BadLocation = "BadLocation",
|
|
786
|
-
NoSubscription = "NoSubscription",
|
|
787
|
-
AlreadySubscribed = "AlreadySubscribed",
|
|
788
|
-
CannotCheckOutTeleport = "CannotCheckOutTeleport",
|
|
789
|
-
LowBalance = "LowBalance",
|
|
790
|
-
TooManyLocks = "TooManyLocks",
|
|
791
|
-
AccountNotSovereign = "AccountNotSovereign",
|
|
792
|
-
FeesNotMet = "FeesNotMet",
|
|
793
|
-
LockNotFound = "LockNotFound",
|
|
794
|
-
InUse = "InUse",
|
|
795
|
-
REMOVED = "REMOVED",
|
|
796
|
-
InvalidAssetUnknownReserve = "InvalidAssetUnknownReserve",
|
|
797
|
-
InvalidAssetUnsupportedReserve = "InvalidAssetUnsupportedReserve",
|
|
798
|
-
TooManyReserves = "TooManyReserves",
|
|
799
|
-
LocalExecutionIncomplete = "LocalExecutionIncomplete",
|
|
800
|
-
TooManyAuthorizedAliases = "TooManyAuthorizedAliases",
|
|
801
|
-
ExpiresInPast = "ExpiresInPast",
|
|
802
|
-
AliasNotFound = "AliasNotFound",
|
|
803
|
-
LocalExecutionIncompleteWithError = "LocalExecutionIncompleteWithError"
|
|
804
|
-
}
|
|
805
|
-
declare enum PolkadotXcmExecutionError {
|
|
806
|
-
Overflow = "Overflow",
|
|
807
|
-
Unimplemented = "Unimplemented",
|
|
808
|
-
UntrustedReserveLocation = "UntrustedReserveLocation",
|
|
809
|
-
UntrustedTeleportLocation = "UntrustedTeleportLocation",
|
|
810
|
-
LocationFull = "LocationFull",
|
|
811
|
-
LocationNotInvertible = "LocationNotInvertible",
|
|
812
|
-
BadOrigin = "BadOrigin",
|
|
813
|
-
InvalidLocation = "InvalidLocation",
|
|
814
|
-
AssetNotFound = "AssetNotFound",
|
|
815
|
-
FailedToTransactAsset = "FailedToTransactAsset",
|
|
816
|
-
NotWithdrawable = "NotWithdrawable",
|
|
817
|
-
LocationCannotHold = "LocationCannotHold",
|
|
818
|
-
ExceedsMaxMessageSize = "ExceedsMaxMessageSize",
|
|
819
|
-
DestinationUnsupported = "DestinationUnsupported",
|
|
820
|
-
Transport = "Transport",
|
|
821
|
-
Unroutable = "Unroutable",
|
|
822
|
-
UnknownClaim = "UnknownClaim",
|
|
823
|
-
FailedToDecode = "FailedToDecode",
|
|
824
|
-
MaxWeightInvalid = "MaxWeightInvalid",
|
|
825
|
-
NotHoldingFees = "NotHoldingFees",
|
|
826
|
-
TooExpensive = "TooExpensive",
|
|
827
|
-
Trap = "Trap",
|
|
828
|
-
ExpectationFalse = "ExpectationFalse",
|
|
829
|
-
PalletNotFound = "PalletNotFound",
|
|
830
|
-
NameMismatch = "NameMismatch",
|
|
831
|
-
VersionIncompatible = "VersionIncompatible",
|
|
832
|
-
HoldingWouldOverflow = "HoldingWouldOverflow",
|
|
833
|
-
ExportError = "ExportError",
|
|
834
|
-
ReanchorFailed = "ReanchorFailed",
|
|
835
|
-
NoDeal = "NoDeal",
|
|
836
|
-
FeesNotMet = "FeesNotMet",
|
|
837
|
-
LockError = "LockError",
|
|
838
|
-
NoPermission = "NoPermission",
|
|
839
|
-
Unanchored = "Unanchored",
|
|
840
|
-
NotDepositable = "NotDepositable",
|
|
841
|
-
TooManyAssets = "TooManyAssets",
|
|
842
|
-
UnhandledXcmVersion = "UnhandledXcmVersion",
|
|
843
|
-
WeightLimitReached = "WeightLimitReached",
|
|
844
|
-
Barrier = "Barrier",
|
|
845
|
-
WeightNotComputable = "WeightNotComputable",
|
|
846
|
-
ExceedsStackLimit = "ExceedsStackLimit"
|
|
847
|
-
}
|
|
848
|
-
type TModuleError = {
|
|
849
|
-
index: string;
|
|
850
|
-
error: string;
|
|
851
|
-
};
|
|
852
|
-
type TDryRunError = {
|
|
853
|
-
failureReason: string;
|
|
854
|
-
failureSubReason?: string;
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
type TXcmFeeSwapConfig = TSwapConfig & {
|
|
858
|
-
amountOut: bigint;
|
|
859
|
-
};
|
|
860
|
-
type TTxFactory<TRes> = (amount?: string, relative?: boolean) => Promise<TRes>;
|
|
861
|
-
type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
|
|
862
|
-
/**
|
|
863
|
-
* The transaction factory
|
|
864
|
-
*/
|
|
865
|
-
buildTx: TTxFactory<TRes>;
|
|
866
|
-
/**
|
|
867
|
-
* The origin chain
|
|
868
|
-
*/
|
|
869
|
-
origin: TSubstrateChain;
|
|
870
|
-
/**
|
|
871
|
-
* The destination chain
|
|
872
|
-
*/
|
|
873
|
-
destination: TChain;
|
|
874
|
-
/**
|
|
875
|
-
* The sender address
|
|
876
|
-
*/
|
|
877
|
-
sender: string;
|
|
878
|
-
recipient: string;
|
|
879
|
-
currency: WithAmount<TCurrencyCore>;
|
|
880
|
-
version?: Version;
|
|
881
|
-
feeAsset?: TCurrencyInput;
|
|
882
|
-
disableFallback: TDisableFallback;
|
|
883
|
-
swapConfig?: TXcmFeeSwapConfig;
|
|
884
|
-
skipReverseFeeCalculation?: boolean;
|
|
885
|
-
};
|
|
886
|
-
type TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes, TSigner>;
|
|
887
|
-
type TGetXcmFeeInternalOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = Omit<TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback>, 'buildTx'> & {
|
|
888
|
-
tx: TRes;
|
|
889
|
-
useRootOrigin: boolean;
|
|
890
|
-
};
|
|
891
|
-
type TGetXcmFeeBuilderOptions = {
|
|
892
|
-
disableFallback: boolean;
|
|
893
|
-
};
|
|
894
|
-
type TGetOriginXcmFeeBaseOptions<TRes> = {
|
|
895
|
-
buildTx: TTxFactory<TRes>;
|
|
896
|
-
origin: TSubstrateChain;
|
|
897
|
-
destination: TChain;
|
|
898
|
-
sender: string;
|
|
899
|
-
currency: WithAmount<TCurrencyCore>;
|
|
900
|
-
version?: Version;
|
|
901
|
-
feeAsset?: TCurrencyInput;
|
|
902
|
-
disableFallback: boolean;
|
|
903
|
-
useRootOrigin?: boolean;
|
|
904
|
-
};
|
|
905
|
-
type TGetOriginXcmFeeOptions<TApi, TRes, TSigner> = WithApi<TGetOriginXcmFeeBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
906
|
-
type TGetOriginXcmFeeInternalOptions<TApi, TRes, TSigner> = Omit<TGetOriginXcmFeeOptions<TApi, TRes, TSigner>, 'buildTx'> & {
|
|
907
|
-
tx: TRes;
|
|
908
|
-
};
|
|
909
|
-
type TGetFeeForDestChainBaseOptions<TRes> = {
|
|
910
|
-
prevChain: TSubstrateChain;
|
|
911
|
-
origin: TSubstrateChain;
|
|
912
|
-
destination: TChain;
|
|
913
|
-
sender: string;
|
|
914
|
-
recipient: string;
|
|
915
|
-
currency: WithAmount<TCurrencyCore>;
|
|
916
|
-
forwardedXcms: any;
|
|
917
|
-
tx: TRes;
|
|
918
|
-
asset: TAssetInfo;
|
|
919
|
-
version: Version;
|
|
920
|
-
originFee: bigint;
|
|
921
|
-
feeAsset?: TCurrencyInput;
|
|
922
|
-
disableFallback: boolean;
|
|
923
|
-
hasPassedExchange?: boolean;
|
|
924
|
-
swapConfig?: TXcmFeeSwapConfig;
|
|
925
|
-
skipReverseFeeCalculation?: boolean;
|
|
926
|
-
};
|
|
927
|
-
type TGetFeeForDestChainOptions<TApi, TRes, TSigner> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
928
|
-
type TGetReverseTxFeeOptions<TApi, TRes, TSigner> = Omit<TGetFeeForDestChainOptions<TApi, TRes, TSigner>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain' | 'version'> & {
|
|
929
|
-
destination: TSubstrateChain;
|
|
930
|
-
};
|
|
931
|
-
type TFeeType = 'dryRun' | 'paymentInfo' | 'noFeeRequired';
|
|
932
|
-
type TXcmFeeBase$1 = {
|
|
933
|
-
asset: TAssetInfo;
|
|
934
|
-
weight?: TWeight;
|
|
935
|
-
sufficient?: boolean;
|
|
936
|
-
isExchange?: boolean;
|
|
937
|
-
};
|
|
938
|
-
type TXcmFeeDetailSuccess = TXcmFeeBase$1 & {
|
|
939
|
-
fee: bigint;
|
|
940
|
-
feeType: TFeeType;
|
|
941
|
-
dryRunError?: string;
|
|
942
|
-
dryRunSubError?: string;
|
|
943
|
-
};
|
|
944
|
-
type TXcmFeeDetailWithFallback = TXcmFeeDetailSuccess;
|
|
945
|
-
type TXcmFeeDetailError = TXcmFeeBase$1 & {
|
|
946
|
-
fee?: bigint;
|
|
947
|
-
feeType?: TFeeType;
|
|
948
|
-
dryRunError: string;
|
|
949
|
-
dryRunSubError?: string;
|
|
950
|
-
};
|
|
951
|
-
type TXcmFeeDetail = TXcmFeeDetailSuccess | TXcmFeeDetailError;
|
|
952
|
-
type TXcmFeeHopResult = {
|
|
953
|
-
fee?: bigint;
|
|
954
|
-
feeType?: TFeeType;
|
|
955
|
-
sufficient?: boolean;
|
|
956
|
-
dryRunError?: string;
|
|
957
|
-
dryRunSubError?: string;
|
|
958
|
-
forwardedXcms?: any;
|
|
959
|
-
destParaId?: number;
|
|
960
|
-
asset: TAssetInfo;
|
|
961
|
-
};
|
|
962
|
-
type TConditionalXcmFeeDetail<TDisableFallback extends boolean> = TDisableFallback extends false ? TXcmFeeDetailWithFallback : TXcmFeeDetail;
|
|
963
|
-
type TDestXcmFeeDetail<TDisableFallback extends boolean> = TConditionalXcmFeeDetail<TDisableFallback> & {
|
|
964
|
-
forwardedXcms?: any;
|
|
965
|
-
destParaId?: number;
|
|
966
|
-
};
|
|
967
|
-
type TConditionalXcmFeeHopInfo<TDisableFallback extends boolean> = {
|
|
968
|
-
chain: TChain;
|
|
969
|
-
result: TConditionalXcmFeeDetail<TDisableFallback>;
|
|
970
|
-
};
|
|
971
|
-
type TXcmFeeHopInfo = {
|
|
972
|
-
chain: TChain;
|
|
973
|
-
result: TXcmFeeDetail;
|
|
974
|
-
};
|
|
975
|
-
type TGetXcmFeeResult<TDisableFallback extends boolean = boolean> = {
|
|
976
|
-
failureReason?: string;
|
|
977
|
-
failureChain?: TChainEndpoint;
|
|
978
|
-
origin: TConditionalXcmFeeDetail<TDisableFallback>;
|
|
979
|
-
destination: TConditionalXcmFeeDetail<TDisableFallback>;
|
|
980
|
-
hops: TConditionalXcmFeeHopInfo<TDisableFallback>[];
|
|
981
|
-
};
|
|
982
|
-
type TPaymentInfo = {
|
|
983
|
-
partialFee: bigint;
|
|
984
|
-
weight: TWeight;
|
|
985
|
-
};
|
|
986
|
-
|
|
987
|
-
type TExchangeChain = (typeof EXCHANGE_CHAINS)[number];
|
|
988
|
-
type TExchangeInput = TExchangeChain | TExchangeChain[] | undefined;
|
|
989
|
-
type TSwapOptions<TApi, TRes, TSigner> = {
|
|
990
|
-
currencyTo: TCurrencyCore;
|
|
991
|
-
exchange?: TExchangeInput;
|
|
992
|
-
slippage?: number;
|
|
993
|
-
evmSenderAddress?: string;
|
|
994
|
-
evmSigner?: TSigner;
|
|
995
|
-
onStatusChange?: TStatusChangeCallback<TApi, TRes>;
|
|
996
|
-
};
|
|
997
|
-
type TTransactionContext<TApi, TRes> = {
|
|
998
|
-
type: TTransactionType;
|
|
999
|
-
api: TApi;
|
|
1000
|
-
chain: TSubstrateChain;
|
|
1001
|
-
tx: TRes;
|
|
1002
|
-
};
|
|
1003
|
-
type TTransactionType = 'TRANSFER' | 'SWAP' | 'SWAP_AND_TRANSFER';
|
|
1004
|
-
type TSwapEventType = TTransactionType | 'SELECTING_EXCHANGE' | 'COMPLETED';
|
|
1005
|
-
/**
|
|
1006
|
-
* The transaction progress information.
|
|
1007
|
-
*/
|
|
1008
|
-
type TSwapEvent<TApi, TRes> = {
|
|
1009
|
-
/**
|
|
1010
|
-
* Current execution phase type
|
|
1011
|
-
*/
|
|
1012
|
-
type: TSwapEventType;
|
|
1013
|
-
/**
|
|
1014
|
-
* Full transaction plan for visualization
|
|
1015
|
-
*/
|
|
1016
|
-
routerPlan?: TTransactionContext<TApi, TRes>[];
|
|
1017
|
-
/**
|
|
1018
|
-
* Current transaction's origin chain
|
|
1019
|
-
*/
|
|
1020
|
-
chain?: TSubstrateChain;
|
|
1021
|
-
/**
|
|
1022
|
-
* Current transaction's destination chain
|
|
1023
|
-
*/
|
|
1024
|
-
destinationChain?: TChain;
|
|
1025
|
-
/**
|
|
1026
|
-
* 0-based step index of current operation
|
|
1027
|
-
*/
|
|
1028
|
-
currentStep?: number;
|
|
1029
|
-
};
|
|
1030
|
-
type TStatusChangeCallback<TApi, TRes> = (info: TSwapEvent<TApi, TRes>) => void;
|
|
1031
|
-
interface TSwapBuilder<TApi, TRes, TSigner> {
|
|
1032
|
-
from(chain: TSubstrateChain | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1033
|
-
to(chain: TChain | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1034
|
-
exchange(chain: TExchangeInput): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1035
|
-
currencyFrom(currency: TCurrencyInput): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1036
|
-
currencyTo(currency: TCurrencyInput): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1037
|
-
feeAsset(currency: TCurrencyInput | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1038
|
-
amount(amount: TAmount): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1039
|
-
recipient(address: string | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1040
|
-
sender(address: string): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1041
|
-
signer(signer: TSigner): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1042
|
-
evmSenderAddress(address: string | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1043
|
-
evmSigner(signer: TSigner | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1044
|
-
slippagePct(pct: string): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1045
|
-
onStatusChange(callback: TStatusChangeCallback<TApi, TRes>): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1046
|
-
getXcmFees<TDisableFallback extends boolean = false>(options?: TGetXcmFeeBuilderOptions & {
|
|
1047
|
-
disableFallback: TDisableFallback;
|
|
1048
|
-
}): Promise<TGetXcmFeeResult<TDisableFallback>>;
|
|
1049
|
-
getTransferableAmount(): Promise<bigint>;
|
|
1050
|
-
getMinTransferableAmount(): Promise<bigint>;
|
|
1051
|
-
getBestAmountOut(): Promise<{
|
|
1052
|
-
exchange: TExchangeChain;
|
|
1053
|
-
amountOut: bigint;
|
|
1054
|
-
}>;
|
|
1055
|
-
dryRun(): Promise<TDryRunResult>;
|
|
1056
|
-
build(): Promise<TTransactionContext<TApi, TRes>[]>;
|
|
1057
|
-
signAndSubmit(): Promise<string[]>;
|
|
1058
|
-
}
|
|
1059
|
-
type TSwapBuilderFactory = <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>) => TSwapBuilder<TApi, TRes, TSigner>;
|
|
1060
|
-
|
|
1061
|
-
type TPolkadotXCMTransferOptions<TApi, TRes, TSigner> = {
|
|
1062
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1063
|
-
chain: TSubstrateChain;
|
|
1064
|
-
beneficiaryLocation: TLocation;
|
|
1065
|
-
recipient: TAddress;
|
|
1066
|
-
asset: TAsset;
|
|
1067
|
-
overriddenAsset?: TLocation | TAssetWithFee[];
|
|
1068
|
-
scenario: TScenario;
|
|
1069
|
-
assetInfo: WithAmount<TAssetInfo>;
|
|
1070
|
-
currency: TCurrencyInputWithAmount;
|
|
1071
|
-
feeAssetInfo?: TAssetInfo;
|
|
1072
|
-
feeCurrency?: TCurrencyInput;
|
|
1073
|
-
destination: TDestination;
|
|
1074
|
-
destChain?: TChain;
|
|
1075
|
-
paraIdTo?: number;
|
|
1076
|
-
version: Version;
|
|
1077
|
-
sender?: string;
|
|
1078
|
-
ahAddress?: string;
|
|
1079
|
-
pallet?: string;
|
|
1080
|
-
method?: string;
|
|
1081
|
-
transactOptions?: TTransactOptions<TRes>;
|
|
1082
|
-
};
|
|
1083
|
-
type TXTokensTransferOptions<TApi, TRes, TSigner> = {
|
|
1084
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1085
|
-
asset: WithAmount<TAssetInfo>;
|
|
1086
|
-
recipient: TAddress;
|
|
1087
|
-
scenario: TScenario;
|
|
1088
|
-
origin: TSubstrateChain;
|
|
1089
|
-
destination: TDestination;
|
|
1090
|
-
paraIdTo?: number;
|
|
1091
|
-
version: Version;
|
|
1092
|
-
overriddenAsset?: TLocation | TAssetWithFee[];
|
|
1093
|
-
pallet?: string;
|
|
1094
|
-
method?: string;
|
|
1095
|
-
useMultiAssetTransfer?: boolean;
|
|
1096
|
-
};
|
|
1097
|
-
interface IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
1098
|
-
transferPolkadotXCM: (input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
|
|
1099
|
-
}
|
|
1100
|
-
interface IXTokensTransfer<TApi, TRes, TSigner> {
|
|
1101
|
-
transferXTokens: (input: TXTokensTransferOptions<TApi, TRes, TSigner>) => TRes;
|
|
1102
|
-
}
|
|
1103
|
-
type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
|
|
1104
|
-
type TAddress = string | TLocation;
|
|
1105
|
-
type TDestination = TChain | TLocation;
|
|
1106
|
-
type TTransferBaseOptions<TApi, TRes, TSigner> = {
|
|
1107
|
-
/**
|
|
1108
|
-
* The origin chain
|
|
1109
|
-
*/
|
|
1110
|
-
from: TChain;
|
|
1111
|
-
/**
|
|
1112
|
-
* The destination address. A SS58 or H160 format.
|
|
1113
|
-
*/
|
|
1114
|
-
recipient: TAddress;
|
|
1115
|
-
/**
|
|
1116
|
-
* The optional sender address. A SS58 or H160 format.
|
|
1117
|
-
*/
|
|
1118
|
-
sender?: string;
|
|
1119
|
-
/**
|
|
1120
|
-
* The optional asset hub address. A SS58 format only.
|
|
1121
|
-
*/
|
|
1122
|
-
ahAddress?: string;
|
|
1123
|
-
/**
|
|
1124
|
-
* The destination chain or XCM location
|
|
1125
|
-
*/
|
|
1126
|
-
to: TDestination;
|
|
1127
|
-
/**
|
|
1128
|
-
* The currency to transfer. Either ID, symbol, location, or multi-asset
|
|
1129
|
-
*/
|
|
1130
|
-
currency: TCurrencyInputWithAmount;
|
|
1131
|
-
/**
|
|
1132
|
-
* The optional fee asset. Either ID, symbol, or location
|
|
1133
|
-
*/
|
|
1134
|
-
feeAsset?: TCurrencyInput;
|
|
1135
|
-
/**
|
|
1136
|
-
* The optional destination parachain ID
|
|
1137
|
-
*/
|
|
1138
|
-
paraIdTo?: number;
|
|
1139
|
-
/**
|
|
1140
|
-
* The optional overrided XCM version
|
|
1141
|
-
*/
|
|
1142
|
-
version?: Version;
|
|
1143
|
-
/**
|
|
1144
|
-
* The optional pallet override
|
|
1145
|
-
*/
|
|
1146
|
-
pallet?: string;
|
|
1147
|
-
/**
|
|
1148
|
-
* Whether to keep the account alive after the transfer.
|
|
1149
|
-
*/
|
|
1150
|
-
keepAlive?: boolean;
|
|
1151
|
-
/**
|
|
1152
|
-
* The optional pallet method override
|
|
1153
|
-
*/
|
|
1154
|
-
method?: string;
|
|
1155
|
-
/**
|
|
1156
|
-
* Hex of the encoded transaction call to apply on the destination chain
|
|
1157
|
-
*/
|
|
1158
|
-
transactOptions?: TTransactOptions<TRes>;
|
|
1159
|
-
/**
|
|
1160
|
-
* The optional swap options
|
|
1161
|
-
*/
|
|
1162
|
-
swapOptions?: TSwapOptions<TApi, TRes, TSigner>;
|
|
1163
|
-
};
|
|
1164
|
-
/**
|
|
1165
|
-
* Options for transferring from a parachain to another parachain or relay chain
|
|
1166
|
-
*/
|
|
1167
|
-
type TTransferOptions<TApi, TRes, TSigner> = WithApi<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner> & {
|
|
1168
|
-
isAmountAll: boolean;
|
|
1169
|
-
};
|
|
1170
|
-
type TSubstrateTransferBaseOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from'> & {
|
|
1171
|
-
from: TSubstrateChain;
|
|
1172
|
-
};
|
|
1173
|
-
type TSubstrateTransferOptions<TApi, TRes, TSigner> = Omit<TTransferOptions<TApi, TRes, TSigner>, 'from'> & {
|
|
1174
|
-
from: TSubstrateChain;
|
|
1175
|
-
};
|
|
1176
|
-
type WithRequiredSender<TBase> = Omit<TBase, 'sender'> & {
|
|
1177
|
-
/**
|
|
1178
|
-
* The sender address. A SS58 or H160 format.
|
|
1179
|
-
*/
|
|
1180
|
-
sender: string;
|
|
1181
|
-
};
|
|
1182
|
-
type WithRequiredSwapOptions<TBase, TApi, TRes, TSigner> = Omit<TBase, 'swapOptions'> & {
|
|
1183
|
-
swapOptions: TSwapOptions<TApi, TRes, TSigner>;
|
|
1184
|
-
};
|
|
1185
|
-
type TTransferOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<Omit<TSubstrateTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'>, TApi, TRes, TSigner>;
|
|
1186
|
-
type TTransferBaseOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner>;
|
|
1187
|
-
type TTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TTransferBaseOptions<TApi, TRes, TSigner>>;
|
|
1188
|
-
type TSubstrateTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TSubstrateTransferBaseOptions<TApi, TRes, TSigner>>;
|
|
1189
|
-
type TTransferInternalOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from' | 'feeAsset' | 'version'> & {
|
|
1190
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1191
|
-
assetInfo: WithAmount<TAssetInfo>;
|
|
1192
|
-
feeAsset?: TAssetInfo;
|
|
1193
|
-
feeCurrency?: TCurrencyInput;
|
|
1194
|
-
overriddenAsset?: TLocation | TAssetWithFee[];
|
|
1195
|
-
version: Version;
|
|
1196
|
-
isAmountAll: boolean;
|
|
1197
|
-
};
|
|
1198
|
-
type TTransactOrigin = (typeof TRANSACT_ORIGINS)[number];
|
|
1199
|
-
type TTransactOptions<TRes, TWeightType = bigint> = {
|
|
1200
|
-
call: string | TRes;
|
|
1201
|
-
originKind?: TTransactOrigin;
|
|
1202
|
-
maxWeight?: TWeight<TWeightType>;
|
|
1203
|
-
};
|
|
1204
|
-
type TSerializedExtrinsics = {
|
|
1205
|
-
module: TPallet;
|
|
1206
|
-
method: string;
|
|
1207
|
-
params: Record<string, unknown>;
|
|
1208
|
-
};
|
|
1209
|
-
type TSerializedStateQuery = {
|
|
1210
|
-
module: TAssetsPallet;
|
|
1211
|
-
method: string;
|
|
1212
|
-
params: unknown[];
|
|
1213
|
-
};
|
|
1214
|
-
type TSerializedRuntimeApiQuery = {
|
|
1215
|
-
module: string;
|
|
1216
|
-
method: string;
|
|
1217
|
-
params: unknown[];
|
|
1218
|
-
};
|
|
1219
|
-
type TDestWeight = {
|
|
1220
|
-
ref_time: bigint;
|
|
1221
|
-
proof_size: bigint;
|
|
1222
|
-
};
|
|
1223
|
-
type TXTokensMethod = 'transfer' | 'transfer_multiasset' | 'transfer_multiassets';
|
|
1224
|
-
type TPolkadotXcmMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'reserve_transfer_assets' | 'reserve_withdraw_assets' | 'transfer_assets' | 'transfer_assets_using_type_and_then';
|
|
1225
|
-
type TXcmPalletMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'transfer_assets_using_type_and_then';
|
|
1226
|
-
type TWeight<TWeightType = bigint> = {
|
|
1227
|
-
refTime: TWeightType;
|
|
1228
|
-
proofSize: TWeightType;
|
|
1229
|
-
};
|
|
1230
|
-
type TCreateBeneficiaryOptions<TApi, TRes, TSigner> = {
|
|
1231
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1232
|
-
address: TAddress;
|
|
1233
|
-
version: Version;
|
|
1234
|
-
};
|
|
1235
|
-
type TCreateBeneficiaryXTokensOptions<TApi, TRes, TSigner> = {
|
|
1236
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1237
|
-
origin: TSubstrateChain;
|
|
1238
|
-
destination: TDestination;
|
|
1239
|
-
recipient: TAddress;
|
|
1240
|
-
version: Version;
|
|
1241
|
-
paraId?: number;
|
|
1242
|
-
};
|
|
1243
|
-
type TBridgeStatus = 'Normal' | 'Halted';
|
|
1244
|
-
type TTransferLocalOptions<TApi, TRes, TSigner> = Omit<TTransferInternalOptions<TApi, TRes, TSigner>, 'recipient'> & {
|
|
1245
|
-
recipient: string;
|
|
1246
|
-
balance: bigint;
|
|
1247
|
-
};
|
|
1248
|
-
type TTransferFeeEstimates = {
|
|
1249
|
-
originFee: bigint;
|
|
1250
|
-
reserveFee: bigint;
|
|
1251
|
-
};
|
|
1252
|
-
type TCreateBaseTransferXcmOptions<TRes> = {
|
|
1253
|
-
chain: TSubstrateChain;
|
|
1254
|
-
destChain: TChain;
|
|
1255
|
-
assetInfo: WithAmount<TAssetInfo>;
|
|
1256
|
-
feeAssetInfo?: TAssetInfo;
|
|
1257
|
-
fees: TTransferFeeEstimates;
|
|
1258
|
-
recipient: string;
|
|
1259
|
-
sender?: string;
|
|
1260
|
-
version: Version;
|
|
1261
|
-
useJitWithdraw?: boolean;
|
|
1262
|
-
useFeeAssetOnHops?: boolean;
|
|
1263
|
-
paraIdTo?: number;
|
|
1264
|
-
transactOptions?: TTransactOptions<TRes>;
|
|
1265
|
-
};
|
|
1266
|
-
type TCreateTransferXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseTransferXcmOptions<TRes>, TApi, TRes, TSigner>;
|
|
1267
|
-
type TCreateBaseSwapXcmOptions = {
|
|
1268
|
-
chain?: TSubstrateChain;
|
|
1269
|
-
exchangeChain: TExchangeChain;
|
|
1270
|
-
destChain?: TChain;
|
|
1271
|
-
assetInfoFrom: WithAmount<TAssetInfo>;
|
|
1272
|
-
assetInfoTo: WithAmount<TAssetInfo>;
|
|
1273
|
-
currencyTo: TCurrencyInput;
|
|
1274
|
-
feeAssetInfo?: TAssetInfo;
|
|
1275
|
-
sender: string;
|
|
1276
|
-
recipient: string;
|
|
1277
|
-
calculateMinAmountOut: (amountIn: bigint, assetTo?: TAssetInfo) => Promise<bigint>;
|
|
1278
|
-
};
|
|
1279
|
-
type TCreateSwapXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner>;
|
|
1280
|
-
type TSwapFeeEstimates = {
|
|
1281
|
-
originFee: bigint;
|
|
1282
|
-
originReserveFee: bigint;
|
|
1283
|
-
exchangeFee: bigint;
|
|
1284
|
-
destReserveFee: bigint;
|
|
1285
|
-
};
|
|
1286
|
-
type TCreateSwapXcmInternalOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner> & {
|
|
1287
|
-
version: Version;
|
|
1288
|
-
fees: TSwapFeeEstimates;
|
|
1289
|
-
paraIdTo?: number;
|
|
1290
|
-
};
|
|
1291
|
-
type TCreateEthBridgeInstructionsOptions<TApi, TRes, TSigner> = {
|
|
1292
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1293
|
-
recipient: TAddress;
|
|
1294
|
-
assetInfo: TAssetInfo;
|
|
1295
|
-
sender: string;
|
|
1296
|
-
ahAddress?: string;
|
|
1297
|
-
version: Version;
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
/** @deprecated Asset claim functionality is deprecated and will be removed in v14. */
|
|
1301
|
-
type TAssetClaimOptionsBase = {
|
|
1302
|
-
chain: TSubstrateChain;
|
|
1303
|
-
currency: WithComplexAmount<TCurrencyCore> | TAsset<TAmount>[] | WithComplexAmount<TCurrencyCore>[];
|
|
1304
|
-
address: TAddress;
|
|
1305
|
-
version?: Version;
|
|
1306
|
-
};
|
|
1307
|
-
type TAssetClaimOptions<TApi, TRes, TSigner> = WithApi<TAssetClaimOptionsBase, TApi, TRes, TSigner>;
|
|
1308
|
-
type TAssetClaimInternalOptions<TApi, TRes, TSigner> = TAssetClaimOptions<TApi, TRes, TSigner> & {
|
|
1309
|
-
version: Version;
|
|
1310
|
-
assets: TAsset<bigint>[];
|
|
1311
|
-
};
|
|
1312
|
-
|
|
1313
|
-
type TSetBalanceRes = {
|
|
1314
|
-
assetStatusTx?: TSerializedExtrinsics;
|
|
1315
|
-
balanceTx: TSerializedExtrinsics;
|
|
1316
|
-
};
|
|
1317
|
-
declare abstract class BaseAssetsPallet {
|
|
1318
|
-
protected palletName: TAssetsPallet;
|
|
1319
|
-
constructor(palletName: TAssetsPallet);
|
|
1320
|
-
abstract mint<TApi, TRes, TSigner>(address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint, chain: TSubstrateChain, api: PolkadotApi<TApi, TRes, TSigner>): Promise<TSetBalanceRes>;
|
|
1321
|
-
abstract getBalance<TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo, customCurrencyId?: unknown): Promise<bigint>;
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
/**
|
|
1325
|
-
* Builder class for constructing asset claim transactions.
|
|
1326
|
-
*
|
|
1327
|
-
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
1328
|
-
*/
|
|
1329
|
-
declare class AssetClaimBuilder<TApi, TRes, TSigner, T extends Partial<TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>> = object> {
|
|
1330
|
-
readonly api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1331
|
-
readonly _options: T;
|
|
1332
|
-
constructor(api: PolkadotApi<TApi, TRes, TSigner>, options?: T);
|
|
1333
|
-
/**
|
|
1334
|
-
* Specifies the assets to be claimed.
|
|
1335
|
-
*
|
|
1336
|
-
* @param assets - An array of assets to claim in a multi-asset format.
|
|
1337
|
-
* @returns An instance of Builder
|
|
1338
|
-
*/
|
|
1339
|
-
currency(currency: TAssetClaimOptionsBase['currency']): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
1340
|
-
currency: TAssetClaimOptionsBase['currency'];
|
|
1341
|
-
}>;
|
|
1342
|
-
/**
|
|
1343
|
-
* Sets the sender address.
|
|
1344
|
-
*
|
|
1345
|
-
* @param address - The sender address.
|
|
1346
|
-
* @returns
|
|
1347
|
-
*/
|
|
1348
|
-
sender(sender: TSender<TSigner>): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
1349
|
-
sender: string;
|
|
1350
|
-
}>;
|
|
1351
|
-
/**
|
|
1352
|
-
* Specifies the account address on which the assets will be claimed.
|
|
1353
|
-
*
|
|
1354
|
-
* @param address - The destination account address.
|
|
1355
|
-
* @returns An instance of Builder
|
|
1356
|
-
*/
|
|
1357
|
-
address(address: TAddress): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
1358
|
-
address: TAddress;
|
|
1359
|
-
}>;
|
|
1360
|
-
/**
|
|
1361
|
-
* Sets the XCM version to be used for the asset claim.
|
|
1362
|
-
*
|
|
1363
|
-
* @param version - The XCM version.
|
|
1364
|
-
* @returns An instance of Builder
|
|
1365
|
-
*/
|
|
1366
|
-
xcmVersion(version: Version): AssetClaimBuilder<TApi, TRes, TSigner, T & {
|
|
1367
|
-
version: Version;
|
|
1368
|
-
}>;
|
|
1369
|
-
/**
|
|
1370
|
-
* Builds and returns the asset claim extrinsic.
|
|
1371
|
-
*
|
|
1372
|
-
* @returns A Promise that resolves to the asset claim extrinsic.
|
|
1373
|
-
*/
|
|
1374
|
-
build(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase>): Promise<TRes>;
|
|
1375
|
-
signAndSubmit(this: AssetClaimBuilder<TApi, TRes, TSigner, TAssetClaimOptionsBase & TBuilderInternalOptions<TSigner>>): Promise<string>;
|
|
1376
|
-
/**
|
|
1377
|
-
* Returns the API instance used by the builder.
|
|
1378
|
-
*
|
|
1379
|
-
* @returns The API instance.
|
|
1380
|
-
*/
|
|
1381
|
-
getApi(): TApi;
|
|
1382
|
-
/**
|
|
1383
|
-
* Disconnects the API.
|
|
1384
|
-
*
|
|
1385
|
-
* @returns A Promise that resolves when the API is disconnected.
|
|
1386
|
-
*/
|
|
1387
|
-
disconnect(): Promise<void>;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
declare class BatchTransactionManager<TApi, TRes, TSigner> {
|
|
1391
|
-
transactionOptions: TBatchedTransferOptions<TApi, TRes, TSigner>[];
|
|
1392
|
-
addTransaction(options: TBatchedTransferOptions<TApi, TRes, TSigner>): void;
|
|
1393
|
-
isEmpty(): boolean;
|
|
1394
|
-
buildBatch(api: PolkadotApi<TApi, TRes, TSigner>, from: TSubstrateChain, options?: TBatchOptions): Promise<TRes>;
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
/**
|
|
1398
|
-
* A builder class for constructing Para-to-Para, Para-to-Relay, Relay-to-Para transactions and asset claims.
|
|
1399
|
-
*/
|
|
1400
|
-
declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>> = object> {
|
|
1401
|
-
readonly batchManager: BatchTransactionManager<TApi, TRes, TSigner>;
|
|
1402
|
-
readonly api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1403
|
-
readonly _options: T;
|
|
1404
|
-
constructor(api: PolkadotApi<TApi, TRes, TSigner>, batchManager: BatchTransactionManager<TApi, TRes, TSigner>, options?: T);
|
|
1405
|
-
/**
|
|
1406
|
-
* Specifies the origin chain for the transaction.
|
|
1407
|
-
*
|
|
1408
|
-
* @param chain - The chain from which the transaction originates.
|
|
1409
|
-
* @returns An instance of Builder
|
|
1410
|
-
*/
|
|
1411
|
-
from(chain: TChain): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1412
|
-
from: TChain;
|
|
1413
|
-
}>;
|
|
1414
|
-
/**
|
|
1415
|
-
* Specifies the destination chain for the transaction.
|
|
1416
|
-
*
|
|
1417
|
-
* @param chain - The chain to which the transaction is sent.
|
|
1418
|
-
* @param paraIdTo - (Optional) The parachain ID of the destination chain.
|
|
1419
|
-
* @returns An instance of Builder
|
|
1420
|
-
*/
|
|
1421
|
-
to(chain: TDestination, paraIdTo?: number): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1422
|
-
to: TDestination;
|
|
1423
|
-
}>;
|
|
1424
|
-
/**
|
|
1425
|
-
* Initiates the process to claim assets from a specified chain.
|
|
1426
|
-
*
|
|
1427
|
-
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
1428
|
-
* @param chain - The chain from which to claim assets.
|
|
1429
|
-
* @returns An instance of Builder
|
|
1430
|
-
*/
|
|
1431
|
-
claimFrom(chain: TSubstrateChain): AssetClaimBuilder<TApi, TRes, TSigner, {
|
|
714
|
+
to(chain: TDestination | TCustomChain, paraIdTo?: number): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
715
|
+
to: TDestination;
|
|
716
|
+
}, TCustomChain>;
|
|
717
|
+
/**
|
|
718
|
+
* Initiates the process to claim assets from a specified chain.
|
|
719
|
+
*
|
|
720
|
+
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
721
|
+
* @param chain - The chain from which to claim assets.
|
|
722
|
+
* @returns An instance of Builder
|
|
723
|
+
*/
|
|
724
|
+
claimFrom(chain: TSubstrateChain): AssetClaimBuilder<TApi, TRes, TSigner, {
|
|
1432
725
|
chain: TSubstrateChain;
|
|
1433
726
|
}>;
|
|
1434
727
|
/**
|
|
@@ -1439,7 +732,7 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1439
732
|
*/
|
|
1440
733
|
currency(currency: TCurrencyInputWithAmount): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1441
734
|
currency: TCurrencyInputWithAmount;
|
|
1442
|
-
}>;
|
|
735
|
+
}, TCustomChain>;
|
|
1443
736
|
/**
|
|
1444
737
|
* Sets the recipient address.
|
|
1445
738
|
*
|
|
@@ -1448,7 +741,7 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1448
741
|
*/
|
|
1449
742
|
recipient(address: TAddress): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1450
743
|
recipient: TAddress;
|
|
1451
|
-
}>;
|
|
744
|
+
}, TCustomChain>;
|
|
1452
745
|
/**
|
|
1453
746
|
* Sets the sender address or signer.
|
|
1454
747
|
*
|
|
@@ -1457,7 +750,7 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1457
750
|
*/
|
|
1458
751
|
sender(sender: TSender<TSigner> | WalletClient): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1459
752
|
sender: string;
|
|
1460
|
-
}>;
|
|
753
|
+
}, TCustomChain>;
|
|
1461
754
|
/**
|
|
1462
755
|
* Sets the asset hub address. This is used for transfers that go through the Asset Hub and originate from an EVM chain.
|
|
1463
756
|
*
|
|
@@ -1466,7 +759,7 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1466
759
|
*/
|
|
1467
760
|
ahAddress(address: string | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1468
761
|
ahAddress: string | undefined;
|
|
1469
|
-
}>;
|
|
762
|
+
}, never>;
|
|
1470
763
|
/**
|
|
1471
764
|
* Sets the XCM version to be used for the transfer.
|
|
1472
765
|
*
|
|
@@ -1475,7 +768,7 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1475
768
|
*/
|
|
1476
769
|
xcmVersion(version: Version): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1477
770
|
version: Version;
|
|
1478
|
-
}>;
|
|
771
|
+
}, never>;
|
|
1479
772
|
/**
|
|
1480
773
|
* Whether to keep the account alive after the transfer.
|
|
1481
774
|
*
|
|
@@ -1484,7 +777,7 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1484
777
|
*/
|
|
1485
778
|
keepAlive(keepAlive: boolean): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1486
779
|
keepAlive: boolean;
|
|
1487
|
-
}>;
|
|
780
|
+
}, never>;
|
|
1488
781
|
/**
|
|
1489
782
|
* Sets a custom pallet for the transaction.
|
|
1490
783
|
*
|
|
@@ -1495,640 +788,1451 @@ declare class GeneralBuilder<TApi, TRes, TSigner, T extends Partial<TTransferBas
|
|
|
1495
788
|
customPallet(pallet: string | undefined, method: string | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
1496
789
|
pallet: string | undefined;
|
|
1497
790
|
method: string | undefined;
|
|
791
|
+
}, never>;
|
|
792
|
+
/**
|
|
793
|
+
* Optional fee asset for the transaction.
|
|
794
|
+
*
|
|
795
|
+
* @param currency - The currency to be used for the fee.
|
|
796
|
+
* @returns An instance of the Builder
|
|
797
|
+
*/
|
|
798
|
+
feeAsset(currency: TCurrencyInput | undefined): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
799
|
+
feeAsset: TCurrencyInput | undefined;
|
|
800
|
+
}, never>;
|
|
801
|
+
/**
|
|
802
|
+
* Sets the hex of the encoded transaction call to apply on the destination chain
|
|
803
|
+
*
|
|
804
|
+
* @param hex - The encoded call hex or extrinsics.
|
|
805
|
+
* @param originKind - (Optional) The means of expressing the message origin as a dispatch origin.
|
|
806
|
+
* @param maxWeight - (Optional) The weight of the call. If not provided, the weight will be estimated.
|
|
807
|
+
* @returns An instance of the Builder.
|
|
808
|
+
*/
|
|
809
|
+
transact(call: string | TRes, originKind?: TTransactOrigin, maxWeight?: TWeight): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
810
|
+
transactOptions: {
|
|
811
|
+
call: string | TRes;
|
|
812
|
+
originKind: "Native" | "SovereignAccount" | "Superuser" | "Xcm" | undefined;
|
|
813
|
+
maxWeight: TWeight | undefined;
|
|
814
|
+
};
|
|
815
|
+
}, never>;
|
|
816
|
+
/**
|
|
817
|
+
* Performs a token swap as part of the transfer, using the specified exchange and destination currency.
|
|
818
|
+
*
|
|
819
|
+
* @param options - The swap options.
|
|
820
|
+
* @returns An instance of the Builder.
|
|
821
|
+
*/
|
|
822
|
+
swap(options: TSwapOptions<TApi, TRes, TSigner>): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
823
|
+
swapOptions: TSwapOptions<TApi, TRes, TSigner>;
|
|
824
|
+
}, TCustomChain>;
|
|
825
|
+
/**
|
|
826
|
+
* Adds the transfer transaction to the batch.
|
|
827
|
+
*
|
|
828
|
+
* @returns An instance of Builder
|
|
829
|
+
*/
|
|
830
|
+
addToBatch(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): GeneralBuilder<TApi, TRes, TSigner, T & {
|
|
831
|
+
from: TSubstrateChain;
|
|
832
|
+
}, TCustomChain>;
|
|
833
|
+
/**
|
|
834
|
+
* Builds and returns the batched transaction based on the configured parameters.
|
|
835
|
+
*
|
|
836
|
+
* @param options - (Optional) Options to customize the batch transaction.
|
|
837
|
+
* @returns A Extrinsic representing the batched transactions.
|
|
838
|
+
*/
|
|
839
|
+
buildBatch(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>, options?: TBatchOptions): Promise<TRes>;
|
|
840
|
+
protected buildInternal<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions, TCustomChain>): Promise<TBuildInternalRes<TApi, TRes, TSigner, TOptions>>;
|
|
841
|
+
private prepareNormalizedOptions;
|
|
842
|
+
/**
|
|
843
|
+
* Builds and returns the transfer extrinsic.
|
|
844
|
+
*
|
|
845
|
+
* @returns A Promise that resolves to the transfer extrinsic.
|
|
846
|
+
*/
|
|
847
|
+
build(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<TRes>;
|
|
848
|
+
/**
|
|
849
|
+
* Builds an unsigned EIP-1559 transaction (viem `TransactionSerializableEIP1559`) for an
|
|
850
|
+
* EVM-compatible origin. `nonce`, `gas`, and fees are populated from the origin chain's RPC.
|
|
851
|
+
*/
|
|
852
|
+
buildEvm(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<TransactionSerializableEIP1559>;
|
|
853
|
+
/**
|
|
854
|
+
* Builds and returns multiple transfer or swap extrinsics
|
|
855
|
+
*
|
|
856
|
+
* @returns A Promise that resolves to the transfer extrinsic contexts
|
|
857
|
+
*/
|
|
858
|
+
buildAll(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<TTransactionContext<TApi, TRes>[]>;
|
|
859
|
+
private validateBatchState;
|
|
860
|
+
private buildCommon;
|
|
861
|
+
private buildCommonAll;
|
|
862
|
+
private maybePerformXcmFormatCheck;
|
|
863
|
+
dryRun(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<TDryRunResult>;
|
|
864
|
+
dryRunPreview(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>, dryRunOptions?: TDryRunPreviewOptions): Promise<TDryRunResult>;
|
|
865
|
+
protected createTxFactory<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions, TCustomChain>): TTxFactory<TRes>;
|
|
866
|
+
/**
|
|
867
|
+
* Returns the XCM fee for the transfer using dryRun or paymentInfo function.
|
|
868
|
+
*
|
|
869
|
+
* @returns An origin and destination fee.
|
|
870
|
+
*/
|
|
871
|
+
getXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>, options?: TGetXcmFeeBuilderOptions & {
|
|
872
|
+
disableFallback: TDisableFallback;
|
|
873
|
+
}): Promise<TGetXcmFeeResult<TDisableFallback>>;
|
|
874
|
+
/**
|
|
875
|
+
* Returns the origin XCM fee for the transfer using dryRun or paymentInfo function.
|
|
876
|
+
*
|
|
877
|
+
* @returns An origin fee.
|
|
878
|
+
*/
|
|
879
|
+
getOriginXcmFee<TDisableFallback extends boolean = false>(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>, options?: TGetXcmFeeBuilderOptions & {
|
|
880
|
+
disableFallback: TDisableFallback;
|
|
881
|
+
}): Promise<TXcmFeeDetailWithForwardedXcm<TDisableFallback>>;
|
|
882
|
+
/**
|
|
883
|
+
* Returns the max transferable amount for the transfer
|
|
884
|
+
*
|
|
885
|
+
* @returns The max transferable amount.
|
|
886
|
+
*/
|
|
887
|
+
getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<bigint>;
|
|
888
|
+
/**
|
|
889
|
+
* Returns the min transferable amount for the transfer
|
|
890
|
+
*
|
|
891
|
+
* @returns The min transferable amount.
|
|
892
|
+
*/
|
|
893
|
+
getMinTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<bigint>;
|
|
894
|
+
/**
|
|
895
|
+
* Returns the max transferable amount for the transfer
|
|
896
|
+
*
|
|
897
|
+
* @returns The max transferable amount.
|
|
898
|
+
*/
|
|
899
|
+
verifyEdOnDestination(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<boolean>;
|
|
900
|
+
/**
|
|
901
|
+
* Returns the transfer info for the transfer
|
|
902
|
+
*
|
|
903
|
+
* @returns The transfer info.
|
|
904
|
+
*/
|
|
905
|
+
getTransferInfo(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<TTransferInfo>;
|
|
906
|
+
/**
|
|
907
|
+
* Returns the receivable amount on the destination after the transfer
|
|
908
|
+
*
|
|
909
|
+
* @returns The computed receivable amount.
|
|
910
|
+
* @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
|
|
911
|
+
*/
|
|
912
|
+
getReceivableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<bigint>;
|
|
913
|
+
getBestAmountOut(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSwap<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<{
|
|
914
|
+
exchange: TExchangeChain;
|
|
915
|
+
amountOut: bigint;
|
|
1498
916
|
}>;
|
|
917
|
+
signAndSubmit(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<string>;
|
|
918
|
+
signAndSubmitAll(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>, TCustomChain>): Promise<string[]>;
|
|
919
|
+
private executeWithEvmSigner;
|
|
920
|
+
private prepareEvmDispatch;
|
|
921
|
+
/**
|
|
922
|
+
* Returns the API instance used by the builder.
|
|
923
|
+
*
|
|
924
|
+
* @returns The API instance.
|
|
925
|
+
*/
|
|
926
|
+
getApi(): TApi;
|
|
927
|
+
/**
|
|
928
|
+
* Disconnects the API.
|
|
929
|
+
*
|
|
930
|
+
* @returns A Promise that resolves when the API is disconnected.
|
|
931
|
+
*/
|
|
932
|
+
disconnect(): Promise<void>;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Creates a new Builder instance.
|
|
936
|
+
*
|
|
937
|
+
* @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
|
|
938
|
+
* @returns A new Builder instance.
|
|
939
|
+
*/
|
|
940
|
+
declare const Builder: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner>) => GeneralBuilder<TApi, TRes, TSigner, object, TCustomChain>;
|
|
941
|
+
|
|
942
|
+
type TProviderEntry = {
|
|
943
|
+
name: string;
|
|
944
|
+
endpoint: string;
|
|
945
|
+
};
|
|
946
|
+
type TChainConfig = {
|
|
947
|
+
name: string;
|
|
948
|
+
info: string;
|
|
949
|
+
paraId: number;
|
|
950
|
+
providers: TProviderEntry[];
|
|
951
|
+
};
|
|
952
|
+
type TChainConfigMap = Record<TSubstrateChain, TChainConfig>;
|
|
953
|
+
|
|
954
|
+
type TCustomChainPalletsInput = {
|
|
955
|
+
nativeAssets?: TAssetsPallet;
|
|
956
|
+
otherAssets?: TAssetsPallet[];
|
|
957
|
+
};
|
|
958
|
+
type TCustomChainInput = {
|
|
959
|
+
paraId: number;
|
|
960
|
+
ecosystem: TRelaychain;
|
|
961
|
+
providers: TProviderEntry[];
|
|
962
|
+
xcmVersion: Version;
|
|
963
|
+
ss58Prefix?: number;
|
|
964
|
+
nativeAssetSymbol?: string;
|
|
965
|
+
nativeAssetDecimals?: number;
|
|
966
|
+
assets?: TCustomAssetInfo[];
|
|
967
|
+
pallets?: TCustomChainPalletsInput;
|
|
968
|
+
};
|
|
969
|
+
type TCustomChainsMap = Record<string, TCustomChainInput>;
|
|
970
|
+
type TCustomChainEntry = {
|
|
971
|
+
name: string;
|
|
972
|
+
paraId: number;
|
|
973
|
+
ecosystem: TRelaychain;
|
|
974
|
+
providers: TProviderEntry[];
|
|
975
|
+
xcmVersion: Version;
|
|
976
|
+
ss58Prefix?: number;
|
|
977
|
+
nativeAssetSymbol?: string;
|
|
978
|
+
nativeAssetDecimals?: number;
|
|
979
|
+
assets: TAssetInfo[];
|
|
980
|
+
pallets?: TCustomChainPallets;
|
|
981
|
+
};
|
|
982
|
+
type TCustomChainEntryHydrated = TCustomChainEntry & {
|
|
983
|
+
xcmPallet: TCrosschainPallet;
|
|
984
|
+
isEVM: boolean;
|
|
985
|
+
supportsDryRunApi: boolean;
|
|
986
|
+
supportsXcmPaymentApi: boolean;
|
|
987
|
+
pallets: TCustomChainPallets;
|
|
988
|
+
};
|
|
989
|
+
type TCustomChainsCtx = Record<string, TCustomChainEntry>;
|
|
990
|
+
type TFullCustomCtx = TCustomCtx & {
|
|
991
|
+
customChains?: TCustomChainsCtx;
|
|
992
|
+
customChainPallets?: Record<string, TCustomChainPallets>;
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
type TEvmTransferOptionsBase = {
|
|
996
|
+
from: TChain;
|
|
997
|
+
to: TChain;
|
|
998
|
+
currency: TCurrencyInputWithAmount;
|
|
999
|
+
recipient: string;
|
|
1000
|
+
ahAddress?: string;
|
|
1001
|
+
};
|
|
1002
|
+
type TEvmTransferOptions<TApi, TRes, TSigner> = WithApi<TEvmTransferOptionsBase & {
|
|
1003
|
+
signer: WalletClient;
|
|
1004
|
+
}, TApi, TRes, TSigner>;
|
|
1005
|
+
type TBuildEvmTransferOptions<TApi, TRes, TSigner> = WithApi<TEvmTransferOptionsBase & {
|
|
1006
|
+
sender: string;
|
|
1007
|
+
}, TApi, TRes, TSigner>;
|
|
1008
|
+
/**
|
|
1009
|
+
* The options for the batch builder.
|
|
1010
|
+
*/
|
|
1011
|
+
declare enum BatchMode {
|
|
1012
|
+
/**
|
|
1013
|
+
* Does not commit if one of the calls in the batch fails.
|
|
1014
|
+
*/
|
|
1015
|
+
BATCH_ALL = "BATCH_ALL",
|
|
1016
|
+
/**
|
|
1017
|
+
* Commits each successful call regardless if a call fails.
|
|
1018
|
+
*/
|
|
1019
|
+
BATCH = "BATCH"
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* The options for the batch builder.
|
|
1023
|
+
*/
|
|
1024
|
+
type TBatchOptions = {
|
|
1025
|
+
/**
|
|
1026
|
+
* The batch mode. Can be either:
|
|
1027
|
+
* `BATCH_ALL` - does not commit if one of the calls in the batch fails.
|
|
1028
|
+
* `BATCH` - commits each successful call regardless if a call fails.
|
|
1029
|
+
*/
|
|
1030
|
+
mode: BatchMode;
|
|
1031
|
+
};
|
|
1032
|
+
type TDryRunPreviewOptions = {
|
|
1033
|
+
mintFeeAssets?: boolean;
|
|
1034
|
+
};
|
|
1035
|
+
type TBuilderOptions<TApi> = TApi | TBuilderConfig<TApi>;
|
|
1036
|
+
type TBuilderConfig<TApi> = Partial<{
|
|
1037
|
+
apiOverrides: Partial<Record<TChain, TApi>>;
|
|
1038
|
+
customAssets: TCustomAssetsMap;
|
|
1039
|
+
customChains: TCustomChainsMap;
|
|
1040
|
+
development: boolean;
|
|
1041
|
+
abstractDecimals: boolean;
|
|
1042
|
+
xcmFormatCheck: boolean;
|
|
1043
|
+
}>;
|
|
1044
|
+
type TCustomChainFrom<TOpts> = TOpts extends {
|
|
1045
|
+
customChains: infer C;
|
|
1046
|
+
} ? Extract<keyof C, string> : never;
|
|
1047
|
+
type TCreateTxsOptions<TApi, TRes, TSigner> = Pick<TTransferOptions<TApi, TRes, TSigner>, 'api' | 'from' | 'to' | 'currency'>;
|
|
1048
|
+
type TBatchedTransferOptions<TApi, TRes, TSigner> = Omit<TSubstrateTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'> & {
|
|
1049
|
+
builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>;
|
|
1050
|
+
};
|
|
1051
|
+
type TBuildInternalResBase<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = {
|
|
1052
|
+
options: TTransferOptions<TApi, TRes, TSigner> & TOptions;
|
|
1053
|
+
};
|
|
1054
|
+
type TBuildInternalRes<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = TBuildInternalResBase<TApi, TRes, TSigner, TOptions> & {
|
|
1055
|
+
tx: TRes;
|
|
1056
|
+
};
|
|
1057
|
+
type TBuildAllInternalRes<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = TBuildInternalResBase<TApi, TRes, TSigner, TOptions> & {
|
|
1058
|
+
txContexts: TTransactionContext<TApi, TRes>[];
|
|
1059
|
+
};
|
|
1060
|
+
type TSender<TSigner> = string | TSigner;
|
|
1061
|
+
type TBuilderInternalOptions<TSigner> = {
|
|
1062
|
+
senderSource?: TSender<TSigner> | WalletClient;
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
type TSwapConfig = {
|
|
1066
|
+
currencyTo: TCurrencyCore;
|
|
1067
|
+
exchangeChain: TParachain;
|
|
1068
|
+
};
|
|
1069
|
+
type TDryRunBaseOptions<TRes> = {
|
|
1070
|
+
tx: TRes;
|
|
1071
|
+
origin: TSubstrateChain;
|
|
1072
|
+
destination: TChain;
|
|
1073
|
+
sender: string;
|
|
1074
|
+
currency: TCurrencyInputWithAmount;
|
|
1075
|
+
version?: Version;
|
|
1076
|
+
feeAsset?: TCurrencyInput;
|
|
1077
|
+
swapConfig?: TSwapConfig;
|
|
1078
|
+
useRootOrigin?: boolean;
|
|
1079
|
+
bypassOptions?: TBypassOptions;
|
|
1080
|
+
};
|
|
1081
|
+
type TDryRunOptions<TApi, TRes, TSigner> = WithApi<TDryRunBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
1082
|
+
type TDryRunCallBaseOptions<TRes> = {
|
|
1499
1083
|
/**
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
* @param currency - The currency to be used for the fee.
|
|
1503
|
-
* @returns An instance of the Builder
|
|
1084
|
+
* The transaction to dry-run
|
|
1504
1085
|
*/
|
|
1505
|
-
|
|
1506
|
-
feeAsset: TCurrencyInput | undefined;
|
|
1507
|
-
}>;
|
|
1086
|
+
tx: TRes;
|
|
1508
1087
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
* @param hex - The encoded call hex or extrinsics.
|
|
1512
|
-
* @param originKind - (Optional) The means of expressing the message origin as a dispatch origin.
|
|
1513
|
-
* @param maxWeight - (Optional) The weight of the call. If not provided, the weight will be estimated.
|
|
1514
|
-
* @returns An instance of the Builder.
|
|
1088
|
+
* The chain to dry-run on
|
|
1515
1089
|
*/
|
|
1516
|
-
|
|
1517
|
-
transactOptions: {
|
|
1518
|
-
call: string | TRes;
|
|
1519
|
-
originKind: "Native" | "SovereignAccount" | "Superuser" | "Xcm" | undefined;
|
|
1520
|
-
maxWeight: TWeight | undefined;
|
|
1521
|
-
};
|
|
1522
|
-
}>;
|
|
1090
|
+
chain: TSubstrateChain;
|
|
1523
1091
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1526
|
-
* @param options - The swap options.
|
|
1527
|
-
* @returns An instance of the Builder.
|
|
1092
|
+
* The destination chain
|
|
1528
1093
|
*/
|
|
1529
|
-
|
|
1530
|
-
swapOptions: TSwapOptions<TApi, TRes, TSigner>;
|
|
1531
|
-
}>;
|
|
1094
|
+
destination: TDestination;
|
|
1532
1095
|
/**
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
* @returns An instance of Builder
|
|
1096
|
+
* The address to dry-run with
|
|
1536
1097
|
*/
|
|
1537
|
-
|
|
1538
|
-
from: TSubstrateChain;
|
|
1539
|
-
}>;
|
|
1098
|
+
address: string;
|
|
1540
1099
|
/**
|
|
1541
|
-
*
|
|
1542
|
-
*
|
|
1543
|
-
* @param options - (Optional) Options to customize the batch transaction.
|
|
1544
|
-
* @returns A Extrinsic representing the batched transactions.
|
|
1100
|
+
* Whether to use the root origin
|
|
1545
1101
|
*/
|
|
1546
|
-
|
|
1547
|
-
protected buildInternal<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions>): Promise<TBuildInternalRes<TApi, TRes, TSigner, TOptions>>;
|
|
1548
|
-
private prepareNormalizedOptions;
|
|
1102
|
+
useRootOrigin?: boolean;
|
|
1549
1103
|
/**
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
* @returns A Promise that resolves to the transfer extrinsic.
|
|
1104
|
+
* XCM version to use for the dry-run parameters
|
|
1553
1105
|
*/
|
|
1554
|
-
|
|
1106
|
+
version: Version;
|
|
1107
|
+
asset: WithAmount<TAssetInfo>;
|
|
1108
|
+
bypassOptions?: TBypassOptions;
|
|
1109
|
+
feeAsset?: TAssetInfo;
|
|
1110
|
+
};
|
|
1111
|
+
type TDryRunBypassOptions<TApi, TRes, TSigner> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin' | 'destination'>, TApi, TRes, TSigner>;
|
|
1112
|
+
type TDryRunCallOptions<TApi, TRes, TSigner> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
1113
|
+
type TDryRunXcmBaseOptions<TRes> = {
|
|
1114
|
+
originLocation: any;
|
|
1555
1115
|
/**
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1558
|
-
* @returns A Promise that resolves to the transfer extrinsic contexts
|
|
1116
|
+
* The XCM instructions
|
|
1559
1117
|
*/
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
private buildCommonAll;
|
|
1564
|
-
private maybePerformXcmFormatCheck;
|
|
1565
|
-
dryRun(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<TDryRunResult>;
|
|
1566
|
-
dryRunPreview(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>, dryRunOptions?: TDryRunPreviewOptions): Promise<TDryRunResult>;
|
|
1567
|
-
protected createTxFactory<TOptions extends TTransferBaseOptions<TApi, TRes, TSigner>>(this: GeneralBuilder<TApi, TRes, TSigner, TOptions>): TTxFactory<TRes>;
|
|
1118
|
+
xcm: any;
|
|
1119
|
+
/** The transaction to dry-run */
|
|
1120
|
+
tx: TRes;
|
|
1568
1121
|
/**
|
|
1569
|
-
*
|
|
1570
|
-
*
|
|
1571
|
-
* @returns An origin and destination fee.
|
|
1122
|
+
* The chain to dry-run on
|
|
1572
1123
|
*/
|
|
1573
|
-
|
|
1574
|
-
disableFallback: TDisableFallback;
|
|
1575
|
-
}): Promise<TGetXcmFeeResult<TDisableFallback>>;
|
|
1124
|
+
chain: TSubstrateChain;
|
|
1576
1125
|
/**
|
|
1577
|
-
*
|
|
1578
|
-
*
|
|
1579
|
-
* @returns An origin fee.
|
|
1126
|
+
* The origin chain
|
|
1580
1127
|
*/
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1128
|
+
origin: TSubstrateChain;
|
|
1129
|
+
asset: TAssetInfo;
|
|
1130
|
+
version: Version;
|
|
1131
|
+
feeAsset?: TAssetInfo;
|
|
1132
|
+
amount: bigint;
|
|
1133
|
+
originFee: bigint;
|
|
1134
|
+
};
|
|
1135
|
+
type TDryRunXcmOptions<TApi, TRes, TSigner> = WithApi<TDryRunXcmBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
1136
|
+
type TDryRunResBase = {
|
|
1137
|
+
asset: TAssetInfo;
|
|
1138
|
+
isExchange?: boolean;
|
|
1139
|
+
};
|
|
1140
|
+
type TDryRunChainSuccess = TDryRunResBase & {
|
|
1141
|
+
success: true;
|
|
1142
|
+
fee: bigint;
|
|
1143
|
+
weight?: TWeight;
|
|
1144
|
+
forwardedXcms: any;
|
|
1145
|
+
destParaId?: number;
|
|
1146
|
+
};
|
|
1147
|
+
type TDryRunChainFailure = TDryRunResBase & {
|
|
1148
|
+
success: false;
|
|
1149
|
+
failureReason: string;
|
|
1150
|
+
failureSubReason?: string;
|
|
1151
|
+
};
|
|
1152
|
+
type TDryRunChainResult = TDryRunChainSuccess | TDryRunChainFailure;
|
|
1153
|
+
type THopInfo = {
|
|
1154
|
+
chain: TChain;
|
|
1155
|
+
result: TDryRunChainResult;
|
|
1156
|
+
};
|
|
1157
|
+
type TChainEndpoint = 'origin' | 'destination' | TChain;
|
|
1158
|
+
type TDryRunResult = {
|
|
1159
|
+
failureReason?: string;
|
|
1160
|
+
failureSubReason?: string;
|
|
1161
|
+
failureChain?: TChainEndpoint;
|
|
1162
|
+
origin: TDryRunChainResult;
|
|
1163
|
+
destination?: TDryRunChainResult;
|
|
1164
|
+
hops: THopInfo[];
|
|
1165
|
+
};
|
|
1166
|
+
type TResolveHopParams<TApi, TRes, TSigner> = {
|
|
1167
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1168
|
+
tx: TRes;
|
|
1169
|
+
originChain: TSubstrateChain;
|
|
1170
|
+
currentChain: TSubstrateChain;
|
|
1171
|
+
destination: TDestination;
|
|
1172
|
+
asset: TAssetInfo;
|
|
1173
|
+
currency: TCurrencyInputWithAmount;
|
|
1174
|
+
swapConfig?: TSwapConfig;
|
|
1175
|
+
hasPassedExchange: boolean;
|
|
1176
|
+
};
|
|
1177
|
+
type HopProcessParams<TApi, TRes, TSigner> = {
|
|
1178
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1179
|
+
currentChain: TSubstrateChain;
|
|
1180
|
+
currentOrigin: TSubstrateChain;
|
|
1181
|
+
currentAsset: TAssetInfo;
|
|
1182
|
+
forwardedXcms: any;
|
|
1183
|
+
hasPassedExchange: boolean;
|
|
1184
|
+
isDestination: boolean;
|
|
1185
|
+
};
|
|
1186
|
+
type HopTraversalConfig<TApi, TRes, TSigner, THopResult> = {
|
|
1187
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1188
|
+
origin: TSubstrateChain;
|
|
1189
|
+
destination: TChain;
|
|
1190
|
+
currency: TCurrencyCore;
|
|
1191
|
+
initialForwardedXcms: any;
|
|
1192
|
+
initialDestParaId: number | undefined;
|
|
1193
|
+
swapConfig?: TSwapConfig;
|
|
1194
|
+
processHop: (params: HopProcessParams<TApi, TRes, TSigner>) => Promise<THopResult>;
|
|
1195
|
+
shouldContinue: (hopResult: THopResult) => boolean;
|
|
1196
|
+
extractNextHopData: (hopResult: THopResult) => {
|
|
1197
|
+
forwardedXcms: any;
|
|
1198
|
+
destParaId: number | undefined;
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
type HopTraversalResult<THopResult> = {
|
|
1202
|
+
hops: Array<{
|
|
1203
|
+
chain: TSubstrateChain;
|
|
1204
|
+
result: THopResult;
|
|
1584
1205
|
}>;
|
|
1206
|
+
destination?: THopResult;
|
|
1207
|
+
lastProcessedChain?: TSubstrateChain;
|
|
1208
|
+
};
|
|
1209
|
+
type TBypassOptions = {
|
|
1210
|
+
mintFeeAssets?: boolean;
|
|
1211
|
+
sentAssetMintMode?: 'preview' | 'bypass';
|
|
1212
|
+
};
|
|
1213
|
+
declare enum XTokensError {
|
|
1214
|
+
AssetHasNoReserve = "AssetHasNoReserve",
|
|
1215
|
+
NotCrossChainTransfer = "NotCrossChainTransfer",
|
|
1216
|
+
InvalidDest = "InvalidDest",
|
|
1217
|
+
NotCrossChainTransferableCurrency = "NotCrossChainTransferableCurrency",
|
|
1218
|
+
UnweighableMessage = "UnweighableMessage",
|
|
1219
|
+
XcmExecutionFailed = "XcmExecutionFailed",
|
|
1220
|
+
CannotReanchor = "CannotReanchor",
|
|
1221
|
+
InvalidAncestry = "InvalidAncestry",
|
|
1222
|
+
InvalidAsset = "InvalidAsset",
|
|
1223
|
+
DestinationNotInvertible = "DestinationNotInvertible",
|
|
1224
|
+
BadVersion = "BadVersion",
|
|
1225
|
+
DistinctReserveForAssetAndFee = "DistinctReserveForAssetAndFee",
|
|
1226
|
+
ZeroFee = "ZeroFee",
|
|
1227
|
+
ZeroAmount = "ZeroAmount",
|
|
1228
|
+
TooManyAssetsBeingSent = "TooManyAssetsBeingSent",
|
|
1229
|
+
AssetIndexNonExistent = "AssetIndexNonExistent",
|
|
1230
|
+
FeeNotEnough = "FeeNotEnough",
|
|
1231
|
+
NotSupportedLocation = "NotSupportedLocation",
|
|
1232
|
+
MinXcmFeeNotDefined = "MinXcmFeeNotDefined",
|
|
1233
|
+
RateLimited = "RateLimited"
|
|
1234
|
+
}
|
|
1235
|
+
declare enum PolkadotXcmError {
|
|
1236
|
+
Unreachable = "Unreachable",
|
|
1237
|
+
SendFailure = "SendFailure",
|
|
1238
|
+
Filtered = "Filtered",
|
|
1239
|
+
UnweighableMessage = "UnweighableMessage",
|
|
1240
|
+
DestinationNotInvertible = "DestinationNotInvertible",
|
|
1241
|
+
Empty = "Empty",
|
|
1242
|
+
CannotReanchor = "CannotReanchor",
|
|
1243
|
+
TooManyAssets = "TooManyAssets",
|
|
1244
|
+
InvalidOrigin = "InvalidOrigin",
|
|
1245
|
+
BadVersion = "BadVersion",
|
|
1246
|
+
BadLocation = "BadLocation",
|
|
1247
|
+
NoSubscription = "NoSubscription",
|
|
1248
|
+
AlreadySubscribed = "AlreadySubscribed",
|
|
1249
|
+
CannotCheckOutTeleport = "CannotCheckOutTeleport",
|
|
1250
|
+
LowBalance = "LowBalance",
|
|
1251
|
+
TooManyLocks = "TooManyLocks",
|
|
1252
|
+
AccountNotSovereign = "AccountNotSovereign",
|
|
1253
|
+
FeesNotMet = "FeesNotMet",
|
|
1254
|
+
LockNotFound = "LockNotFound",
|
|
1255
|
+
InUse = "InUse",
|
|
1256
|
+
REMOVED = "REMOVED",
|
|
1257
|
+
InvalidAssetUnknownReserve = "InvalidAssetUnknownReserve",
|
|
1258
|
+
InvalidAssetUnsupportedReserve = "InvalidAssetUnsupportedReserve",
|
|
1259
|
+
TooManyReserves = "TooManyReserves",
|
|
1260
|
+
LocalExecutionIncomplete = "LocalExecutionIncomplete",
|
|
1261
|
+
TooManyAuthorizedAliases = "TooManyAuthorizedAliases",
|
|
1262
|
+
ExpiresInPast = "ExpiresInPast",
|
|
1263
|
+
AliasNotFound = "AliasNotFound",
|
|
1264
|
+
LocalExecutionIncompleteWithError = "LocalExecutionIncompleteWithError"
|
|
1265
|
+
}
|
|
1266
|
+
declare enum PolkadotXcmExecutionError {
|
|
1267
|
+
Overflow = "Overflow",
|
|
1268
|
+
Unimplemented = "Unimplemented",
|
|
1269
|
+
UntrustedReserveLocation = "UntrustedReserveLocation",
|
|
1270
|
+
UntrustedTeleportLocation = "UntrustedTeleportLocation",
|
|
1271
|
+
LocationFull = "LocationFull",
|
|
1272
|
+
LocationNotInvertible = "LocationNotInvertible",
|
|
1273
|
+
BadOrigin = "BadOrigin",
|
|
1274
|
+
InvalidLocation = "InvalidLocation",
|
|
1275
|
+
AssetNotFound = "AssetNotFound",
|
|
1276
|
+
FailedToTransactAsset = "FailedToTransactAsset",
|
|
1277
|
+
NotWithdrawable = "NotWithdrawable",
|
|
1278
|
+
LocationCannotHold = "LocationCannotHold",
|
|
1279
|
+
ExceedsMaxMessageSize = "ExceedsMaxMessageSize",
|
|
1280
|
+
DestinationUnsupported = "DestinationUnsupported",
|
|
1281
|
+
Transport = "Transport",
|
|
1282
|
+
Unroutable = "Unroutable",
|
|
1283
|
+
UnknownClaim = "UnknownClaim",
|
|
1284
|
+
FailedToDecode = "FailedToDecode",
|
|
1285
|
+
MaxWeightInvalid = "MaxWeightInvalid",
|
|
1286
|
+
NotHoldingFees = "NotHoldingFees",
|
|
1287
|
+
TooExpensive = "TooExpensive",
|
|
1288
|
+
Trap = "Trap",
|
|
1289
|
+
ExpectationFalse = "ExpectationFalse",
|
|
1290
|
+
PalletNotFound = "PalletNotFound",
|
|
1291
|
+
NameMismatch = "NameMismatch",
|
|
1292
|
+
VersionIncompatible = "VersionIncompatible",
|
|
1293
|
+
HoldingWouldOverflow = "HoldingWouldOverflow",
|
|
1294
|
+
ExportError = "ExportError",
|
|
1295
|
+
ReanchorFailed = "ReanchorFailed",
|
|
1296
|
+
NoDeal = "NoDeal",
|
|
1297
|
+
FeesNotMet = "FeesNotMet",
|
|
1298
|
+
LockError = "LockError",
|
|
1299
|
+
NoPermission = "NoPermission",
|
|
1300
|
+
Unanchored = "Unanchored",
|
|
1301
|
+
NotDepositable = "NotDepositable",
|
|
1302
|
+
TooManyAssets = "TooManyAssets",
|
|
1303
|
+
UnhandledXcmVersion = "UnhandledXcmVersion",
|
|
1304
|
+
WeightLimitReached = "WeightLimitReached",
|
|
1305
|
+
Barrier = "Barrier",
|
|
1306
|
+
WeightNotComputable = "WeightNotComputable",
|
|
1307
|
+
ExceedsStackLimit = "ExceedsStackLimit"
|
|
1308
|
+
}
|
|
1309
|
+
type TModuleError = {
|
|
1310
|
+
index: string;
|
|
1311
|
+
error: string;
|
|
1312
|
+
};
|
|
1313
|
+
type TDryRunError = {
|
|
1314
|
+
failureReason: string;
|
|
1315
|
+
failureSubReason?: string;
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
declare class AmountTooLowError extends Error {
|
|
1319
|
+
constructor(message?: string);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Error thrown when an API operation is attempted before the API has been initialized.
|
|
1324
|
+
*/
|
|
1325
|
+
declare class ApiNotInitializedError extends Error {
|
|
1326
|
+
constructor();
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Error thrown when a batch operation is invalid or cannot be executed.
|
|
1331
|
+
*/
|
|
1332
|
+
declare class BatchValidationError extends Error {
|
|
1333
|
+
constructor(message: string);
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Error thrown when the Ethereum bridge is halted.
|
|
1338
|
+
*/
|
|
1339
|
+
declare class BridgeHaltedError extends Error {
|
|
1585
1340
|
/**
|
|
1586
|
-
*
|
|
1587
|
-
*
|
|
1588
|
-
* @returns The max transferable amount.
|
|
1589
|
-
*/
|
|
1590
|
-
getTransferableAmount(this: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>): Promise<bigint>;
|
|
1591
|
-
/**
|
|
1592
|
-
* Returns the min transferable amount for the transfer
|
|
1341
|
+
* Constructs a new BridgeHaltedError.
|
|
1593
1342
|
*
|
|
1594
|
-
* @
|
|
1343
|
+
* @param message - Optional custom error message.
|
|
1595
1344
|
*/
|
|
1596
|
-
|
|
1345
|
+
constructor();
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Error thrown when a custom chain name collides with a built-in chain.
|
|
1350
|
+
*/
|
|
1351
|
+
declare class CustomChainConflictError extends Error {
|
|
1352
|
+
constructor(msg: string);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Error thrown when a custom chain definition is missing required fields or
|
|
1357
|
+
* carries invalid values.
|
|
1358
|
+
*/
|
|
1359
|
+
declare class CustomChainInvalidError extends Error {
|
|
1360
|
+
constructor(msg: string);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Error thrown when the Dry Run fails.
|
|
1365
|
+
*/
|
|
1366
|
+
declare class DryRunFailedError extends Error {
|
|
1367
|
+
readonly reason: string;
|
|
1368
|
+
readonly dryRunType?: TChainEndpoint;
|
|
1597
1369
|
/**
|
|
1598
|
-
*
|
|
1370
|
+
* Constructs a new DryRunFailedError.
|
|
1599
1371
|
*
|
|
1600
|
-
* @
|
|
1372
|
+
* @param reason - The reason why the dry run failed.
|
|
1373
|
+
* @param dryRunType - Optional. Specifies if the error is related to the 'origin' or 'destination' dry run.
|
|
1374
|
+
* @param prefix - Optional. A short sentence prepended to the message
|
|
1601
1375
|
*/
|
|
1602
|
-
|
|
1376
|
+
constructor(reason: string, dryRunType?: TChainEndpoint, prefix?: string);
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* Error thrown when an extension is not installed.
|
|
1381
|
+
*/
|
|
1382
|
+
declare class ExtensionNotInstalledError extends Error {
|
|
1603
1383
|
/**
|
|
1604
|
-
*
|
|
1384
|
+
* Constructs a new ExtensionNotInstalledError.
|
|
1605
1385
|
*
|
|
1606
|
-
* @
|
|
1386
|
+
* @param message - The error message.
|
|
1607
1387
|
*/
|
|
1608
|
-
|
|
1388
|
+
constructor(message: string);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Error thrown when a feature or route is temporarily disabled via configuration or governance.
|
|
1393
|
+
*/
|
|
1394
|
+
declare class FeatureTemporarilyDisabledError extends Error {
|
|
1395
|
+
constructor(message: string);
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Error thrown when an invalid address is provided.
|
|
1400
|
+
*/
|
|
1401
|
+
declare class InvalidAddressError extends Error {
|
|
1609
1402
|
/**
|
|
1610
|
-
*
|
|
1403
|
+
* Constructs a new InvalidAddressError.
|
|
1611
1404
|
*
|
|
1612
|
-
* @
|
|
1613
|
-
* @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
|
|
1405
|
+
* @param message - The error message.
|
|
1614
1406
|
*/
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
private executeWithEvmSigner;
|
|
1407
|
+
constructor(message: string);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Error development mode is on and no API override is provided for a specific chain.
|
|
1412
|
+
*/
|
|
1413
|
+
declare class MissingChainApiError<TCustomChain extends string = never> extends Error {
|
|
1623
1414
|
/**
|
|
1624
|
-
*
|
|
1415
|
+
* Constructs a new MissingChainApiError.
|
|
1625
1416
|
*
|
|
1626
|
-
* @
|
|
1417
|
+
* @param chain - The chain for which the API is missing.
|
|
1627
1418
|
*/
|
|
1628
|
-
|
|
1419
|
+
constructor(chain: TChain | TCustomChain);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Error thrown when a required parameter is missing.
|
|
1424
|
+
*/
|
|
1425
|
+
declare class MissingParameterError extends Error {
|
|
1426
|
+
constructor(parameter: string | string[], message?: string);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
|
|
1431
|
+
*/
|
|
1432
|
+
declare class NoXCMSupportImplementedError<TCustomChain extends string = never> extends Error {
|
|
1629
1433
|
/**
|
|
1630
|
-
*
|
|
1434
|
+
* Constructs a new NoXCMSupportImplementedError.
|
|
1631
1435
|
*
|
|
1632
|
-
* @
|
|
1436
|
+
* @param chain - The chain for which XCM support is not implemented.
|
|
1633
1437
|
*/
|
|
1634
|
-
|
|
1438
|
+
constructor(chain: TChain | TCustomChain);
|
|
1635
1439
|
}
|
|
1440
|
+
|
|
1636
1441
|
/**
|
|
1637
|
-
*
|
|
1638
|
-
*
|
|
1639
|
-
* @param api - The API instance to use for building transactions. If not provided, a new instance will be created.
|
|
1640
|
-
* @returns A new Builder instance.
|
|
1442
|
+
* Error thrown when numeric input is invalid or cannot be parsed.
|
|
1641
1443
|
*/
|
|
1642
|
-
declare
|
|
1444
|
+
declare class NumberFormatError extends Error {
|
|
1445
|
+
constructor(message?: string);
|
|
1446
|
+
}
|
|
1643
1447
|
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1448
|
+
/**
|
|
1449
|
+
* Error thrown when asset or currency overrides are invalid or conflicting.
|
|
1450
|
+
*/
|
|
1451
|
+
declare class OverrideConflictError extends Error {
|
|
1452
|
+
constructor(message: string);
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* Error thrown when no provider or RPC endpoint is available for the requested chain.
|
|
1457
|
+
*/
|
|
1458
|
+
declare class ProviderUnavailableError extends Error {
|
|
1459
|
+
constructor(message: string);
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
/**
|
|
1463
|
+
* Error thrown when routing or path resolution fails.
|
|
1464
|
+
*/
|
|
1465
|
+
declare class RoutingResolutionError extends Error {
|
|
1466
|
+
constructor(message: string);
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Error thrown when a runtime API call fails
|
|
1471
|
+
*/
|
|
1472
|
+
declare class RuntimeApiError extends Error {
|
|
1473
|
+
constructor(message: string);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/**
|
|
1477
|
+
* Error thrown when a required runtime API is not available on the target chain.
|
|
1478
|
+
*/
|
|
1479
|
+
declare class RuntimeApiUnavailableError extends Error {
|
|
1480
|
+
constructor(chain: string, apiName: string);
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
type TScenarioNotSupportedContext = {
|
|
1652
1484
|
chain: TChain;
|
|
1485
|
+
scenario: TScenario;
|
|
1653
1486
|
};
|
|
1654
1487
|
/**
|
|
1655
|
-
*
|
|
1488
|
+
* Error thrown when a scenario, route, or chain capability is not supported.
|
|
1656
1489
|
*/
|
|
1657
|
-
|
|
1490
|
+
declare class ScenarioNotSupportedError extends Error {
|
|
1491
|
+
constructor(message: string);
|
|
1492
|
+
constructor({ chain, scenario }: TScenarioNotSupportedContext);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Error thrown when a submitted transaction encounters a dispatch error on-chain.
|
|
1497
|
+
*/
|
|
1498
|
+
declare class SubmitTransactionError extends Error {
|
|
1658
1499
|
/**
|
|
1659
|
-
*
|
|
1500
|
+
* Constructs a new SubmitTransactionError.
|
|
1501
|
+
*
|
|
1502
|
+
* @param message - The dispatch error details.
|
|
1660
1503
|
*/
|
|
1661
|
-
|
|
1662
|
-
}
|
|
1504
|
+
constructor(message: string);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
declare class TransferToAhNotSupported extends Error {
|
|
1508
|
+
constructor(message?: string);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
declare class TypeAndThenUnavailableError extends Error {
|
|
1512
|
+
constructor(message: string);
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* UnableToComputeError is thrown when a computation cannot be performed.
|
|
1517
|
+
*/
|
|
1518
|
+
declare class UnableToComputeError extends Error {
|
|
1519
|
+
/**
|
|
1520
|
+
* Constructs a new UnableToComputeError.
|
|
1521
|
+
*
|
|
1522
|
+
* @param message - Required error message.
|
|
1523
|
+
*/
|
|
1524
|
+
constructor(message: string);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* Error thrown when an operation or parameter combination is not supported.
|
|
1529
|
+
*/
|
|
1530
|
+
declare class UnsupportedOperationError extends Error {
|
|
1531
|
+
constructor(message: string);
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1663
1534
|
/**
|
|
1664
|
-
*
|
|
1535
|
+
* Thrown when a validation check fails.
|
|
1665
1536
|
*/
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1537
|
+
declare class ValidationError extends Error {
|
|
1538
|
+
constructor(message: string);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
type TXcmFeeSwapConfig = TSwapConfig & {
|
|
1542
|
+
amountOut: bigint;
|
|
1671
1543
|
};
|
|
1672
|
-
type
|
|
1673
|
-
type
|
|
1674
|
-
type TGetTransferableAmountOptionsBase<TRes> = {
|
|
1544
|
+
type TTxFactory<TRes> = (amount?: string, relative?: boolean) => Promise<TRes>;
|
|
1545
|
+
type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
|
|
1675
1546
|
/**
|
|
1676
|
-
* The
|
|
1547
|
+
* The transaction factory
|
|
1677
1548
|
*/
|
|
1678
|
-
|
|
1549
|
+
buildTx: TTxFactory<TRes>;
|
|
1679
1550
|
/**
|
|
1680
|
-
* The chain
|
|
1551
|
+
* The origin chain
|
|
1681
1552
|
*/
|
|
1682
1553
|
origin: TSubstrateChain;
|
|
1683
1554
|
/**
|
|
1684
|
-
* The destination chain
|
|
1555
|
+
* The destination chain
|
|
1685
1556
|
*/
|
|
1686
1557
|
destination: TChain;
|
|
1687
1558
|
/**
|
|
1688
|
-
* The
|
|
1559
|
+
* The sender address
|
|
1689
1560
|
*/
|
|
1561
|
+
sender: string;
|
|
1562
|
+
recipient: string;
|
|
1690
1563
|
currency: WithAmount<TCurrencyCore>;
|
|
1691
|
-
version
|
|
1564
|
+
version?: Version;
|
|
1565
|
+
feeAsset?: TCurrencyInput;
|
|
1566
|
+
disableFallback: TDisableFallback;
|
|
1567
|
+
swapConfig?: TXcmFeeSwapConfig;
|
|
1568
|
+
skipReverseFeeCalculation?: boolean;
|
|
1569
|
+
};
|
|
1570
|
+
type TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes, TSigner>;
|
|
1571
|
+
type TGetXcmFeeInternalOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = Omit<TGetXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback>, 'buildTx'> & {
|
|
1572
|
+
tx: TRes;
|
|
1573
|
+
useRootOrigin: boolean;
|
|
1574
|
+
};
|
|
1575
|
+
type TGetXcmFeeBuilderOptions = {
|
|
1576
|
+
disableFallback: boolean;
|
|
1577
|
+
};
|
|
1578
|
+
type TGetOriginXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
|
|
1692
1579
|
buildTx: TTxFactory<TRes>;
|
|
1580
|
+
origin: TSubstrateChain;
|
|
1581
|
+
destination: TChain;
|
|
1582
|
+
sender: string;
|
|
1583
|
+
currency: WithAmount<TCurrencyCore>;
|
|
1584
|
+
version?: Version;
|
|
1693
1585
|
feeAsset?: TCurrencyInput;
|
|
1586
|
+
disableFallback: TDisableFallback;
|
|
1587
|
+
useRootOrigin?: boolean;
|
|
1694
1588
|
};
|
|
1695
|
-
type
|
|
1696
|
-
type
|
|
1589
|
+
type TGetOriginXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback extends boolean = boolean> = WithApi<TGetOriginXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes, TSigner>;
|
|
1590
|
+
type TGetOriginXcmFeeInternalOptions<TApi, TRes, TSigner> = Omit<TGetOriginXcmFeeOptions<TApi, TRes, TSigner>, 'buildTx'> & {
|
|
1591
|
+
tx: TRes;
|
|
1592
|
+
};
|
|
1593
|
+
type TGetFeeForDestChainBaseOptions<TRes> = {
|
|
1594
|
+
prevChain: TSubstrateChain;
|
|
1595
|
+
origin: TSubstrateChain;
|
|
1596
|
+
destination: TChain;
|
|
1597
|
+
sender: string;
|
|
1697
1598
|
recipient: string;
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1599
|
+
currency: WithAmount<TCurrencyCore>;
|
|
1600
|
+
forwardedXcms: any;
|
|
1601
|
+
tx: TRes;
|
|
1602
|
+
asset: TAssetInfo;
|
|
1603
|
+
version: Version;
|
|
1604
|
+
originFee: bigint;
|
|
1605
|
+
feeAsset?: TCurrencyInput;
|
|
1606
|
+
disableFallback: boolean;
|
|
1607
|
+
hasPassedExchange?: boolean;
|
|
1608
|
+
swapConfig?: TXcmFeeSwapConfig;
|
|
1609
|
+
skipReverseFeeCalculation?: boolean;
|
|
1610
|
+
};
|
|
1611
|
+
type TGetFeeForDestChainOptions<TApi, TRes, TSigner> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes, TSigner>;
|
|
1612
|
+
type TGetReverseTxFeeOptions<TApi, TRes, TSigner> = Omit<TGetFeeForDestChainOptions<TApi, TRes, TSigner>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain' | 'version'> & {
|
|
1613
|
+
destination: TSubstrateChain;
|
|
1614
|
+
};
|
|
1615
|
+
type TFeeType = 'dryRun' | 'paymentInfo' | 'noFeeRequired';
|
|
1616
|
+
type TXcmFeeBase$1 = {
|
|
1617
|
+
asset: TAssetInfo;
|
|
1618
|
+
weight?: TWeight;
|
|
1619
|
+
sufficient?: boolean;
|
|
1620
|
+
isExchange?: boolean;
|
|
1621
|
+
};
|
|
1622
|
+
type TXcmFeeDetailSuccess = TXcmFeeBase$1 & {
|
|
1623
|
+
fee: bigint;
|
|
1624
|
+
feeType: TFeeType;
|
|
1625
|
+
dryRunError?: string;
|
|
1626
|
+
dryRunSubError?: string;
|
|
1627
|
+
};
|
|
1628
|
+
type TXcmFeeDetailWithFallback = TXcmFeeDetailSuccess;
|
|
1629
|
+
type TXcmFeeDetailError = TXcmFeeBase$1 & {
|
|
1630
|
+
fee?: bigint;
|
|
1631
|
+
feeType?: TFeeType;
|
|
1632
|
+
dryRunError: string;
|
|
1633
|
+
dryRunSubError?: string;
|
|
1634
|
+
};
|
|
1635
|
+
type TXcmFeeDetail = TXcmFeeDetailSuccess | TXcmFeeDetailError;
|
|
1636
|
+
type TXcmFeeHopResult = {
|
|
1637
|
+
fee?: bigint;
|
|
1638
|
+
feeType?: TFeeType;
|
|
1639
|
+
sufficient?: boolean;
|
|
1640
|
+
dryRunError?: string;
|
|
1641
|
+
dryRunSubError?: string;
|
|
1642
|
+
forwardedXcms?: any;
|
|
1643
|
+
destParaId?: number;
|
|
1644
|
+
asset: TAssetInfo;
|
|
1645
|
+
};
|
|
1646
|
+
type TConditionalXcmFeeDetail<TDisableFallback extends boolean> = TDisableFallback extends false ? TXcmFeeDetailWithFallback : TXcmFeeDetail;
|
|
1647
|
+
type TXcmFeeDetailWithForwardedXcm<TDisableFallback extends boolean> = TConditionalXcmFeeDetail<TDisableFallback> & {
|
|
1648
|
+
forwardedXcms?: unknown;
|
|
1649
|
+
destParaId?: number;
|
|
1650
|
+
};
|
|
1651
|
+
type TConditionalXcmFeeHopInfo<TDisableFallback extends boolean> = {
|
|
1652
|
+
chain: TChain;
|
|
1653
|
+
result: TConditionalXcmFeeDetail<TDisableFallback>;
|
|
1654
|
+
};
|
|
1655
|
+
type TXcmFeeHopInfo = {
|
|
1656
|
+
chain: TChain;
|
|
1657
|
+
result: TXcmFeeDetail;
|
|
1658
|
+
};
|
|
1659
|
+
type TGetXcmFeeResult<TDisableFallback extends boolean = boolean> = {
|
|
1660
|
+
failureReason?: string;
|
|
1661
|
+
failureChain?: TChainEndpoint;
|
|
1662
|
+
origin: TConditionalXcmFeeDetail<TDisableFallback>;
|
|
1663
|
+
destination: TConditionalXcmFeeDetail<TDisableFallback>;
|
|
1664
|
+
hops: TConditionalXcmFeeHopInfo<TDisableFallback>[];
|
|
1665
|
+
};
|
|
1666
|
+
type TPaymentInfo = {
|
|
1667
|
+
partialFee: bigint;
|
|
1668
|
+
weight: TWeight;
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
type THopTransferInfo = {
|
|
1672
|
+
chain: TChain;
|
|
1673
|
+
result: {
|
|
1674
|
+
xcmFee: TXcmFeeBase;
|
|
1675
|
+
asset: TAssetInfo;
|
|
1676
|
+
isExchange?: boolean;
|
|
1677
|
+
};
|
|
1678
|
+
};
|
|
1679
|
+
type TXcmFeeBase = {
|
|
1680
|
+
fee: bigint;
|
|
1681
|
+
asset: TAssetInfo;
|
|
1682
|
+
};
|
|
1683
|
+
type TTransferInfo = {
|
|
1684
|
+
chain: {
|
|
1685
|
+
origin: TChain;
|
|
1686
|
+
destination: TChain;
|
|
1687
|
+
ecosystem: string;
|
|
1688
|
+
};
|
|
1689
|
+
origin: {
|
|
1690
|
+
selectedCurrency: {
|
|
1691
|
+
sufficient: boolean;
|
|
1692
|
+
balance: bigint;
|
|
1693
|
+
balanceAfter: bigint;
|
|
1694
|
+
asset: TAssetInfo;
|
|
1695
|
+
};
|
|
1696
|
+
xcmFee: TXcmFeeBase & {
|
|
1697
|
+
sufficient: boolean;
|
|
1698
|
+
balance: bigint;
|
|
1699
|
+
balanceAfter: bigint;
|
|
1700
|
+
};
|
|
1701
|
+
isExchange?: boolean;
|
|
1702
|
+
};
|
|
1703
|
+
hops: THopTransferInfo[];
|
|
1704
|
+
destination: {
|
|
1705
|
+
receivedCurrency: {
|
|
1706
|
+
sufficient: boolean | UnableToComputeError;
|
|
1707
|
+
receivedAmount: bigint | UnableToComputeError;
|
|
1708
|
+
balance: bigint;
|
|
1709
|
+
balanceAfter: bigint | UnableToComputeError;
|
|
1710
|
+
asset: TAssetInfo;
|
|
1711
|
+
};
|
|
1712
|
+
xcmFee: TXcmFeeBase & {
|
|
1713
|
+
balanceAfter: bigint | UnableToComputeError;
|
|
1714
|
+
};
|
|
1715
|
+
isExchange?: boolean;
|
|
1716
|
+
};
|
|
1717
|
+
};
|
|
1718
|
+
type TBuildOriginInfoOptions<TApi, TRes, TSigner> = {
|
|
1719
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1720
|
+
origin: TSubstrateChain;
|
|
1721
|
+
sender: string;
|
|
1722
|
+
currency: TCurrencyCore;
|
|
1723
|
+
originAsset: TAssetInfo;
|
|
1724
|
+
amount: bigint;
|
|
1725
|
+
originFee: bigint;
|
|
1726
|
+
originFeeAsset: TAssetInfo;
|
|
1727
|
+
isFeeAssetAh: boolean;
|
|
1728
|
+
};
|
|
1729
|
+
type BuildHopInfoOptions<TApi, TRes, TSigner> = {
|
|
1730
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1731
|
+
chain: TChain;
|
|
1732
|
+
fee: bigint;
|
|
1733
|
+
originChain: TSubstrateChain;
|
|
1734
|
+
currency: TCurrencyCore;
|
|
1735
|
+
asset: TAssetInfo;
|
|
1736
|
+
sender: string;
|
|
1737
|
+
ahAddress?: string;
|
|
1738
|
+
};
|
|
1739
|
+
type TBuildDestInfoOptions<TApi, TRes, TSigner> = {
|
|
1740
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1741
|
+
origin: TSubstrateChain;
|
|
1742
|
+
destination: TChain;
|
|
1743
|
+
recipient: string;
|
|
1744
|
+
currency: WithAmount<TCurrencyCore>;
|
|
1745
|
+
originFee: bigint;
|
|
1746
|
+
isFeeAssetAh: boolean;
|
|
1747
|
+
destFeeDetail: TXcmFeeDetail;
|
|
1748
|
+
totalHopFee: bigint;
|
|
1749
|
+
bridgeFee?: bigint;
|
|
1750
|
+
};
|
|
1751
|
+
type TOriginFeeDetails = {
|
|
1752
|
+
sufficientForXCM: boolean;
|
|
1753
|
+
xcmFee: bigint;
|
|
1754
|
+
};
|
|
1755
|
+
type TGetTransferInfoOptionsBase<TRes> = {
|
|
1756
|
+
buildTx: TTxFactory<TRes>;
|
|
1757
|
+
origin: TSubstrateChain;
|
|
1758
|
+
destination: TChain;
|
|
1759
|
+
sender: string;
|
|
1760
|
+
ahAddress?: string;
|
|
1761
|
+
recipient: string;
|
|
1762
|
+
currency: WithAmount<TCurrencyCore>;
|
|
1763
|
+
version: Version | undefined;
|
|
1764
|
+
feeAsset?: TCurrencyCore;
|
|
1765
|
+
};
|
|
1766
|
+
type TGetTransferInfoOptions<TApi, TRes, TSigner> = WithApi<TGetTransferInfoOptionsBase<TRes>, TApi, TRes, TSigner>;
|
|
1767
|
+
|
|
1768
|
+
type TExchangeChain = (typeof EXCHANGE_CHAINS)[number];
|
|
1769
|
+
type TExchangeInput = TExchangeChain | TExchangeChain[] | undefined;
|
|
1770
|
+
type TSwapOptions<TApi, TRes, TSigner> = {
|
|
1771
|
+
currencyTo: TCurrencyCore;
|
|
1772
|
+
exchange?: TExchangeInput;
|
|
1773
|
+
slippage?: number;
|
|
1774
|
+
evmSenderAddress?: string;
|
|
1775
|
+
evmSigner?: TSigner;
|
|
1776
|
+
onStatusChange?: TStatusChangeCallback<TApi, TRes>;
|
|
1777
|
+
};
|
|
1778
|
+
type TTransactionContext<TApi, TRes> = {
|
|
1779
|
+
type: TTransactionType;
|
|
1780
|
+
api: TApi;
|
|
1781
|
+
chain: TSubstrateChain;
|
|
1782
|
+
tx: TRes;
|
|
1783
|
+
};
|
|
1784
|
+
type TTransactionType = 'TRANSFER' | 'SWAP' | 'SWAP_AND_TRANSFER';
|
|
1785
|
+
type TSwapEventType = TTransactionType | 'SELECTING_EXCHANGE' | 'COMPLETED';
|
|
1786
|
+
/**
|
|
1787
|
+
* The transaction progress information.
|
|
1788
|
+
*/
|
|
1789
|
+
type TSwapEvent<TApi, TRes> = {
|
|
1701
1790
|
/**
|
|
1702
|
-
*
|
|
1791
|
+
* Current execution phase type
|
|
1703
1792
|
*/
|
|
1704
|
-
|
|
1793
|
+
type: TSwapEventType;
|
|
1705
1794
|
/**
|
|
1706
|
-
*
|
|
1795
|
+
* Full transaction plan for visualization
|
|
1707
1796
|
*/
|
|
1708
|
-
|
|
1797
|
+
routerPlan?: TTransactionContext<TApi, TRes>[];
|
|
1709
1798
|
/**
|
|
1710
|
-
*
|
|
1799
|
+
* Current transaction's origin chain
|
|
1711
1800
|
*/
|
|
1712
|
-
|
|
1801
|
+
chain?: TSubstrateChain;
|
|
1713
1802
|
/**
|
|
1714
|
-
*
|
|
1803
|
+
* Current transaction's destination chain
|
|
1715
1804
|
*/
|
|
1716
|
-
|
|
1805
|
+
destinationChain?: TChain;
|
|
1717
1806
|
/**
|
|
1718
|
-
*
|
|
1807
|
+
* 0-based step index of current operation
|
|
1719
1808
|
*/
|
|
1720
|
-
|
|
1721
|
-
version: Version | undefined;
|
|
1722
|
-
buildTx: TTxFactory<TRes>;
|
|
1723
|
-
feeAsset?: TCurrencyInput;
|
|
1809
|
+
currentStep?: number;
|
|
1724
1810
|
};
|
|
1725
|
-
type
|
|
1811
|
+
type TStatusChangeCallback<TApi, TRes> = (info: TSwapEvent<TApi, TRes>) => void;
|
|
1812
|
+
interface TSwapBuilder<TApi, TRes, TSigner> {
|
|
1813
|
+
from(chain: TSubstrateChain | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1814
|
+
to(chain: TChain | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1815
|
+
exchange(chain: TExchangeInput): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1816
|
+
currencyFrom(currency: TCurrencyInput): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1817
|
+
currencyTo(currency: TCurrencyInput): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1818
|
+
feeAsset(currency: TCurrencyInput | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1819
|
+
amount(amount: TAmount): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1820
|
+
recipient(address: string | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1821
|
+
sender(address: string): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1822
|
+
signer(signer: TSigner): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1823
|
+
evmSenderAddress(address: string | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1824
|
+
evmSigner(signer: TSigner | undefined): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1825
|
+
slippagePct(pct: string): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1826
|
+
onStatusChange(callback: TStatusChangeCallback<TApi, TRes>): TSwapBuilder<TApi, TRes, TSigner>;
|
|
1827
|
+
getXcmFees<TDisableFallback extends boolean = false>(options?: TGetXcmFeeBuilderOptions & {
|
|
1828
|
+
disableFallback: TDisableFallback;
|
|
1829
|
+
}): Promise<TGetXcmFeeResult<TDisableFallback>>;
|
|
1830
|
+
getOriginXcmFee<TDisableFallback extends boolean = false>(options?: TGetXcmFeeBuilderOptions & {
|
|
1831
|
+
disableFallback: TDisableFallback;
|
|
1832
|
+
}): Promise<TXcmFeeDetailWithForwardedXcm<TDisableFallback>>;
|
|
1833
|
+
getSwapInfo(): Promise<TTransferInfo>;
|
|
1834
|
+
getTransferableAmount(): Promise<bigint>;
|
|
1835
|
+
getMinTransferableAmount(): Promise<bigint>;
|
|
1836
|
+
getBestAmountOut(): Promise<{
|
|
1837
|
+
exchange: TExchangeChain;
|
|
1838
|
+
amountOut: bigint;
|
|
1839
|
+
}>;
|
|
1840
|
+
dryRun(): Promise<TDryRunResult>;
|
|
1841
|
+
dryRunPreview(previewOptions?: TDryRunPreviewOptions): Promise<TDryRunResult>;
|
|
1842
|
+
build(): Promise<TTransactionContext<TApi, TRes>[]>;
|
|
1843
|
+
signAndSubmit(): Promise<string[]>;
|
|
1844
|
+
}
|
|
1845
|
+
type TSwapBuilderFactory = <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>) => TSwapBuilder<TApi, TRes, TSigner>;
|
|
1726
1846
|
|
|
1727
|
-
type
|
|
1728
|
-
|
|
1729
|
-
|
|
1847
|
+
type TPolkadotXCMTransferOptions<TApi, TRes, TSigner> = {
|
|
1848
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1849
|
+
chain: TSubstrateChain;
|
|
1850
|
+
beneficiaryLocation: TLocation;
|
|
1851
|
+
recipient: TAddress;
|
|
1852
|
+
asset: TAsset;
|
|
1853
|
+
overriddenAsset?: TLocation | TAssetWithFee[];
|
|
1854
|
+
scenario: TScenario;
|
|
1855
|
+
assetInfo: WithAmount<TAssetInfo>;
|
|
1730
1856
|
currency: TCurrencyInputWithAmount;
|
|
1731
|
-
|
|
1857
|
+
feeAssetInfo?: TAssetInfo;
|
|
1858
|
+
feeCurrency?: TCurrencyInput;
|
|
1859
|
+
destination: TDestination;
|
|
1860
|
+
destChain?: TChain;
|
|
1861
|
+
paraIdTo?: number;
|
|
1862
|
+
version: Version;
|
|
1863
|
+
sender?: string;
|
|
1732
1864
|
ahAddress?: string;
|
|
1733
|
-
|
|
1865
|
+
pallet?: string;
|
|
1866
|
+
method?: string;
|
|
1867
|
+
transactOptions?: TTransactOptions<TRes>;
|
|
1734
1868
|
};
|
|
1735
|
-
type
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1869
|
+
type TXTokensTransferOptions<TApi, TRes, TSigner> = {
|
|
1870
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1871
|
+
asset: WithAmount<TAssetInfo>;
|
|
1872
|
+
recipient: TAddress;
|
|
1873
|
+
scenario: TScenario;
|
|
1874
|
+
origin: TSubstrateChain;
|
|
1875
|
+
destination: TDestination;
|
|
1876
|
+
paraIdTo?: number;
|
|
1877
|
+
version: Version;
|
|
1878
|
+
overriddenAsset?: TLocation | TAssetWithFee[];
|
|
1879
|
+
pallet?: string;
|
|
1880
|
+
method?: string;
|
|
1881
|
+
useMultiAssetTransfer?: boolean;
|
|
1882
|
+
};
|
|
1883
|
+
interface IPolkadotXCMTransfer<TApi, TRes, TSigner> {
|
|
1884
|
+
transferPolkadotXCM: (input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
|
|
1885
|
+
}
|
|
1886
|
+
interface IXTokensTransfer<TApi, TRes, TSigner> {
|
|
1887
|
+
transferXTokens: (input: TXTokensTransferOptions<TApi, TRes, TSigner>) => TRes;
|
|
1888
|
+
}
|
|
1889
|
+
type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
|
|
1890
|
+
type TAddress = string | TLocation;
|
|
1891
|
+
type TDestination = TChain | TLocation;
|
|
1892
|
+
type TTransferBaseOptions<TApi, TRes, TSigner> = {
|
|
1740
1893
|
/**
|
|
1741
|
-
*
|
|
1894
|
+
* The origin chain
|
|
1742
1895
|
*/
|
|
1743
|
-
|
|
1896
|
+
from: TChain;
|
|
1744
1897
|
/**
|
|
1745
|
-
*
|
|
1898
|
+
* The destination address. A SS58 or H160 format.
|
|
1746
1899
|
*/
|
|
1747
|
-
|
|
1748
|
-
}
|
|
1749
|
-
/**
|
|
1750
|
-
* The options for the batch builder.
|
|
1751
|
-
*/
|
|
1752
|
-
type TBatchOptions = {
|
|
1900
|
+
recipient: TAddress;
|
|
1753
1901
|
/**
|
|
1754
|
-
* The
|
|
1755
|
-
* `BATCH_ALL` - does not commit if one of the calls in the batch fails.
|
|
1756
|
-
* `BATCH` - commits each successful call regardless if a call fails.
|
|
1902
|
+
* The optional sender address. A SS58 or H160 format.
|
|
1757
1903
|
*/
|
|
1758
|
-
|
|
1759
|
-
};
|
|
1760
|
-
type TDryRunPreviewOptions = {
|
|
1761
|
-
mintFeeAssets?: boolean;
|
|
1762
|
-
};
|
|
1763
|
-
type TBuilderOptions<TApi> = TApi | TBuilderConfig<TApi>;
|
|
1764
|
-
type TBuilderConfig<TApi> = Partial<{
|
|
1765
|
-
apiOverrides: Partial<Record<TChain, TApi>>;
|
|
1766
|
-
development: boolean;
|
|
1767
|
-
abstractDecimals: boolean;
|
|
1768
|
-
xcmFormatCheck: boolean;
|
|
1769
|
-
}>;
|
|
1770
|
-
type TCreateTxsOptions<TApi, TRes, TSigner> = Pick<TTransferOptions<TApi, TRes, TSigner>, 'api' | 'from' | 'to' | 'currency'>;
|
|
1771
|
-
type TBatchedTransferOptions<TApi, TRes, TSigner> = Omit<TSubstrateTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'> & {
|
|
1772
|
-
builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptions<TApi, TRes, TSigner> & TBuilderInternalOptions<TSigner>>;
|
|
1773
|
-
};
|
|
1774
|
-
type TBuildInternalResBase<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = {
|
|
1775
|
-
options: TTransferOptions<TApi, TRes, TSigner> & TOptions;
|
|
1776
|
-
};
|
|
1777
|
-
type TBuildInternalRes<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = TBuildInternalResBase<TApi, TRes, TSigner, TOptions> & {
|
|
1778
|
-
tx: TRes;
|
|
1779
|
-
};
|
|
1780
|
-
type TBuildAllInternalRes<TApi, TRes, TSigner, TOptions extends TTransferBaseOptions<TApi, TRes, TSigner> = TTransferBaseOptions<TApi, TRes, TSigner>> = TBuildInternalResBase<TApi, TRes, TSigner, TOptions> & {
|
|
1781
|
-
txContexts: TTransactionContext<TApi, TRes>[];
|
|
1782
|
-
};
|
|
1783
|
-
type TSender<TSigner> = string | TSigner;
|
|
1784
|
-
type TBuilderInternalOptions<TSigner> = {
|
|
1785
|
-
senderSource?: TSender<TSigner> | WalletClient;
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
|
-
type TProviderEntry = {
|
|
1789
|
-
name: string;
|
|
1790
|
-
endpoint: string;
|
|
1791
|
-
};
|
|
1792
|
-
type TChainConfig = {
|
|
1793
|
-
name: string;
|
|
1794
|
-
info: string;
|
|
1795
|
-
paraId: number;
|
|
1796
|
-
providers: TProviderEntry[];
|
|
1797
|
-
};
|
|
1798
|
-
type TChainConfigMap = Record<TSubstrateChain, TChainConfig>;
|
|
1799
|
-
|
|
1800
|
-
type OneKey<K extends string, V = unknown> = {
|
|
1801
|
-
[P in K]: Record<P, V> & Partial<Record<Exclude<K, P>, never>> extends infer O ? {
|
|
1802
|
-
[Q in keyof O]: O[Q];
|
|
1803
|
-
} : never;
|
|
1804
|
-
}[K];
|
|
1805
|
-
type TXcmVersioned<T> = OneKey<Version, T>;
|
|
1806
|
-
type TXcmForeignAsset = {
|
|
1807
|
-
ForeignAsset: string | number | bigint | undefined;
|
|
1808
|
-
};
|
|
1809
|
-
type TForeignAssetId = {
|
|
1810
|
-
ForeignAssetId: bigint | undefined;
|
|
1811
|
-
};
|
|
1812
|
-
type TForeignOrTokenAsset = TXcmForeignAsset | {
|
|
1813
|
-
Token: string | undefined;
|
|
1814
|
-
};
|
|
1815
|
-
type TForeignOrNativeAsset = TXcmForeignAsset | 'Native';
|
|
1816
|
-
type TXcmAsset = {
|
|
1817
|
-
XCM: number | undefined;
|
|
1818
|
-
} | {
|
|
1819
|
-
Native: null;
|
|
1820
|
-
};
|
|
1821
|
-
type TNativeTokenAsset = 'NativeToken';
|
|
1822
|
-
type TZeitgeistAsset = 'Ztg';
|
|
1823
|
-
type TOtherReserveAsset = {
|
|
1824
|
-
OtherReserve: string | bigint | undefined;
|
|
1825
|
-
};
|
|
1826
|
-
type TSelfReserveAsset = 'SelfReserve';
|
|
1827
|
-
type TReserveAsset = TOtherReserveAsset | TSelfReserveAsset;
|
|
1828
|
-
type TBifrostToken = {
|
|
1829
|
-
Native: string | number;
|
|
1830
|
-
} | {
|
|
1831
|
-
VToken: string;
|
|
1832
|
-
} | {
|
|
1833
|
-
Token: string;
|
|
1834
|
-
} | {
|
|
1835
|
-
VSToken2: number;
|
|
1836
|
-
} | {
|
|
1837
|
-
VToken2: number;
|
|
1838
|
-
} | {
|
|
1839
|
-
Token2: number;
|
|
1840
|
-
};
|
|
1841
|
-
type TXTokensCurrencySelection = TXcmVersioned<TLocation | TAsset | TAsset[]> | TXcmForeignAsset | TForeignAssetId | TForeignOrTokenAsset | TXcmAsset | TOtherReserveAsset | TBifrostToken | string | bigint | number | undefined;
|
|
1842
|
-
|
|
1843
|
-
declare class AmountTooLowError extends Error {
|
|
1844
|
-
constructor(message?: string);
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
/**
|
|
1848
|
-
* Error thrown when an API operation is attempted before the API has been initialized.
|
|
1849
|
-
*/
|
|
1850
|
-
declare class ApiNotInitializedError extends Error {
|
|
1851
|
-
constructor();
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
/**
|
|
1855
|
-
* Error thrown when a batch operation is invalid or cannot be executed.
|
|
1856
|
-
*/
|
|
1857
|
-
declare class BatchValidationError extends Error {
|
|
1858
|
-
constructor(message: string);
|
|
1859
|
-
}
|
|
1860
|
-
|
|
1861
|
-
/**
|
|
1862
|
-
* Error thrown when the Ethereum bridge is halted.
|
|
1863
|
-
*/
|
|
1864
|
-
declare class BridgeHaltedError extends Error {
|
|
1904
|
+
sender?: string;
|
|
1865
1905
|
/**
|
|
1866
|
-
*
|
|
1867
|
-
|
|
1868
|
-
|
|
1906
|
+
* The optional asset hub address. A SS58 format only.
|
|
1907
|
+
*/
|
|
1908
|
+
ahAddress?: string;
|
|
1909
|
+
/**
|
|
1910
|
+
* The destination chain or XCM location
|
|
1911
|
+
*/
|
|
1912
|
+
to: TDestination;
|
|
1913
|
+
/**
|
|
1914
|
+
* The currency to transfer. Either ID, symbol, location, or multi-asset
|
|
1915
|
+
*/
|
|
1916
|
+
currency: TCurrencyInputWithAmount;
|
|
1917
|
+
/**
|
|
1918
|
+
* The optional fee asset. Either ID, symbol, or location
|
|
1919
|
+
*/
|
|
1920
|
+
feeAsset?: TCurrencyInput;
|
|
1921
|
+
/**
|
|
1922
|
+
* The optional destination parachain ID
|
|
1923
|
+
*/
|
|
1924
|
+
paraIdTo?: number;
|
|
1925
|
+
/**
|
|
1926
|
+
* The optional overrided XCM version
|
|
1927
|
+
*/
|
|
1928
|
+
version?: Version;
|
|
1929
|
+
/**
|
|
1930
|
+
* The optional pallet override
|
|
1869
1931
|
*/
|
|
1870
|
-
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* Error thrown when the Dry Run fails.
|
|
1875
|
-
*/
|
|
1876
|
-
declare class DryRunFailedError extends Error {
|
|
1877
|
-
readonly reason: string;
|
|
1878
|
-
readonly dryRunType?: TChainEndpoint;
|
|
1932
|
+
pallet?: string;
|
|
1879
1933
|
/**
|
|
1880
|
-
*
|
|
1881
|
-
*
|
|
1882
|
-
* @param reason - The reason why the dry run failed.
|
|
1883
|
-
* @param dryRunType - Optional. Specifies if the error is related to the 'origin' or 'destination' dry run.
|
|
1934
|
+
* Whether to keep the account alive after the transfer.
|
|
1884
1935
|
*/
|
|
1885
|
-
|
|
1886
|
-
}
|
|
1887
|
-
|
|
1888
|
-
/**
|
|
1889
|
-
* Error thrown when an extension is not installed.
|
|
1890
|
-
*/
|
|
1891
|
-
declare class ExtensionNotInstalledError extends Error {
|
|
1936
|
+
keepAlive?: boolean;
|
|
1892
1937
|
/**
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
1895
|
-
* @param message - The error message.
|
|
1938
|
+
* The optional pallet method override
|
|
1896
1939
|
*/
|
|
1897
|
-
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
|
-
/**
|
|
1901
|
-
* Error thrown when a feature or route is temporarily disabled via configuration or governance.
|
|
1902
|
-
*/
|
|
1903
|
-
declare class FeatureTemporarilyDisabledError extends Error {
|
|
1904
|
-
constructor(message: string);
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
/**
|
|
1908
|
-
* Error thrown when an invalid address is provided.
|
|
1909
|
-
*/
|
|
1910
|
-
declare class InvalidAddressError extends Error {
|
|
1940
|
+
method?: string;
|
|
1911
1941
|
/**
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
1914
|
-
* @param message - The error message.
|
|
1942
|
+
* Hex of the encoded transaction call to apply on the destination chain
|
|
1915
1943
|
*/
|
|
1916
|
-
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
/**
|
|
1920
|
-
* Error development mode is on and no API override is provided for a specific chain.
|
|
1921
|
-
*/
|
|
1922
|
-
declare class MissingChainApiError extends Error {
|
|
1944
|
+
transactOptions?: TTransactOptions<TRes>;
|
|
1923
1945
|
/**
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
* @param chain - The chain for which the API is missing.
|
|
1946
|
+
* The optional swap options
|
|
1927
1947
|
*/
|
|
1928
|
-
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
/**
|
|
1932
|
-
* Error thrown when a required parameter is missing.
|
|
1933
|
-
*/
|
|
1934
|
-
declare class MissingParameterError extends Error {
|
|
1935
|
-
constructor(parameter: string | string[], message?: string);
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1948
|
+
swapOptions?: TSwapOptions<TApi, TRes, TSigner>;
|
|
1949
|
+
};
|
|
1938
1950
|
/**
|
|
1939
|
-
*
|
|
1951
|
+
* Options for transferring from a parachain to another parachain or relay chain
|
|
1940
1952
|
*/
|
|
1941
|
-
|
|
1953
|
+
type TTransferOptions<TApi, TRes, TSigner> = WithApi<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner> & {
|
|
1954
|
+
isAmountAll: boolean;
|
|
1955
|
+
};
|
|
1956
|
+
type TSubstrateTransferBaseOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from'> & {
|
|
1957
|
+
from: TSubstrateChain;
|
|
1958
|
+
};
|
|
1959
|
+
type TSubstrateTransferOptions<TApi, TRes, TSigner> = Omit<TTransferOptions<TApi, TRes, TSigner>, 'from'> & {
|
|
1960
|
+
from: TSubstrateChain;
|
|
1961
|
+
};
|
|
1962
|
+
type WithRequiredSender<TBase> = Omit<TBase, 'sender'> & {
|
|
1942
1963
|
/**
|
|
1943
|
-
*
|
|
1944
|
-
*
|
|
1945
|
-
* @param chain - The chain for which XCM support is not implemented.
|
|
1964
|
+
* The sender address. A SS58 or H160 format.
|
|
1946
1965
|
*/
|
|
1947
|
-
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1966
|
+
sender: string;
|
|
1967
|
+
};
|
|
1968
|
+
type WithRequiredSwapOptions<TBase, TApi, TRes, TSigner> = Omit<TBase, 'swapOptions'> & {
|
|
1969
|
+
swapOptions: TSwapOptions<TApi, TRes, TSigner>;
|
|
1970
|
+
};
|
|
1971
|
+
type TTransferOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<Omit<TSubstrateTransferOptions<TApi, TRes, TSigner>, 'isAmountAll'>, TApi, TRes, TSigner>;
|
|
1972
|
+
type TTransferBaseOptionsWithSwap<TApi, TRes, TSigner> = WithRequiredSwapOptions<TTransferBaseOptions<TApi, TRes, TSigner>, TApi, TRes, TSigner>;
|
|
1973
|
+
type TTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TTransferBaseOptions<TApi, TRes, TSigner>>;
|
|
1974
|
+
type TSubstrateTransferBaseOptionsWithSender<TApi, TRes, TSigner> = WithRequiredSender<TSubstrateTransferBaseOptions<TApi, TRes, TSigner>>;
|
|
1975
|
+
type TTransferInternalOptions<TApi, TRes, TSigner> = Omit<TTransferBaseOptions<TApi, TRes, TSigner>, 'from' | 'feeAsset' | 'version'> & {
|
|
1976
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
1977
|
+
assetInfo: WithAmount<TAssetInfo>;
|
|
1978
|
+
feeAsset?: TAssetInfo;
|
|
1979
|
+
feeCurrency?: TCurrencyInput;
|
|
1980
|
+
overriddenAsset?: TLocation | TAssetWithFee[];
|
|
1981
|
+
version: Version;
|
|
1982
|
+
isAmountAll: boolean;
|
|
1983
|
+
};
|
|
1984
|
+
type TTransactOrigin = (typeof TRANSACT_ORIGINS)[number];
|
|
1985
|
+
type TTransactOptions<TRes, TWeightType = bigint> = {
|
|
1986
|
+
call: string | TRes;
|
|
1987
|
+
originKind?: TTransactOrigin;
|
|
1988
|
+
maxWeight?: TWeight<TWeightType>;
|
|
1989
|
+
};
|
|
1990
|
+
type TSerializedExtrinsics = {
|
|
1991
|
+
module: TPallet;
|
|
1992
|
+
method: string;
|
|
1993
|
+
params: Record<string, unknown>;
|
|
1994
|
+
};
|
|
1995
|
+
type TSerializedStateQuery = {
|
|
1996
|
+
module: TAssetsPallet;
|
|
1997
|
+
method: string;
|
|
1998
|
+
params: unknown[];
|
|
1999
|
+
};
|
|
2000
|
+
type TSerializedRuntimeApiQuery = {
|
|
2001
|
+
module: string;
|
|
2002
|
+
method: string;
|
|
2003
|
+
params: unknown[];
|
|
2004
|
+
};
|
|
2005
|
+
type TDestWeight = {
|
|
2006
|
+
ref_time: bigint;
|
|
2007
|
+
proof_size: bigint;
|
|
2008
|
+
};
|
|
2009
|
+
type TXTokensMethod = 'transfer' | 'transfer_multiasset' | 'transfer_multiassets';
|
|
2010
|
+
type TPolkadotXcmMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'reserve_transfer_assets' | 'reserve_withdraw_assets' | 'transfer_assets' | 'transfer_assets_using_type_and_then';
|
|
2011
|
+
type TXcmPalletMethod = 'limited_teleport_assets' | 'limited_reserve_transfer_assets' | 'transfer_assets_using_type_and_then';
|
|
2012
|
+
type TWeight<TWeightType = bigint> = {
|
|
2013
|
+
refTime: TWeightType;
|
|
2014
|
+
proofSize: TWeightType;
|
|
2015
|
+
};
|
|
2016
|
+
type TCreateBeneficiaryOptions<TApi, TRes, TSigner> = {
|
|
2017
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
2018
|
+
address: TAddress;
|
|
2019
|
+
version: Version;
|
|
2020
|
+
};
|
|
2021
|
+
type TCreateBeneficiaryXTokensOptions<TApi, TRes, TSigner> = {
|
|
2022
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
2023
|
+
origin: TSubstrateChain;
|
|
2024
|
+
destination: TDestination;
|
|
2025
|
+
recipient: TAddress;
|
|
2026
|
+
version: Version;
|
|
2027
|
+
paraId?: number;
|
|
2028
|
+
};
|
|
2029
|
+
type TBridgeStatus = 'Normal' | 'Halted';
|
|
2030
|
+
type TTransferLocalOptions<TApi, TRes, TSigner> = Omit<TTransferInternalOptions<TApi, TRes, TSigner>, 'recipient'> & {
|
|
2031
|
+
recipient: string;
|
|
2032
|
+
balance: bigint;
|
|
2033
|
+
};
|
|
2034
|
+
type TTransferFeeEstimates = {
|
|
2035
|
+
originFee: bigint;
|
|
2036
|
+
reserveFee: bigint;
|
|
2037
|
+
};
|
|
2038
|
+
type TCreateBaseTransferXcmOptions<TRes> = {
|
|
2039
|
+
chain: TSubstrateChain;
|
|
2040
|
+
destChain: TChain;
|
|
2041
|
+
assetInfo: WithAmount<TAssetInfo>;
|
|
2042
|
+
feeAssetInfo?: TAssetInfo;
|
|
2043
|
+
fees: TTransferFeeEstimates;
|
|
2044
|
+
recipient: string;
|
|
2045
|
+
sender?: string;
|
|
2046
|
+
version: Version;
|
|
2047
|
+
useJitWithdraw?: boolean;
|
|
2048
|
+
useFeeAssetOnHops?: boolean;
|
|
2049
|
+
forceBuyExecution?: boolean;
|
|
2050
|
+
paraIdTo?: number;
|
|
2051
|
+
transactOptions?: TTransactOptions<TRes>;
|
|
2052
|
+
};
|
|
2053
|
+
type TCreateTransferXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseTransferXcmOptions<TRes>, TApi, TRes, TSigner>;
|
|
2054
|
+
type TCreateBaseSwapXcmOptions = {
|
|
2055
|
+
chain?: TSubstrateChain;
|
|
2056
|
+
exchangeChain: TExchangeChain;
|
|
2057
|
+
destChain?: TChain;
|
|
2058
|
+
assetInfoFrom: WithAmount<TAssetInfo>;
|
|
2059
|
+
assetInfoTo: WithAmount<TAssetInfo>;
|
|
2060
|
+
currencyTo: TCurrencyInput;
|
|
2061
|
+
feeAssetInfo?: TAssetInfo;
|
|
2062
|
+
sender: string;
|
|
2063
|
+
recipient: string;
|
|
2064
|
+
calculateMinAmountOut: (amountIn: bigint, assetTo?: TAssetInfo) => Promise<bigint>;
|
|
2065
|
+
};
|
|
2066
|
+
type TCreateSwapXcmOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner>;
|
|
2067
|
+
type TSwapFeeEstimates = {
|
|
2068
|
+
originFee: bigint;
|
|
2069
|
+
originReserveFee: bigint;
|
|
2070
|
+
exchangeFee: bigint;
|
|
2071
|
+
destReserveFee: bigint;
|
|
2072
|
+
};
|
|
2073
|
+
type TCreateSwapXcmInternalOptions<TApi, TRes, TSigner> = WithApi<TCreateBaseSwapXcmOptions, TApi, TRes, TSigner> & {
|
|
2074
|
+
version: Version;
|
|
2075
|
+
fees: TSwapFeeEstimates;
|
|
2076
|
+
paraIdTo?: number;
|
|
2077
|
+
};
|
|
2078
|
+
type TCreateEthBridgeInstructionsOptions<TApi, TRes, TSigner> = {
|
|
2079
|
+
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
2080
|
+
recipient: TAddress;
|
|
2081
|
+
assetInfo: TAssetInfo;
|
|
2082
|
+
sender: string;
|
|
2083
|
+
ahAddress?: string;
|
|
2084
|
+
version: Version;
|
|
2085
|
+
};
|
|
1984
2086
|
|
|
1985
|
-
/**
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2087
|
+
/** @deprecated Asset claim functionality is deprecated and will be removed in v14. */
|
|
2088
|
+
type TAssetClaimOptionsBase = {
|
|
2089
|
+
chain: TSubstrateChain;
|
|
2090
|
+
currency: WithComplexAmount<TCurrencyCore> | TAsset<TAmount>[] | WithComplexAmount<TCurrencyCore>[];
|
|
2091
|
+
address: TAddress;
|
|
2092
|
+
version?: Version;
|
|
2093
|
+
};
|
|
2094
|
+
type TAssetClaimOptions<TApi, TRes, TSigner> = WithApi<TAssetClaimOptionsBase, TApi, TRes, TSigner>;
|
|
2095
|
+
type TAssetClaimInternalOptions<TApi, TRes, TSigner> = TAssetClaimOptions<TApi, TRes, TSigner> & {
|
|
2096
|
+
version: Version;
|
|
2097
|
+
assets: TAsset<bigint>[];
|
|
2098
|
+
};
|
|
1991
2099
|
|
|
1992
|
-
type
|
|
1993
|
-
|
|
1994
|
-
|
|
2100
|
+
type TSetBalanceRes = {
|
|
2101
|
+
assetStatusTx?: TSerializedExtrinsics;
|
|
2102
|
+
balanceTx: TSerializedExtrinsics;
|
|
1995
2103
|
};
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
constructor({ chain, scenario }: TScenarioNotSupportedContext);
|
|
2104
|
+
declare abstract class BaseAssetsPallet {
|
|
2105
|
+
protected palletName: TAssetsPallet;
|
|
2106
|
+
constructor(palletName: TAssetsPallet);
|
|
2107
|
+
abstract mint<TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, assetInfo: WithAmount<TAssetInfo>, balance: bigint, chain: TSubstrateChain): Promise<TSetBalanceRes>;
|
|
2108
|
+
abstract getBalance<TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, address: string, asset: TAssetInfo, customCurrencyId?: unknown): Promise<bigint>;
|
|
2002
2109
|
}
|
|
2003
2110
|
|
|
2004
|
-
|
|
2005
|
-
* Error thrown when a submitted transaction encounters a dispatch error on-chain.
|
|
2006
|
-
*/
|
|
2007
|
-
declare class SubmitTransactionError extends Error {
|
|
2111
|
+
type TGetBalanceCommonOptions = {
|
|
2008
2112
|
/**
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
* @param message - The dispatch error details.
|
|
2113
|
+
* The address of the account.
|
|
2012
2114
|
*/
|
|
2013
|
-
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
declare class TransferToAhNotSupported extends Error {
|
|
2017
|
-
constructor(message?: string);
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
declare class TypeAndThenUnavailableError extends Error {
|
|
2021
|
-
constructor(message: string);
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
/**
|
|
2025
|
-
* UnableToComputeError is thrown when a computation cannot be performed.
|
|
2026
|
-
*/
|
|
2027
|
-
declare class UnableToComputeError extends Error {
|
|
2115
|
+
address: string;
|
|
2028
2116
|
/**
|
|
2029
|
-
*
|
|
2030
|
-
*
|
|
2031
|
-
* @param message - Required error message.
|
|
2117
|
+
* The chain on which to query the balance.
|
|
2032
2118
|
*/
|
|
2033
|
-
constructor(message: string);
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
/**
|
|
2037
|
-
* Error thrown when an operation or parameter combination is not supported.
|
|
2038
|
-
*/
|
|
2039
|
-
declare class UnsupportedOperationError extends Error {
|
|
2040
|
-
constructor(message: string);
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
/**
|
|
2044
|
-
* Thrown when a validation check fails.
|
|
2045
|
-
*/
|
|
2046
|
-
declare class ValidationError extends Error {
|
|
2047
|
-
constructor(message: string);
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
type THopTransferInfo = {
|
|
2051
2119
|
chain: TChain;
|
|
2052
|
-
result: {
|
|
2053
|
-
xcmFee: TXcmFeeBase;
|
|
2054
|
-
asset: TAssetInfo;
|
|
2055
|
-
};
|
|
2056
2120
|
};
|
|
2057
|
-
|
|
2058
|
-
|
|
2121
|
+
/**
|
|
2122
|
+
* Retrieves the asset balance for a given account on a specified chain.
|
|
2123
|
+
*/
|
|
2124
|
+
type TGetAssetBalanceOptionsBase = TGetBalanceCommonOptions & {
|
|
2125
|
+
/**
|
|
2126
|
+
* The resolved asset to query balance for.
|
|
2127
|
+
*/
|
|
2059
2128
|
asset: TAssetInfo;
|
|
2060
2129
|
};
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
sufficient: boolean;
|
|
2070
|
-
balance: bigint;
|
|
2071
|
-
balanceAfter: bigint;
|
|
2072
|
-
asset: TAssetInfo;
|
|
2073
|
-
};
|
|
2074
|
-
xcmFee: TXcmFeeBase & {
|
|
2075
|
-
sufficient: boolean;
|
|
2076
|
-
balance: bigint;
|
|
2077
|
-
balanceAfter: bigint;
|
|
2078
|
-
};
|
|
2079
|
-
};
|
|
2080
|
-
hops: THopTransferInfo[];
|
|
2081
|
-
destination: {
|
|
2082
|
-
receivedCurrency: {
|
|
2083
|
-
sufficient: boolean | UnableToComputeError;
|
|
2084
|
-
receivedAmount: bigint | UnableToComputeError;
|
|
2085
|
-
balance: bigint;
|
|
2086
|
-
balanceAfter: bigint | UnableToComputeError;
|
|
2087
|
-
asset: TAssetInfo;
|
|
2088
|
-
};
|
|
2089
|
-
xcmFee: TXcmFeeBase & {
|
|
2090
|
-
balanceAfter: bigint | UnableToComputeError;
|
|
2091
|
-
};
|
|
2092
|
-
};
|
|
2130
|
+
/**
|
|
2131
|
+
* Retrieves the currency balance for a given account on a specified chain.
|
|
2132
|
+
*/
|
|
2133
|
+
type TGetBalanceOptionsBase = TGetBalanceCommonOptions & {
|
|
2134
|
+
/**
|
|
2135
|
+
* The currency to query.
|
|
2136
|
+
*/
|
|
2137
|
+
currency?: TCurrencyCore;
|
|
2093
2138
|
};
|
|
2094
|
-
type
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
asset: TAssetInfo;
|
|
2139
|
+
type TGetBalanceOptions<TApi, TRes, TSigner> = WithApi<TGetBalanceOptionsBase, TApi, TRes, TSigner>;
|
|
2140
|
+
type TGetAssetBalanceOptions<TApi, TRes, TSigner> = WithApi<TGetAssetBalanceOptionsBase, TApi, TRes, TSigner>;
|
|
2141
|
+
type TGetTransferableAmountOptionsBase<TRes> = {
|
|
2142
|
+
/**
|
|
2143
|
+
* The sender address of the account.
|
|
2144
|
+
*/
|
|
2101
2145
|
sender: string;
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
2146
|
+
/**
|
|
2147
|
+
* The chain on which to query the balance.
|
|
2148
|
+
*/
|
|
2106
2149
|
origin: TSubstrateChain;
|
|
2150
|
+
/**
|
|
2151
|
+
* The destination chain.
|
|
2152
|
+
*/
|
|
2107
2153
|
destination: TChain;
|
|
2108
|
-
|
|
2154
|
+
/**
|
|
2155
|
+
* The currency to query.
|
|
2156
|
+
*/
|
|
2109
2157
|
currency: WithAmount<TCurrencyCore>;
|
|
2110
|
-
|
|
2111
|
-
isFeeAssetAh: boolean;
|
|
2112
|
-
destFeeDetail: TXcmFeeDetail;
|
|
2113
|
-
totalHopFee: bigint;
|
|
2114
|
-
bridgeFee?: bigint;
|
|
2115
|
-
};
|
|
2116
|
-
type TOriginFeeDetails = {
|
|
2117
|
-
sufficientForXCM: boolean;
|
|
2118
|
-
xcmFee: bigint;
|
|
2119
|
-
};
|
|
2120
|
-
type TGetTransferInfoOptionsBase<TRes> = {
|
|
2158
|
+
version: Version | undefined;
|
|
2121
2159
|
buildTx: TTxFactory<TRes>;
|
|
2160
|
+
feeAsset?: TCurrencyInput;
|
|
2161
|
+
};
|
|
2162
|
+
type TGetTransferableAmountOptions<TApi, TRes, TSigner> = WithApi<TGetTransferableAmountOptionsBase<TRes>, TApi, TRes, TSigner>;
|
|
2163
|
+
type TGetMinTransferableAmountOptions<TApi, TRes, TSigner> = WithApi<TGetTransferableAmountOptionsBase<TRes> & {
|
|
2164
|
+
recipient: string;
|
|
2165
|
+
builder: GeneralBuilder<TApi, TRes, TSigner, TTransferBaseOptionsWithSender<TApi, TRes, TSigner>>;
|
|
2166
|
+
}, TApi, TRes, TSigner>;
|
|
2167
|
+
type TVerifyEdOnDestinationOptionsBase<TRes> = {
|
|
2168
|
+
/**
|
|
2169
|
+
* The origin chain.
|
|
2170
|
+
*/
|
|
2122
2171
|
origin: TSubstrateChain;
|
|
2172
|
+
/**
|
|
2173
|
+
* The destination chain.
|
|
2174
|
+
*/
|
|
2123
2175
|
destination: TChain;
|
|
2124
|
-
|
|
2125
|
-
|
|
2176
|
+
/**
|
|
2177
|
+
* The address of the account.
|
|
2178
|
+
*/
|
|
2126
2179
|
recipient: string;
|
|
2180
|
+
/**
|
|
2181
|
+
* The account of the sender.
|
|
2182
|
+
*/
|
|
2183
|
+
sender: string;
|
|
2184
|
+
/**
|
|
2185
|
+
* The currency to query.
|
|
2186
|
+
*/
|
|
2127
2187
|
currency: WithAmount<TCurrencyCore>;
|
|
2128
2188
|
version: Version | undefined;
|
|
2129
|
-
|
|
2189
|
+
buildTx: TTxFactory<TRes>;
|
|
2190
|
+
feeAsset?: TCurrencyInput;
|
|
2130
2191
|
};
|
|
2131
|
-
type
|
|
2192
|
+
type TVerifyEdOnDestinationOptions<TApi, TRes, TSigner> = WithApi<TVerifyEdOnDestinationOptionsBase<TRes>, TApi, TRes, TSigner>;
|
|
2193
|
+
|
|
2194
|
+
type OneKey<K extends string, V = unknown> = {
|
|
2195
|
+
[P in K]: Record<P, V> & Partial<Record<Exclude<K, P>, never>> extends infer O ? {
|
|
2196
|
+
[Q in keyof O]: O[Q];
|
|
2197
|
+
} : never;
|
|
2198
|
+
}[K];
|
|
2199
|
+
type TXcmVersioned<T> = OneKey<Version, T>;
|
|
2200
|
+
type TXcmForeignAsset = {
|
|
2201
|
+
ForeignAsset: string | number | bigint | undefined;
|
|
2202
|
+
};
|
|
2203
|
+
type TForeignAssetId = {
|
|
2204
|
+
ForeignAssetId: bigint | undefined;
|
|
2205
|
+
};
|
|
2206
|
+
type TForeignOrTokenAsset = TXcmForeignAsset | {
|
|
2207
|
+
Token: string | undefined;
|
|
2208
|
+
};
|
|
2209
|
+
type TForeignOrNativeAsset = TXcmForeignAsset | 'Native';
|
|
2210
|
+
type TXcmAsset = {
|
|
2211
|
+
XCM: number | undefined;
|
|
2212
|
+
} | {
|
|
2213
|
+
Native: null;
|
|
2214
|
+
};
|
|
2215
|
+
type TNativeTokenAsset = 'NativeToken';
|
|
2216
|
+
type TZeitgeistAsset = 'Ztg';
|
|
2217
|
+
type TOtherReserveAsset = {
|
|
2218
|
+
OtherReserve: string | bigint | undefined;
|
|
2219
|
+
};
|
|
2220
|
+
type TSelfReserveAsset = 'SelfReserve';
|
|
2221
|
+
type TReserveAsset = TOtherReserveAsset | TSelfReserveAsset;
|
|
2222
|
+
type TBifrostToken = {
|
|
2223
|
+
Native: string | number;
|
|
2224
|
+
} | {
|
|
2225
|
+
VToken: string;
|
|
2226
|
+
} | {
|
|
2227
|
+
Token: string;
|
|
2228
|
+
} | {
|
|
2229
|
+
VSToken2: number;
|
|
2230
|
+
} | {
|
|
2231
|
+
VToken2: number;
|
|
2232
|
+
} | {
|
|
2233
|
+
Token2: number;
|
|
2234
|
+
};
|
|
2235
|
+
type TXTokensCurrencySelection = TXcmVersioned<TLocation | TAsset | TAsset[]> | TXcmForeignAsset | TForeignAssetId | TForeignOrTokenAsset | TXcmAsset | TOtherReserveAsset | TBifrostToken | string | bigint | number | undefined;
|
|
2132
2236
|
|
|
2133
2237
|
type TChainWithApi<TApi, TRes, TSigner, T = TSubstrateChain> = {
|
|
2134
2238
|
api: PolkadotApi<TApi, TRes, TSigner>;
|
|
@@ -2136,13 +2240,14 @@ type TChainWithApi<TApi, TRes, TSigner, T = TSubstrateChain> = {
|
|
|
2136
2240
|
};
|
|
2137
2241
|
type TTypeAndThenCallContext<TApi, TRes, TSigner> = {
|
|
2138
2242
|
origin: TChainWithApi<TApi, TRes, TSigner>;
|
|
2139
|
-
dest: TChainWithApi<TApi, TRes, TSigner>;
|
|
2243
|
+
dest: TChainWithApi<TApi, TRes, TSigner, TChain>;
|
|
2140
2244
|
reserve: TChainWithApi<TApi, TRes, TSigner, TChain>;
|
|
2141
2245
|
isSubBridge: boolean;
|
|
2142
2246
|
isSnowbridge: boolean;
|
|
2143
2247
|
isRelayAsset: boolean;
|
|
2144
2248
|
assetInfo: WithAmount<TAssetInfo>;
|
|
2145
2249
|
systemAsset: TAssetInfo;
|
|
2250
|
+
bridgeHopChain?: TSubstrateChain;
|
|
2146
2251
|
options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>;
|
|
2147
2252
|
};
|
|
2148
2253
|
type TTypeAndThenFees = {
|
|
@@ -2176,17 +2281,24 @@ declare const getEthErc20Balance: (chain: TExternalChain, asset: TAssetInfo, add
|
|
|
2176
2281
|
|
|
2177
2282
|
declare const getMoonbeamErc20Balance: (chain: TSubstrateChain, assetId: string, address: string) => Promise<bigint>;
|
|
2178
2283
|
|
|
2284
|
+
declare const getChainConfigImpl: <TCustomChain extends string = never>(chain: TSubstrateChain | TCustomChain, ctx?: TFullCustomCtx) => TChainConfig;
|
|
2179
2285
|
declare const getChainConfig: (chain: TSubstrateChain) => TChainConfig;
|
|
2180
2286
|
|
|
2287
|
+
declare const getChainProvidersImpl: <TCustomChain extends string = never>(chain: TSubstrateChain | TCustomChain, ctx?: TFullCustomCtx) => string[];
|
|
2181
2288
|
declare const getChainProviders: (chain: TSubstrateChain) => string[];
|
|
2182
2289
|
|
|
2290
|
+
declare const getParaIdImpl: <TCustomChain extends string = never>(chain: TChain | TCustomChain, ctx?: TFullCustomCtx) => number;
|
|
2183
2291
|
/**
|
|
2184
2292
|
* Retrieves the parachain ID for a specified chain.
|
|
2185
2293
|
*
|
|
2186
2294
|
* @param chain - The chain for which to get the paraId.
|
|
2187
2295
|
* @returns The parachain ID of the chain.
|
|
2188
2296
|
*/
|
|
2189
|
-
declare const getParaId: (chain: TChain) => number;
|
|
2297
|
+
declare const getParaId: <TCustomChain extends string = never>(chain: TChain | TCustomChain) => number;
|
|
2298
|
+
|
|
2299
|
+
declare const normalizeCustomChains: (map: TCustomChainsMap | undefined) => TCustomChainsCtx;
|
|
2300
|
+
declare const buildCustomChainConfig: (entry: TCustomChainEntry) => TChainConfig;
|
|
2301
|
+
declare const buildCustomChainAssetsInfo: (entry: TCustomChainEntryHydrated) => TChainAssetsInfo;
|
|
2190
2302
|
|
|
2191
2303
|
/**
|
|
2192
2304
|
* Retrieves the chain name corresponding to a specified parachain ID.
|
|
@@ -2197,13 +2309,15 @@ declare const getParaId: (chain: TChain) => number;
|
|
|
2197
2309
|
declare const getTChain: (paraId: number, ecosystem: TRelaychain | TExternalChain) => TChain | null;
|
|
2198
2310
|
|
|
2199
2311
|
interface TEvmExtension {
|
|
2200
|
-
|
|
2312
|
+
executeTransfer: <TApi, TRes, TSigner>(options: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<string>;
|
|
2313
|
+
buildTransfer: <TApi, TRes, TSigner>(options: TBuildEvmTransferOptions<TApi, TRes, TSigner>) => Promise<TransactionSerializableEIP1559>;
|
|
2201
2314
|
}
|
|
2202
2315
|
declare const registerEvmExtension: (extension: TEvmExtension | undefined) => void;
|
|
2203
2316
|
declare const getEvmExtensionOrThrow: () => TEvmExtension;
|
|
2204
2317
|
|
|
2205
2318
|
interface TEvmSnowbridgeExtension {
|
|
2206
|
-
|
|
2319
|
+
executeTransfer: <TApi, TRes, TSigner>(options: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<string>;
|
|
2320
|
+
buildTransfer: <TApi, TRes, TSigner>(options: TBuildEvmTransferOptions<TApi, TRes, TSigner>) => Promise<TransactionSerializableEIP1559>;
|
|
2207
2321
|
}
|
|
2208
2322
|
declare const registerEvmSnowbridgeExtension: (extension: TEvmSnowbridgeExtension | undefined) => void;
|
|
2209
2323
|
declare const getEvmSnowbridgeExtensionOrThrow: () => TEvmSnowbridgeExtension;
|
|
@@ -2259,10 +2373,7 @@ declare const transferMoonbeamEvm: <TApi, TRes, TSigner>(options: TEvmTransferOp
|
|
|
2259
2373
|
|
|
2260
2374
|
declare const transferMoonbeamToEth: <TApi, TRes, TSigner>(from: TSubstrateChain, { api, to, signer, recipient, ahAddress, currency }: TEvmTransferOptions<TApi, TRes, TSigner>) => Promise<`0x${string}`>;
|
|
2261
2375
|
|
|
2262
|
-
declare const getOriginXcmFee: <TApi, TRes, TSigner>(options: TGetOriginXcmFeeOptions<TApi, TRes, TSigner>) => Promise<
|
|
2263
|
-
forwardedXcms?: unknown;
|
|
2264
|
-
destParaId?: number;
|
|
2265
|
-
}>;
|
|
2376
|
+
declare const getOriginXcmFee: <TApi, TRes, TSigner, TDisableFallback extends boolean = boolean>(options: TGetOriginXcmFeeOptions<TApi, TRes, TSigner, TDisableFallback>) => Promise<TXcmFeeDetailWithForwardedXcm<TDisableFallback>>;
|
|
2266
2377
|
|
|
2267
2378
|
declare const getOriginXcmFeeInternal: <TApi, TRes, TSigner>({ api, tx, origin, destination, sender, disableFallback, feeAsset, currency, version, useRootOrigin }: TGetOriginXcmFeeInternalOptions<TApi, TRes, TSigner>) => Promise<TXcmFeeDetail & {
|
|
2268
2379
|
forwardedXcms?: any;
|
|
@@ -2276,6 +2387,37 @@ declare const getXcmFeeOnce: <TApi, TRes, TSigner, TDisableFallback extends bool
|
|
|
2276
2387
|
|
|
2277
2388
|
declare const getBridgeStatus: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>) => Promise<TBridgeStatus>;
|
|
2278
2389
|
|
|
2390
|
+
declare const aggregateHopFees: (hops: TXcmFeeHopInfo[], matchAsset: TAssetInfo) => {
|
|
2391
|
+
totalHopFee: bigint;
|
|
2392
|
+
bridgeFee?: bigint;
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2395
|
+
declare const buildDestInfo: <TApi, TRes, TSigner>({ api, origin, destination, recipient, currency, originFee, isFeeAssetAh, destFeeDetail, totalHopFee, bridgeFee }: TBuildDestInfoOptions<TApi, TRes, TSigner>) => Promise<{
|
|
2396
|
+
receivedCurrency: {
|
|
2397
|
+
sufficient: boolean | UnableToComputeError;
|
|
2398
|
+
receivedAmount: bigint | UnableToComputeError;
|
|
2399
|
+
balance: bigint;
|
|
2400
|
+
balanceAfter: bigint | UnableToComputeError;
|
|
2401
|
+
asset: _paraspell_assets.TAssetInfo;
|
|
2402
|
+
};
|
|
2403
|
+
xcmFee: {
|
|
2404
|
+
fee: bigint;
|
|
2405
|
+
balance: bigint;
|
|
2406
|
+
balanceAfter: bigint;
|
|
2407
|
+
asset: _paraspell_assets.TAssetInfo;
|
|
2408
|
+
};
|
|
2409
|
+
}>;
|
|
2410
|
+
|
|
2411
|
+
declare const buildHopInfo: <TApi, TRes, TSigner>({ api, chain, fee, originChain, asset, currency }: BuildHopInfoOptions<TApi, TRes, TSigner>) => Promise<{
|
|
2412
|
+
asset: _paraspell_assets.TAssetInfo;
|
|
2413
|
+
xcmFee: {
|
|
2414
|
+
fee: bigint;
|
|
2415
|
+
asset: _paraspell_assets.TAssetInfo;
|
|
2416
|
+
};
|
|
2417
|
+
}>;
|
|
2418
|
+
|
|
2419
|
+
declare const buildOriginInfo: <TApi, TRes, TSigner>({ api, origin, sender, currency, originAsset, amount, originFee, originFeeAsset, isFeeAssetAh }: TBuildOriginInfoOptions<TApi, TRes, TSigner>) => Promise<TTransferInfo["origin"]>;
|
|
2420
|
+
|
|
2279
2421
|
declare const getTransferInfo: <TApi, TRes, TSigner>({ api, buildTx, origin, destination, sender, ahAddress, recipient, currency, feeAsset, version }: TGetTransferInfoOptions<TApi, TRes, TSigner>) => Promise<TTransferInfo>;
|
|
2280
2422
|
|
|
2281
2423
|
declare const getMinTransferableAmountInternal: <TApi, TRes, TSigner>({ api, origin, sender, recipient, origin: chain, destination, currency, feeAsset, buildTx, builder, version }: TGetMinTransferableAmountOptions<TApi, TRes, TSigner>) => Promise<bigint>;
|
|
@@ -2299,7 +2441,7 @@ declare const createTypeAndThenCall: <TApi, TRes, TSigner>(options: TPolkadotXCM
|
|
|
2299
2441
|
declare const createTypeThenAutoReserve: <TApi, TRes, TSigner>(chain: TSubstrateChain, options: TPolkadotXCMTransferOptions<TApi, TRes, TSigner>) => Promise<TSerializedExtrinsics>;
|
|
2300
2442
|
|
|
2301
2443
|
declare const validateCurrency: (currency: TCurrencyInput, feeAsset?: TCurrencyInput) => void;
|
|
2302
|
-
declare const validateDestination: (origin: TSubstrateChain, destination: TDestination) => void;
|
|
2444
|
+
declare const validateDestination: <TApi, TRes, TSigner>(origin: TSubstrateChain, destination: TDestination, api: PolkadotApi<TApi, TRes, TSigner>) => void;
|
|
2303
2445
|
declare const validateAssetSpecifiers: (assetCheckEnabled: boolean, currency: TCurrencyInput) => void;
|
|
2304
2446
|
declare const validateTransact: <TApi, TRes, TSigner>({ api, from, to, sender, recipient: address, transactOptions }: TSubstrateTransferOptions<TApi, TRes, TSigner>) => ValidationError | undefined;
|
|
2305
2447
|
|
|
@@ -2314,7 +2456,9 @@ declare const validateDestinationAddress: <TApi, TRes, TSigner>(address: TAddres
|
|
|
2314
2456
|
declare const assertToIsString: (to: TDestination, overrideMsg?: string) => asserts to is Exclude<TDestination, TLocation>;
|
|
2315
2457
|
declare const assertAddressIsString: (address: TAddress) => asserts address is Exclude<TAddress, TLocation>;
|
|
2316
2458
|
declare const assertSender: (address: string | undefined) => asserts address is string;
|
|
2459
|
+
declare const assertEvmAddress: (address: string) => asserts address is Address;
|
|
2317
2460
|
declare const assertHasId: (asset: TAssetInfo) => asserts asset is TAssetInfoWithId;
|
|
2461
|
+
declare const assertCurrencyCore: <T>(value: T) => asserts value is (T & TCurrencyCore) | (T & undefined);
|
|
2318
2462
|
declare const assertSenderSource: <TSigner>(sender?: TSender<TSigner>) => asserts sender is TSender<TSigner>;
|
|
2319
2463
|
declare const isSenderSigner: <TSigner>(sender: TSender<TSigner>) => sender is TSigner;
|
|
2320
2464
|
declare const assertSwapSupport: <TApi, TRes, TSigner>(options: TSwapOptions<TApi, TRes, TSigner> | undefined) => void;
|
|
@@ -2341,9 +2485,10 @@ declare const createTxOverrideAmount: <TApi, TRes, TSigner>(options: TCreateTxsO
|
|
|
2341
2485
|
declare const createTransferOrSwapAll: <TApi, TRes, TSigner>(options: TSubstrateTransferOptions<TApi, TRes, TSigner>) => Promise<TTransactionContext<TApi, TRes>[]>;
|
|
2342
2486
|
declare const createTransferOrSwap: <TApi, TRes, TSigner>(options: TSubstrateTransferOptions<TApi, TRes, TSigner>) => Promise<TRes>;
|
|
2343
2487
|
|
|
2344
|
-
declare const getAssetReserveChain: (chain: TSubstrateChain, assetLocation: TLocation) =>
|
|
2488
|
+
declare const getAssetReserveChain: (chain: TSubstrateChain, assetLocation: TLocation, resolveExternalReserve?: boolean) => TChain;
|
|
2489
|
+
declare const getAssetReserveChainImpl: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TSubstrateChain | TCustomChain, assetLocation: TLocation, resolveExternalReserve?: boolean) => TChain | TCustomChain;
|
|
2345
2490
|
|
|
2346
|
-
declare const getChainVersion: <TApi, TRes, TSigner>(chain: TChain) => Version;
|
|
2491
|
+
declare const getChainVersion: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TChain) => Version;
|
|
2347
2492
|
|
|
2348
2493
|
/**
|
|
2349
2494
|
* Gets the relay chain (Polkadot, Kusama, Westend, or Paseo) of a given chain.
|
|
@@ -2352,6 +2497,15 @@ declare const getChainVersion: <TApi, TRes, TSigner>(chain: TChain) => Version;
|
|
|
2352
2497
|
* @returns The corresponding relay chain.
|
|
2353
2498
|
*/
|
|
2354
2499
|
declare const getRelayChainOf: (chain: TSubstrateChain) => TRelaychain;
|
|
2500
|
+
declare const getRelayChainOfImpl: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TSubstrateChain | TCustomChain) => TRelaychain;
|
|
2501
|
+
|
|
2502
|
+
/**
|
|
2503
|
+
* Gets the native asset symbol of the relay chain that the given chain belongs to.
|
|
2504
|
+
*
|
|
2505
|
+
* @param chain - The chain to evaluate.
|
|
2506
|
+
* @returns The native asset symbol of the corresponding relay chain.
|
|
2507
|
+
*/
|
|
2508
|
+
declare const getRelayChainSymbolOf: (chain: TSubstrateChain) => string;
|
|
2355
2509
|
|
|
2356
2510
|
declare const createChainClient: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TSubstrateChain) => Promise<TApi>;
|
|
2357
2511
|
|
|
@@ -2384,29 +2538,21 @@ declare const isViemSigner: (value: unknown) => value is WalletClient;
|
|
|
2384
2538
|
declare const createBeneficiaryLocXTokens: <TApi, TRes, TSigner>({ api, recipient, origin, destination, version, paraId }: TCreateBeneficiaryXTokensOptions<TApi, TRes, TSigner>) => TLocation;
|
|
2385
2539
|
declare const createBeneficiaryLocation: <TApi, TRes, TSigner>({ api, address, version }: TCreateBeneficiaryOptions<TApi, TRes, TSigner>) => TLocation;
|
|
2386
2540
|
|
|
2387
|
-
declare const createDestination: (version: Version, origin:
|
|
2388
|
-
declare const createVersionedDestination: (version: Version, origin: TSubstrateChain, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TXcmVersioned<TLocation>;
|
|
2541
|
+
declare const createDestination: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner>, version: Version, origin: TChain | TCustomChain, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TLocation;
|
|
2542
|
+
declare const createVersionedDestination: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, version: Version, origin: TSubstrateChain, destination: TDestination, chainId?: number, junction?: TJunction, parents?: Parents) => TXcmVersioned<TLocation>;
|
|
2389
2543
|
|
|
2390
2544
|
declare const createX1Payload: (version: Version, junction: TJunction) => TJunctions;
|
|
2391
2545
|
|
|
2392
2546
|
declare const getChainLocation: (chain: TChain, destChain: TChain) => TLocation;
|
|
2393
2547
|
|
|
2394
|
-
/**
|
|
2395
|
-
* This function localizes a location by removing the `Parachain` junction
|
|
2396
|
-
* if it exists. The `parents` field is set to `0` either if a `Parachain` was removed
|
|
2397
|
-
* or if the resulting interior is `'Here'` and the chain is a relay chain.
|
|
2398
|
-
*
|
|
2399
|
-
* @param chain - The current chain
|
|
2400
|
-
* @param location - The location to localize
|
|
2401
|
-
* @returns The localized location
|
|
2402
|
-
*/
|
|
2403
2548
|
declare const localizeLocation: (chain: TChain, location: TLocation, origin?: TChain) => TLocation;
|
|
2549
|
+
declare const localizeLocationImpl: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner>, chain: TChain | TCustomChain, location: TLocation, origin?: TChain | TCustomChain) => TLocation;
|
|
2404
2550
|
|
|
2405
2551
|
declare const reverseTransformLocation: (location: TLocation) => TLocation;
|
|
2406
2552
|
|
|
2407
2553
|
declare const normalizeAmount: (amount: bigint) => bigint;
|
|
2408
2554
|
|
|
2409
|
-
declare const resolveDestChain: (originChain: TSubstrateChain, paraId: number | undefined) => "AssetHubPolkadot" | "Acala" | "Ajuna" | "Astar" | "BifrostPolkadot" | "BridgeHubPolkadot" | "Centrifuge" | "Darwinia" | "EnergyWebX" | "Hydration" | "Interlay" | "Heima" | "Jamton" | "Moonbeam" | "CoretimePolkadot" | "Collectives" | "Crust" | "NeuroWeb" | "Pendulum" | "Mythos" | "Peaq" | "PeoplePolkadot" | "Unique" | "Xode" | "AssetHubKusama" | "BridgeHubKusama" | "Karura" | "Kintsugi" | "Moonriver" | "CoretimeKusama" | "Encointer" | "Basilisk" | "BifrostKusama" | "CrustShadow" | "Crab" | "
|
|
2555
|
+
declare const resolveDestChain: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner>, originChain: TSubstrateChain | TCustomChain, paraId: number | undefined) => "AssetHubPolkadot" | "Acala" | "Ajuna" | "Astar" | "BifrostPolkadot" | "BridgeHubPolkadot" | "Centrifuge" | "Darwinia" | "EnergyWebX" | "Hydration" | "Interlay" | "Heima" | "Jamton" | "Moonbeam" | "CoretimePolkadot" | "Collectives" | "Crust" | "NeuroWeb" | "Pendulum" | "Mythos" | "Peaq" | "PeoplePolkadot" | "Unique" | "Xode" | "AssetHubKusama" | "BridgeHubKusama" | "Karura" | "Kintsugi" | "Moonriver" | "CoretimeKusama" | "Encointer" | "Basilisk" | "BifrostKusama" | "CrustShadow" | "Crab" | "Quartz" | "RobonomicsPolkadot" | "PeopleKusama" | "Shiden" | "Zeitgeist" | "AssetHubWestend" | "BridgeHubWestend" | "CollectivesWestend" | "CoretimeWestend" | "Penpal" | "PeopleWestend" | "AjunaPaseo" | "AssetHubPaseo" | "BifrostPaseo" | "BridgeHubPaseo" | "CoretimePaseo" | "EnergyWebXPaseo" | "HeimaPaseo" | "HydrationPaseo" | "NeuroWebPaseo" | "PeoplePaseo" | "ZeitgeistPaseo" | undefined;
|
|
2410
2556
|
|
|
2411
2557
|
declare const resolveParaId: (paraId: number | undefined, destination: TDestination) => number | undefined;
|
|
2412
2558
|
|
|
@@ -2429,7 +2575,7 @@ declare const createAssetsFilter: (asset: TAsset, version: Version) => {
|
|
|
2429
2575
|
};
|
|
2430
2576
|
};
|
|
2431
2577
|
|
|
2432
|
-
declare const createBaseExecuteXcm: <TRes>(options:
|
|
2578
|
+
declare const createBaseExecuteXcm: <TApi, TRes, TSigner>(options: TCreateTransferXcmOptions<TApi, TRes, TSigner> & {
|
|
2433
2579
|
suffixXcm?: unknown[];
|
|
2434
2580
|
}) => unknown[];
|
|
2435
2581
|
|
|
@@ -2456,8 +2602,8 @@ declare const formatUnits: typeof formatUnits$1;
|
|
|
2456
2602
|
|
|
2457
2603
|
declare const addXcmVersionHeader: <T, V extends Version>(obj: T, version: V) => OneKey<V, T>;
|
|
2458
2604
|
declare const selectXcmVersion: (forcedVersion: Version | undefined, originVersion: Version, destMaxVersion?: Version) => Version;
|
|
2459
|
-
declare const pickCompatibleXcmVersion: (origin: TSubstrateChain, destination: TDestination, override?: Version) => Version;
|
|
2460
|
-
declare const pickRouterCompatibleXcmVersion: (origin: TSubstrateChain | undefined, exchangeChain: TSubstrateChain, destination: TChain | undefined) => Version;
|
|
2605
|
+
declare const pickCompatibleXcmVersion: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, origin: TSubstrateChain, destination: TDestination, override?: Version) => Version;
|
|
2606
|
+
declare const pickRouterCompatibleXcmVersion: <TApi, TRes, TSigner>(api: PolkadotApi<TApi, TRes, TSigner>, origin: TSubstrateChain | undefined, exchangeChain: TSubstrateChain, destination: TChain | undefined) => Version;
|
|
2461
2607
|
|
|
2462
|
-
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|
|
2463
|
-
export type { BuildHopInfoOptions, ClientCache, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotXCMTransfer, IXTokensTransfer, OneKey, TAddress, TApiOrUrl, TApiType, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBatchedTransferOptions, TBifrostToken, TBridgeStatus, TBuildAllInternalRes, TBuildDestInfoOptions, TBuildInternalRes, TBuildInternalResBase, TBuilderConfig, TBuilderInternalOptions, TBuilderOptions, TBypassOptions, TCacheItem, TChainConfig, TChainConfigMap, TChainEndpoint, TChainWithApi, TClientEntry, TClientKey, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateEthBridgeInstructionsOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions,
|
|
2608
|
+
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getAssetReserveChainImpl, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainConfigImpl, getChainLocation, getChainProviders, getChainProvidersImpl, getChainVersion, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getParaIdImpl, getRelayChainOf, getRelayChainOfImpl, getRelayChainSymbolOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, localizeLocationImpl, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeCustomChains, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|
|
2609
|
+
export type { BuildHopInfoOptions, ClientCache, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotXCMTransfer, IXTokensTransfer, OneKey, TAddress, TApiOrUrl, TApiType, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TBatchOptions, TBatchedTransferOptions, TBifrostToken, TBridgeStatus, TBuildAllInternalRes, TBuildDestInfoOptions, TBuildEvmTransferOptions, TBuildInternalRes, TBuildInternalResBase, TBuildOriginInfoOptions, TBuilderConfig, TBuilderInternalOptions, TBuilderOptions, TBypassOptions, TCacheItem, TChainConfig, TChainConfigMap, TChainEndpoint, TChainWithApi, TClientEntry, TClientKey, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateEthBridgeInstructionsOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TCreateTxsOptions, TCustomChainEntry, TCustomChainEntryHydrated, TCustomChainFrom, TCustomChainInput, TCustomChainPalletsInput, TCustomChainsCtx, TCustomChainsMap, TDestWeight, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunError, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmExtension, TEvmSnowbridgeExtension, TEvmTransferOptions, TEvmTransferOptionsBase, TExchangeChain, TExchangeInput, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TFullCustomCtx, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceCommonOptions, TGetBalanceOptions, TGetBalanceOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeInternalOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeInternalOptions, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, TModuleError, TNativeTokenAsset, TOriginFeeDetails, TOtherReserveAsset, TPaymentInfo, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TReserveAsset, TResolveHopParams, TRuntimeApi, TScenario, TSelfReserveAsset, TSender, TSerializedExtrinsics, TSerializedRuntimeApiQuery, TSerializedStateQuery, TSetBalanceRes, TStatusChangeCallback, TSubstrateTransferBaseOptions, TSubstrateTransferBaseOptionsWithSender, TSubstrateTransferOptions, TSwapBuilder, TSwapBuilderFactory, TSwapConfig, TSwapEvent, TSwapEventType, TSwapExtension, TSwapFeeEstimates, TSwapOptions, TSystemProperties, TTransactOptions, TTransactOrigin, TTransactionContext, TTransactionType, TTransferBaseOptions, TTransferBaseOptionsWithSender, TTransferBaseOptionsWithSwap, TTransferFeeEstimates, TTransferInfo, TTransferInternalOptions, TTransferLocalOptions, TTransferOptions, TTransferOptionsWithSwap, TTxFactory, TTypeAndThenCallContext, TTypeAndThenFees, TTypeAndThenOverrides, TUrl, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeDetailWithForwardedXcm, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmFeeSwapConfig, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSender, WithRequiredSwapOptions };
|