@across-protocol/sdk 4.2.16-alpha.5 → 4.2.16-alpha.6
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/cjs/arch/evm/SpokeUtils.d.ts +8 -3
- package/dist/cjs/arch/evm/SpokeUtils.js +21 -21
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +8 -6
- package/dist/cjs/arch/svm/SpokeUtils.js +17 -17
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +8 -8
- package/dist/cjs/interfaces/SpokePool.d.ts +7 -8
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +9 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +12 -12
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +9 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +22 -22
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +5 -5
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +9 -4
- package/dist/esm/arch/evm/SpokeUtils.js +24 -24
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -7
- package/dist/esm/arch/svm/SpokeUtils.js +19 -19
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +8 -8
- package/dist/esm/interfaces/SpokePool.d.ts +7 -8
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +12 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +16 -16
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -2
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +11 -8
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +26 -27
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +3 -3
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +9 -4
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +9 -7
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +8 -8
- package/dist/types/interfaces/SpokePool.d.ts +7 -8
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +12 -8
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +11 -8
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/evm/SpokeUtils.ts +42 -27
- package/src/arch/svm/SpokeUtils.ts +25 -33
- package/src/interfaces/SpokePool.ts +8 -8
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +18 -19
- package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +27 -30
- package/src/relayFeeCalculator/relayFeeCalculator.ts +3 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SVMProvider } from "../../arch/svm";
|
|
2
|
-
import {
|
|
2
|
+
import { RelayData } from "../../interfaces";
|
|
3
3
|
import { BigNumber, BigNumberish, SvmAddress, TransactionCostEstimate } from "../../utils";
|
|
4
4
|
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
5
5
|
import { SymbolMappingType } from "./";
|
|
@@ -37,7 +37,7 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
37
37
|
constructor(provider: SVMProvider, symbolMapping: SymbolMappingType, spokePool: SvmAddress, simulatedRelayerAddress: SvmAddress, logger: Logger, coingeckoProApiKey?: string | undefined, fixedGasPrice?: BigNumberish | undefined, coingeckoBaseCurrency?: string);
|
|
38
38
|
/**
|
|
39
39
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
40
|
-
* @param
|
|
40
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
41
41
|
* @param _relayer Relayer address to simulate with.
|
|
42
42
|
* @param options
|
|
43
43
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
@@ -45,7 +45,9 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
45
45
|
* @param options.transport Optional transport object for custom gas price retrieval.
|
|
46
46
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
47
47
|
*/
|
|
48
|
-
getGasCosts(
|
|
48
|
+
getGasCosts(relayData: RelayData & {
|
|
49
|
+
destinationChainId: number;
|
|
50
|
+
}, relayer?: import("../../utils").Address, options?: Partial<{
|
|
49
51
|
gasPrice: BigNumberish;
|
|
50
52
|
gasUnits: BigNumberish;
|
|
51
53
|
baseFeeMultiplier: BigNumber;
|
|
@@ -57,18 +59,19 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
57
59
|
* @param relayer SVM address of the relayer
|
|
58
60
|
* @returns Estimated gas cost in compute units
|
|
59
61
|
*/
|
|
60
|
-
getNativeGasCost(deposit:
|
|
61
|
-
|
|
62
|
+
getNativeGasCost(deposit: RelayData & {
|
|
63
|
+
destinationChainId: number;
|
|
64
|
+
}, _relayer?: import("../../utils").Address): Promise<BigNumber>;
|
|
62
65
|
/**
|
|
63
66
|
* @notice Return the fillRelay transaction for a given deposit
|
|
64
|
-
* @param
|
|
67
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
65
68
|
* @param relayer SVM address of the relayer
|
|
66
69
|
* @returns FillRelay transaction
|
|
67
70
|
*/
|
|
68
|
-
getFillRelayTx(
|
|
71
|
+
getFillRelayTx(relayData: Omit<RelayData, "recipent" | "outputToken"> & {
|
|
72
|
+
destinationChainId: number;
|
|
69
73
|
recipient: SvmAddress;
|
|
70
74
|
outputToken: SvmAddress;
|
|
71
|
-
exclusiveRelayer: SvmAddress;
|
|
72
75
|
}, relayer?: import("../../utils").Address, repaymentChainId?: number, repaymentAddress?: import("../../utils").Address): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, import("@solana/kit").TransactionSigner<string>> & Omit<Readonly<{
|
|
73
76
|
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | import("@solana/kit").IAccountMeta<string>)[]>[];
|
|
74
77
|
version: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,WAAW,EAS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AQ,EAAE,YAAY,CAAC;QACvB,QAAQ,EAAE,YAAY,CAAC;QACvB,iBAAiB,EAAE,SAAS,CAAC;QAC7B,qBAAqB,EAAE,SAAS,CAAC;KAClC,CAAM,GACN,OAAO,CAAC,uBAAuB,CAAC;IA8BnC;;;;;OAKG;IACG,gBAAgB,CACpB,OAAO,EAAE,SAAS,GAAG;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,EACnD,QAAQ,gCAA2F,GAClG,OAAO,CAAC,SAAS,CAAC;IAUrB;;;;;OAKG;IACG,cAAc,CAClB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,aAAa,CAAC,GAAG;QACvD,kBAAkB,EAAE,MAAM,CAAC;QAC3B,SAAS,EAAE,UAAU,CAAC;QACtB,WAAW,EAAE,UAAU,CAAC;KACzB,EACD,OAAO,gCAA+F,EACtG,gBAAgB,SAA+B,EAC/C,gBAAgB,gCAA+F;;;;IAqEjH;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUzD;;;;OAIG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;CAI9C"}
|
|
@@ -74,7 +74,7 @@ export interface Logger {
|
|
|
74
74
|
error: LoggingFunction;
|
|
75
75
|
}
|
|
76
76
|
export declare const DEFAULT_LOGGER: Logger;
|
|
77
|
-
export declare function
|
|
77
|
+
export declare function getDefaultRelayer(chainId?: number): "0x07aE8551Be970cB1cCa11Dd7a11F47Ae82e70E67" | "FmMK62wrtWVb5SVoTZftSCGw3nEDA79hDbZNTRnC1R6t";
|
|
78
78
|
export declare class RelayFeeCalculator {
|
|
79
79
|
private queries;
|
|
80
80
|
private gasDiscountPercent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayFeeCalculator.d.ts","sourceRoot":"","sources":["../../../src/relayFeeCalculator/relayFeeCalculator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,S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AAO,CAAC,uBAAuB;IA0C/B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA8B7B;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CACrB,OAAO,EAAE,OAAO,EAChB,YAAY,CAAC,EAAE,YAAY,EAC3B,gBAAgB,UAAQ,EACxB,cAAc,UAA2F,EACzG,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,YAAY,EACvB,QAAQ,CAAC,EAAE,YAAY,EACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,iBAAiB,CAAC;CAuE9B"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import { BytesLike, Contract, PopulatedTransaction, providers } from "ethers";
|
|
3
3
|
import { CHAIN_IDs } from "../../constants";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Deposit,
|
|
6
|
+
FillStatus,
|
|
7
|
+
FillWithBlock,
|
|
8
|
+
RelayData,
|
|
9
|
+
RelayExecutionEventInfo,
|
|
10
|
+
SpeedUpCommon,
|
|
11
|
+
} from "../../interfaces";
|
|
5
12
|
import {
|
|
6
13
|
bnUint32Max,
|
|
7
14
|
BigNumber,
|
|
15
|
+
EvmAddress,
|
|
8
16
|
toBN,
|
|
9
17
|
bnZero,
|
|
10
18
|
chunk,
|
|
@@ -12,7 +20,6 @@ import {
|
|
|
12
20
|
getRelayDataHash,
|
|
13
21
|
isDefined,
|
|
14
22
|
isUnsafeDepositId,
|
|
15
|
-
isZeroAddress,
|
|
16
23
|
getNetworkName,
|
|
17
24
|
paginatedEventQuery,
|
|
18
25
|
spreadEventWithBlockNumber,
|
|
@@ -22,53 +29,61 @@ import {
|
|
|
22
29
|
|
|
23
30
|
type BlockTag = providers.BlockTag;
|
|
24
31
|
|
|
32
|
+
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> &
|
|
33
|
+
Pick<Deposit, "speedUpSignature"> &
|
|
34
|
+
Partial<SpeedUpCommon> & {
|
|
35
|
+
destinationChainId: number;
|
|
36
|
+
recipient: EvmAddress;
|
|
37
|
+
outputToken: EvmAddress;
|
|
38
|
+
};
|
|
39
|
+
|
|
25
40
|
/**
|
|
26
41
|
* @param spokePool SpokePool Contract instance.
|
|
27
|
-
* @param
|
|
42
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
28
43
|
* @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
|
|
29
44
|
* @returns An Ethers UnsignedTransaction instance.
|
|
30
45
|
*/
|
|
31
46
|
export function populateV3Relay(
|
|
32
47
|
spokePool: Contract,
|
|
33
|
-
|
|
48
|
+
relayData: ProtoFill,
|
|
34
49
|
repaymentAddress: Address,
|
|
35
|
-
repaymentChainId =
|
|
50
|
+
repaymentChainId = relayData.destinationChainId
|
|
36
51
|
): Promise<PopulatedTransaction> {
|
|
37
52
|
assert(
|
|
38
53
|
repaymentAddress.isValidOn(repaymentChainId),
|
|
39
54
|
`Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
|
|
40
55
|
);
|
|
41
|
-
const
|
|
42
|
-
depositor:
|
|
43
|
-
recipient:
|
|
44
|
-
inputToken:
|
|
45
|
-
outputToken:
|
|
46
|
-
inputAmount:
|
|
47
|
-
outputAmount:
|
|
48
|
-
originChainId:
|
|
49
|
-
depositId:
|
|
50
|
-
fillDeadline:
|
|
51
|
-
exclusivityDeadline:
|
|
52
|
-
message:
|
|
53
|
-
exclusiveRelayer:
|
|
56
|
+
const evmRelayData = {
|
|
57
|
+
depositor: relayData.depositor.toBytes32(),
|
|
58
|
+
recipient: relayData.recipient.toBytes32(),
|
|
59
|
+
inputToken: relayData.inputToken.toBytes32(),
|
|
60
|
+
outputToken: relayData.outputToken.toBytes32(),
|
|
61
|
+
inputAmount: relayData.inputAmount,
|
|
62
|
+
outputAmount: relayData.outputAmount,
|
|
63
|
+
originChainId: relayData.originChainId,
|
|
64
|
+
depositId: relayData.depositId,
|
|
65
|
+
fillDeadline: relayData.fillDeadline,
|
|
66
|
+
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
67
|
+
message: relayData.message,
|
|
68
|
+
exclusiveRelayer: relayData.exclusiveRelayer.toBytes32(),
|
|
54
69
|
};
|
|
55
70
|
|
|
56
|
-
if (isDefined(
|
|
57
|
-
assert(isDefined(
|
|
58
|
-
assert(isDefined(
|
|
59
|
-
assert(isDefined(
|
|
71
|
+
if (isDefined(relayData.speedUpSignature)) {
|
|
72
|
+
assert(isDefined(relayData.updatedRecipient) && !relayData.updatedRecipient.isZeroAddress());
|
|
73
|
+
assert(isDefined(relayData.updatedOutputAmount));
|
|
74
|
+
assert(isDefined(relayData.updatedMessage));
|
|
60
75
|
return spokePool.populateTransaction.fillRelayWithUpdatedDeposit(
|
|
61
76
|
relayData,
|
|
62
77
|
repaymentChainId,
|
|
63
78
|
repaymentAddress.toBytes32(),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
relayData.updatedOutputAmount,
|
|
80
|
+
relayData.updatedRecipient.toBytes32(),
|
|
81
|
+
relayData.updatedMessage,
|
|
82
|
+
relayData.speedUpSignature
|
|
68
83
|
);
|
|
69
84
|
}
|
|
70
85
|
|
|
71
|
-
return spokePool.populateTransaction.fillRelay(
|
|
86
|
+
return spokePool.populateTransaction.fillRelay(evmRelayData, repaymentChainId, repaymentAddress.toBytes32());
|
|
72
87
|
}
|
|
73
88
|
|
|
74
89
|
/**
|
|
@@ -25,14 +25,7 @@ import assert from "assert";
|
|
|
25
25
|
import { arrayify, hexZeroPad, hexlify } from "ethers/lib/utils";
|
|
26
26
|
import { Logger } from "winston";
|
|
27
27
|
import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
|
|
28
|
-
import {
|
|
29
|
-
Deposit,
|
|
30
|
-
DepositWithBlock,
|
|
31
|
-
FillStatus,
|
|
32
|
-
FillWithBlock,
|
|
33
|
-
RelayData,
|
|
34
|
-
RelayExecutionEventInfo,
|
|
35
|
-
} from "../../interfaces";
|
|
28
|
+
import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
|
|
36
29
|
import {
|
|
37
30
|
BigNumber,
|
|
38
31
|
EvmAddress,
|
|
@@ -62,6 +55,12 @@ import { SVMEventNames, SVMProvider } from "./types";
|
|
|
62
55
|
*/
|
|
63
56
|
export const SLOT_DURATION_MS = 400;
|
|
64
57
|
|
|
58
|
+
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
|
|
59
|
+
destinationChainId: number;
|
|
60
|
+
recipient: SvmAddress;
|
|
61
|
+
outputToken: SvmAddress;
|
|
62
|
+
};
|
|
63
|
+
|
|
65
64
|
/**
|
|
66
65
|
* Retrieves the chain time at a particular slot.
|
|
67
66
|
*/
|
|
@@ -378,25 +377,18 @@ export async function findFillEvent(
|
|
|
378
377
|
|
|
379
378
|
/**
|
|
380
379
|
* @param spokePool Address (program ID) of the SvmSpoke.
|
|
381
|
-
* @param
|
|
380
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
382
381
|
* @param relayer Address of the relayer filling the deposit.
|
|
383
382
|
* @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
|
|
384
383
|
* @returns An Ethers UnsignedTransaction instance.
|
|
385
384
|
*/
|
|
386
385
|
export async function fillRelayInstruction(
|
|
387
386
|
spokePool: SvmAddress,
|
|
388
|
-
|
|
389
|
-
Deposit,
|
|
390
|
-
"recipient" | "outputToken" | "exclusiveRelayer" | "messageHash" | "fromLiteChain" | "toLiteChain"
|
|
391
|
-
> & {
|
|
392
|
-
recipient: SvmAddress;
|
|
393
|
-
outputToken: SvmAddress;
|
|
394
|
-
exclusiveRelayer: SvmAddress;
|
|
395
|
-
},
|
|
387
|
+
relayData: ProtoFill,
|
|
396
388
|
signer: TransactionSigner<string>,
|
|
397
389
|
recipientTokenAccount: Address<string>,
|
|
398
390
|
repaymentAddress: EvmAddress | SvmAddress = SvmAddress.from(signer.address),
|
|
399
|
-
repaymentChainId =
|
|
391
|
+
repaymentChainId = relayData.destinationChainId
|
|
400
392
|
) {
|
|
401
393
|
const program = toAddress(spokePool);
|
|
402
394
|
|
|
@@ -405,22 +397,22 @@ export async function fillRelayInstruction(
|
|
|
405
397
|
`Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
|
|
406
398
|
);
|
|
407
399
|
|
|
408
|
-
const _relayDataHash = getRelayDataHash(
|
|
400
|
+
const _relayDataHash = getRelayDataHash(relayData, relayData.destinationChainId);
|
|
409
401
|
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
410
402
|
|
|
411
403
|
const relayer = SvmAddress.from(signer.address);
|
|
412
404
|
|
|
413
405
|
// Create ATA for the relayer and recipient token accounts
|
|
414
|
-
const relayerTokenAccount = await getAssociatedTokenAddress(relayer,
|
|
406
|
+
const relayerTokenAccount = await getAssociatedTokenAddress(relayer, relayData.outputToken);
|
|
415
407
|
|
|
416
408
|
const [statePda, fillStatusPda, eventAuthority] = await Promise.all([
|
|
417
409
|
getStatePda(program),
|
|
418
|
-
getFillStatusPda(program,
|
|
410
|
+
getFillStatusPda(program, relayData, relayData.destinationChainId),
|
|
419
411
|
getEventAuthority(program),
|
|
420
412
|
]);
|
|
421
413
|
|
|
422
414
|
const depositIdBuffer = new Uint8Array(32);
|
|
423
|
-
const shortenedBuffer = new Uint8Array(Buffer.from(
|
|
415
|
+
const shortenedBuffer = new Uint8Array(Buffer.from(relayData.depositId.toHexString().slice(2), "hex"));
|
|
424
416
|
depositIdBuffer.set(shortenedBuffer, 32 - shortenedBuffer.length);
|
|
425
417
|
|
|
426
418
|
const delegatePda = await getFillRelayDelegatePda(
|
|
@@ -431,11 +423,11 @@ export async function fillRelayInstruction(
|
|
|
431
423
|
);
|
|
432
424
|
|
|
433
425
|
const [recipient, outputToken, exclusiveRelayer, depositor, inputToken] = [
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
426
|
+
relayData.recipient,
|
|
427
|
+
relayData.outputToken,
|
|
428
|
+
relayData.exclusiveRelayer,
|
|
429
|
+
relayData.depositor,
|
|
430
|
+
relayData.inputToken,
|
|
439
431
|
].map(toAddress);
|
|
440
432
|
|
|
441
433
|
return SvmSpokeClient.getFillRelayInstruction({
|
|
@@ -455,13 +447,13 @@ export async function fillRelayInstruction(
|
|
|
455
447
|
exclusiveRelayer,
|
|
456
448
|
inputToken,
|
|
457
449
|
outputToken,
|
|
458
|
-
inputAmount:
|
|
459
|
-
outputAmount:
|
|
460
|
-
originChainId: BigInt(
|
|
461
|
-
fillDeadline:
|
|
462
|
-
exclusivityDeadline:
|
|
450
|
+
inputAmount: relayData.inputAmount.toBigInt(),
|
|
451
|
+
outputAmount: relayData.outputAmount.toBigInt(),
|
|
452
|
+
originChainId: BigInt(relayData.originChainId),
|
|
453
|
+
fillDeadline: relayData.fillDeadline,
|
|
454
|
+
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
463
455
|
depositId: depositIdBuffer,
|
|
464
|
-
message: new Uint8Array(Buffer.from(
|
|
456
|
+
message: new Uint8Array(Buffer.from(relayData.message.slice(2), "hex")),
|
|
465
457
|
}),
|
|
466
458
|
repaymentChainId: some(BigInt(repaymentChainId)),
|
|
467
459
|
repaymentAddress: toAddress(repaymentAddress),
|
|
@@ -18,14 +18,17 @@ export interface RelayData {
|
|
|
18
18
|
exclusivityDeadline: number;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export interface
|
|
21
|
+
export interface SpeedUpCommon {
|
|
22
|
+
updatedRecipient: Address;
|
|
23
|
+
updatedOutputAmount: BigNumber;
|
|
24
|
+
updatedMessage: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Deposit extends RelayData, Partial<SpeedUpCommon> {
|
|
22
28
|
messageHash: string;
|
|
23
29
|
destinationChainId: number;
|
|
24
30
|
quoteTimestamp: number;
|
|
25
31
|
speedUpSignature?: string;
|
|
26
|
-
updatedRecipient?: Address;
|
|
27
|
-
updatedOutputAmount?: BigNumber;
|
|
28
|
-
updatedMessage?: string;
|
|
29
32
|
fromLiteChain: boolean;
|
|
30
33
|
toLiteChain: boolean;
|
|
31
34
|
}
|
|
@@ -78,14 +81,11 @@ export interface EnabledDepositRoute {
|
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
export interface EnabledDepositRouteWithBlock extends EnabledDepositRoute, SortableEvent {}
|
|
81
|
-
export interface SpeedUp {
|
|
84
|
+
export interface SpeedUp extends SpeedUpCommon {
|
|
82
85
|
depositor: EvmAddress;
|
|
83
86
|
depositorSignature: string;
|
|
84
87
|
depositId: BigNumber;
|
|
85
88
|
originChainId: number;
|
|
86
|
-
updatedRecipient: Address;
|
|
87
|
-
updatedOutputAmount: BigNumber;
|
|
88
|
-
updatedMessage: string;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { L2Provider } from "@eth-optimism/sdk/dist/interfaces/l2-provider";
|
|
2
2
|
import { isL2Provider as isOptimismL2Provider } from "@eth-optimism/sdk/dist/l2-provider";
|
|
3
|
-
|
|
4
3
|
import { PopulatedTransaction, providers, VoidSigner } from "ethers";
|
|
5
4
|
import { Coingecko } from "../../coingecko";
|
|
6
5
|
import { CHAIN_IDs } from "../../constants";
|
|
7
|
-
import {
|
|
6
|
+
import { RelayData } from "../../interfaces";
|
|
8
7
|
import { SpokePool, SpokePool__factory } from "../../typechain";
|
|
9
8
|
import { populateV3Relay } from "../../arch/evm";
|
|
10
9
|
import {
|
|
@@ -20,7 +19,7 @@ import {
|
|
|
20
19
|
Address,
|
|
21
20
|
} from "../../utils";
|
|
22
21
|
import assert from "assert";
|
|
23
|
-
import { Logger, QueryInterface,
|
|
22
|
+
import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
|
|
24
23
|
import { Transport } from "viem";
|
|
25
24
|
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
26
25
|
import { EvmProvider } from "../../arch/evm/types";
|
|
@@ -65,7 +64,7 @@ export class QueryBase implements QueryInterface {
|
|
|
65
64
|
|
|
66
65
|
/**
|
|
67
66
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
68
|
-
* @param
|
|
67
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
69
68
|
* @param relayerAddress Relayer address to simulate with.
|
|
70
69
|
* @param options
|
|
71
70
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
@@ -74,8 +73,8 @@ export class QueryBase implements QueryInterface {
|
|
|
74
73
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
75
74
|
*/
|
|
76
75
|
async getGasCosts(
|
|
77
|
-
|
|
78
|
-
relayer = toAddressType(
|
|
76
|
+
relayData: RelayData & { destinationChainId: number },
|
|
77
|
+
relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId),
|
|
79
78
|
options: Partial<{
|
|
80
79
|
gasPrice: BigNumberish;
|
|
81
80
|
gasUnits: BigNumberish;
|
|
@@ -94,12 +93,12 @@ export class QueryBase implements QueryInterface {
|
|
|
94
93
|
transport,
|
|
95
94
|
} = options;
|
|
96
95
|
|
|
97
|
-
const { recipient, outputToken, exclusiveRelayer } =
|
|
96
|
+
const { recipient, outputToken, exclusiveRelayer } = relayData;
|
|
98
97
|
assert(recipient.isEVM(), `getGasCosts: recipient not an EVM address (${recipient})`);
|
|
99
98
|
assert(outputToken.isEVM(), `getGasCosts: outputToken not an EVM address (${outputToken})`);
|
|
100
99
|
assert(exclusiveRelayer.isEVM(), `getGasCosts: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
|
|
101
100
|
|
|
102
|
-
const tx = await this.getUnsignedTxFromDeposit({ ...
|
|
101
|
+
const tx = await this.getUnsignedTxFromDeposit({ ...relayData, recipient, outputToken, exclusiveRelayer }, relayer);
|
|
103
102
|
const {
|
|
104
103
|
nativeGasCost,
|
|
105
104
|
tokenGasCost,
|
|
@@ -124,38 +123,38 @@ export class QueryBase implements QueryInterface {
|
|
|
124
123
|
|
|
125
124
|
/**
|
|
126
125
|
* @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
|
|
127
|
-
* @param
|
|
126
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
128
127
|
* @param relayer Sender of PopulatedTransaction
|
|
129
128
|
* @returns PopulatedTransaction
|
|
130
129
|
*/
|
|
131
130
|
getUnsignedTxFromDeposit(
|
|
132
|
-
|
|
131
|
+
relayData: Omit<RelayData, "recipient" | "outputToken"> & {
|
|
132
|
+
destinationChainId: number;
|
|
133
133
|
recipient: EvmAddress;
|
|
134
134
|
outputToken: EvmAddress;
|
|
135
|
-
exclusiveRelayer: EvmAddress;
|
|
136
135
|
},
|
|
137
|
-
relayer = toAddressType(
|
|
136
|
+
relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
|
|
138
137
|
): Promise<PopulatedTransaction> {
|
|
139
|
-
return populateV3Relay(this.spokePool,
|
|
138
|
+
return populateV3Relay(this.spokePool, relayData, relayer);
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
/**
|
|
143
142
|
* @notice Return the gas cost of a simulated transaction
|
|
144
|
-
* @param
|
|
143
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
145
144
|
* @param relayer Sender of PopulatedTransaction
|
|
146
145
|
* @returns Estimated gas cost based on ethers.VoidSigner's gas estimation
|
|
147
146
|
*/
|
|
148
147
|
async getNativeGasCost(
|
|
149
|
-
|
|
150
|
-
relayer = toAddressType(
|
|
148
|
+
relayData: RelayData & { destinationChainId: number },
|
|
149
|
+
relayer = toAddressType(getDefaultRelayer(relayData.destinationChainId), relayData.destinationChainId)
|
|
151
150
|
): Promise<BigNumber> {
|
|
152
|
-
const { recipient, outputToken, exclusiveRelayer } =
|
|
151
|
+
const { recipient, outputToken, exclusiveRelayer } = relayData;
|
|
153
152
|
assert(recipient.isEVM(), `getNativeGasCost: recipient not an EVM address (${recipient})`);
|
|
154
153
|
assert(outputToken.isEVM(), `getNativeGasCost: outputToken not an EVM address (${outputToken})`);
|
|
155
154
|
assert(exclusiveRelayer.isEVM(), `getNativeGasCost: exclusiveRelayer not an EVM address (${exclusiveRelayer})`);
|
|
156
155
|
|
|
157
156
|
const unsignedTx = await this.getUnsignedTxFromDeposit(
|
|
158
|
-
{ ...
|
|
157
|
+
{ ...relayData, recipient, outputToken, exclusiveRelayer },
|
|
159
158
|
relayer
|
|
160
159
|
);
|
|
161
160
|
const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
@@ -172,7 +171,7 @@ export class QueryBase implements QueryInterface {
|
|
|
172
171
|
*/
|
|
173
172
|
async getOpStackL1DataFee(
|
|
174
173
|
unsignedTx: PopulatedTransaction,
|
|
175
|
-
relayer = toAddressType(
|
|
174
|
+
relayer = toAddressType(getDefaultRelayer(unsignedTx.chainId), CHAIN_IDs.MAINNET),
|
|
176
175
|
options: Partial<{
|
|
177
176
|
opStackL2GasUnits: BigNumberish;
|
|
178
177
|
opStackL1DataFeeMultiplier: BigNumber;
|
|
@@ -7,7 +7,7 @@ import { CUSTOM_GAS_TOKENS } from "../../constants";
|
|
|
7
7
|
import { chainIsOPStack, isDefined, chainIsSvm, SvmAddress } from "../../utils";
|
|
8
8
|
import { QueryBase } from "./baseQuery";
|
|
9
9
|
import { SVMProvider as svmProvider } from "../../arch/svm";
|
|
10
|
-
import { DEFAULT_LOGGER,
|
|
10
|
+
import { DEFAULT_LOGGER, getDefaultRelayer, Logger } from "../relayFeeCalculator";
|
|
11
11
|
import { CustomGasTokenQueries } from "./customGasToken";
|
|
12
12
|
import { SvmQuery } from "./svmQuery";
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ export class QueryBase__factory {
|
|
|
25
25
|
provider: providers.Provider | svmProvider,
|
|
26
26
|
symbolMapping = TOKEN_SYMBOLS_MAP,
|
|
27
27
|
spokePoolAddress = getDeployedAddress("SpokePool", chainId),
|
|
28
|
-
simulatedRelayerAddress =
|
|
28
|
+
simulatedRelayerAddress = getDefaultRelayer(chainId),
|
|
29
29
|
coingeckoProApiKey?: string,
|
|
30
30
|
logger: Logger = DEFAULT_LOGGER,
|
|
31
31
|
coingeckoBaseCurrency = "eth"
|