@galacticcouncil/xc-cfg 2.3.0-pr350-7caff1d → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets.d.ts +1 -0
- package/build/bridges/wormhole/constants.d.ts +12 -0
- package/build/bridges/wormhole/constants.spec.d.ts +1 -0
- package/build/bridges/wormhole/index.d.ts +1 -0
- package/build/builders/ExtrinsicBuilder.d.ts +2 -10
- package/build/builders/FeeAmountBuilder.d.ts +15 -0
- package/build/builders/contracts/Wormhole/Ntt.d.ts +2 -0
- package/build/builders/contracts/Wormhole/index.d.ts +2 -0
- package/build/builders/extrinsics/evm.d.ts +4 -0
- package/build/builders/extrinsics/evm.spec.d.ts +1 -0
- package/build/builders/extrinsics/xcm/index.d.ts +0 -1
- package/build/builders/extrinsics/xcm/polkadotXcm.d.ts +0 -7
- package/build/builders/extrinsics/xcm/polkadotXcm.utils.d.ts +2 -145
- package/build/clients/index.d.ts +2 -1
- package/build/clients/ntt/NttEvmClient.d.ts +13 -0
- package/build/clients/ntt/NttSolanaClient.d.ts +22 -0
- package/build/clients/ntt/NttSuiClient.d.ts +13 -0
- package/build/clients/ntt/index.d.ts +18 -0
- package/build/clients/ntt/index.spec.d.ts +1 -0
- package/build/clients/ntt/types.d.ts +45 -0
- package/build/clients/wormhole/ExecutorClient.d.ts +50 -0
- package/build/clients/wormhole/ExecutorClient.spec.d.ts +1 -0
- package/build/clients/wormhole/index.d.ts +1 -0
- package/build/configs/evm/base/templates.d.ts +6 -0
- package/build/configs/evm/ethereum/templates.d.ts +18 -0
- package/build/configs/ntt.spec.d.ts +1 -0
- package/build/configs/polkadot/hydration/templates.d.ts +25 -0
- package/build/index.cjs +1 -1
- package/build/index.mjs +1 -1
- package/build/tags.d.ts +1 -0
- package/build/validations/chain/hydration.d.ts +0 -4
- package/package.json +2 -2
- package/build/builders/extrinsics/xcm/ethereumXcm.d.ts +0 -4
- package/build/clients/bridge/index.d.ts +0 -1
- package/build/clients/bridge/ntt.d.ts +0 -16
package/build/assets.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare const weth: Asset;
|
|
|
50
50
|
export declare const weth_wh: Asset;
|
|
51
51
|
export declare const wbtc: Asset;
|
|
52
52
|
export declare const wbtc_wh: Asset;
|
|
53
|
+
export declare const wsol: Asset;
|
|
53
54
|
export declare const wsteth: Asset;
|
|
54
55
|
export declare const wud: Asset;
|
|
55
56
|
export declare const assets: Asset[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const NTT_DEFAULT_INSTRUCTIONS = "0x00";
|
|
2
|
+
export declare const NTT_TRIMMED_DECIMALS = 8;
|
|
3
|
+
export declare const EXECUTOR_API = "https://executor.labsapis.com";
|
|
4
|
+
/**
|
|
5
|
+
* Names the ntt message an Executor request is paying to deliver.
|
|
6
|
+
*
|
|
7
|
+
* The sequence is the manager's `nextMessageSequence()` read at build time,
|
|
8
|
+
* so a transfer through the same manager landing in between leaves the
|
|
9
|
+
* request pointing at the wrong message. It relays nothing then, and the
|
|
10
|
+
* transfer stays claimable by hand.
|
|
11
|
+
*/
|
|
12
|
+
export declare const encodeNttRequest: (srcWormholeId: number, nttManager: string, sequence: bigint) => `0x${string}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './constants';
|
|
@@ -11,8 +11,8 @@ export declare function ExtrinsicBuilder(): {
|
|
|
11
11
|
balances: () => {
|
|
12
12
|
transferAll: (keepAlive?: boolean) => ExtrinsicConfigBuilder;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
evm: () => {
|
|
15
|
+
call: (contract: import("@galacticcouncil/xc-core").ContractConfigBuilder) => ExtrinsicConfigBuilder;
|
|
16
16
|
};
|
|
17
17
|
polkadotXcm: () => {
|
|
18
18
|
limitedReserveTransferAssets: () => ExtrinsicConfigBuilder;
|
|
@@ -29,14 +29,6 @@ export declare function ExtrinsicBuilder(): {
|
|
|
29
29
|
viaSnowbridge: () => ExtrinsicConfigBuilder;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
send: () => {
|
|
33
|
-
transact: (opts: {
|
|
34
|
-
fee: number;
|
|
35
|
-
}) => ExtrinsicConfigBuilder;
|
|
36
|
-
transferAsset: (opts: {
|
|
37
|
-
fee: number;
|
|
38
|
-
}) => ExtrinsicConfigBuilder;
|
|
39
|
-
};
|
|
40
32
|
};
|
|
41
33
|
router: () => {
|
|
42
34
|
buy: (opts: {
|
|
@@ -13,6 +13,20 @@ declare function XcmPaymentApi(): {
|
|
|
13
13
|
reserve?: AnyParachain;
|
|
14
14
|
}) => FeeAmountConfigBuilder;
|
|
15
15
|
};
|
|
16
|
+
declare function Wormhole(): {
|
|
17
|
+
/**
|
|
18
|
+
* Native gas an executor-delivered NTT transfer pays on top of itself -
|
|
19
|
+
* the wormhole delivery price plus what the Executor charges to redeem
|
|
20
|
+
* on the far side.
|
|
21
|
+
*
|
|
22
|
+
* Declared as the route's destination fee because an erc20 source pays it
|
|
23
|
+
* out of a balance the amount never competes for, so
|
|
24
|
+
* {@link EvmPlatform.estimateFee} deliberately leaves the call value out.
|
|
25
|
+
* A native gas source must NOT use this - there the value is already part
|
|
26
|
+
* of the source fee, and charging it twice inflates the route minimum.
|
|
27
|
+
*/
|
|
28
|
+
quoteExecutorCost: () => FeeAmountConfigBuilder;
|
|
29
|
+
};
|
|
16
30
|
declare function Basejump(): {
|
|
17
31
|
quoteFee: () => FeeAmountConfigBuilder;
|
|
18
32
|
};
|
|
@@ -20,5 +34,6 @@ export declare function FeeAmountBuilder(): {
|
|
|
20
34
|
Basejump: typeof Basejump;
|
|
21
35
|
XcmPaymentApi: typeof XcmPaymentApi;
|
|
22
36
|
Snowbridge: typeof Snowbridge;
|
|
37
|
+
Wormhole: typeof Wormhole;
|
|
23
38
|
};
|
|
24
39
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function Wormhole(): {
|
|
2
2
|
Ntt: () => {
|
|
3
3
|
transfer: () => import("@galacticcouncil/xc-core").ContractConfigBuilder;
|
|
4
|
+
transferWithExecutor: () => import("@galacticcouncil/xc-core").ContractConfigBuilder;
|
|
5
|
+
transferViaExecutor: () => import("@galacticcouncil/xc-core").ContractConfigBuilder;
|
|
4
6
|
};
|
|
5
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,9 +5,6 @@ type TransferOpts = {
|
|
|
5
5
|
transferType: XcmTransferType;
|
|
6
6
|
executionFee?: number;
|
|
7
7
|
};
|
|
8
|
-
type TransactOpts = {
|
|
9
|
-
fee: number;
|
|
10
|
-
};
|
|
11
8
|
declare function execute(messageBuilder: XcmMessageBuilder): ExtrinsicConfigBuilder;
|
|
12
9
|
declare function execute(): {
|
|
13
10
|
viaSnowbridge: () => ExtrinsicConfigBuilder;
|
|
@@ -19,9 +16,5 @@ export declare const polkadotXcm: () => {
|
|
|
19
16
|
transferAssets: () => ExtrinsicConfigBuilder;
|
|
20
17
|
transferAssetsUsingTypeAndThen: (opts: TransferOpts) => ExtrinsicConfigBuilder;
|
|
21
18
|
execute: typeof execute;
|
|
22
|
-
send: () => {
|
|
23
|
-
transact: (opts: TransactOpts) => ExtrinsicConfigBuilder;
|
|
24
|
-
transferAsset: (opts: TransactOpts) => ExtrinsicConfigBuilder;
|
|
25
|
-
};
|
|
26
19
|
};
|
|
27
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Asset, Parachain
|
|
1
|
+
import { Asset, Parachain } from '@galacticcouncil/xc-core';
|
|
2
2
|
import { SizedHex } from 'polkadot-api';
|
|
3
|
-
import { XcmV3Junctions, XcmV3Junction,
|
|
3
|
+
import { XcmV3Junctions, XcmV3Junction, XcmV4Instruction, XcmV4AssetAssetFilter } from '@galacticcouncil/descriptors';
|
|
4
4
|
import { XcmTransferType, XcmVersion } from './types';
|
|
5
5
|
export declare const isSnowbridgeTransfer: (assetLocation: any) => boolean;
|
|
6
6
|
export declare const toDest: (version: XcmVersion, source: Parachain, destination: Parachain) => {
|
|
@@ -201,146 +201,3 @@ export declare const toReserveXcmOnDest: (version: XcmVersion, account: any, des
|
|
|
201
201
|
type: "DepositReserveAsset";
|
|
202
202
|
}))[];
|
|
203
203
|
};
|
|
204
|
-
/**
|
|
205
|
-
* Instructions are executed in 3 steps:
|
|
206
|
-
*
|
|
207
|
-
* 1) WithdrawAsset - Withdraw fee asset from the target account
|
|
208
|
-
* 2) BuyExecution - Buy execution with the fee asset
|
|
209
|
-
* 3) Transact - Destination (Transact) chain call execution
|
|
210
|
-
*
|
|
211
|
-
* Note that DepositAsset using AllCounted and not All, since All
|
|
212
|
-
* has too high of a gas requirement.
|
|
213
|
-
*
|
|
214
|
-
* @param version - XCM Version
|
|
215
|
-
* @param account - destination account (receiver)
|
|
216
|
-
* @param transactFeeLocation - transact fee xcm location
|
|
217
|
-
* @param transactFeeAmount - transact fee amount
|
|
218
|
-
* @param transactCall - transact calldata
|
|
219
|
-
* @param transactWeight - transact weight
|
|
220
|
-
* @returns xcm transact message instructions
|
|
221
|
-
*/
|
|
222
|
-
export declare const toTransactMessage: (version: XcmVersion, account: any, transactFeeLocation: {
|
|
223
|
-
parents: number;
|
|
224
|
-
interior: XcmV3Junctions;
|
|
225
|
-
}, transactFeeAmount: any, transactCall: Uint8Array, transactWeight: TxWeight) => {
|
|
226
|
-
type: XcmVersion;
|
|
227
|
-
value: (({
|
|
228
|
-
type: "BuyExecution";
|
|
229
|
-
value: {
|
|
230
|
-
fees: {
|
|
231
|
-
id: {
|
|
232
|
-
parents: number;
|
|
233
|
-
interior: XcmV3Junctions;
|
|
234
|
-
};
|
|
235
|
-
fun: XcmV3MultiassetFungibility;
|
|
236
|
-
};
|
|
237
|
-
weight_limit: XcmV3WeightLimit;
|
|
238
|
-
};
|
|
239
|
-
} & {
|
|
240
|
-
type: "BuyExecution";
|
|
241
|
-
}) | ({
|
|
242
|
-
type: "DepositAsset";
|
|
243
|
-
value: {
|
|
244
|
-
assets: XcmV4AssetAssetFilter;
|
|
245
|
-
beneficiary: {
|
|
246
|
-
parents: number;
|
|
247
|
-
interior: XcmV3Junctions;
|
|
248
|
-
};
|
|
249
|
-
};
|
|
250
|
-
} & {
|
|
251
|
-
type: "DepositAsset";
|
|
252
|
-
}) | ({
|
|
253
|
-
type: "WithdrawAsset";
|
|
254
|
-
value: {
|
|
255
|
-
id: {
|
|
256
|
-
parents: number;
|
|
257
|
-
interior: XcmV3Junctions;
|
|
258
|
-
};
|
|
259
|
-
fun: XcmV3MultiassetFungibility;
|
|
260
|
-
}[];
|
|
261
|
-
} & {
|
|
262
|
-
type: "WithdrawAsset";
|
|
263
|
-
}) | ({
|
|
264
|
-
type: "Transact";
|
|
265
|
-
value: {
|
|
266
|
-
call: Uint8Array<ArrayBufferLike>;
|
|
267
|
-
origin_kind: XcmV2OriginKind;
|
|
268
|
-
require_weight_at_most: {
|
|
269
|
-
ref_time: bigint;
|
|
270
|
-
proof_size: bigint;
|
|
271
|
-
};
|
|
272
|
-
};
|
|
273
|
-
} & {
|
|
274
|
-
type: "Transact";
|
|
275
|
-
}) | ({
|
|
276
|
-
type: "RefundSurplus";
|
|
277
|
-
value: undefined;
|
|
278
|
-
} & {
|
|
279
|
-
type: "RefundSurplus";
|
|
280
|
-
}))[];
|
|
281
|
-
};
|
|
282
|
-
export declare const toTransferMessage: (version: XcmVersion, account: any, transferAssetLocation: {
|
|
283
|
-
parents: number;
|
|
284
|
-
interior: XcmV3Junctions;
|
|
285
|
-
}, transferAssetAmount: any, transferFeeAmount: any, receiver: any) => {
|
|
286
|
-
type: XcmVersion;
|
|
287
|
-
value: (({
|
|
288
|
-
type: "BuyExecution";
|
|
289
|
-
value: {
|
|
290
|
-
fees: {
|
|
291
|
-
id: {
|
|
292
|
-
parents: number;
|
|
293
|
-
interior: XcmV3Junctions;
|
|
294
|
-
};
|
|
295
|
-
fun: XcmV3MultiassetFungibility;
|
|
296
|
-
};
|
|
297
|
-
weight_limit: XcmV3WeightLimit;
|
|
298
|
-
};
|
|
299
|
-
} & {
|
|
300
|
-
type: "BuyExecution";
|
|
301
|
-
}) | ({
|
|
302
|
-
type: "DepositAsset";
|
|
303
|
-
value: {
|
|
304
|
-
assets: XcmV4AssetAssetFilter;
|
|
305
|
-
beneficiary: {
|
|
306
|
-
parents: number;
|
|
307
|
-
interior: XcmV3Junctions;
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
} & {
|
|
311
|
-
type: "DepositAsset";
|
|
312
|
-
}) | ({
|
|
313
|
-
type: "WithdrawAsset";
|
|
314
|
-
value: {
|
|
315
|
-
id: {
|
|
316
|
-
parents: number;
|
|
317
|
-
interior: XcmV3Junctions;
|
|
318
|
-
};
|
|
319
|
-
fun: XcmV3MultiassetFungibility;
|
|
320
|
-
}[];
|
|
321
|
-
} & {
|
|
322
|
-
type: "WithdrawAsset";
|
|
323
|
-
}) | ({
|
|
324
|
-
type: "RefundSurplus";
|
|
325
|
-
value: undefined;
|
|
326
|
-
} & {
|
|
327
|
-
type: "RefundSurplus";
|
|
328
|
-
}) | ({
|
|
329
|
-
type: "TransferAsset";
|
|
330
|
-
value: {
|
|
331
|
-
assets: {
|
|
332
|
-
id: {
|
|
333
|
-
parents: number;
|
|
334
|
-
interior: XcmV3Junctions;
|
|
335
|
-
};
|
|
336
|
-
fun: XcmV3MultiassetFungibility;
|
|
337
|
-
}[];
|
|
338
|
-
beneficiary: {
|
|
339
|
-
parents: number;
|
|
340
|
-
interior: XcmV3Junctions;
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
} & {
|
|
344
|
-
type: "TransferAsset";
|
|
345
|
-
}))[];
|
|
346
|
-
};
|
package/build/clients/index.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnyChain, AnyEvmChain, Asset } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { ExecutorBudget } from '../wormhole';
|
|
3
|
+
import { NttClient, NttRateLimit } from './types';
|
|
4
|
+
export declare class NttEvmClient implements NttClient {
|
|
5
|
+
private readonly chain;
|
|
6
|
+
private readonly asset?;
|
|
7
|
+
constructor(chain: AnyEvmChain, asset?: Asset | undefined);
|
|
8
|
+
getOutboundLimit(): Promise<NttRateLimit>;
|
|
9
|
+
getInboundLimit(from: AnyChain): Promise<NttRateLimit>;
|
|
10
|
+
/** An evm redeem holds nothing - receiveMessage moves no value. */
|
|
11
|
+
getRedeemBudget(): Promise<ExecutorBudget>;
|
|
12
|
+
private getLimit;
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AnyChain, Asset, SolanaChain } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { ExecutorBudget } from '../wormhole';
|
|
3
|
+
import { NttClient, NttRateLimit } from './types';
|
|
4
|
+
export declare class NttSolanaClient implements NttClient {
|
|
5
|
+
private readonly chain;
|
|
6
|
+
private readonly asset?;
|
|
7
|
+
constructor(chain: SolanaChain, asset?: Asset | undefined);
|
|
8
|
+
getOutboundLimit(): Promise<NttRateLimit>;
|
|
9
|
+
getInboundLimit(from: AnyChain): Promise<NttRateLimit>;
|
|
10
|
+
/**
|
|
11
|
+
* An svm redeem mints into the recipient's associated token account and the
|
|
12
|
+
* relayer opens it when missing, so its rent is charged only then -
|
|
13
|
+
* mirroring upstream, which adds it on `getAccountInfo(ata) === null`.
|
|
14
|
+
*
|
|
15
|
+
* Budgeting it unconditionally would be simpler, but the executor charges
|
|
16
|
+
* source native for lamports it fronts, so every transfer to an existing
|
|
17
|
+
* account would pay for rent nobody spends.
|
|
18
|
+
*/
|
|
19
|
+
getRedeemBudget(recipient?: string): Promise<ExecutorBudget>;
|
|
20
|
+
private getLimit;
|
|
21
|
+
private rateLimitPda;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnyChain, Asset, SuiChain } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { ExecutorBudget } from '../wormhole';
|
|
3
|
+
import { NttClient, NttRateLimit } from './types';
|
|
4
|
+
export declare class NttSuiClient implements NttClient {
|
|
5
|
+
private readonly chain;
|
|
6
|
+
private readonly asset?;
|
|
7
|
+
constructor(chain: SuiChain, asset?: Asset | undefined);
|
|
8
|
+
getOutboundLimit(): Promise<NttRateLimit>;
|
|
9
|
+
getInboundLimit(from: AnyChain): Promise<NttRateLimit>;
|
|
10
|
+
/** A sui redeem holds nothing - the coin is minted to the recipient. */
|
|
11
|
+
getRedeemBudget(): Promise<ExecutorBudget>;
|
|
12
|
+
private getLimit;
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnyChain, Asset } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { NttEvmClient } from './NttEvmClient';
|
|
3
|
+
import { NttSolanaClient } from './NttSolanaClient';
|
|
4
|
+
import { NttSuiClient } from './NttSuiClient';
|
|
5
|
+
import { NttClient } from './types';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { NttEvmClient, NttSolanaClient, NttSuiClient };
|
|
8
|
+
/**
|
|
9
|
+
* Ntt deployment on a chain, for an asset.
|
|
10
|
+
*
|
|
11
|
+
* Keyed on the chain the question is about, not the direction of travel:
|
|
12
|
+
* hydration -> sui asks sui for both the inbound limit and the redeem budget,
|
|
13
|
+
* and it is sui's answer that binds.
|
|
14
|
+
*
|
|
15
|
+
* @param asset - omit only when the budget is wanted and the destination asset
|
|
16
|
+
* is not resolved yet; the rate limits need it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nttClient(chain: AnyChain, asset?: Asset): NttClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AnyChain, Asset, NttTokenDef } from '@galacticcouncil/xc-core';
|
|
2
|
+
import { ExecutorBudget } from '../wormhole';
|
|
3
|
+
/**
|
|
4
|
+
* Rate limit of one direction of an ntt manager.
|
|
5
|
+
*
|
|
6
|
+
* `capacity` is the headroom right now - the manager refills it linearly over
|
|
7
|
+
* `windowMs`. A `windowMs` of 0 means the direction is not metered at all.
|
|
8
|
+
*/
|
|
9
|
+
export interface NttRateLimit {
|
|
10
|
+
capacity: bigint;
|
|
11
|
+
limit: bigint;
|
|
12
|
+
windowMs: number;
|
|
13
|
+
capacityAtLastTx: bigint;
|
|
14
|
+
lastTxMs: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The ntt deployment on one chain, for one asset.
|
|
18
|
+
*
|
|
19
|
+
* Both halves of a transfer read the same deployment: the rate limits decide
|
|
20
|
+
* whether it is allowed through, the redeem budget decides what delivering it
|
|
21
|
+
* costs. Keyed on the chain the question is about - an inbound limit and a
|
|
22
|
+
* redeem budget are both destination-side.
|
|
23
|
+
*/
|
|
24
|
+
export interface NttClient {
|
|
25
|
+
getOutboundLimit(): Promise<NttRateLimit>;
|
|
26
|
+
getInboundLimit(from: AnyChain): Promise<NttRateLimit>;
|
|
27
|
+
/**
|
|
28
|
+
* What the Executor must reserve to redeem this transfer.
|
|
29
|
+
*
|
|
30
|
+
* @param recipient - whose accounts the redeem may have to open. Without it
|
|
31
|
+
* the budget assumes the worst case rather than reading chain.
|
|
32
|
+
*/
|
|
33
|
+
getRedeemBudget(recipient?: string): Promise<ExecutorBudget>;
|
|
34
|
+
}
|
|
35
|
+
export declare const UNMETERED: NttRateLimit;
|
|
36
|
+
/**
|
|
37
|
+
* Deployment for the asset this client was built for.
|
|
38
|
+
*
|
|
39
|
+
* Resolved per call rather than in the constructor: a redeem budget on an evm
|
|
40
|
+
* or sui destination never reads the registry, so constructing a client for an
|
|
41
|
+
* unregistered asset must not throw on its own.
|
|
42
|
+
*/
|
|
43
|
+
export declare function nttDef(chain: AnyChain, asset?: Asset): NttTokenDef;
|
|
44
|
+
/** Mirrors the manager's linear refill (rate_limit::capacity_at). */
|
|
45
|
+
export declare function capacityAt(limit: bigint, capacityAtLastTx: bigint, lastTxTimestamp: bigint, now: bigint, duration: bigint): bigint;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the Executor is asked to reserve to deliver on a destination.
|
|
3
|
+
*
|
|
4
|
+
* `gasLimit` budgets execution, `msgValue` budgets what the executor must
|
|
5
|
+
* hold. Both are destination units - evm gas, svm compute units, sui MIST -
|
|
6
|
+
* so neither has a value that is meaningful across chains.
|
|
7
|
+
*/
|
|
8
|
+
export interface ExecutorBudget {
|
|
9
|
+
gasLimit: bigint;
|
|
10
|
+
msgValue: bigint;
|
|
11
|
+
}
|
|
12
|
+
export type ExecutorQuote = {
|
|
13
|
+
/** Quoter-signed cost attestation, passed through to the shim. */
|
|
14
|
+
signedQuote: `0x${string}`;
|
|
15
|
+
/** What the Executor charges for delivery, in source chain native. */
|
|
16
|
+
estimatedCost: bigint;
|
|
17
|
+
/** Serialized delivery request the quote was priced for. */
|
|
18
|
+
relayInstructions: `0x${string}`;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Off-chain Executor quoting service.
|
|
22
|
+
*
|
|
23
|
+
* A signed quote carries its own expiry (an hour, currently) and the executor
|
|
24
|
+
* rejects a stale one, so quotes are reused only while comfortably live.
|
|
25
|
+
*/
|
|
26
|
+
export declare class ExecutorClient {
|
|
27
|
+
/** Live quotes, keyed by what they were priced for. */
|
|
28
|
+
private readonly quotes;
|
|
29
|
+
/**
|
|
30
|
+
* Price the delivery of one NTT transfer.
|
|
31
|
+
*
|
|
32
|
+
* @param srcWormholeId - source chain wormhole id
|
|
33
|
+
* @param dstWormholeId - destination chain wormhole id
|
|
34
|
+
* @param budget - what the executor must reserve on the destination, from
|
|
35
|
+
* {@link ExecutorBudget}. Both halves are keyed here: a quote is only
|
|
36
|
+
* honoured for the instructions it priced.
|
|
37
|
+
*/
|
|
38
|
+
quote(srcWormholeId: number, dstWormholeId: number, budget: ExecutorBudget): Promise<ExecutorQuote>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Shared instance - always quote through this, never a fresh client.
|
|
42
|
+
*
|
|
43
|
+
* The route's fee builder quotes to size the funding and the contract builder
|
|
44
|
+
* quotes to spend it, and those two numbers have to be the same one. Quoting
|
|
45
|
+
* twice lets the destination gas price move in between - observed drift was
|
|
46
|
+
* 807e9 wei against a 9e9 margin - and the transfer then reverts underfunded.
|
|
47
|
+
* Separate instances would each hold their own cache and reintroduce exactly
|
|
48
|
+
* that.
|
|
49
|
+
*/
|
|
50
|
+
export declare const executorClient: ExecutorClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ExecutorClient';
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { Asset, AssetRoute } from '@galacticcouncil/xc-core';
|
|
2
2
|
export declare function toHydrationViaNttTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
3
|
+
/**
|
|
4
|
+
* Executor-delivered variant, offered alongside the self-redeem route above
|
|
5
|
+
* for the same pair - the sender pays for delivery instead of signing a
|
|
6
|
+
* redeem on the destination. Cost is native gas on the source chain.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toHydrationViaNttExecutorTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
3
9
|
export declare function toHydrationViaBasejumpTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { Asset, AssetRoute } from '@galacticcouncil/xc-core';
|
|
2
2
|
export declare function toHydrationViaNttTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
3
|
+
/**
|
|
4
|
+
* Executor-delivered variant, offered alongside the self-redeem route above
|
|
5
|
+
* for the same pair - the sender pays for delivery instead of signing a
|
|
6
|
+
* redeem on the destination.
|
|
7
|
+
*
|
|
8
|
+
* The cost is native gas on the source chain, declared as the destination fee
|
|
9
|
+
* because an erc20 source pays it from a balance the amount never competes
|
|
10
|
+
* for (which is why EvmPlatform.estimateFee leaves the call value out there).
|
|
11
|
+
*/
|
|
12
|
+
export declare function toHydrationViaNttExecutorTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
13
|
+
/**
|
|
14
|
+
* Executor-delivered ntt out of a native gas source.
|
|
15
|
+
*
|
|
16
|
+
* The delivery price & executor cost come out of the very balance being
|
|
17
|
+
* bridged, so they are already folded into the source fee - declaring them
|
|
18
|
+
* as a destination fee too would charge the user twice.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toHydrationViaNttExecutorNativeTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
3
21
|
export declare function toHydrationViaSnowbridgeTemplate(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
4
22
|
export declare function toHydrationViaSnowbridgeV1Template(assetIn: Asset, assetOut: Asset): AssetRoute;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,6 +8,31 @@ export declare function toHubTemplate(asset: Asset, hub: Parachain): AssetRoute;
|
|
|
8
8
|
export declare function toHubExtTemplate(asset: Asset): AssetRoute;
|
|
9
9
|
export declare function toKusamaHubTemplate(asset: Asset, destFee: number, executionFee: number): AssetRoute;
|
|
10
10
|
export declare function toParaErc20Template(asset: Asset, destination: AnyParachain, transferType?: XcmTransferType): AssetRoute;
|
|
11
|
+
/**
|
|
12
|
+
* Both signer origins are served, and the route declares a config for each:
|
|
13
|
+
* an ss58 signer takes the `extrinsic` (evm calls wrapped in `EVM.call`, one
|
|
14
|
+
* signature, fee quoted by the runtime in the sender's fee currency), an h160
|
|
15
|
+
* signer takes the `contract` and signs plain evm transactions.
|
|
16
|
+
*/
|
|
11
17
|
export declare function viaNttTemplate(assetIn: Asset, assetOut: Asset, to: AnyChain): AssetRoute;
|
|
18
|
+
/**
|
|
19
|
+
* Executor-delivered variant, offered alongside the self-redeem route above
|
|
20
|
+
* for the same pair - the sender pays for delivery instead of signing a
|
|
21
|
+
* redeem on the destination.
|
|
22
|
+
*
|
|
23
|
+
* Cost is charged in weth, hydration's evm native gas - `EVM.call { value }`
|
|
24
|
+
* debits the weth balance (asset 20), not hdx - whether the transfer is signed
|
|
25
|
+
* as h160 or wrapped in EVM.call. Ntt still delivers the full amount.
|
|
26
|
+
*
|
|
27
|
+
* Must stay an 18 decimal asset: the builder returns a raw evm value, and hdx
|
|
28
|
+
* would both name the wrong balance and resolve to 12 decimals.
|
|
29
|
+
*
|
|
30
|
+
* A sender holding no weth buys it first: the same destination fee swap the
|
|
31
|
+
* xcm routes use, batched ahead of the calls. Only an ss58 origin needs it -
|
|
32
|
+
* that one pays its extrinsic fee in hdx and can hold zero weth, and is the
|
|
33
|
+
* origin whose config is an extrinsic in the first place. An h160 has nothing
|
|
34
|
+
* to batch into, but pays its own gas in weth, so it already holds some.
|
|
35
|
+
*/
|
|
36
|
+
export declare function viaNttExecutorTemplate(assetIn: Asset, assetOut: Asset, to: AnyChain): AssetRoute;
|
|
12
37
|
export declare function viaSnowbridgeTemplate(assetIn: Asset, assetOut: Asset, to: AnyChain): AssetRoute;
|
|
13
38
|
export declare function viaSnowbridgeV1Template(assetIn: Asset, assetOut: Asset, to: AnyChain): AssetRoute;
|