@across-protocol/sdk 4.2.16-alpha.6 → 4.2.16
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 +3 -8
- package/dist/cjs/arch/evm/SpokeUtils.js +11 -26
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +2 -8
- package/dist/cjs/arch/svm/SpokeUtils.js +50 -41
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/eventsClient.js +2 -4
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +3 -3
- package/dist/cjs/arch/svm/utils.js +14 -16
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +83 -78
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +13 -13
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +2 -3
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
- package/dist/cjs/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +3 -3
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -13
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +21 -21
- package/dist/cjs/clients/HubPoolClient.js +58 -84
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +45 -65
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.d.ts +13 -0
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js +18 -0
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -0
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +9 -15
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +36 -40
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +4 -6
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js +2 -2
- package/dist/cjs/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/HubPool.d.ts +14 -19
- package/dist/cjs/interfaces/SpokePool.d.ts +19 -18
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +7 -15
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +15 -24
- 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 +4 -12
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +44 -46
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +10 -10
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +8 -12
- package/dist/cjs/utils/AddressUtils.js +36 -33
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/NetworkUtils.js +1 -1
- package/dist/cjs/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/utils/SpokeUtils.d.ts +3 -3
- package/dist/cjs/utils/SpokeUtils.js +22 -4
- package/dist/cjs/utils/SpokeUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +4 -4
- package/dist/cjs/utils/TokenUtils.js +3 -5
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +4 -9
- package/dist/esm/arch/evm/SpokeUtils.js +14 -29
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +3 -9
- package/dist/esm/arch/svm/SpokeUtils.js +55 -42
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/eventsClient.js +3 -5
- package/dist/esm/arch/svm/eventsClient.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +3 -3
- package/dist/esm/arch/svm/utils.js +15 -17
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +2 -4
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +84 -79
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +14 -14
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -5
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js +1 -5
- package/dist/esm/clients/BundleDataClient/utils/MerkleTreeUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +4 -4
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +10 -20
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +22 -23
- package/dist/esm/clients/HubPoolClient.js +63 -98
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +47 -68
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.d.ts +28 -0
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js +30 -0
- package/dist/esm/clients/SpokePoolClient/SpokePoolClientManager.js.map +1 -0
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/esm/clients/mocks/MockHubPoolClient.js +10 -16
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +38 -42
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +5 -7
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js +3 -3
- package/dist/esm/clients/mocks/MockSvmSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/HubPool.d.ts +14 -19
- package/dist/esm/interfaces/SpokePool.d.ts +19 -18
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +10 -18
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +20 -29
- 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 +6 -14
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +48 -51
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +9 -9
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +8 -12
- package/dist/esm/utils/AddressUtils.js +38 -36
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/NetworkUtils.js +1 -1
- package/dist/esm/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/utils/SpokeUtils.d.ts +8 -3
- package/dist/esm/utils/SpokeUtils.js +26 -4
- package/dist/esm/utils/SpokeUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +18 -22
- package/dist/esm/utils/TokenUtils.js +4 -6
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +4 -9
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +3 -9
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +3 -3
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts +6 -7
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts +1 -2
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/MerkleTreeUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/dist/types/clients/HubPoolClient.d.ts +22 -23
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +2 -2
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClientManager.d.ts +29 -0
- package/dist/types/clients/SpokePoolClient/SpokePoolClientManager.d.ts.map +1 -0
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +9 -9
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +3 -5
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/types/clients/mocks/MockSvmCpiEventsClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts +2 -2
- package/dist/types/clients/mocks/MockSvmSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/HubPool.d.ts +14 -19
- package/dist/types/interfaces/HubPool.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +19 -18
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +10 -18
- 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 +6 -14
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +6 -6
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +8 -12
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/SpokeUtils.d.ts +8 -3
- package/dist/types/utils/SpokeUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +18 -22
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/arch/evm/SpokeUtils.ts +22 -72
- package/src/arch/svm/SpokeUtils.ts +53 -67
- package/src/arch/svm/eventsClient.ts +8 -40
- package/src/arch/svm/utils.ts +6 -6
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +4 -7
- package/src/clients/BundleDataClient/BundleDataClient.ts +90 -77
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +13 -28
- package/src/clients/BundleDataClient/utils/FillUtils.ts +4 -10
- package/src/clients/BundleDataClient/utils/MerkleTreeUtils.ts +1 -7
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +4 -4
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +10 -22
- package/src/clients/HubPoolClient.ts +82 -127
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +0 -6
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +35 -121
- package/src/clients/SpokePoolClient/SpokePoolClientManager.ts +36 -0
- package/src/clients/mocks/MockHubPoolClient.ts +19 -24
- package/src/clients/mocks/MockSpokePoolClient.ts +27 -39
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +5 -8
- package/src/clients/mocks/MockSvmSpokePoolClient.ts +3 -12
- package/src/interfaces/HubPool.ts +14 -23
- package/src/interfaces/SpokePool.ts +19 -19
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +20 -39
- package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +56 -57
- package/src/relayFeeCalculator/relayFeeCalculator.ts +13 -15
- package/src/utils/AddressUtils.ts +51 -39
- package/src/utils/NetworkUtils.ts +1 -1
- package/src/utils/SpokeUtils.ts +33 -11
- package/src/utils/TokenUtils.ts +8 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { object, number, optional, string, array, record, coerce, instance, pattern, boolean, defaulted, union, type, } from "superstruct";
|
|
3
|
-
import {
|
|
4
|
-
import { BigNumber
|
|
3
|
+
import { UNDEFINED_MESSAGE_HASH } from "../../../constants";
|
|
4
|
+
import { BigNumber } from "../../../utils";
|
|
5
5
|
var PositiveIntegerStringSS = pattern(string(), /\d+/);
|
|
6
6
|
var Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{40}$/);
|
|
7
7
|
var BigNumberType = coerce(instance(BigNumber), union([string(), number()]), function (value) {
|
|
@@ -15,28 +15,18 @@ var BigNumberType = coerce(instance(BigNumber), union([string(), number()]), fun
|
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
// Accept any concrete implementation of `Address` (Evm, Svm, or Raw) but avoid using the
|
|
19
|
-
// abstract `Address` class directly to keep TypeScript happy.
|
|
20
|
-
var AddressInstanceSS = union([instance(EvmAddress), instance(SvmAddress), instance(RawAddress)]);
|
|
21
|
-
var AddressType = coerce(AddressInstanceSS, string(), function (value) {
|
|
22
|
-
// Addresses are posted to arweave in their native format (base16 for EVM, base58 for SVM). The chainId for
|
|
23
|
-
// for the event data is not directly available, so infer it based on the shape of the address. RawAddress
|
|
24
|
-
// will be instantiated if the address format does not match the expected family.
|
|
25
|
-
var chainId = value.startsWith("0x") ? CHAIN_IDs.MAINNET : CHAIN_IDs.SOLANA;
|
|
26
|
-
return toAddressType(value, chainId);
|
|
27
|
-
});
|
|
28
18
|
var FillTypeSS = number();
|
|
29
19
|
var V3RelayDataSS = {
|
|
30
|
-
inputToken:
|
|
20
|
+
inputToken: string(),
|
|
31
21
|
inputAmount: BigNumberType,
|
|
32
|
-
outputToken:
|
|
22
|
+
outputToken: string(),
|
|
33
23
|
outputAmount: BigNumberType,
|
|
34
24
|
fillDeadline: number(),
|
|
35
|
-
exclusiveRelayer:
|
|
25
|
+
exclusiveRelayer: string(),
|
|
36
26
|
exclusivityDeadline: number(),
|
|
37
27
|
originChainId: number(),
|
|
38
|
-
depositor:
|
|
39
|
-
recipient:
|
|
28
|
+
depositor: string(),
|
|
29
|
+
recipient: string(),
|
|
40
30
|
depositId: BigNumberType,
|
|
41
31
|
message: string(),
|
|
42
32
|
};
|
|
@@ -56,7 +46,7 @@ var V3DepositSS = {
|
|
|
56
46
|
quoteTimestamp: number(),
|
|
57
47
|
relayerFeePct: optional(BigNumberType),
|
|
58
48
|
speedUpSignature: optional(string()),
|
|
59
|
-
updatedRecipient: optional(
|
|
49
|
+
updatedRecipient: optional(string()),
|
|
60
50
|
updatedOutputAmount: optional(BigNumberType),
|
|
61
51
|
updatedMessage: optional(string()),
|
|
62
52
|
};
|
|
@@ -66,11 +56,11 @@ var V3DepositWithBlockLpFeeSS = object(__assign(__assign({}, _V3DepositWithBlock
|
|
|
66
56
|
var V3RelayExecutionEventInfoSS = object({
|
|
67
57
|
updatedOutputAmount: BigNumberType,
|
|
68
58
|
fillType: FillTypeSS,
|
|
69
|
-
updatedRecipient:
|
|
59
|
+
updatedRecipient: string(),
|
|
70
60
|
updatedMessage: optional(string()),
|
|
71
61
|
updatedMessageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH),
|
|
72
62
|
});
|
|
73
|
-
var V3FillSS = __assign(__assign({}, V3RelayDataSS), { message: optional(string()), messageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH), destinationChainId: number(), relayer:
|
|
63
|
+
var V3FillSS = __assign(__assign({}, V3RelayDataSS), { message: optional(string()), messageHash: defaulted(string(), UNDEFINED_MESSAGE_HASH), destinationChainId: number(), relayer: string(), repaymentChainId: number(), relayExecutionInfo: V3RelayExecutionEventInfoSS, quoteTimestamp: number() });
|
|
74
64
|
var V3FillWithBlockSS = __assign(__assign({}, SortableEventSS), V3FillSS);
|
|
75
65
|
var BundleFillV3SS = object(__assign(__assign({}, V3FillWithBlockSS), { lpFeePct: BigNumberType }));
|
|
76
66
|
var nestedV3DepositRecordSS = record(PositiveIntegerStringSS, record(Web3AddressSS, array(V3DepositWithBlockSS)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperstructUtils.js","sourceRoot":"","sources":["../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,KAAK,EACL,IAAI,GACL,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SuperstructUtils.js","sourceRoot":"","sources":["../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Contract, EventFilter } from "ethers";
|
|
2
2
|
import winston from "winston";
|
|
3
|
-
import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle,
|
|
3
|
+
import { CachingMechanismInterface, CancelledRootBundle, CrossChainContractsSet, Deposit, DepositWithBlock, DestinationTokenWithBlock, DisputedRootBundle, ExecutedRootBundle, L1Token, Log, LpToken, PendingRootBundle, ProposedRootBundle, RealizedLpFee, TokenRunningBalance } from "../interfaces";
|
|
4
4
|
import { EVMBlockFinder } from "../arch/evm";
|
|
5
|
-
import { BigNumber, EventSearchConfig, MakeOptional
|
|
5
|
+
import { BigNumber, EventSearchConfig, MakeOptional } from "../utils";
|
|
6
6
|
import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
|
|
7
7
|
import { BaseAbstractClient, UpdateFailureReason } from "./BaseAbstractClient";
|
|
8
8
|
type HubPoolUpdateSuccess = {
|
|
@@ -38,7 +38,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
38
38
|
timeToCache?: number;
|
|
39
39
|
};
|
|
40
40
|
protected l1TokensToDestinationTokens: L1TokensToDestinationTokens;
|
|
41
|
-
protected l1Tokens:
|
|
41
|
+
protected l1Tokens: L1Token[];
|
|
42
42
|
protected lpTokens: {
|
|
43
43
|
[token: string]: LpToken;
|
|
44
44
|
};
|
|
@@ -69,22 +69,21 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
69
69
|
getCancelledRootBundles(): CancelledRootBundle[];
|
|
70
70
|
getDisputedRootBundles(): DisputedRootBundle[];
|
|
71
71
|
getExecutedRootBundles(): ExecutedRootBundle[];
|
|
72
|
-
getSpokePoolForBlock(chain: number, block?: number):
|
|
73
|
-
getSpokePoolActivationBlock(chain: number, spokePool:
|
|
74
|
-
getL2TokenForL1TokenAtBlock(l1Token:
|
|
75
|
-
getL1TokenForL2TokenAtBlock(l2Token:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock?: number): boolean;
|
|
72
|
+
getSpokePoolForBlock(chain: number, block?: number): string;
|
|
73
|
+
getSpokePoolActivationBlock(chain: number, spokePool: string): number | undefined;
|
|
74
|
+
getL2TokenForL1TokenAtBlock(l1Token: string, destinationChainId: number, latestHubBlock?: number): string;
|
|
75
|
+
getL1TokenForL2TokenAtBlock(l2Token: string, destinationChainId: number, latestHubBlock?: number): string;
|
|
76
|
+
protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): string;
|
|
77
|
+
l2TokenEnabledForL1Token(l1Token: string, destinationChainId: number): boolean;
|
|
78
|
+
l2TokenEnabledForL1TokenAtBlock(l1Token: string, destinationChainId: number, hubBlockNumber: number): boolean;
|
|
79
|
+
l2TokenHasPoolRebalanceRoute(l2Token: string, l2ChainId: number, hubPoolBlock?: number): boolean;
|
|
81
80
|
/**
|
|
82
81
|
* @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
|
|
83
82
|
* @param tokenAddress Token address on `chain`
|
|
84
|
-
* @param
|
|
83
|
+
* @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
|
|
85
84
|
* @returns Token info for the given token address on the L2 chain including symbol and decimal.
|
|
86
85
|
*/
|
|
87
|
-
getTokenInfoForAddress(tokenAddress: string,
|
|
86
|
+
getTokenInfoForAddress(tokenAddress: string, chain: number): L1Token;
|
|
88
87
|
/**
|
|
89
88
|
* Resolve a given timestamp to a block number on the HubPool chain.
|
|
90
89
|
* @param timestamp A single timestamp to be resolved to a block number on the HubPool chain.
|
|
@@ -101,7 +100,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
101
100
|
getBlockNumbers(timestamps: number[]): Promise<{
|
|
102
101
|
[quoteTimestamp: number]: number;
|
|
103
102
|
}>;
|
|
104
|
-
getCurrentPoolUtilization(l1Token:
|
|
103
|
+
getCurrentPoolUtilization(l1Token: string): Promise<BigNumber>;
|
|
105
104
|
/**
|
|
106
105
|
* For a HubPool token at a specific block number, compute the relevant utilization.
|
|
107
106
|
* @param hubPoolToken HubPool token to query utilization for.
|
|
@@ -111,13 +110,13 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
111
110
|
* @param timeToCache Age at which the response is able to be cached.
|
|
112
111
|
* @returns HubPool utilization at `blockNumber` after optional `amount` increase in utilization.
|
|
113
112
|
*/
|
|
114
|
-
protected getUtilization(hubPoolToken:
|
|
113
|
+
protected getUtilization(hubPoolToken: string, blockNumber: number, depositAmount: BigNumber, timestamp: number, timeToCache: number): Promise<BigNumber>;
|
|
115
114
|
computeRealizedLpFeePct(deposit: LpFeeRequest): Promise<RealizedLpFee>;
|
|
116
115
|
batchComputeRealizedLpFeePct(deposits: LpFeeRequest[]): Promise<RealizedLpFee[]>;
|
|
117
|
-
getL1Tokens():
|
|
118
|
-
getTokenInfoForL1Token(l1Token:
|
|
119
|
-
getLpTokenInfoForL1Token(l1Token:
|
|
120
|
-
areTokensEquivalent(tokenA:
|
|
116
|
+
getL1Tokens(): L1Token[];
|
|
117
|
+
getTokenInfoForL1Token(l1Token: string): L1Token | undefined;
|
|
118
|
+
getLpTokenInfoForL1Token(l1Token: string): LpToken | undefined;
|
|
119
|
+
areTokensEquivalent(tokenA: string, chainIdA: number, tokenB: string, chainIdB: number, hubPoolBlock?: number): boolean;
|
|
121
120
|
getSpokeActivationBlockForChain(chainId: number): number;
|
|
122
121
|
isRootBundleValid(rootBundle: ProposedRootBundle, latestMainnetBlock: number): boolean;
|
|
123
122
|
getRootBundleEvalBlockNumberContainingBlock(latestMainnetBlock: number, block: number, chain: number, chainIdListOverride?: number[]): number | undefined;
|
|
@@ -143,9 +142,9 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
143
142
|
getNthFullyExecutedRootBundle(n: number, startBlock?: number): ProposedRootBundle | undefined;
|
|
144
143
|
getLatestBundleEndBlockForChain(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
|
|
145
144
|
getNextBundleStartBlockNumber(chainIdList: number[], latestMainnetBlock: number, chainId: number): number;
|
|
146
|
-
getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token:
|
|
147
|
-
getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token:
|
|
148
|
-
getRunningBalanceForToken(l1Token:
|
|
145
|
+
getLatestExecutedRootBundleContainingL1Token(block: number, chain: number, l1Token: string): ExecutedRootBundle | undefined;
|
|
146
|
+
getRunningBalanceBeforeBlockForChain(block: number, chain: number, l1Token: string): TokenRunningBalance;
|
|
147
|
+
getRunningBalanceForToken(l1Token: string, executedRootBundle: ExecutedRootBundle | undefined): TokenRunningBalance;
|
|
149
148
|
_update(eventNames: HubPoolEvent[]): Promise<HubPoolUpdate>;
|
|
150
149
|
update(eventsToQuery?: HubPoolEvent[]): Promise<void>;
|
|
151
150
|
protected getBundleEndBlockForChain(proposeRootBundleEvent: ProposedRootBundle, chainId: number, chainIdList: number[]): number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __assign, __awaiter, __extends, __generator, __spreadArray } from "tslib";
|
|
2
2
|
import assert from "assert";
|
|
3
3
|
import _ from "lodash";
|
|
4
|
-
import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP } from "../constants";
|
|
4
|
+
import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, TOKEN_SYMBOLS_MAP, ZERO_ADDRESS } from "../constants";
|
|
5
5
|
import * as lpFeeCalculator from "../lpFeeCalculator";
|
|
6
6
|
import { EVMBlockFinder } from "../arch/evm";
|
|
7
|
-
import { BigNumber, bnZero, dedupArray, assign, fetchTokenInfo, getCachedBlockForTimestamp, getCurrentTime, getNetworkName, isDefined, mapAsync, paginatedEventQuery, shouldCache, sortEventsDescending, spreadEventWithBlockNumber, toBN, getTokenInfo, getUsdcSymbol, chainIsSvm, getDeployedAddress, SvmAddress,
|
|
7
|
+
import { BigNumber, bnZero, dedupArray, assign, fetchTokenInfo, getCachedBlockForTimestamp, getCurrentTime, getNetworkName, isDefined, mapAsync, paginatedEventQuery, shouldCache, sortEventsDescending, spreadEventWithBlockNumber, toBN, getTokenInfo, getUsdcSymbol, compareAddressesSimple, chainIsSvm, getDeployedAddress, SvmAddress, } from "../utils";
|
|
8
8
|
import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
|
|
9
9
|
var HubPoolClient = /** @class */ (function (_super) {
|
|
10
10
|
__extends(HubPoolClient, _super);
|
|
@@ -26,7 +26,6 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
26
26
|
// L1Token -> destinationChainId -> destinationToken
|
|
27
27
|
_this.l1TokensToDestinationTokens = {};
|
|
28
28
|
_this.l1Tokens = []; // L1Tokens and their associated info.
|
|
29
|
-
// @dev `token` here is a 20-byte hex sting
|
|
30
29
|
_this.lpTokens = {};
|
|
31
30
|
_this.proposedRootBundles = [];
|
|
32
31
|
_this.canceledRootBundles = [];
|
|
@@ -85,52 +84,42 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
85
84
|
HubPoolClient.prototype.getSpokePoolActivationBlock = function (chain, spokePool) {
|
|
86
85
|
// Return first time that this spoke pool was registered in the HubPool as a cross chain contract. We can use
|
|
87
86
|
// this block as the oldest block that we should query for SpokePoolClient purposes.
|
|
88
|
-
var mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(function (crossChainContract) {
|
|
89
|
-
return crossChainContract.spokePool.eq(spokePool);
|
|
90
|
-
});
|
|
87
|
+
var mostRecentSpokePoolUpdateBeforeBlock = this.crossChainContracts[chain].find(function (crossChainContract) { return crossChainContract.spokePool === spokePool; });
|
|
91
88
|
return mostRecentSpokePoolUpdateBeforeBlock === null || mostRecentSpokePoolUpdateBeforeBlock === void 0 ? void 0 : mostRecentSpokePoolUpdateBeforeBlock.blockNumber;
|
|
92
89
|
};
|
|
93
90
|
// Returns the latest L2 token to use for an L1 token as of the input hub block.
|
|
94
91
|
HubPoolClient.prototype.getL2TokenForL1TokenAtBlock = function (l1Token, destinationChainId, latestHubBlock) {
|
|
95
92
|
var _a, _b, _c, _d;
|
|
96
93
|
if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
|
|
97
|
-
if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token
|
|
94
|
+
if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId])) {
|
|
98
95
|
var chain = getNetworkName(destinationChainId);
|
|
99
96
|
var symbol = ((_c = this.l1Tokens.find(function (_a) {
|
|
100
97
|
var address = _a.address;
|
|
101
|
-
return address
|
|
102
|
-
})) !== null && _c !== void 0 ? _c : { symbol: l1Token
|
|
98
|
+
return address === l1Token;
|
|
99
|
+
})) !== null && _c !== void 0 ? _c : { symbol: l1Token }).symbol;
|
|
103
100
|
throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " and L1 token ").concat(l1Token));
|
|
104
101
|
}
|
|
105
102
|
// Find the last mapping published before the target block.
|
|
106
|
-
var l2Token = sortEventsDescending(this.l1TokensToDestinationTokensWithBlock[l1Token
|
|
103
|
+
var l2Token = sortEventsDescending(this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId]).find(function (mapping) { return mapping.blockNumber <= latestHubBlock; });
|
|
107
104
|
if (!l2Token) {
|
|
108
105
|
var chain = getNetworkName(destinationChainId);
|
|
109
106
|
var symbol = ((_d = this.l1Tokens.find(function (_a) {
|
|
110
107
|
var address = _a.address;
|
|
111
|
-
return address
|
|
112
|
-
})) !== null && _d !== void 0 ? _d : { symbol: l1Token
|
|
108
|
+
return address === l1Token;
|
|
109
|
+
})) !== null && _d !== void 0 ? _d : { symbol: l1Token }).symbol;
|
|
113
110
|
throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " at or before HubPool block ").concat(latestHubBlock, "!"));
|
|
114
111
|
}
|
|
115
112
|
return l2Token.l2Token;
|
|
116
113
|
};
|
|
117
|
-
// TODO: this might have to deal with truncated Solana addresses? Depends on what input is given actually
|
|
118
|
-
// TODO: might craete `getL1TokenForL2EVMTokenAtBlock` and some other fn
|
|
119
114
|
// Returns the latest L1 token to use for an L2 token as of the input hub block.
|
|
120
|
-
HubPoolClient.prototype.getL1TokenForL2TokenAtBlock = function (l2Token,
|
|
121
|
-
destinationChainId, latestHubBlock) {
|
|
115
|
+
HubPoolClient.prototype.getL1TokenForL2TokenAtBlock = function (l2Token, destinationChainId, latestHubBlock) {
|
|
122
116
|
var _this = this;
|
|
123
117
|
if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
|
|
124
118
|
var l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
|
|
125
|
-
.filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(
|
|
119
|
+
.filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(l1Token, destinationChainId); })
|
|
126
120
|
.map(function (l1Token) {
|
|
127
121
|
// Return all matching L2 token mappings that are equal to or earlier than the target block.
|
|
128
|
-
return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(
|
|
129
|
-
// ! TODO: Okay. Here, in `l1TokensToDestinationTokensWithBlock`, we might be saving truncated solana addresses (as `l1TokensToDestinationTokensWithBlock` is probably generated from events)
|
|
130
|
-
// ! TODO: Considering this, this filtering should be a bit different. If .isSvmAddress => check not for equality, but for *truncated equality*. If .isEvmAddress, check for equality
|
|
131
|
-
function (dstTokenWithBlock) {
|
|
132
|
-
return dstTokenWithBlock.l2Token.eq(l2Token) && dstTokenWithBlock.blockNumber <= latestHubBlock;
|
|
133
|
-
});
|
|
122
|
+
return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(function (mapping) { return mapping.l2Token === l2Token && mapping.blockNumber <= latestHubBlock; });
|
|
134
123
|
})
|
|
135
124
|
.flat();
|
|
136
125
|
if (l2Tokens.length === 0) {
|
|
@@ -148,12 +137,12 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
148
137
|
};
|
|
149
138
|
HubPoolClient.prototype.l2TokenEnabledForL1Token = function (l1Token, destinationChainId) {
|
|
150
139
|
var _a, _b;
|
|
151
|
-
return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token
|
|
140
|
+
return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) != undefined;
|
|
152
141
|
};
|
|
153
142
|
HubPoolClient.prototype.l2TokenEnabledForL1TokenAtBlock = function (l1Token, destinationChainId, hubBlockNumber) {
|
|
154
143
|
var _a, _b, _c;
|
|
155
144
|
// Find the last mapping published before the target block.
|
|
156
|
-
var l2Token = sortEventsDescending((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token
|
|
145
|
+
var l2Token = sortEventsDescending((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) !== null && _c !== void 0 ? _c : []).find(function (mapping) { return mapping.blockNumber <= hubBlockNumber; });
|
|
157
146
|
return l2Token !== undefined;
|
|
158
147
|
};
|
|
159
148
|
HubPoolClient.prototype.l2TokenHasPoolRebalanceRoute = function (l2Token, l2ChainId, hubPoolBlock) {
|
|
@@ -163,8 +152,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
163
152
|
var _l2ChainId = _a[0], setPoolRebalanceRouteEvents = _a[1];
|
|
164
153
|
return setPoolRebalanceRouteEvents.some(function (e) {
|
|
165
154
|
return (e.blockNumber <= hubPoolBlock &&
|
|
166
|
-
|
|
167
|
-
e.l2Token.eq(l2Token) &&
|
|
155
|
+
compareAddressesSimple(e.l2Token, l2Token) &&
|
|
168
156
|
Number(_l2ChainId) === l2ChainId);
|
|
169
157
|
});
|
|
170
158
|
});
|
|
@@ -173,17 +161,16 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
173
161
|
/**
|
|
174
162
|
* @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
|
|
175
163
|
* @param tokenAddress Token address on `chain`
|
|
176
|
-
* @param
|
|
164
|
+
* @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
|
|
177
165
|
* @returns Token info for the given token address on the L2 chain including symbol and decimal.
|
|
178
166
|
*/
|
|
179
|
-
|
|
180
|
-
HubPoolClient.prototype.getTokenInfoForAddress = function (tokenAddress, chainId) {
|
|
167
|
+
HubPoolClient.prototype.getTokenInfoForAddress = function (tokenAddress, chain) {
|
|
181
168
|
var _a;
|
|
182
|
-
var tokenInfo = getTokenInfo(tokenAddress,
|
|
169
|
+
var tokenInfo = getTokenInfo(tokenAddress, chain);
|
|
183
170
|
// @dev Temporarily handle case where an L2 token for chain ID can map to more than one TOKEN_SYMBOLS_MAP
|
|
184
171
|
// entry. For example, L2 Bridged USDC maps to both the USDC and USDC.e/USDbC entries in TOKEN_SYMBOLS_MAP.
|
|
185
|
-
if (tokenInfo.symbol.toLowerCase() === "usdc" &&
|
|
186
|
-
tokenInfo.symbol = (_a = getUsdcSymbol(tokenAddress,
|
|
172
|
+
if (tokenInfo.symbol.toLowerCase() === "usdc" && chain !== this.chainId) {
|
|
173
|
+
tokenInfo.symbol = (_a = getUsdcSymbol(tokenAddress, chain)) !== null && _a !== void 0 ? _a : "UNKNOWN";
|
|
187
174
|
}
|
|
188
175
|
return tokenInfo;
|
|
189
176
|
};
|
|
@@ -275,11 +262,11 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
275
262
|
case 0:
|
|
276
263
|
overrides = { blockTag: blockNumber };
|
|
277
264
|
if (!depositAmount.eq(0)) return [3 /*break*/, 2];
|
|
278
|
-
return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken
|
|
265
|
+
return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationCurrent(hubPoolToken, overrides)];
|
|
279
266
|
case 1:
|
|
280
267
|
// For zero amount, just get the utilisation at `blockNumber`.
|
|
281
268
|
return [2 /*return*/, _a.sent()];
|
|
282
|
-
case 2: return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken
|
|
269
|
+
case 2: return [4 /*yield*/, this.hubPool.callStatic.liquidityUtilizationPostRelay(hubPoolToken, depositAmount, overrides)];
|
|
283
270
|
case 3: return [2 /*return*/, _a.sent()];
|
|
284
271
|
}
|
|
285
272
|
});
|
|
@@ -290,8 +277,8 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
290
277
|
return [2 /*return*/, resolver()];
|
|
291
278
|
}
|
|
292
279
|
key = depositAmount.eq(0)
|
|
293
|
-
? "utilization_".concat(hubPoolToken
|
|
294
|
-
: "utilization_".concat(hubPoolToken
|
|
280
|
+
? "utilization_".concat(hubPoolToken, "_").concat(blockNumber)
|
|
281
|
+
: "utilization_".concat(hubPoolToken, "_").concat(blockNumber, "_").concat(depositAmount.toString(), "_");
|
|
295
282
|
return [4 /*yield*/, cache.get(key)];
|
|
296
283
|
case 1:
|
|
297
284
|
result = _a.sent();
|
|
@@ -354,7 +341,6 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
354
341
|
getHubPoolTokens = function () { return dedupArray(Object.values(hubPoolTokens).filter(isDefined)); };
|
|
355
342
|
resolveUniqueQuoteTimestamps = function (deposit) {
|
|
356
343
|
var _a;
|
|
357
|
-
var _b;
|
|
358
344
|
var quoteTimestamp = deposit.quoteTimestamp;
|
|
359
345
|
// Resolve the HubPool token address for this origin chainId/token pair, if it isn't already known.
|
|
360
346
|
var quoteBlockNumber = quoteBlocks[quoteTimestamp];
|
|
@@ -363,9 +349,9 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
363
349
|
return;
|
|
364
350
|
}
|
|
365
351
|
// Append the quoteTimestamp for this HubPool token, if it isn't already enqueued.
|
|
366
|
-
(_a = utilizationTimestamps[
|
|
367
|
-
if (!utilizationTimestamps[hubPoolToken
|
|
368
|
-
utilizationTimestamps[hubPoolToken
|
|
352
|
+
(_a = utilizationTimestamps[hubPoolToken]) !== null && _a !== void 0 ? _a : (utilizationTimestamps[hubPoolToken] = []);
|
|
353
|
+
if (!utilizationTimestamps[hubPoolToken].includes(quoteTimestamp)) {
|
|
354
|
+
utilizationTimestamps[hubPoolToken].push(quoteTimestamp);
|
|
369
355
|
}
|
|
370
356
|
};
|
|
371
357
|
resolveUtilization = function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -375,7 +361,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
375
361
|
switch (_c.label) {
|
|
376
362
|
case 0:
|
|
377
363
|
_b = (_a = Object).fromEntries;
|
|
378
|
-
return [4 /*yield*/, mapAsync(utilizationTimestamps[hubPoolToken
|
|
364
|
+
return [4 /*yield*/, mapAsync(utilizationTimestamps[hubPoolToken], function (quoteTimestamp) { return __awaiter(_this, void 0, void 0, function () {
|
|
379
365
|
var blockNumber, utilization;
|
|
380
366
|
return __generator(this, function (_a) {
|
|
381
367
|
switch (_a.label) {
|
|
@@ -408,7 +394,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
408
394
|
throw new Error("Cannot computeRealizedLpFeePct for deposit with no pool rebalance route for input token ".concat(deposit.inputToken, " on ").concat(originChainId));
|
|
409
395
|
}
|
|
410
396
|
rateModel = this.configStoreClient.getRateModelForBlockNumber(hubPoolToken, originChainId, paymentChainId, quoteBlock);
|
|
411
|
-
preUtilization = utilization[hubPoolToken
|
|
397
|
+
preUtilization = utilization[hubPoolToken][quoteBlock];
|
|
412
398
|
return [4 /*yield*/, this.getUtilization(hubPoolToken, quoteBlock, inputAmount, quoteTimestamp, timeToCache)];
|
|
413
399
|
case 1:
|
|
414
400
|
postUtilization = _a.sent();
|
|
@@ -428,19 +414,14 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
428
414
|
// Identify the unique hubPoolToken & quoteTimestamp mappings. This is used to optimise subsequent HubPool queries.
|
|
429
415
|
deposits.forEach(function (deposit) { return resolveUniqueQuoteTimestamps(deposit); });
|
|
430
416
|
_c = (_b = Object).fromEntries;
|
|
431
|
-
return [4 /*yield*/, mapAsync(getHubPoolTokens(), function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
_b.sent()
|
|
440
|
-
])];
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
}); })];
|
|
417
|
+
return [4 /*yield*/, mapAsync(getHubPoolTokens(), function (hubPoolToken) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
418
|
+
switch (_b.label) {
|
|
419
|
+
case 0:
|
|
420
|
+
_a = [hubPoolToken];
|
|
421
|
+
return [4 /*yield*/, resolveUtilization(hubPoolToken)];
|
|
422
|
+
case 1: return [2 /*return*/, _a.concat([_b.sent()])];
|
|
423
|
+
}
|
|
424
|
+
}); }); })];
|
|
444
425
|
case 2:
|
|
445
426
|
// For each token / quoteBlock pair, resolve the utilisation for each quoted block.
|
|
446
427
|
// This can be reused for each deposit with the same HubPool token and quoteTimestamp pair.
|
|
@@ -473,10 +454,10 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
473
454
|
return this.l1Tokens;
|
|
474
455
|
};
|
|
475
456
|
HubPoolClient.prototype.getTokenInfoForL1Token = function (l1Token) {
|
|
476
|
-
return this.l1Tokens.find(function (token) { return token.address
|
|
457
|
+
return this.l1Tokens.find(function (token) { return token.address === l1Token; });
|
|
477
458
|
};
|
|
478
459
|
HubPoolClient.prototype.getLpTokenInfoForL1Token = function (l1Token) {
|
|
479
|
-
return this.lpTokens[l1Token
|
|
460
|
+
return this.lpTokens[l1Token];
|
|
480
461
|
};
|
|
481
462
|
HubPoolClient.prototype.areTokensEquivalent = function (tokenA, chainIdA, tokenB, chainIdB, hubPoolBlock) {
|
|
482
463
|
if (hubPoolBlock === void 0) { hubPoolBlock = this.latestHeightSearched; }
|
|
@@ -487,13 +468,13 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
487
468
|
// Resolve both SpokePool tokens back to their respective HubPool tokens and verify that they match.
|
|
488
469
|
var l1TokenA = this.getL1TokenForL2TokenAtBlock(tokenA, chainIdA, hubPoolBlock);
|
|
489
470
|
var l1TokenB = this.getL1TokenForL2TokenAtBlock(tokenB, chainIdB, hubPoolBlock);
|
|
490
|
-
if (
|
|
471
|
+
if (l1TokenA !== l1TokenB) {
|
|
491
472
|
return false;
|
|
492
473
|
}
|
|
493
474
|
// Resolve both HubPool tokens back to a current SpokePool token and verify that they match.
|
|
494
475
|
var _tokenA = this.getL2TokenForL1TokenAtBlock(l1TokenA, chainIdA, hubPoolBlock);
|
|
495
476
|
var _tokenB = this.getL2TokenForL1TokenAtBlock(l1TokenB, chainIdB, hubPoolBlock);
|
|
496
|
-
return tokenA
|
|
477
|
+
return tokenA === _tokenA && tokenB === _tokenB;
|
|
497
478
|
};
|
|
498
479
|
HubPoolClient.prototype.getSpokeActivationBlockForChain = function (chainId) {
|
|
499
480
|
var _a;
|
|
@@ -680,7 +661,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
680
661
|
return sortEventsDescending(this.executedRootBundles).find(function (executedLeaf) {
|
|
681
662
|
return (executedLeaf.blockNumber <= block &&
|
|
682
663
|
executedLeaf.chainId === chain &&
|
|
683
|
-
executedLeaf.l1Tokens.some(function (token) { return token.
|
|
664
|
+
executedLeaf.l1Tokens.some(function (token) { return token.toLowerCase() === l1Token.toLowerCase(); }));
|
|
684
665
|
});
|
|
685
666
|
};
|
|
686
667
|
HubPoolClient.prototype.getRunningBalanceBeforeBlockForChain = function (block, chain, l1Token) {
|
|
@@ -690,11 +671,10 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
690
671
|
HubPoolClient.prototype.getRunningBalanceForToken = function (l1Token, executedRootBundle) {
|
|
691
672
|
var runningBalance = toBN(0);
|
|
692
673
|
if (executedRootBundle) {
|
|
693
|
-
var indexOfL1Token = executedRootBundle.l1Tokens
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}
|
|
674
|
+
var indexOfL1Token = executedRootBundle.l1Tokens
|
|
675
|
+
.map(function (l1Token) { return l1Token.toLowerCase(); })
|
|
676
|
+
.indexOf(l1Token.toLowerCase());
|
|
677
|
+
runningBalance = executedRootBundle.runningBalances[indexOfL1Token];
|
|
698
678
|
}
|
|
699
679
|
return { runningBalance: runningBalance };
|
|
700
680
|
};
|
|
@@ -758,7 +738,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
758
738
|
return [2 /*return*/, {
|
|
759
739
|
success: true,
|
|
760
740
|
currentTime: currentTime,
|
|
761
|
-
pendingRootBundleProposal:
|
|
741
|
+
pendingRootBundleProposal: pendingRootBundleProposal,
|
|
762
742
|
searchEndBlock: searchConfig.to,
|
|
763
743
|
events: _events,
|
|
764
744
|
}];
|
|
@@ -769,7 +749,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
769
749
|
HubPoolClient.prototype.update = function (eventsToQuery) {
|
|
770
750
|
if (eventsToQuery === void 0) { eventsToQuery = Object.keys(this.hubPoolEventFilters()); }
|
|
771
751
|
return __awaiter(this, void 0, void 0, function () {
|
|
772
|
-
var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool,
|
|
752
|
+
var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool, truncatedAddress, _b, _c, event_2, args, destinationToken, usdcTokenSol, truncatedAddress, uniqueL1Tokens, _d, tokenInfo, lpTokenInfo_1, _loop_1, this_1, _e, tokenInfo_1, info, _f, _g, event_3, executedRootBundle, l1Tokens, runningBalances, nTokens, mostRecentProposedRootBundle;
|
|
773
753
|
var _h, _j, _k;
|
|
774
754
|
var _this = this;
|
|
775
755
|
return __generator(this, function (_l) {
|
|
@@ -794,7 +774,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
794
774
|
event_1 = _a[_i];
|
|
795
775
|
args = spreadEventWithBlockNumber(event_1);
|
|
796
776
|
dataToAdd = {
|
|
797
|
-
spokePool:
|
|
777
|
+
spokePool: args.spokePool,
|
|
798
778
|
blockNumber: args.blockNumber,
|
|
799
779
|
txnRef: args.txnRef,
|
|
800
780
|
logIndex: args.logIndex,
|
|
@@ -810,14 +790,14 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
810
790
|
if (!solanaSpokePool) {
|
|
811
791
|
throw new Error("SVM spoke pool not found for chain ".concat(args.l2ChainId));
|
|
812
792
|
}
|
|
813
|
-
|
|
814
|
-
truncatedAddress = svmSpoke.truncateToBytes20();
|
|
793
|
+
truncatedAddress = SvmAddress.from(solanaSpokePool).truncateToBytes20();
|
|
815
794
|
// Verify the event address matches our expected truncated address
|
|
816
795
|
if (args.spokePool.toLowerCase() !== truncatedAddress.toLowerCase()) {
|
|
817
796
|
throw new Error("SVM spoke pool address mismatch for chain ".concat(args.l2ChainId, ". ") +
|
|
818
797
|
"Expected ".concat(truncatedAddress, ", got ").concat(args.spokePool));
|
|
819
798
|
}
|
|
820
|
-
|
|
799
|
+
// Store the full Solana address
|
|
800
|
+
dataToAdd.spokePool = SvmAddress.from(solanaSpokePool).toBytes32();
|
|
821
801
|
}
|
|
822
802
|
assign(this.crossChainContracts, [args.l2ChainId], [dataToAdd]);
|
|
823
803
|
}
|
|
@@ -826,23 +806,23 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
826
806
|
for (_b = 0, _c = events["SetPoolRebalanceRoute"]; _b < _c.length; _b++) {
|
|
827
807
|
event_2 = _c[_b];
|
|
828
808
|
args = spreadEventWithBlockNumber(event_2);
|
|
829
|
-
destinationToken =
|
|
809
|
+
destinationToken = args.destinationToken;
|
|
830
810
|
if (chainIsSvm(args.destinationChainId)) {
|
|
831
811
|
usdcTokenSol = TOKEN_SYMBOLS_MAP.USDC.addresses[args.destinationChainId];
|
|
832
|
-
|
|
833
|
-
if (destinationToken.
|
|
812
|
+
truncatedAddress = SvmAddress.from(usdcTokenSol).truncateToBytes20();
|
|
813
|
+
if (destinationToken.toLowerCase() !== truncatedAddress.toLowerCase()) {
|
|
834
814
|
throw new Error("SVM USDC address mismatch for chain ".concat(args.destinationChainId, ". ") +
|
|
835
|
-
"Expected ".concat(
|
|
815
|
+
"Expected ".concat(truncatedAddress, ", got ").concat(destinationToken));
|
|
836
816
|
}
|
|
837
|
-
destinationToken =
|
|
817
|
+
destinationToken = SvmAddress.from(usdcTokenSol).toBytes32();
|
|
838
818
|
}
|
|
839
819
|
// If the destination token is set to the zero address in an event, then this means Across should no longer
|
|
840
820
|
// rebalance to this chain.
|
|
841
|
-
if (
|
|
821
|
+
if (destinationToken !== ZERO_ADDRESS) {
|
|
842
822
|
assign(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], destinationToken);
|
|
843
823
|
assign(this.l1TokensToDestinationTokensWithBlock, [args.l1Token, args.destinationChainId], [
|
|
844
824
|
{
|
|
845
|
-
l1Token:
|
|
825
|
+
l1Token: args.l1Token,
|
|
846
826
|
l2Token: destinationToken,
|
|
847
827
|
blockNumber: args.blockNumber,
|
|
848
828
|
txnIndex: args.txnIndex,
|
|
@@ -856,17 +836,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
856
836
|
if (!eventsToQuery.includes("L1TokenEnabledForLiquidityProvision")) return [3 /*break*/, 3];
|
|
857
837
|
uniqueL1Tokens = dedupArray(events["L1TokenEnabledForLiquidityProvision"].map(function (event) { return String(event.args["l1Token"]); }));
|
|
858
838
|
return [4 /*yield*/, Promise.all([
|
|
859
|
-
Promise.all(uniqueL1Tokens.map(function (l1Token) { return
|
|
860
|
-
var tokenInfo;
|
|
861
|
-
return __generator(this, function (_a) {
|
|
862
|
-
switch (_a.label) {
|
|
863
|
-
case 0: return [4 /*yield*/, fetchTokenInfo(l1Token, this.hubPool.provider)];
|
|
864
|
-
case 1:
|
|
865
|
-
tokenInfo = _a.sent();
|
|
866
|
-
return [2 /*return*/, __assign(__assign({}, tokenInfo), { address: EvmAddress.from(l1Token) })];
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
}); })),
|
|
839
|
+
Promise.all(uniqueL1Tokens.map(function (l1Token) { return fetchTokenInfo(l1Token, _this.hubPool.provider); })),
|
|
870
840
|
Promise.all(uniqueL1Tokens.map(function (l1Token) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
871
841
|
switch (_a.label) {
|
|
872
842
|
case 0: return [4 /*yield*/, this.hubPool.pooledTokens(l1Token, { blockTag: update.searchEndBlock })];
|
|
@@ -877,7 +847,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
877
847
|
case 2:
|
|
878
848
|
_d = _l.sent(), tokenInfo = _d[0], lpTokenInfo_1 = _d[1];
|
|
879
849
|
_loop_1 = function (info) {
|
|
880
|
-
if (!this_1.l1Tokens.find(function (token) { return token.address
|
|
850
|
+
if (!this_1.l1Tokens.find(function (token) { return compareAddressesSimple(token.address, info.address); })) {
|
|
881
851
|
if (info.decimals > 0 && info.decimals <= 18) {
|
|
882
852
|
this_1.l1Tokens.push(info);
|
|
883
853
|
}
|
|
@@ -902,10 +872,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
902
872
|
if (eventsToQuery.includes("ProposeRootBundle")) {
|
|
903
873
|
(_h = this.proposedRootBundles).push.apply(_h, events["ProposeRootBundle"]
|
|
904
874
|
.filter(function (event) { return !_this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber); })
|
|
905
|
-
.map(function (
|
|
906
|
-
var args = spreadEventWithBlockNumber(_event);
|
|
907
|
-
return __assign(__assign({}, args), { proposer: EvmAddress.from(args.proposer) });
|
|
908
|
-
}));
|
|
875
|
+
.map(function (event) { return spreadEventWithBlockNumber(event); }));
|
|
909
876
|
}
|
|
910
877
|
if (eventsToQuery.includes("RootBundleCanceled")) {
|
|
911
878
|
(_j = this.canceledRootBundles).push.apply(_j, events["RootBundleCanceled"].map(function (event) { return spreadEventWithBlockNumber(event); }));
|
|
@@ -928,9 +895,7 @@ var HubPoolClient = /** @class */ (function (_super) {
|
|
|
928
895
|
" Expected ".concat(nTokens, " or ").concat(nTokens * 2, " for chain ").concat(this.chainId, " transaction ").concat(event_3.transactionHash));
|
|
929
896
|
}
|
|
930
897
|
executedRootBundle.runningBalances = runningBalances.slice(0, nTokens);
|
|
931
|
-
this.executedRootBundles.push(
|
|
932
|
-
return EvmAddress.from(token, "base16");
|
|
933
|
-
}) }));
|
|
898
|
+
this.executedRootBundles.push(executedRootBundle);
|
|
934
899
|
}
|
|
935
900
|
}
|
|
936
901
|
// If the contract's current rootBundleProposal() value has an unclaimedPoolRebalanceLeafCount > 0, then
|