@across-protocol/sdk 4.3.132 → 4.3.134-alpha.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/cjs/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/cjs/src/gasPriceOracle/index.js.map +1 -1
- package/dist/cjs/src/relayFeeCalculator/chain-queries/baseQuery.d.ts +3 -9
- package/dist/cjs/src/relayFeeCalculator/chain-queries/baseQuery.js +5 -12
- package/dist/cjs/src/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/esm/src/gasPriceOracle/index.js.map +1 -1
- package/dist/esm/src/relayFeeCalculator/chain-queries/baseQuery.d.ts +3 -9
- package/dist/esm/src/relayFeeCalculator/chain-queries/baseQuery.js +5 -12
- package/dist/esm/src/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/types/src/gasPriceOracle/index.d.ts +1 -1
- package/dist/types/src/gasPriceOracle/index.d.ts.map +1 -1
- package/dist/types/src/relayFeeCalculator/chain-queries/baseQuery.d.ts +3 -9
- package/dist/types/src/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/gasPriceOracle/index.ts +1 -1
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +26 -30
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getGasPriceEstimate } from "./oracle";
|
|
1
|
+
export { getGasPriceEstimate, GasPriceEstimateOptions } from "./oracle";
|
|
2
2
|
export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwE;AAA/D,6GAAA,mBAAmB,OAAA"}
|
|
@@ -4,7 +4,7 @@ import { RelayData } from "../../interfaces";
|
|
|
4
4
|
import { SpokePool } from "../../typechain";
|
|
5
5
|
import { BigNumberish, EvmAddress, TransactionCostEstimate, BigNumber, Address } from "../../utils";
|
|
6
6
|
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
7
|
-
import {
|
|
7
|
+
import { GasPriceEstimateOptions } from "../../gasPriceOracle";
|
|
8
8
|
import { EvmProvider } from "../../arch/evm/types";
|
|
9
9
|
export type SymbolMappingType = Record<string, {
|
|
10
10
|
addresses: Record<number, string>;
|
|
@@ -23,13 +23,10 @@ export declare class QueryBase implements QueryInterface {
|
|
|
23
23
|
constructor(provider: EvmProvider, symbolMapping: SymbolMappingType, spokePoolAddress: string, simulatedRelayerAddress: EvmAddress, logger: Logger, coingeckoProApiKey?: string | undefined, fixedGasPrice?: BigNumberish | undefined, coingeckoBaseCurrency?: string);
|
|
24
24
|
getGasCosts(relayData: RelayData & {
|
|
25
25
|
destinationChainId: number;
|
|
26
|
-
}, relayer?: Address, options?: Partial<{
|
|
26
|
+
}, relayer?: Address, options?: Partial<GasPriceEstimateOptions & {
|
|
27
27
|
gasPrice: BigNumberish;
|
|
28
28
|
gasUnits: BigNumberish;
|
|
29
|
-
baseFeeMultiplier: BigNumber;
|
|
30
|
-
priorityFeeMultiplier: BigNumber;
|
|
31
29
|
opStackL1GasCostMultiplier: BigNumber;
|
|
32
|
-
transport: Transport;
|
|
33
30
|
}>): Promise<TransactionCostEstimate>;
|
|
34
31
|
getUnsignedTxFromDeposit(relayData: Omit<RelayData, "recipient" | "outputToken"> & {
|
|
35
32
|
destinationChainId: number;
|
|
@@ -44,13 +41,10 @@ export declare class QueryBase implements QueryInterface {
|
|
|
44
41
|
opStackL2GasUnits: BigNumberish;
|
|
45
42
|
opStackL1DataFeeMultiplier: BigNumber;
|
|
46
43
|
}>): Promise<BigNumber>;
|
|
47
|
-
estimateGas(unsignedTx: PopulatedTransaction, senderAddress: Address, provider: providers.Provider | L2Provider<providers.Provider>, options?: Partial<{
|
|
44
|
+
estimateGas(unsignedTx: PopulatedTransaction, senderAddress: Address, provider: providers.Provider | L2Provider<providers.Provider>, options?: Partial<GasPriceEstimateOptions & {
|
|
48
45
|
gasPrice: BigNumberish;
|
|
49
46
|
gasUnits: BigNumberish;
|
|
50
|
-
baseFeeMultiplier: BigNumber;
|
|
51
|
-
priorityFeeMultiplier: BigNumber;
|
|
52
47
|
opStackL1GasCostMultiplier: BigNumber;
|
|
53
|
-
transport: Transport;
|
|
54
48
|
}>): Promise<TransactionCostEstimate>;
|
|
55
49
|
getTokenPrice(tokenSymbol: string): Promise<number>;
|
|
56
50
|
}
|
|
@@ -28,13 +28,13 @@ var QueryBase = (function () {
|
|
|
28
28
|
}
|
|
29
29
|
QueryBase.prototype.getGasCosts = function (relayData_1) {
|
|
30
30
|
return tslib_1.__awaiter(this, arguments, void 0, function (relayData, relayer, options) {
|
|
31
|
-
var _a, gasPrice, gasUnits,
|
|
31
|
+
var _a, gasPrice, gasUnits, opStackL1GasCostMultiplier, recipient, outputToken, exclusiveRelayer, tx, _b, nativeGasCost, tokenGasCost, impliedGasPrice, opStackL1GasCost;
|
|
32
32
|
if (relayer === void 0) { relayer = (0, relayFeeCalculator_1.getDefaultRelayer)(relayData.destinationChainId); }
|
|
33
33
|
if (options === void 0) { options = {}; }
|
|
34
34
|
return tslib_1.__generator(this, function (_c) {
|
|
35
35
|
switch (_c.label) {
|
|
36
36
|
case 0:
|
|
37
|
-
_a = options.gasPrice, gasPrice = _a === void 0 ? this.fixedGasPrice : _a, gasUnits = options.gasUnits,
|
|
37
|
+
_a = options.gasPrice, gasPrice = _a === void 0 ? this.fixedGasPrice : _a, gasUnits = options.gasUnits, opStackL1GasCostMultiplier = options.opStackL1GasCostMultiplier;
|
|
38
38
|
recipient = relayData.recipient, outputToken = relayData.outputToken, exclusiveRelayer = relayData.exclusiveRelayer;
|
|
39
39
|
(0, assert_1.default)(recipient.isEVM(), "getGasCosts: recipient not an EVM address (".concat(recipient, ")"));
|
|
40
40
|
(0, assert_1.default)(outputToken.isEVM(), "getGasCosts: outputToken not an EVM address (".concat(outputToken, ")"));
|
|
@@ -42,14 +42,7 @@ var QueryBase = (function () {
|
|
|
42
42
|
return [4, this.getUnsignedTxFromDeposit(tslib_1.__assign(tslib_1.__assign({}, relayData), { recipient: recipient, outputToken: outputToken, exclusiveRelayer: exclusiveRelayer }), relayer)];
|
|
43
43
|
case 1:
|
|
44
44
|
tx = _c.sent();
|
|
45
|
-
return [4, this.estimateGas(tx, relayer, this.provider, {
|
|
46
|
-
gasPrice: gasPrice,
|
|
47
|
-
gasUnits: gasUnits,
|
|
48
|
-
baseFeeMultiplier: baseFeeMultiplier,
|
|
49
|
-
priorityFeeMultiplier: priorityFeeMultiplier,
|
|
50
|
-
opStackL1GasCostMultiplier: opStackL1GasCostMultiplier,
|
|
51
|
-
transport: transport,
|
|
52
|
-
})];
|
|
45
|
+
return [4, this.estimateGas(tx, relayer, this.provider, tslib_1.__assign(tslib_1.__assign({}, options), { gasPrice: gasPrice, gasUnits: gasUnits, opStackL1GasCostMultiplier: opStackL1GasCostMultiplier }))];
|
|
53
46
|
case 2:
|
|
54
47
|
_b = _c.sent(), nativeGasCost = _b.nativeGasCost, tokenGasCost = _b.tokenGasCost, impliedGasPrice = _b.gasPrice, opStackL1GasCost = _b.opStackL1GasCost;
|
|
55
48
|
return [2, {
|
|
@@ -102,7 +95,7 @@ var QueryBase = (function () {
|
|
|
102
95
|
chainId = (_c.sent()).chainId;
|
|
103
96
|
(0, assert_1.default)((0, l2_provider_1.isL2Provider)(this.provider), "Unexpected provider for chain ID ".concat(chainId, "."));
|
|
104
97
|
voidSigner = new ethers_1.VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
105
|
-
return [4, voidSigner.populateTransaction(tslib_1.__assign(tslib_1.__assign({}, unsignedTx), { gasLimit: opStackL2GasUnits }))];
|
|
98
|
+
return [4, voidSigner.populateTransaction(tslib_1.__assign(tslib_1.__assign({}, unsignedTx), { nonce: 0xffffffff, gasLimit: opStackL2GasUnits }))];
|
|
106
99
|
case 2:
|
|
107
100
|
populatedTransaction = _c.sent();
|
|
108
101
|
return [4, this.provider.estimateL1GasCost(populatedTransaction)];
|
|
@@ -129,7 +122,7 @@ var QueryBase = (function () {
|
|
|
129
122
|
gasUnits ? Promise.resolve(utils_1.BigNumber.from(gasUnits)) : voidSigner.estimateGas(unsignedTx),
|
|
130
123
|
_gasPrice
|
|
131
124
|
? Promise.resolve({ maxFeePerGas: _gasPrice })
|
|
132
|
-
: (0, gasPriceOracle_1.getGasPriceEstimate)(provider, { chainId: chainId, baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier, transport: transport, unsignedTx: unsignedTx }),
|
|
125
|
+
: (0, gasPriceOracle_1.getGasPriceEstimate)(provider, tslib_1.__assign(tslib_1.__assign({}, options), { chainId: chainId, baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier, transport: transport, unsignedTx: unsignedTx })),
|
|
133
126
|
];
|
|
134
127
|
return [4, Promise.all(queries)];
|
|
135
128
|
case 2:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseQuery.js","sourceRoot":"","sources":["../../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":";;;;AACA,kEAA0F;AAC1F,iCAAqE;AACrE,6CAA4C;AAC5C,6CAA4C;AAE5C,6CAAgE;AAChE,sCAAiD;AACjD,qCAUqB;AACrB,0DAA4B;AAC5B,4DAAkF;
|
|
1
|
+
{"version":3,"file":"baseQuery.js","sourceRoot":"","sources":["../../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":";;;;AACA,kEAA0F;AAC1F,iCAAqE;AACrE,6CAA4C;AAC5C,6CAA4C;AAE5C,6CAAgE;AAChE,sCAAiD;AACjD,qCAUqB;AACrB,0DAA4B;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5D,IAAI,CAAC,qBAAqB,CAC3B,EAAA;;wBAHK,KAAY,SAGjB,EAHQ,KAAK,QAAA;wBAId,WAAO,KAAK,EAAC;;;;KACd;IACH,gBAAC;AAAD,CAAC,AApPD,IAoPC;AApPY,8BAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getGasPriceEstimate } from "./oracle";
|
|
1
|
+
export { getGasPriceEstimate, GasPriceEstimateOptions } from "./oracle";
|
|
2
2
|
export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA2B,MAAM,UAAU,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { RelayData } from "../../interfaces";
|
|
|
4
4
|
import { SpokePool } from "../../typechain";
|
|
5
5
|
import { BigNumberish, EvmAddress, TransactionCostEstimate, BigNumber, Address } from "../../utils";
|
|
6
6
|
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
7
|
-
import {
|
|
7
|
+
import { GasPriceEstimateOptions } from "../../gasPriceOracle";
|
|
8
8
|
import { EvmProvider } from "../../arch/evm/types";
|
|
9
9
|
export type SymbolMappingType = Record<string, {
|
|
10
10
|
addresses: Record<number, string>;
|
|
@@ -48,13 +48,10 @@ export declare class QueryBase implements QueryInterface {
|
|
|
48
48
|
*/
|
|
49
49
|
getGasCosts(relayData: RelayData & {
|
|
50
50
|
destinationChainId: number;
|
|
51
|
-
}, relayer?: Address, options?: Partial<{
|
|
51
|
+
}, relayer?: Address, options?: Partial<GasPriceEstimateOptions & {
|
|
52
52
|
gasPrice: BigNumberish;
|
|
53
53
|
gasUnits: BigNumberish;
|
|
54
|
-
baseFeeMultiplier: BigNumber;
|
|
55
|
-
priorityFeeMultiplier: BigNumber;
|
|
56
54
|
opStackL1GasCostMultiplier: BigNumber;
|
|
57
|
-
transport: Transport;
|
|
58
55
|
}>): Promise<TransactionCostEstimate>;
|
|
59
56
|
/**
|
|
60
57
|
* @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
|
|
@@ -106,13 +103,10 @@ export declare class QueryBase implements QueryInterface {
|
|
|
106
103
|
* @param options.transport A custom transport object for custom gas price retrieval.
|
|
107
104
|
* @returns Estimated cost in units of gas and the underlying gas token (gasPrice * estimatedGasUnits).
|
|
108
105
|
*/
|
|
109
|
-
estimateGas(unsignedTx: PopulatedTransaction, senderAddress: Address, provider: providers.Provider | L2Provider<providers.Provider>, options?: Partial<{
|
|
106
|
+
estimateGas(unsignedTx: PopulatedTransaction, senderAddress: Address, provider: providers.Provider | L2Provider<providers.Provider>, options?: Partial<GasPriceEstimateOptions & {
|
|
110
107
|
gasPrice: BigNumberish;
|
|
111
108
|
gasUnits: BigNumberish;
|
|
112
|
-
baseFeeMultiplier: BigNumber;
|
|
113
|
-
priorityFeeMultiplier: BigNumber;
|
|
114
109
|
opStackL1GasCostMultiplier: BigNumber;
|
|
115
|
-
transport: Transport;
|
|
116
110
|
}>): Promise<TransactionCostEstimate>;
|
|
117
111
|
/**
|
|
118
112
|
* Retrieves the current price of a token
|
|
@@ -50,13 +50,13 @@ var QueryBase = /** @class */ (function () {
|
|
|
50
50
|
*/
|
|
51
51
|
QueryBase.prototype.getGasCosts = function (relayData_1) {
|
|
52
52
|
return __awaiter(this, arguments, void 0, function (relayData, relayer, options) {
|
|
53
|
-
var _a, gasPrice, gasUnits,
|
|
53
|
+
var _a, gasPrice, gasUnits, opStackL1GasCostMultiplier, recipient, outputToken, exclusiveRelayer, tx, _b, nativeGasCost, tokenGasCost, impliedGasPrice, opStackL1GasCost;
|
|
54
54
|
if (relayer === void 0) { relayer = getDefaultRelayer(relayData.destinationChainId); }
|
|
55
55
|
if (options === void 0) { options = {}; }
|
|
56
56
|
return __generator(this, function (_c) {
|
|
57
57
|
switch (_c.label) {
|
|
58
58
|
case 0:
|
|
59
|
-
_a = options.gasPrice, gasPrice = _a === void 0 ? this.fixedGasPrice : _a, gasUnits = options.gasUnits,
|
|
59
|
+
_a = options.gasPrice, gasPrice = _a === void 0 ? this.fixedGasPrice : _a, gasUnits = options.gasUnits, opStackL1GasCostMultiplier = options.opStackL1GasCostMultiplier;
|
|
60
60
|
recipient = relayData.recipient, outputToken = relayData.outputToken, exclusiveRelayer = relayData.exclusiveRelayer;
|
|
61
61
|
assert(recipient.isEVM(), "getGasCosts: recipient not an EVM address (".concat(recipient, ")"));
|
|
62
62
|
assert(outputToken.isEVM(), "getGasCosts: outputToken not an EVM address (".concat(outputToken, ")"));
|
|
@@ -64,14 +64,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
64
64
|
return [4 /*yield*/, this.getUnsignedTxFromDeposit(__assign(__assign({}, relayData), { recipient: recipient, outputToken: outputToken, exclusiveRelayer: exclusiveRelayer }), relayer)];
|
|
65
65
|
case 1:
|
|
66
66
|
tx = _c.sent();
|
|
67
|
-
return [4 /*yield*/, this.estimateGas(tx, relayer, this.provider, {
|
|
68
|
-
gasPrice: gasPrice,
|
|
69
|
-
gasUnits: gasUnits,
|
|
70
|
-
baseFeeMultiplier: baseFeeMultiplier,
|
|
71
|
-
priorityFeeMultiplier: priorityFeeMultiplier,
|
|
72
|
-
opStackL1GasCostMultiplier: opStackL1GasCostMultiplier,
|
|
73
|
-
transport: transport,
|
|
74
|
-
})];
|
|
67
|
+
return [4 /*yield*/, this.estimateGas(tx, relayer, this.provider, __assign(__assign({}, options), { gasPrice: gasPrice, gasUnits: gasUnits, opStackL1GasCostMultiplier: opStackL1GasCostMultiplier }))];
|
|
75
68
|
case 2:
|
|
76
69
|
_b = _c.sent(), nativeGasCost = _b.nativeGasCost, tokenGasCost = _b.tokenGasCost, impliedGasPrice = _b.gasPrice, opStackL1GasCost = _b.opStackL1GasCost;
|
|
77
70
|
return [2 /*return*/, {
|
|
@@ -150,7 +143,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
150
143
|
chainId = (_c.sent()).chainId;
|
|
151
144
|
assert(isOptimismL2Provider(this.provider), "Unexpected provider for chain ID ".concat(chainId, "."));
|
|
152
145
|
voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
153
|
-
return [4 /*yield*/, voidSigner.populateTransaction(__assign(__assign({}, unsignedTx), { gasLimit: opStackL2GasUnits }))];
|
|
146
|
+
return [4 /*yield*/, voidSigner.populateTransaction(__assign(__assign({}, unsignedTx), { nonce: 0xffffffff, gasLimit: opStackL2GasUnits }))];
|
|
154
147
|
case 2:
|
|
155
148
|
populatedTransaction = _c.sent();
|
|
156
149
|
return [4 /*yield*/, this.provider.estimateL1GasCost(populatedTransaction)];
|
|
@@ -188,7 +181,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
188
181
|
gasUnits ? Promise.resolve(BigNumber.from(gasUnits)) : voidSigner.estimateGas(unsignedTx),
|
|
189
182
|
_gasPrice
|
|
190
183
|
? Promise.resolve({ maxFeePerGas: _gasPrice })
|
|
191
|
-
: getGasPriceEstimate(provider, { chainId: chainId, baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier, transport: transport, unsignedTx: unsignedTx }),
|
|
184
|
+
: getGasPriceEstimate(provider, __assign(__assign({}, options), { chainId: chainId, baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier, transport: transport, unsignedTx: unsignedTx })),
|
|
192
185
|
];
|
|
193
186
|
return [4 /*yield*/, Promise.all(queries)];
|
|
194
187
|
case 2:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseQuery.js","sourceRoot":"","sources":["../../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,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AC,qBAAqB,CAC3B,EAAA;;wBAHK,KAAY,SAGjB,EAHQ,KAAK,QAAA;wBAId,sBAAO,KAAK,EAAC;;;;KACd;IACH,gBAAC;AAAD,CAAC,AApPD,IAoPC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { RelayData } from "../../interfaces";
|
|
|
4
4
|
import { SpokePool } from "../../typechain";
|
|
5
5
|
import { BigNumberish, EvmAddress, TransactionCostEstimate, BigNumber, Address } from "../../utils";
|
|
6
6
|
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
7
|
-
import {
|
|
7
|
+
import { GasPriceEstimateOptions } from "../../gasPriceOracle";
|
|
8
8
|
import { EvmProvider } from "../../arch/evm/types";
|
|
9
9
|
export type SymbolMappingType = Record<string, {
|
|
10
10
|
addresses: Record<number, string>;
|
|
@@ -48,13 +48,10 @@ export declare class QueryBase implements QueryInterface {
|
|
|
48
48
|
*/
|
|
49
49
|
getGasCosts(relayData: RelayData & {
|
|
50
50
|
destinationChainId: number;
|
|
51
|
-
}, relayer?: Address, options?: Partial<{
|
|
51
|
+
}, relayer?: Address, options?: Partial<GasPriceEstimateOptions & {
|
|
52
52
|
gasPrice: BigNumberish;
|
|
53
53
|
gasUnits: BigNumberish;
|
|
54
|
-
baseFeeMultiplier: BigNumber;
|
|
55
|
-
priorityFeeMultiplier: BigNumber;
|
|
56
54
|
opStackL1GasCostMultiplier: BigNumber;
|
|
57
|
-
transport: Transport;
|
|
58
55
|
}>): Promise<TransactionCostEstimate>;
|
|
59
56
|
/**
|
|
60
57
|
* @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
|
|
@@ -106,13 +103,10 @@ export declare class QueryBase implements QueryInterface {
|
|
|
106
103
|
* @param options.transport A custom transport object for custom gas price retrieval.
|
|
107
104
|
* @returns Estimated cost in units of gas and the underlying gas token (gasPrice * estimatedGasUnits).
|
|
108
105
|
*/
|
|
109
|
-
estimateGas(unsignedTx: PopulatedTransaction, senderAddress: Address, provider: providers.Provider | L2Provider<providers.Provider>, options?: Partial<{
|
|
106
|
+
estimateGas(unsignedTx: PopulatedTransaction, senderAddress: Address, provider: providers.Provider | L2Provider<providers.Provider>, options?: Partial<GasPriceEstimateOptions & {
|
|
110
107
|
gasPrice: BigNumberish;
|
|
111
108
|
gasUnits: BigNumberish;
|
|
112
|
-
baseFeeMultiplier: BigNumber;
|
|
113
|
-
priorityFeeMultiplier: BigNumber;
|
|
114
109
|
opStackL1GasCostMultiplier: BigNumber;
|
|
115
|
-
transport: Transport;
|
|
116
110
|
}>): Promise<TransactionCostEstimate>;
|
|
117
111
|
/**
|
|
118
112
|
* Retrieves the current price of a token
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseQuery.d.ts","sourceRoot":"","sources":["../../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAc,MAAM,QAAQ,CAAC;AAGrE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAsB,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EACL,YAAY,EACZ,UAAU,EACV,uBAAuB,EACvB,SAAS,EAKT,OAAO,EACR,MAAM,aAAa,CAAC;AAErB,OAA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O,CAAC,SAAS,CAAC;IAcrB;;;;;;;;;;OAUG;IACG,WAAW,CACf,UAAU,EAAE,oBAAoB,EAChC,aAAa,EAAE,OAAO,EACtB,QAAQ,EAAE,SAAS,CAAC,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EAC7D,OAAO,GAAE,OAAO,CACd,uBAAuB,GAAG;QACxB,QAAQ,EAAE,YAAY,CAAC;QACvB,QAAQ,EAAE,YAAY,CAAC;QACvB,0BAA0B,EAAE,SAAS,CAAC;KACvC,CACG,GACL,OAAO,CAAC,uBAAuB,CAAC;IAsDnC;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAS1D"}
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getGasPriceEstimate } from "./oracle";
|
|
1
|
+
export { getGasPriceEstimate, GasPriceEstimateOptions } from "./oracle";
|
|
2
2
|
export { GasPriceEstimate, EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
@@ -19,8 +19,7 @@ import {
|
|
|
19
19
|
} from "../../utils";
|
|
20
20
|
import assert from "assert";
|
|
21
21
|
import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
|
|
22
|
-
import {
|
|
23
|
-
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
22
|
+
import { getGasPriceEstimate, GasPriceEstimateOptions } from "../../gasPriceOracle";
|
|
24
23
|
import { EvmProvider } from "../../arch/evm/types";
|
|
25
24
|
import { arch } from "../..";
|
|
26
25
|
|
|
@@ -75,23 +74,15 @@ export class QueryBase implements QueryInterface {
|
|
|
75
74
|
async getGasCosts(
|
|
76
75
|
relayData: RelayData & { destinationChainId: number },
|
|
77
76
|
relayer = getDefaultRelayer(relayData.destinationChainId),
|
|
78
|
-
options: Partial<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}> = {}
|
|
77
|
+
options: Partial<
|
|
78
|
+
GasPriceEstimateOptions & {
|
|
79
|
+
gasPrice: BigNumberish;
|
|
80
|
+
gasUnits: BigNumberish;
|
|
81
|
+
opStackL1GasCostMultiplier: BigNumber;
|
|
82
|
+
}
|
|
83
|
+
> = {}
|
|
86
84
|
): Promise<TransactionCostEstimate> {
|
|
87
|
-
const {
|
|
88
|
-
gasPrice = this.fixedGasPrice,
|
|
89
|
-
gasUnits,
|
|
90
|
-
baseFeeMultiplier,
|
|
91
|
-
priorityFeeMultiplier,
|
|
92
|
-
opStackL1GasCostMultiplier,
|
|
93
|
-
transport,
|
|
94
|
-
} = options;
|
|
85
|
+
const { gasPrice = this.fixedGasPrice, gasUnits, opStackL1GasCostMultiplier } = options;
|
|
95
86
|
|
|
96
87
|
const { recipient, outputToken, exclusiveRelayer } = relayData;
|
|
97
88
|
assert(recipient.isEVM(), `getGasCosts: recipient not an EVM address (${recipient})`);
|
|
@@ -105,12 +96,10 @@ export class QueryBase implements QueryInterface {
|
|
|
105
96
|
gasPrice: impliedGasPrice,
|
|
106
97
|
opStackL1GasCost,
|
|
107
98
|
} = await this.estimateGas(tx, relayer, this.provider, {
|
|
99
|
+
...options,
|
|
108
100
|
gasPrice,
|
|
109
101
|
gasUnits,
|
|
110
|
-
baseFeeMultiplier,
|
|
111
|
-
priorityFeeMultiplier,
|
|
112
102
|
opStackL1GasCostMultiplier,
|
|
113
|
-
transport,
|
|
114
103
|
});
|
|
115
104
|
|
|
116
105
|
return {
|
|
@@ -193,6 +182,7 @@ export class QueryBase implements QueryInterface {
|
|
|
193
182
|
const voidSigner = new VoidSigner(relayer.toEvmAddress(), this.provider);
|
|
194
183
|
const populatedTransaction = await voidSigner.populateTransaction({
|
|
195
184
|
...unsignedTx,
|
|
185
|
+
nonce: 0xffffffff, // prevents implicit eth_getTransactionCount; slightly overestimates serialized tx size
|
|
196
186
|
gasLimit: opStackL2GasUnits, // prevents additional gas estimation call
|
|
197
187
|
});
|
|
198
188
|
const l1DataFee = await (this.provider as L2Provider<providers.Provider>).estimateL1GasCost(populatedTransaction);
|
|
@@ -214,14 +204,13 @@ export class QueryBase implements QueryInterface {
|
|
|
214
204
|
unsignedTx: PopulatedTransaction,
|
|
215
205
|
senderAddress: Address,
|
|
216
206
|
provider: providers.Provider | L2Provider<providers.Provider>,
|
|
217
|
-
options: Partial<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}> = {}
|
|
207
|
+
options: Partial<
|
|
208
|
+
GasPriceEstimateOptions & {
|
|
209
|
+
gasPrice: BigNumberish;
|
|
210
|
+
gasUnits: BigNumberish;
|
|
211
|
+
opStackL1GasCostMultiplier: BigNumber;
|
|
212
|
+
}
|
|
213
|
+
> = {}
|
|
225
214
|
): Promise<TransactionCostEstimate> {
|
|
226
215
|
const {
|
|
227
216
|
gasPrice: _gasPrice,
|
|
@@ -240,7 +229,14 @@ export class QueryBase implements QueryInterface {
|
|
|
240
229
|
gasUnits ? Promise.resolve(BigNumber.from(gasUnits)) : voidSigner.estimateGas(unsignedTx),
|
|
241
230
|
_gasPrice
|
|
242
231
|
? Promise.resolve({ maxFeePerGas: _gasPrice })
|
|
243
|
-
: getGasPriceEstimate(provider, {
|
|
232
|
+
: getGasPriceEstimate(provider, {
|
|
233
|
+
...options,
|
|
234
|
+
chainId,
|
|
235
|
+
baseFeeMultiplier,
|
|
236
|
+
priorityFeeMultiplier,
|
|
237
|
+
transport,
|
|
238
|
+
unsignedTx,
|
|
239
|
+
}),
|
|
244
240
|
] as const;
|
|
245
241
|
const [nativeGasCost, gasPriceEstimate] = await Promise.all(queries);
|
|
246
242
|
|