@across-protocol/sdk 4.3.128 → 4.3.130
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/caching/Arweave/ArweaveClient.d.ts +2 -0
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js +20 -16
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/cjs/src/gasPriceOracle/oracle.d.ts +1 -3
- package/dist/cjs/src/gasPriceOracle/oracle.js +20 -39
- package/dist/cjs/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/typechain.d.ts +1 -0
- package/dist/cjs/typechain.js +5 -0
- package/dist/cjs/typechain.js.map +1 -0
- package/dist/esm/src/caching/Arweave/ArweaveClient.d.ts +2 -0
- package/dist/esm/src/caching/Arweave/ArweaveClient.js +20 -18
- package/dist/esm/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/esm/src/gasPriceOracle/oracle.d.ts +1 -10
- package/dist/esm/src/gasPriceOracle/oracle.js +22 -40
- package/dist/esm/src/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/typechain.d.ts +1 -0
- package/dist/esm/typechain.js +4 -0
- package/dist/esm/typechain.js.map +1 -0
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts +2 -0
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts.map +1 -1
- package/dist/types/src/gasPriceOracle/oracle.d.ts +1 -10
- package/dist/types/src/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/typechain.d.ts +2 -0
- package/dist/types/typechain.d.ts.map +1 -0
- package/package.json +9 -2
- package/src/caching/Arweave/ArweaveClient.ts +8 -16
- package/src/gasPriceOracle/oracle.ts +6 -25
- package/test-utils.ts +88 -0
- package/typechain.ts +3 -0
|
@@ -16,6 +16,8 @@ var ArweaveClient = (function () {
|
|
|
16
16
|
if (retryDelaySeconds === void 0) { retryDelaySeconds = 1; }
|
|
17
17
|
this.arweaveJWT = arweaveJWT;
|
|
18
18
|
this.logger = logger;
|
|
19
|
+
this.gatewayURL = gatewayURL;
|
|
20
|
+
this.protocol = protocol;
|
|
19
21
|
this.retries = retries;
|
|
20
22
|
this.retryDelaySeconds = retryDelaySeconds;
|
|
21
23
|
this.gatewayUrl = "".concat(protocol, "://").concat(gatewayURL, ":").concat(port);
|
|
@@ -90,24 +92,26 @@ var ArweaveClient = (function () {
|
|
|
90
92
|
};
|
|
91
93
|
ArweaveClient.prototype.get = function (transactionID, validator) {
|
|
92
94
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
93
|
-
var transactionUrl,
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
var transactionUrl, request, data;
|
|
96
|
+
var _this = this;
|
|
97
|
+
return tslib_1.__generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
96
99
|
case 0:
|
|
97
100
|
transactionUrl = "".concat(this.gatewayUrl, "/").concat(transactionID);
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
data: data,
|
|
101
|
+
request = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
102
|
+
var requestData;
|
|
103
|
+
return tslib_1.__generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0: return [4, axios_1.default.get(transactionUrl)];
|
|
106
|
+
case 1:
|
|
107
|
+
requestData = (_a.sent()).data;
|
|
108
|
+
return [2, requestData];
|
|
109
|
+
}
|
|
108
110
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
}); };
|
|
112
|
+
return [4, this._retryRequest(request, 0)];
|
|
113
|
+
case 1:
|
|
114
|
+
data = _a.sent();
|
|
111
115
|
try {
|
|
112
116
|
return [2, (0, superstruct_1.create)(data, validator)];
|
|
113
117
|
}
|
|
@@ -221,7 +225,7 @@ var ArweaveClient = (function () {
|
|
|
221
225
|
baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount);
|
|
222
226
|
delayS = baseDelay + baseDelay * Math.random();
|
|
223
227
|
this.logger.debug({
|
|
224
|
-
at: "ArweaveClient:
|
|
228
|
+
at: "ArweaveClient:retryRequest",
|
|
225
229
|
message: "Arweave request failed, retrying after waiting ".concat(delayS, " seconds: ").concat(e_2),
|
|
226
230
|
retryCount: retryCount,
|
|
227
231
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArweaveClient.js","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":";;;;AAAA,4DAA8B;AAE9B,wDAA0B;AAC1B,2CAA6C;AAE7C,6CAAiH;AACjH,qCAA4F;AAE5F;IAIE,uBACU,UAAwB,EACxB,MAAsB,
|
|
1
|
+
{"version":3,"file":"ArweaveClient.js","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":";;;;AAAA,4DAA8B;AAE9B,wDAA0B;AAC1B,2CAA6C;AAE7C,6CAAiH;AACjH,qCAA4F;AAE5F;IAIE,uBACU,UAAwB,EACxB,MAAsB,EACvB,UAA0B,EAC1B,QAAkB,EACzB,IAAU,EACO,OAAW,EACX,iBAAqB;QAJ/B,2BAAA,EAAA,0BAA0B;QAC1B,yBAAA,EAAA,kBAAkB;QACzB,qBAAA,EAAA,UAAU;QACO,wBAAA,EAAA,WAAW;QACX,kCAAA,EAAA,qBAAqB;QAN9B,eAAU,GAAV,UAAU,CAAc;QACxB,WAAM,GAAN,MAAM,CAAgB;QACvB,eAAU,GAAV,UAAU,CAAgB;QAC1B,aAAQ,GAAR,QAAQ,CAAU;QAER,YAAO,GAAP,OAAO,CAAI;QACX,sBAAiB,GAAjB,iBAAiB,CAAI;QAEtC,IAAI,CAAC,UAAU,GAAG,UAAG,QAAQ,gBAAM,UAAU,cAAI,IAAI,CAAE,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,IAAI,iBA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CAAC,UAAU,CAAC,OAAO,CAAC,EAAA;;wCAA9D,cAAc,GAAG,SAA6C;wCAMpE,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;4CAC3B,KAAsB,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,EAA9C,OAAO,QAAA,EAAE,QAAQ,QAAA,CAA8B;4CAChD,WAAW,GAAG,iBAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,IAAA,YAAI,EAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;4CACzF,WAAO,iBAAS,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAC;wCAChD,CAAC;6CAAM,CAAC;4CACN,WAAO,iBAAS,CAAC,IAAI,CAAC,cAAc,CAAC,EAAC;wCACxC,CAAC;;;;6BACF,CAAC;wBACK,WAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,EAAA;4BAA3C,WAAO,SAAoC,EAAC;;;;KAC7C;IACH,oBAAC;AAAD,CAAC,AAvQD,IAuQC;AAvQY,sCAAa"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Transport } from "viem";
|
|
2
|
-
import { providers } from "ethers";
|
|
3
2
|
import { BigNumber } from "../utils";
|
|
4
3
|
import { SVMProvider as SolanaProvider } from "../arch/svm";
|
|
5
|
-
import { EvmGasPriceEstimate,
|
|
4
|
+
import { EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
6
5
|
import { EvmProvider } from "../arch/evm/types";
|
|
7
6
|
export interface GasPriceEstimateOptions {
|
|
8
7
|
baseFeeMultiplier: BigNumber;
|
|
@@ -14,4 +13,3 @@ export interface GasPriceEstimateOptions {
|
|
|
14
13
|
}
|
|
15
14
|
export declare function getGasPriceEstimate(provider: EvmProvider, opts?: Partial<GasPriceEstimateOptions>): Promise<EvmGasPriceEstimate>;
|
|
16
15
|
export declare function getGasPriceEstimate(provider: SolanaProvider, opts?: Partial<GasPriceEstimateOptions>): Promise<SvmGasPriceEstimate>;
|
|
17
|
-
export declare function _getViemGasPriceEstimate(providerOrChainId: providers.Provider | number, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGasPriceEstimate = getGasPriceEstimate;
|
|
4
|
-
exports._getViemGasPriceEstimate = _getViemGasPriceEstimate;
|
|
5
4
|
var tslib_1 = require("tslib");
|
|
6
5
|
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
7
6
|
var constants_1 = require("../constants");
|
|
@@ -41,72 +40,54 @@ function getGasPriceEstimate(provider_1) {
|
|
|
41
40
|
chainId = _a;
|
|
42
41
|
optsWithDefaults = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, GAS_PRICE_ESTIMATE_DEFAULTS), { baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier }), opts), { chainId: chainId });
|
|
43
42
|
useViem = VIEM_CHAINS.includes(chainId);
|
|
44
|
-
return [2, useViem
|
|
45
|
-
? _getViemGasPriceEstimate(chainId, optsWithDefaults)
|
|
46
|
-
: _getEthersGasPriceEstimate(provider, optsWithDefaults)];
|
|
43
|
+
return [2, useViem ? getGasPriceViem(chainId, optsWithDefaults) : getGasPriceEthers(provider, optsWithDefaults)];
|
|
47
44
|
}
|
|
48
45
|
});
|
|
49
46
|
});
|
|
50
47
|
}
|
|
51
|
-
function
|
|
48
|
+
function getGasPriceEthers(provider, opts) {
|
|
52
49
|
var _a;
|
|
53
50
|
var chainId = opts.chainId, legacyFallback = opts.legacyFallback;
|
|
54
51
|
(0, assert_1.default)(!VIEM_CHAINS.includes(chainId), "Chain ID ".concat(chainId, " will use Viem gas price estimation"));
|
|
55
52
|
var gasPriceFeeds = (_a = {},
|
|
56
53
|
_a[constants_1.CHAIN_IDs.ARBITRUM] = arbitrum.eip1559,
|
|
57
|
-
_a[constants_1.CHAIN_IDs.BSC] = ethereum.eip1559,
|
|
58
|
-
_a[constants_1.CHAIN_IDs.MAINNET] = ethereum.eip1559,
|
|
59
|
-
_a[constants_1.CHAIN_IDs.MEGAETH] = ethereum.eip1559,
|
|
60
|
-
_a[constants_1.CHAIN_IDs.MONAD] = ethereum.eip1559,
|
|
61
|
-
_a[constants_1.CHAIN_IDs.PLASMA] = ethereum.eip1559,
|
|
62
54
|
_a[constants_1.CHAIN_IDs.POLYGON] = polygon.gasStation,
|
|
63
55
|
_a[constants_1.CHAIN_IDs.SCROLL] = ethereum.legacy,
|
|
64
56
|
_a[constants_1.CHAIN_IDs.TEMPO] = ethereum.eip1559,
|
|
65
57
|
_a[constants_1.CHAIN_IDs.ZK_SYNC] = ethereum.legacy,
|
|
66
|
-
_a[constants_1.CHAIN_IDs.ARBITRUM_SEPOLIA] = arbitrum.eip1559,
|
|
67
58
|
_a[constants_1.CHAIN_IDs.POLYGON_AMOY] = polygon.gasStation,
|
|
68
|
-
_a[constants_1.CHAIN_IDs.SEPOLIA] = ethereum.eip1559,
|
|
69
59
|
_a);
|
|
70
60
|
var gasPriceFeed = gasPriceFeeds[chainId];
|
|
71
61
|
(0, assert_1.default)(gasPriceFeed || legacyFallback, "No suitable gas price oracle for Chain ID ".concat(chainId));
|
|
72
|
-
gasPriceFeed !== null && gasPriceFeed !== void 0 ? gasPriceFeed : (gasPriceFeed =
|
|
62
|
+
gasPriceFeed !== null && gasPriceFeed !== void 0 ? gasPriceFeed : (gasPriceFeed = ethereum.eip1559);
|
|
73
63
|
return gasPriceFeed(provider, opts);
|
|
74
64
|
}
|
|
75
|
-
function
|
|
65
|
+
function getGasPriceViem(chainId, opts) {
|
|
76
66
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
77
|
-
var baseFeeMultiplier, transport,
|
|
78
|
-
var _b, _c
|
|
79
|
-
return tslib_1.__generator(this, function (
|
|
80
|
-
switch (
|
|
67
|
+
var baseFeeMultiplier, transport, viemProvider, gasPriceFeeds, maxFeePerGas, maxPriorityFeePerGas, gasPrice;
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
return tslib_1.__generator(this, function (_d) {
|
|
70
|
+
switch (_d.label) {
|
|
81
71
|
case 0:
|
|
82
72
|
baseFeeMultiplier = opts.baseFeeMultiplier, transport = opts.transport;
|
|
83
|
-
if (!(typeof providerOrChainId === "number")) return [3, 1];
|
|
84
|
-
_a = providerOrChainId;
|
|
85
|
-
return [3, 3];
|
|
86
|
-
case 1: return [4, providerOrChainId.getNetwork()];
|
|
87
|
-
case 2:
|
|
88
|
-
_a = (_e.sent()).chainId;
|
|
89
|
-
_e.label = 3;
|
|
90
|
-
case 3:
|
|
91
|
-
chainId = _a;
|
|
92
73
|
viemProvider = (0, util_1.getPublicClient)(chainId, transport);
|
|
93
|
-
gasPriceFeeds = (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (!gasPriceFeeds[chainId]) return [3,
|
|
74
|
+
gasPriceFeeds = (_a = {},
|
|
75
|
+
_a[constants_1.CHAIN_IDs.LINEA] = lineaViem.eip1559,
|
|
76
|
+
_a);
|
|
77
|
+
if (!gasPriceFeeds[chainId]) return [3, 2];
|
|
97
78
|
return [4, gasPriceFeeds[chainId](viemProvider, opts)];
|
|
98
|
-
case
|
|
99
|
-
(
|
|
100
|
-
return [3,
|
|
101
|
-
case
|
|
79
|
+
case 1:
|
|
80
|
+
(_b = _d.sent(), maxFeePerGas = _b.maxFeePerGas, maxPriorityFeePerGas = _b.maxPriorityFeePerGas);
|
|
81
|
+
return [3, 4];
|
|
82
|
+
case 2:
|
|
102
83
|
gasPrice = void 0;
|
|
103
84
|
return [4, viemProvider.estimateFeesPerGas()];
|
|
104
|
-
case
|
|
105
|
-
(
|
|
85
|
+
case 3:
|
|
86
|
+
(_c = _d.sent(), maxFeePerGas = _c.maxFeePerGas, maxPriorityFeePerGas = _c.maxPriorityFeePerGas, gasPrice = _c.gasPrice);
|
|
106
87
|
maxFeePerGas !== null && maxFeePerGas !== void 0 ? maxFeePerGas : (maxFeePerGas = (gasPrice * BigInt(baseFeeMultiplier.toString())) / BigInt(utils_1.fixedPointAdjustment.toString()));
|
|
107
88
|
maxPriorityFeePerGas !== null && maxPriorityFeePerGas !== void 0 ? maxPriorityFeePerGas : (maxPriorityFeePerGas = BigInt(0));
|
|
108
|
-
|
|
109
|
-
case
|
|
89
|
+
_d.label = 4;
|
|
90
|
+
case 4: return [2, {
|
|
110
91
|
maxFeePerGas: utils_1.BigNumber.from(maxFeePerGas.toString()),
|
|
111
92
|
maxPriorityFeePerGas: utils_1.BigNumber.from(maxPriorityFeePerGas.toString()),
|
|
112
93
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":";;AAuDA,
|
|
1
|
+
{"version":3,"file":"oracle.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":";;AAuDA,kDAgCC;;AAvFD,0DAA4B;AAG5B,0CAAyC;AACzC,kCAAmF;AAGnF,+BAAyC;AACzC,oEAAgD;AAChD,oEAAgD;AAChD,kEAA8C;AAC9C,uEAAmD;AACnD,gEAA4C;AAkB5C,IAAM,2BAA2B,GAAG;IAClC,cAAc,EAAE,IAAI;CACrB,CAAC;AAGF,IAAM,WAAW,GAAG,CAAC,qBAAS,CAAC,KAAK,CAAC,CAAC;AAoBtC,SAAsB,mBAAmB;gEACvC,QAAsC,EACtC,IAA2C;;;QAA3C,qBAAA,EAAA,SAA2C;;;;oBAErC,iBAAiB,GAAG,MAAA,IAAI,CAAC,iBAAiB,mCAAI,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;oBAC3D,qBAAqB,GAAG,MAAA,IAAI,CAAC,qBAAq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AC,QAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,4BAAoB,CAAC,QAAQ,EAAE,CAAC,EAAC;oBAC9G,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,IAApB,oBAAoB,GAAK,MAAM,CAAC,CAAC,CAAC,EAAC;;wBAGrC,WAAO;wBACL,YAAY,EAAE,iBAAS,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;wBACrD,oBAAoB,EAAE,iBAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;qBACtE,EAAC;;;;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/utils/abi/typechain";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typechain.js","sourceRoot":"","sources":["../../typechain.ts"],"names":[],"mappings":";;;AAEA,oEAA0C"}
|
|
@@ -13,6 +13,8 @@ var ArweaveClient = /** @class */ (function () {
|
|
|
13
13
|
if (retryDelaySeconds === void 0) { retryDelaySeconds = 1; }
|
|
14
14
|
this.arweaveJWT = arweaveJWT;
|
|
15
15
|
this.logger = logger;
|
|
16
|
+
this.gatewayURL = gatewayURL;
|
|
17
|
+
this.protocol = protocol;
|
|
16
18
|
this.retries = retries;
|
|
17
19
|
this.retryDelaySeconds = retryDelaySeconds;
|
|
18
20
|
this.gatewayUrl = "".concat(protocol, "://").concat(gatewayURL, ":").concat(port);
|
|
@@ -106,26 +108,26 @@ var ArweaveClient = /** @class */ (function () {
|
|
|
106
108
|
*/
|
|
107
109
|
ArweaveClient.prototype.get = function (transactionID, validator) {
|
|
108
110
|
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
var transactionUrl,
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
var transactionUrl, request, data;
|
|
112
|
+
var _this = this;
|
|
113
|
+
return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
112
115
|
case 0:
|
|
113
116
|
transactionUrl = "".concat(this.gatewayUrl, "/").concat(transactionID);
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
transactionID: transactionID,
|
|
124
|
-
responseStatus: responseStatus,
|
|
125
|
-
data: data,
|
|
117
|
+
request = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
118
|
+
var requestData;
|
|
119
|
+
return __generator(this, function (_a) {
|
|
120
|
+
switch (_a.label) {
|
|
121
|
+
case 0: return [4 /*yield*/, axios.get(transactionUrl)];
|
|
122
|
+
case 1:
|
|
123
|
+
requestData = (_a.sent()).data;
|
|
124
|
+
return [2 /*return*/, requestData];
|
|
125
|
+
}
|
|
126
126
|
});
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
}); };
|
|
128
|
+
return [4 /*yield*/, this._retryRequest(request, 0)];
|
|
129
|
+
case 1:
|
|
130
|
+
data = _a.sent();
|
|
129
131
|
try {
|
|
130
132
|
// We should validate the data and perform any logical coercion here.
|
|
131
133
|
return [2 /*return*/, create(data, validator)];
|
|
@@ -262,7 +264,7 @@ var ArweaveClient = /** @class */ (function () {
|
|
|
262
264
|
baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount);
|
|
263
265
|
delayS = baseDelay + baseDelay * Math.random();
|
|
264
266
|
this.logger.debug({
|
|
265
|
-
at: "ArweaveClient:
|
|
267
|
+
at: "ArweaveClient:retryRequest",
|
|
266
268
|
message: "Arweave request failed, retrying after waiting ".concat(delayS, " seconds: ").concat(e_2),
|
|
267
269
|
retryCount: retryCount,
|
|
268
270
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArweaveClient.js","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,KAAK,MAAM,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kCAAU,GAAhB;;;;;;4BACkB,qBAAM,IAAI,CAAC,UAAU,EAAE,EAAA;;wBAAjC,OAAO,GAAG,SAAuB;wBACjC,OAAO,GAAG;;;;4CACS,qBAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAA;;wCAA9D,cAAc,GAAG,SAA6C;wCACpE,mGAAmG;wCACnG,yGAAyG;wCACzG,kBAAkB;wCAClB,0EAA0E;wCAC1E,4BAA4B;wCAC5B,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;4CAC3B,KAAsB,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,EAA9C,OAAO,QAAA,EAAE,QAAQ,QAAA,CAA8B;4CAChD,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;4CACzF,sBAAO,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAC;wCAChD,CAAC;6CAAM,CAAC;4CACN,sBAAO,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,EAAC;wCACxC,CAAC;;;;6BACF,CAAC;wBACK,qBAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC,EAAA;4BAA3C,sBAAO,SAAoC,EAAC;;;;KAC7C;IACH,oBAAC;AAAD,CAAC,AAvQD,IAuQC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Transport } from "viem";
|
|
2
|
-
import { providers } from "ethers";
|
|
3
2
|
import { BigNumber } from "../utils";
|
|
4
3
|
import { SVMProvider as SolanaProvider } from "../arch/svm";
|
|
5
|
-
import { EvmGasPriceEstimate,
|
|
4
|
+
import { EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
6
5
|
import { EvmProvider } from "../arch/evm/types";
|
|
7
6
|
export interface GasPriceEstimateOptions {
|
|
8
7
|
baseFeeMultiplier: BigNumber;
|
|
@@ -14,11 +13,3 @@ export interface GasPriceEstimateOptions {
|
|
|
14
13
|
}
|
|
15
14
|
export declare function getGasPriceEstimate(provider: EvmProvider, opts?: Partial<GasPriceEstimateOptions>): Promise<EvmGasPriceEstimate>;
|
|
16
15
|
export declare function getGasPriceEstimate(provider: SolanaProvider, opts?: Partial<GasPriceEstimateOptions>): Promise<SvmGasPriceEstimate>;
|
|
17
|
-
/**
|
|
18
|
-
* Provide an estimate for the current gas price for a particular chain.
|
|
19
|
-
* @param providerOrChainId A valid ethers provider or a chain ID.
|
|
20
|
-
* @param transport An optional Viem Transport object for custom gas price retrieval.
|
|
21
|
-
* @param unsignedTx Only used in Linea provider to estimate priority gas fee.
|
|
22
|
-
* @returns An object of type GasPriceEstimate.
|
|
23
|
-
*/
|
|
24
|
-
export declare function _getViemGasPriceEstimate(providerOrChainId: providers.Provider | number, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import { CHAIN_IDs } from "../constants";
|
|
4
|
-
import { BigNumber,
|
|
4
|
+
import { BigNumber, fixedPointAdjustment, isEvmProvider, toBNWei } from "../utils";
|
|
5
5
|
import { getPublicClient } from "./util";
|
|
6
6
|
import * as arbitrum from "./adapters/arbitrum";
|
|
7
7
|
import * as ethereum from "./adapters/ethereum";
|
|
@@ -45,9 +45,7 @@ export function getGasPriceEstimate(provider_1) {
|
|
|
45
45
|
chainId = _a;
|
|
46
46
|
optsWithDefaults = __assign(__assign(__assign(__assign({}, GAS_PRICE_ESTIMATE_DEFAULTS), { baseFeeMultiplier: baseFeeMultiplier, priorityFeeMultiplier: priorityFeeMultiplier }), opts), { chainId: chainId });
|
|
47
47
|
useViem = VIEM_CHAINS.includes(chainId);
|
|
48
|
-
return [2 /*return*/, useViem
|
|
49
|
-
? _getViemGasPriceEstimate(chainId, optsWithDefaults)
|
|
50
|
-
: _getEthersGasPriceEstimate(provider, optsWithDefaults)];
|
|
48
|
+
return [2 /*return*/, useViem ? getGasPriceViem(chainId, optsWithDefaults) : getGasPriceEthers(provider, optsWithDefaults)];
|
|
51
49
|
}
|
|
52
50
|
});
|
|
53
51
|
});
|
|
@@ -59,30 +57,23 @@ export function getGasPriceEstimate(provider_1) {
|
|
|
59
57
|
* @param legacyFallback In the case of an unrecognised chain, fall back to type 0 gas estimation.
|
|
60
58
|
* @returns An object of type GasPriceEstimate.
|
|
61
59
|
*/
|
|
62
|
-
function
|
|
60
|
+
function getGasPriceEthers(provider, opts) {
|
|
63
61
|
var _a;
|
|
64
62
|
var chainId = opts.chainId, legacyFallback = opts.legacyFallback;
|
|
65
63
|
// There shouldn't be any chains in here that we have a Viem adapter for because we'll always use Viem in that case.
|
|
66
64
|
assert(!VIEM_CHAINS.includes(chainId), "Chain ID ".concat(chainId, " will use Viem gas price estimation"));
|
|
67
65
|
var gasPriceFeeds = (_a = {},
|
|
68
66
|
_a[CHAIN_IDs.ARBITRUM] = arbitrum.eip1559,
|
|
69
|
-
_a[CHAIN_IDs.BSC] = ethereum.eip1559,
|
|
70
|
-
_a[CHAIN_IDs.MAINNET] = ethereum.eip1559,
|
|
71
|
-
_a[CHAIN_IDs.MEGAETH] = ethereum.eip1559,
|
|
72
|
-
_a[CHAIN_IDs.MONAD] = ethereum.eip1559,
|
|
73
|
-
_a[CHAIN_IDs.PLASMA] = ethereum.eip1559,
|
|
74
67
|
_a[CHAIN_IDs.POLYGON] = polygon.gasStation,
|
|
75
68
|
_a[CHAIN_IDs.SCROLL] = ethereum.legacy,
|
|
76
69
|
_a[CHAIN_IDs.TEMPO] = ethereum.eip1559,
|
|
77
70
|
_a[CHAIN_IDs.ZK_SYNC] = ethereum.legacy,
|
|
78
|
-
// Testnet
|
|
79
|
-
_a[CHAIN_IDs.ARBITRUM_SEPOLIA] = arbitrum.eip1559,
|
|
71
|
+
// Testnet
|
|
80
72
|
_a[CHAIN_IDs.POLYGON_AMOY] = polygon.gasStation,
|
|
81
|
-
_a[CHAIN_IDs.SEPOLIA] = ethereum.eip1559,
|
|
82
73
|
_a);
|
|
83
74
|
var gasPriceFeed = gasPriceFeeds[chainId];
|
|
84
75
|
assert(gasPriceFeed || legacyFallback, "No suitable gas price oracle for Chain ID ".concat(chainId));
|
|
85
|
-
gasPriceFeed !== null && gasPriceFeed !== void 0 ? gasPriceFeed : (gasPriceFeed =
|
|
76
|
+
gasPriceFeed !== null && gasPriceFeed !== void 0 ? gasPriceFeed : (gasPriceFeed = ethereum.eip1559);
|
|
86
77
|
return gasPriceFeed(provider, opts);
|
|
87
78
|
}
|
|
88
79
|
/**
|
|
@@ -92,41 +83,32 @@ function _getEthersGasPriceEstimate(provider, opts) {
|
|
|
92
83
|
* @param unsignedTx Only used in Linea provider to estimate priority gas fee.
|
|
93
84
|
* @returns An object of type GasPriceEstimate.
|
|
94
85
|
*/
|
|
95
|
-
|
|
86
|
+
function getGasPriceViem(chainId, opts) {
|
|
96
87
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
var baseFeeMultiplier, transport,
|
|
98
|
-
var _b, _c
|
|
99
|
-
return __generator(this, function (
|
|
100
|
-
switch (
|
|
88
|
+
var baseFeeMultiplier, transport, viemProvider, gasPriceFeeds, maxFeePerGas, maxPriorityFeePerGas, gasPrice;
|
|
89
|
+
var _a, _b, _c;
|
|
90
|
+
return __generator(this, function (_d) {
|
|
91
|
+
switch (_d.label) {
|
|
101
92
|
case 0:
|
|
102
93
|
baseFeeMultiplier = opts.baseFeeMultiplier, transport = opts.transport;
|
|
103
|
-
if (!(typeof providerOrChainId === "number")) return [3 /*break*/, 1];
|
|
104
|
-
_a = providerOrChainId;
|
|
105
|
-
return [3 /*break*/, 3];
|
|
106
|
-
case 1: return [4 /*yield*/, providerOrChainId.getNetwork()];
|
|
107
|
-
case 2:
|
|
108
|
-
_a = (_e.sent()).chainId;
|
|
109
|
-
_e.label = 3;
|
|
110
|
-
case 3:
|
|
111
|
-
chainId = _a;
|
|
112
94
|
viemProvider = getPublicClient(chainId, transport);
|
|
113
|
-
gasPriceFeeds = (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (!gasPriceFeeds[chainId]) return [3 /*break*/,
|
|
95
|
+
gasPriceFeeds = (_a = {},
|
|
96
|
+
_a[CHAIN_IDs.LINEA] = lineaViem.eip1559,
|
|
97
|
+
_a);
|
|
98
|
+
if (!gasPriceFeeds[chainId]) return [3 /*break*/, 2];
|
|
117
99
|
return [4 /*yield*/, gasPriceFeeds[chainId](viemProvider, opts)];
|
|
118
|
-
case
|
|
119
|
-
(
|
|
120
|
-
return [3 /*break*/,
|
|
121
|
-
case
|
|
100
|
+
case 1:
|
|
101
|
+
(_b = _d.sent(), maxFeePerGas = _b.maxFeePerGas, maxPriorityFeePerGas = _b.maxPriorityFeePerGas);
|
|
102
|
+
return [3 /*break*/, 4];
|
|
103
|
+
case 2:
|
|
122
104
|
gasPrice = void 0;
|
|
123
105
|
return [4 /*yield*/, viemProvider.estimateFeesPerGas()];
|
|
124
|
-
case
|
|
125
|
-
(
|
|
106
|
+
case 3:
|
|
107
|
+
(_c = _d.sent(), maxFeePerGas = _c.maxFeePerGas, maxPriorityFeePerGas = _c.maxPriorityFeePerGas, gasPrice = _c.gasPrice);
|
|
126
108
|
maxFeePerGas !== null && maxFeePerGas !== void 0 ? maxFeePerGas : (maxFeePerGas = (gasPrice * BigInt(baseFeeMultiplier.toString())) / BigInt(fixedPointAdjustment.toString()));
|
|
127
109
|
maxPriorityFeePerGas !== null && maxPriorityFeePerGas !== void 0 ? maxPriorityFeePerGas : (maxPriorityFeePerGas = BigInt(0));
|
|
128
|
-
|
|
129
|
-
case
|
|
110
|
+
_d.label = 4;
|
|
111
|
+
case 4: return [2 /*return*/, {
|
|
130
112
|
maxFeePerGas: BigNumber.from(maxFeePerGas.toString()),
|
|
131
113
|
maxPriorityFeePerGas: BigNumber.from(maxPriorityFeePerGas.toString()),
|
|
132
114
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"oracle.js","sourceRoot":"","sources":["../../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnF,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAkB5C,IAAM,2BAA2B,GAAG;IAClC,cAAc,EAAE,IAAI;CACrB,CAAC;AAEF,6CAA6C;AAC7C,IAAM,WAAW,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AActC;;;;;GAKG;AACH,MAAM,UAAgB,mBAAmB;wDACvC,QAAsC,EACtC,IAA2C;;;QAA3C,qBAAA,EAAA,SAA2C;;;;oBAErC,iBAAiB,GAAG,MAAA,IAAI,CAAC,iBAAiB,mCAAI,OAAO,CAAC,GAAG,CAAC,CAAC;oBAC3D,qBAAqB,GAAG,MAAA,IAAI,CAAC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Z,YAAY,cAAZ,YAAY,IAAZ,YAAY,GAAK,CAAC,QAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC,EAAC;oBAC9G,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,IAApB,oBAAoB,GAAK,MAAM,CAAC,CAAC,CAAC,EAAC;;wBAGrC,sBAAO;wBACL,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;wBACrD,oBAAoB,EAAE,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;qBACtE,EAAC;;;;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/utils/abi/typechain";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typechain.js","sourceRoot":"","sources":["../../typechain.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,gEAAgE;AAChE,cAAc,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArweaveClient.d.ts","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAC7C,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAsD,MAAM,aAAa,CAAC;AAE5F,qBAAa,aAAa;IAKtB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"ArweaveClient.d.ts","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,MAAM,EAA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AC;YAIf,aAAa;IAqB3B;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;CAmBvC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Transport } from "viem";
|
|
2
|
-
import { providers } from "ethers";
|
|
3
2
|
import { BigNumber } from "../utils";
|
|
4
3
|
import { SVMProvider as SolanaProvider } from "../arch/svm";
|
|
5
|
-
import { EvmGasPriceEstimate,
|
|
4
|
+
import { EvmGasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
6
5
|
import { EvmProvider } from "../arch/evm/types";
|
|
7
6
|
export interface GasPriceEstimateOptions {
|
|
8
7
|
baseFeeMultiplier: BigNumber;
|
|
@@ -14,12 +13,4 @@ export interface GasPriceEstimateOptions {
|
|
|
14
13
|
}
|
|
15
14
|
export declare function getGasPriceEstimate(provider: EvmProvider, opts?: Partial<GasPriceEstimateOptions>): Promise<EvmGasPriceEstimate>;
|
|
16
15
|
export declare function getGasPriceEstimate(provider: SolanaProvider, opts?: Partial<GasPriceEstimateOptions>): Promise<SvmGasPriceEstimate>;
|
|
17
|
-
/**
|
|
18
|
-
* Provide an estimate for the current gas price for a particular chain.
|
|
19
|
-
* @param providerOrChainId A valid ethers provider or a chain ID.
|
|
20
|
-
* @param transport An optional Viem Transport object for custom gas price retrieval.
|
|
21
|
-
* @param unsignedTx Only used in Linea provider to estimate priority gas fee.
|
|
22
|
-
* @returns An object of type GasPriceEstimate.
|
|
23
|
-
*/
|
|
24
|
-
export declare function _getViemGasPriceEstimate(providerOrChainId: providers.Provider | number, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate>;
|
|
25
16
|
//# sourceMappingURL=oracle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"oracle.d.ts","sourceRoot":"","sources":["../../../../src/gasPriceOracle/oracle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAgD,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAoB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAOrF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,uBAAuB;IAEtC,iBAAiB,EAAE,SAAS,CAAC;IAE7B,qBAAqB,EAAE,SAAS,CAAC;IAEjC,cAAc,EAAE,OAAO,CAAC;IAExB,OAAO,EAAE,MAAM,CAAC;IAEhB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAUD,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,WAAW,EACrB,IAAI,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,GACtC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAGhC,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,cAAc,EACxB,IAAI,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,GACtC,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typechain.d.ts","sourceRoot":"","sources":["../../typechain.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.130",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
13
|
"scripts",
|
|
14
|
-
"src"
|
|
14
|
+
"src",
|
|
15
|
+
"test-utils.ts",
|
|
16
|
+
"typechain.ts"
|
|
15
17
|
],
|
|
16
18
|
"engines": {
|
|
17
19
|
"node": ">=22.18.0"
|
|
@@ -161,6 +163,11 @@
|
|
|
161
163
|
"import": "./dist/esm/test-utils.js",
|
|
162
164
|
"types": "./dist/types/test-utils.d.ts"
|
|
163
165
|
},
|
|
166
|
+
"./typechain": {
|
|
167
|
+
"require": "./dist/cjs/typechain.js",
|
|
168
|
+
"import": "./dist/esm/typechain.js",
|
|
169
|
+
"types": "./dist/types/typechain.d.ts"
|
|
170
|
+
},
|
|
164
171
|
"./src/utils/abi/typechain": {
|
|
165
172
|
"require": "./dist/cjs/src/utils/abi/typechain/index.js",
|
|
166
173
|
"import": "./dist/esm/src/utils/abi/typechain/index.js",
|
|
@@ -13,8 +13,8 @@ export class ArweaveClient {
|
|
|
13
13
|
public constructor(
|
|
14
14
|
private arweaveJWT: JWKInterface,
|
|
15
15
|
private logger: winston.Logger,
|
|
16
|
-
gatewayURL = "arweave.net",
|
|
17
|
-
protocol = "https",
|
|
16
|
+
public gatewayURL = "arweave.net",
|
|
17
|
+
public protocol = "https",
|
|
18
18
|
port = 443,
|
|
19
19
|
private readonly retries = 2,
|
|
20
20
|
private readonly retryDelaySeconds = 1
|
|
@@ -102,19 +102,11 @@ export class ArweaveClient {
|
|
|
102
102
|
// We should query in via Axios directly to the gateway URL. The reasoning behind this is
|
|
103
103
|
// that the Arweave SDK's `getData` method is too slow and does not provide a way to set a timeout.
|
|
104
104
|
// Therefore, something that could take milliseconds to complete could take tens of minutes.
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
at: "ArweaveClient:get",
|
|
111
|
-
message: "Failed to retrieve value from Arweave - network error or invalid response status",
|
|
112
|
-
transactionID,
|
|
113
|
-
responseStatus,
|
|
114
|
-
data,
|
|
115
|
-
});
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
105
|
+
const request = async () => {
|
|
106
|
+
const { data: requestData } = await axios.get(transactionUrl);
|
|
107
|
+
return requestData;
|
|
108
|
+
};
|
|
109
|
+
const data = await this._retryRequest(request, 0);
|
|
118
110
|
try {
|
|
119
111
|
// We should validate the data and perform any logical coercion here.
|
|
120
112
|
return create(data, validator);
|
|
@@ -242,7 +234,7 @@ export class ArweaveClient {
|
|
|
242
234
|
const baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount); // ms; attempt = [0, 1, 2, ...]
|
|
243
235
|
const delayS = baseDelay + baseDelay * Math.random();
|
|
244
236
|
this.logger.debug({
|
|
245
|
-
at: "ArweaveClient:
|
|
237
|
+
at: "ArweaveClient:retryRequest",
|
|
246
238
|
message: `Arweave request failed, retrying after waiting ${delayS} seconds: ${e}`,
|
|
247
239
|
retryCount,
|
|
248
240
|
});
|
|
@@ -2,7 +2,7 @@ import assert from "assert";
|
|
|
2
2
|
import { Transport } from "viem";
|
|
3
3
|
import { providers } from "ethers";
|
|
4
4
|
import { CHAIN_IDs } from "../constants";
|
|
5
|
-
import { BigNumber,
|
|
5
|
+
import { BigNumber, fixedPointAdjustment, isEvmProvider, toBNWei } from "../utils";
|
|
6
6
|
import { SVMProvider as SolanaProvider } from "../arch/svm";
|
|
7
7
|
import { EvmGasPriceEstimate, GasPriceEstimate, SvmGasPriceEstimate } from "./types";
|
|
8
8
|
import { getPublicClient } from "./util";
|
|
@@ -84,9 +84,7 @@ export async function getGasPriceEstimate(
|
|
|
84
84
|
|
|
85
85
|
// We only use the unsignedTx in the viem flow.
|
|
86
86
|
const useViem = VIEM_CHAINS.includes(chainId);
|
|
87
|
-
return useViem
|
|
88
|
-
? _getViemGasPriceEstimate(chainId, optsWithDefaults)
|
|
89
|
-
: _getEthersGasPriceEstimate(provider, optsWithDefaults);
|
|
87
|
+
return useViem ? getGasPriceViem(chainId, optsWithDefaults) : getGasPriceEthers(provider, optsWithDefaults);
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
/**
|
|
@@ -96,35 +94,24 @@ export async function getGasPriceEstimate(
|
|
|
96
94
|
* @param legacyFallback In the case of an unrecognised chain, fall back to type 0 gas estimation.
|
|
97
95
|
* @returns An object of type GasPriceEstimate.
|
|
98
96
|
*/
|
|
99
|
-
function
|
|
100
|
-
provider: providers.Provider,
|
|
101
|
-
opts: GasPriceEstimateOptions
|
|
102
|
-
): Promise<GasPriceEstimate> {
|
|
97
|
+
function getGasPriceEthers(provider: providers.Provider, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
|
|
103
98
|
const { chainId, legacyFallback } = opts;
|
|
104
99
|
|
|
105
100
|
// There shouldn't be any chains in here that we have a Viem adapter for because we'll always use Viem in that case.
|
|
106
101
|
assert(!VIEM_CHAINS.includes(chainId), `Chain ID ${chainId} will use Viem gas price estimation`);
|
|
107
102
|
const gasPriceFeeds = {
|
|
108
103
|
[CHAIN_IDs.ARBITRUM]: arbitrum.eip1559,
|
|
109
|
-
[CHAIN_IDs.BSC]: ethereum.eip1559,
|
|
110
|
-
[CHAIN_IDs.MAINNET]: ethereum.eip1559,
|
|
111
|
-
[CHAIN_IDs.MEGAETH]: ethereum.eip1559,
|
|
112
|
-
[CHAIN_IDs.MONAD]: ethereum.eip1559,
|
|
113
|
-
[CHAIN_IDs.PLASMA]: ethereum.eip1559,
|
|
114
104
|
[CHAIN_IDs.POLYGON]: polygon.gasStation,
|
|
115
105
|
[CHAIN_IDs.SCROLL]: ethereum.legacy,
|
|
116
106
|
[CHAIN_IDs.TEMPO]: ethereum.eip1559,
|
|
117
107
|
[CHAIN_IDs.ZK_SYNC]: ethereum.legacy,
|
|
118
|
-
|
|
119
|
-
// Testnet Chains
|
|
120
|
-
[CHAIN_IDs.ARBITRUM_SEPOLIA]: arbitrum.eip1559,
|
|
108
|
+
// Testnet
|
|
121
109
|
[CHAIN_IDs.POLYGON_AMOY]: polygon.gasStation,
|
|
122
|
-
[CHAIN_IDs.SEPOLIA]: ethereum.eip1559,
|
|
123
110
|
} as const;
|
|
124
111
|
|
|
125
112
|
let gasPriceFeed = gasPriceFeeds[chainId];
|
|
126
113
|
assert(gasPriceFeed || legacyFallback, `No suitable gas price oracle for Chain ID ${chainId}`);
|
|
127
|
-
gasPriceFeed ??=
|
|
114
|
+
gasPriceFeed ??= ethereum.eip1559;
|
|
128
115
|
|
|
129
116
|
return gasPriceFeed(provider, opts);
|
|
130
117
|
}
|
|
@@ -136,16 +123,10 @@ function _getEthersGasPriceEstimate(
|
|
|
136
123
|
* @param unsignedTx Only used in Linea provider to estimate priority gas fee.
|
|
137
124
|
* @returns An object of type GasPriceEstimate.
|
|
138
125
|
*/
|
|
139
|
-
|
|
140
|
-
providerOrChainId: providers.Provider | number,
|
|
141
|
-
opts: GasPriceEstimateOptions
|
|
142
|
-
): Promise<GasPriceEstimate> {
|
|
126
|
+
async function getGasPriceViem(chainId: number, opts: GasPriceEstimateOptions): Promise<GasPriceEstimate> {
|
|
143
127
|
const { baseFeeMultiplier, transport } = opts;
|
|
144
128
|
|
|
145
|
-
const chainId =
|
|
146
|
-
typeof providerOrChainId === "number" ? providerOrChainId : (await providerOrChainId.getNetwork()).chainId;
|
|
147
129
|
const viemProvider = getPublicClient(chainId, transport);
|
|
148
|
-
|
|
149
130
|
const gasPriceFeeds = {
|
|
150
131
|
[CHAIN_IDs.LINEA]: lineaViem.eip1559,
|
|
151
132
|
};
|
package/test-utils.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Note: this file sits on a separate export path and is intended to export test utilities.
|
|
2
|
+
// You can import it like this: import * as testUtils from "@across-protocol/sdk/test-utils".
|
|
3
|
+
// This is separated because this code assumes the caller has a hardhat config because it imports
|
|
4
|
+
// hardhat. For non-test code, import the standard index file:
|
|
5
|
+
// import * as sdk from "@across-protocol/sdk"
|
|
6
|
+
|
|
7
|
+
// Export from utils first (primary source for randomAddress, zeroAddress)
|
|
8
|
+
export * from "./test/utils/utils";
|
|
9
|
+
|
|
10
|
+
// Export from constants, excluding duplicates that come from utils
|
|
11
|
+
export {
|
|
12
|
+
TokenRolesEnum,
|
|
13
|
+
destinationChainId,
|
|
14
|
+
originChainId,
|
|
15
|
+
repaymentChainId,
|
|
16
|
+
maxUint256,
|
|
17
|
+
MAX_UINT32,
|
|
18
|
+
MAX_EXCLUSIVITY_OFFSET_SECONDS,
|
|
19
|
+
amountToSeedWallets,
|
|
20
|
+
amountToLp,
|
|
21
|
+
amountToDeposit,
|
|
22
|
+
amountToRelay,
|
|
23
|
+
depositRelayerFeePct,
|
|
24
|
+
modifiedRelayerFeePct,
|
|
25
|
+
incorrectModifiedRelayerFeePct,
|
|
26
|
+
realizedLpFeePct,
|
|
27
|
+
oneHundredPct,
|
|
28
|
+
totalPostFeesPct,
|
|
29
|
+
totalPostModifiedFeesPct,
|
|
30
|
+
amountToRelayPreFees,
|
|
31
|
+
amountReceived,
|
|
32
|
+
amountToRelayPreModifiedFees,
|
|
33
|
+
amountToRelayPreLPFee,
|
|
34
|
+
firstDepositId,
|
|
35
|
+
bondAmount,
|
|
36
|
+
finalFee,
|
|
37
|
+
finalFeeUsdc,
|
|
38
|
+
finalFeeUsdt,
|
|
39
|
+
totalBond,
|
|
40
|
+
refundProposalLiveness,
|
|
41
|
+
zeroAddress,
|
|
42
|
+
zeroBytes32,
|
|
43
|
+
identifier,
|
|
44
|
+
zeroRawValue,
|
|
45
|
+
mockBundleEvaluationBlockNumbers,
|
|
46
|
+
mockPoolRebalanceLeafCount,
|
|
47
|
+
mockPoolRebalanceRoot,
|
|
48
|
+
mockRelayerRefundRoot,
|
|
49
|
+
mockSlowRelayRoot,
|
|
50
|
+
mockTreeRoot,
|
|
51
|
+
amountHeldByPool,
|
|
52
|
+
amountToReturn,
|
|
53
|
+
sampleL2Gas,
|
|
54
|
+
sampleL2GasSendTokens,
|
|
55
|
+
sampleL2MaxSubmissionCost,
|
|
56
|
+
sampleL2GasPrice,
|
|
57
|
+
maxRefundsPerRelayerRefundLeaf,
|
|
58
|
+
maxL1TokensPerPoolRebalanceLeaf,
|
|
59
|
+
l1TokenTransferThreshold,
|
|
60
|
+
MAX_REFUNDS_PER_RELAYER_REFUND_LEAF,
|
|
61
|
+
MAX_L1_TOKENS_PER_POOL_REBALANCE_LEAF,
|
|
62
|
+
sampleRateModel,
|
|
63
|
+
CONFIG_STORE_VERSION,
|
|
64
|
+
randomAddress,
|
|
65
|
+
randomL1Token,
|
|
66
|
+
randomOriginToken,
|
|
67
|
+
randomDestinationToken,
|
|
68
|
+
randomDestinationToken2,
|
|
69
|
+
CHAIN_ID_TEST_LIST,
|
|
70
|
+
} from "./test/constants";
|
|
71
|
+
|
|
72
|
+
// Export from fixtures, excluding zeroAddress which is already exported from utils
|
|
73
|
+
export { deploySpokePool, spokePoolFixture } from "./test/fixtures/SpokePool.Fixture";
|
|
74
|
+
export { deployHubPool, hubPoolFixture } from "./test/fixtures/HubPool.Fixture";
|
|
75
|
+
|
|
76
|
+
// Export MerkleLib utilities (already re-exported by utils, but keep for clarity)
|
|
77
|
+
export {
|
|
78
|
+
buildPoolRebalanceLeafTree,
|
|
79
|
+
buildPoolRebalanceLeaves,
|
|
80
|
+
buildRelayerRefundTree,
|
|
81
|
+
buildRelayerRefundLeaves,
|
|
82
|
+
buildSlowRelayTree,
|
|
83
|
+
buildV3SlowRelayTree,
|
|
84
|
+
getParamType,
|
|
85
|
+
} from "./test/utils/MerkleLib.utils";
|
|
86
|
+
|
|
87
|
+
// Export types
|
|
88
|
+
export * from "./test/types";
|
package/typechain.ts
ADDED