@across-protocol/sdk 4.2.16-alpha.4 → 4.2.16-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/arch/evm/SpokeUtils.d.ts +8 -3
- package/dist/cjs/arch/evm/SpokeUtils.js +21 -21
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +8 -6
- package/dist/cjs/arch/svm/SpokeUtils.js +17 -17
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/eventsClient.js +4 -2
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
- package/dist/cjs/arch/svm/utils.js +1 -1
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +4 -2
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.js +4 -3
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +2 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js +6 -4
- package/dist/cjs/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +7 -8
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.d.ts +13 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +21 -12
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +12 -4
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +42 -30
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +5 -5
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +12 -8
- package/dist/cjs/utils/AddressUtils.js +33 -36
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.js +5 -3
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.d.ts +9 -4
- package/dist/esm/arch/evm/SpokeUtils.js +24 -24
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +9 -7
- package/dist/esm/arch/svm/SpokeUtils.js +19 -19
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/eventsClient.js +5 -3
- package/dist/esm/arch/svm/eventsClient.js.map +1 -1
- package/dist/esm/arch/svm/utils.js +2 -2
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +71 -71
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +11 -4
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.js +4 -3
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +2 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.d.ts +1 -1
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js +7 -5
- package/dist/esm/clients/mocks/MockSvmCpiEventsClient.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +7 -8
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.d.ts +16 -8
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +25 -16
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js +2 -2
- package/dist/esm/relayFeeCalculator/chain-queries/factory.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +14 -6
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +47 -34
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +3 -3
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +12 -8
- package/dist/esm/utils/AddressUtils.js +36 -38
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +16 -0
- package/dist/esm/utils/TokenUtils.js +6 -4
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts +9 -4
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +9 -7
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/eventsClient.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.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.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.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/interfaces/SpokePool.d.ts +7 -8
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts +16 -8
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +14 -6
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +12 -8
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +16 -0
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/evm/SpokeUtils.ts +42 -27
- package/src/arch/svm/SpokeUtils.ts +25 -30
- package/src/arch/svm/eventsClient.ts +40 -8
- package/src/arch/svm/utils.ts +2 -2
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +12 -4
- package/src/clients/HubPoolClient.ts +5 -4
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +4 -1
- package/src/clients/mocks/MockSvmCpiEventsClient.ts +8 -5
- package/src/interfaces/SpokePool.ts +8 -8
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +33 -16
- package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +48 -37
- package/src/relayFeeCalculator/relayFeeCalculator.ts +3 -9
- package/src/utils/AddressUtils.ts +39 -51
- package/src/utils/TokenUtils.ts +6 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { L2Provider } from "@eth-optimism/sdk/dist/interfaces/l2-provider";
|
|
2
2
|
import { PopulatedTransaction, providers } from "ethers";
|
|
3
|
-
import {
|
|
3
|
+
import { RelayData } from "../../interfaces";
|
|
4
4
|
import { SpokePool } from "../../typechain";
|
|
5
|
-
import { BigNumberish, TransactionCostEstimate, BigNumber, Address } from "../../utils";
|
|
5
|
+
import { BigNumberish, EvmAddress, TransactionCostEstimate, BigNumber, Address } from "../../utils";
|
|
6
6
|
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
7
7
|
import { Transport } from "viem";
|
|
8
8
|
import { EvmProvider } from "../../arch/evm/types";
|
|
@@ -38,7 +38,7 @@ export declare class QueryBase implements QueryInterface {
|
|
|
38
38
|
constructor(provider: EvmProvider, symbolMapping: SymbolMappingType, spokePoolAddress: string, simulatedRelayerAddress: string, logger: Logger, coingeckoProApiKey?: string | undefined, fixedGasPrice?: BigNumberish | undefined, coingeckoBaseCurrency?: string);
|
|
39
39
|
/**
|
|
40
40
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
41
|
-
* @param
|
|
41
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
42
42
|
* @param relayerAddress Relayer address to simulate with.
|
|
43
43
|
* @param options
|
|
44
44
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
@@ -46,7 +46,9 @@ export declare class QueryBase implements QueryInterface {
|
|
|
46
46
|
* @param options.transport Optional transport object for custom gas price retrieval.
|
|
47
47
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
48
48
|
*/
|
|
49
|
-
getGasCosts(
|
|
49
|
+
getGasCosts(relayData: RelayData & {
|
|
50
|
+
destinationChainId: number;
|
|
51
|
+
}, relayer?: Address, options?: Partial<{
|
|
50
52
|
gasPrice: BigNumberish;
|
|
51
53
|
gasUnits: BigNumberish;
|
|
52
54
|
baseFeeMultiplier: BigNumber;
|
|
@@ -56,18 +58,24 @@ export declare class QueryBase implements QueryInterface {
|
|
|
56
58
|
}>): Promise<TransactionCostEstimate>;
|
|
57
59
|
/**
|
|
58
60
|
* @notice Return ethers.PopulatedTransaction for a fill based on input deposit args
|
|
59
|
-
* @param
|
|
61
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
60
62
|
* @param relayer Sender of PopulatedTransaction
|
|
61
63
|
* @returns PopulatedTransaction
|
|
62
64
|
*/
|
|
63
|
-
getUnsignedTxFromDeposit(
|
|
65
|
+
getUnsignedTxFromDeposit(relayData: Omit<RelayData, "recipient" | "outputToken"> & {
|
|
66
|
+
destinationChainId: number;
|
|
67
|
+
recipient: EvmAddress;
|
|
68
|
+
outputToken: EvmAddress;
|
|
69
|
+
}, relayer?: Address): Promise<PopulatedTransaction>;
|
|
64
70
|
/**
|
|
65
71
|
* @notice Return the gas cost of a simulated transaction
|
|
66
|
-
* @param
|
|
72
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
67
73
|
* @param relayer Sender of PopulatedTransaction
|
|
68
74
|
* @returns Estimated gas cost based on ethers.VoidSigner's gas estimation
|
|
69
75
|
*/
|
|
70
|
-
getNativeGasCost(
|
|
76
|
+
getNativeGasCost(relayData: RelayData & {
|
|
77
|
+
destinationChainId: number;
|
|
78
|
+
}, relayer?: Address): Promise<BigNumber>;
|
|
71
79
|
/**
|
|
72
80
|
* @notice Return L1 data fee for OP stack L2 transaction, which is based on L2 calldata.
|
|
73
81
|
* @dev https://docs.optimism.io/stack/transactions/fees#l1-data-fee
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"baseQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/baseQuery.ts"],"names":[],"mappings":"AAAA,OAAO,E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QAAQ,EAAE,YAAY,CAAC;QACvB,QAAQ,EAAE,YAAY,CAAC;QACvB,iBAAiB,EAAE,SAAS,CAAC;QAC7B,qBAAqB,EAAE,SAAS,CAAC;QACjC,0BAA0B,EAAE,SAAS,CAAC;QACtC,SAAS,EAAE,SAAS,CAAC;KACtB,CAAM,GACN,OAAO,CAAC,uBAAuB,CAAC;IA+CnC;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAS1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/factory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAqC,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,MAAM,CACX,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,SAAS,CAAC,QAAQ,GAAG,WAAW,EAC1C,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAoB,EACjC,gBAAgB,qBAA2C,EAC3D,uBAAuB,SAA6B,EACpD,kBAAkB,CAAC,EAAE,MAAM,EAC3B,MAAM,GAAE,MAAuB,EAC/B,qBAAqB,SAAQ,GAC5B,SAAS,GAAG,QAAQ;CAgDxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SVMProvider } from "../../arch/svm";
|
|
2
|
-
import {
|
|
2
|
+
import { RelayData } from "../../interfaces";
|
|
3
3
|
import { BigNumber, BigNumberish, SvmAddress, TransactionCostEstimate } from "../../utils";
|
|
4
4
|
import { Logger, QueryInterface } from "../relayFeeCalculator";
|
|
5
5
|
import { SymbolMappingType } from "./";
|
|
@@ -37,7 +37,7 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
37
37
|
constructor(provider: SVMProvider, symbolMapping: SymbolMappingType, spokePool: SvmAddress, simulatedRelayerAddress: SvmAddress, logger: Logger, coingeckoProApiKey?: string | undefined, fixedGasPrice?: BigNumberish | undefined, coingeckoBaseCurrency?: string);
|
|
38
38
|
/**
|
|
39
39
|
* Retrieves the current gas costs of performing a fillRelay contract at the referenced SpokePool.
|
|
40
|
-
* @param
|
|
40
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
41
41
|
* @param _relayer Relayer address to simulate with.
|
|
42
42
|
* @param options
|
|
43
43
|
* @param options.gasPrice Optional gas price to use for the simulation.
|
|
@@ -45,7 +45,9 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
45
45
|
* @param options.transport Optional transport object for custom gas price retrieval.
|
|
46
46
|
* @returns The gas estimate for this function call (multiplied with the optional buffer).
|
|
47
47
|
*/
|
|
48
|
-
getGasCosts(
|
|
48
|
+
getGasCosts(relayData: RelayData & {
|
|
49
|
+
destinationChainId: number;
|
|
50
|
+
}, relayer?: import("../../utils").Address, options?: Partial<{
|
|
49
51
|
gasPrice: BigNumberish;
|
|
50
52
|
gasUnits: BigNumberish;
|
|
51
53
|
baseFeeMultiplier: BigNumber;
|
|
@@ -57,14 +59,20 @@ export declare class SvmQuery implements QueryInterface {
|
|
|
57
59
|
* @param relayer SVM address of the relayer
|
|
58
60
|
* @returns Estimated gas cost in compute units
|
|
59
61
|
*/
|
|
60
|
-
getNativeGasCost(deposit:
|
|
62
|
+
getNativeGasCost(deposit: RelayData & {
|
|
63
|
+
destinationChainId: number;
|
|
64
|
+
}, _relayer?: import("../../utils").Address): Promise<BigNumber>;
|
|
61
65
|
/**
|
|
62
66
|
* @notice Return the fillRelay transaction for a given deposit
|
|
63
|
-
* @param
|
|
67
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
64
68
|
* @param relayer SVM address of the relayer
|
|
65
69
|
* @returns FillRelay transaction
|
|
66
70
|
*/
|
|
67
|
-
getFillRelayTx(
|
|
71
|
+
getFillRelayTx(relayData: Omit<RelayData, "recipent" | "outputToken"> & {
|
|
72
|
+
destinationChainId: number;
|
|
73
|
+
recipient: SvmAddress;
|
|
74
|
+
outputToken: SvmAddress;
|
|
75
|
+
}, relayer?: import("../../utils").Address, repaymentChainId?: number, repaymentAddress?: import("../../utils").Address): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, import("@solana/kit").TransactionSigner<string>> & Omit<Readonly<{
|
|
68
76
|
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | import("@solana/kit").IAccountMeta<string>)[]>[];
|
|
69
77
|
version: 0;
|
|
70
78
|
}>, "feePayer">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,WAAW,EASZ,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,uBAAuB,EAIxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAEvC;;;GAGG;AACH,qBAAa,QAAS,YAAW,cAAc;IAe3C,QAAQ,CAAC,QAAQ,EAAE,WAAW;IAC9B,QAAQ,CAAC,aAAa,EAAE,iBAAiB;IACzC,QAAQ,CAAC,SAAS,EAAE,UAAU;IAC9B,QAAQ,CAAC,uBAAuB,EAAE,UAAU;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,kBAAkB,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC;IACvB,QAAQ,CAAC,qBAAqB,EAAE,MAAM;IArBxC,SAAS,CAAC,oBAAoB;;;;;;sEAAC;IAE/B;;;;;;;;;;OAUG;gBAEQ,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAE,UAAU,EACrB,uBAAuB,EAAE,UAAU,EACnC,MAAM,EAAE,MAAM,EACd,kBAAkB,CAAC,oBAAQ,EAC3B,aAAa,CAAC,0BAAc,EAC5B,qBAAqB,GAAE,MAAc;IAOhD;;;;;;;;;OASG;IACG,WAAW,CACf,SAAS,EAAE,SAAS,GAAG;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,EACrD,OAAO,gCAA+F,EACtG,OAAO,GAAE,OAAO,CAAC;QACf,QAAQ,EAAE,YAAY,CAAC;QACvB,QAAQ,EAAE,YAAY,CAAC;QACvB,iBAAiB,EAAE,SAAS,CAAC;QAC7B,qBAAqB,EAAE,SAAS,CAAC;KAClC,CAAM,GACN,OAAO,CAAC,uBAAuB,CAAC;IA8BnC;;;;;OAKG;IACG,gBAAgB,CACpB,OAAO,EAAE,SAAS,GAAG;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,EACnD,QAAQ,gCAA2F,GAClG,OAAO,CAAC,SAAS,CAAC;IAUrB;;;;;OAKG;IACG,cAAc,CAClB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,aAAa,CAAC,GAAG;QACvD,kBAAkB,EAAE,MAAM,CAAC;QAC3B,SAAS,EAAE,UAAU,CAAC;QACtB,WAAW,EAAE,UAAU,CAAC;KACzB,EACD,OAAO,gCAA+F,EACtG,gBAAgB,SAA+B,EAC/C,gBAAgB,gCAA+F;;;;IAqEjH;;;;OAIG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUzD;;;;OAIG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;CAI9C"}
|
|
@@ -74,7 +74,7 @@ export interface Logger {
|
|
|
74
74
|
error: LoggingFunction;
|
|
75
75
|
}
|
|
76
76
|
export declare const DEFAULT_LOGGER: Logger;
|
|
77
|
-
export declare function
|
|
77
|
+
export declare function getDefaultRelayer(chainId?: number): "0x07aE8551Be970cB1cCa11Dd7a11F47Ae82e70E67" | "FmMK62wrtWVb5SVoTZftSCGw3nEDA79hDbZNTRnC1R6t";
|
|
78
78
|
export declare class RelayFeeCalculator {
|
|
79
79
|
private queries;
|
|
80
80
|
private gasDiscountPercent;
|
|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Aa,EAAE,YAAY,EAC3B,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,eAAe,EAC9B,iBAAiB,CAAC,EAAE,eAAe,GAClC,SAAS;IAmEZ;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IA0C/B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA8B7B;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CACrB,OAAO,EAAE,OAAO,EAChB,YAAY,CAAC,EAAE,YAAY,EAC3B,gBAAgB,UAAQ,EACxB,cAAc,UAA2F,EACzG,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,YAAY,EACvB,QAAQ,CAAC,EAAE,YAAY,EACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,iBAAiB,CAAC;CAuE9B"}
|
|
@@ -20,14 +20,13 @@ export declare function isValidEvmAddress(address: string): boolean;
|
|
|
20
20
|
* @todo: Change this to `toAddress` once we remove the other `toAddress` function.
|
|
21
21
|
*/
|
|
22
22
|
export declare function toAddressType(address: string, chainId: number): Address;
|
|
23
|
-
export declare class Address {
|
|
23
|
+
export declare abstract class Address {
|
|
24
24
|
readonly rawAddress: Uint8Array;
|
|
25
25
|
evmAddress: string | undefined;
|
|
26
26
|
bytes32Address: string | undefined;
|
|
27
27
|
svmAddress: string | undefined;
|
|
28
28
|
bnAddress: BigNumber | undefined;
|
|
29
29
|
constructor(_rawAddress: Uint8Array);
|
|
30
|
-
static __unsafeConstruct(_rawAddress: Uint8Array): Address;
|
|
31
30
|
toBytes32(): string;
|
|
32
31
|
truncateToBytes20(): string;
|
|
33
32
|
toBase58(): string;
|
|
@@ -36,27 +35,32 @@ export declare class Address {
|
|
|
36
35
|
toNative(): string;
|
|
37
36
|
toHexString(): string;
|
|
38
37
|
isValidOn(chainId: number): boolean;
|
|
39
|
-
static isAddress(obj: unknown): boolean;
|
|
40
38
|
toString(): string;
|
|
41
39
|
isZeroAddress(): boolean;
|
|
42
40
|
forceSvmAddress(): SvmAddress;
|
|
43
41
|
eq(other: Address): boolean;
|
|
44
42
|
compare(otherAddress: Address): 1 | -1 | 0;
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
isEVM(): this is EvmAddress;
|
|
44
|
+
isSVM(): this is SvmAddress;
|
|
47
45
|
}
|
|
48
46
|
export declare class EvmAddress extends Address {
|
|
49
|
-
private readonly
|
|
47
|
+
private readonly _type;
|
|
50
48
|
constructor(rawAddress: Uint8Array);
|
|
51
49
|
static validate(rawAddress: Uint8Array): boolean;
|
|
50
|
+
isEVM(): this is EvmAddress;
|
|
52
51
|
toNative(): string;
|
|
53
|
-
static from(address: string, encoding?: "
|
|
52
|
+
static from(address: string, encoding?: "base58" | "base16"): EvmAddress;
|
|
54
53
|
}
|
|
55
54
|
export declare class SvmAddress extends Address {
|
|
56
|
-
private readonly
|
|
55
|
+
private readonly _type;
|
|
57
56
|
constructor(rawAddress: Uint8Array);
|
|
58
57
|
static validate(rawAddress: Uint8Array): boolean;
|
|
58
|
+
isSVM(): this is SvmAddress;
|
|
59
59
|
toNative(): string;
|
|
60
60
|
static from(address: string, encoding?: "base58" | "base16"): SvmAddress;
|
|
61
61
|
}
|
|
62
|
+
export declare class RawAddress extends Address {
|
|
63
|
+
private readonly _type;
|
|
64
|
+
constructor(rawAddress: Uint8Array);
|
|
65
|
+
}
|
|
62
66
|
//# sourceMappingURL=AddressUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/AddressUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,SAAS,EAA0B,MAAM,IAAI,CAAC;AAEvD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CASjH;AAED,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,GAAG,UAAU;CAGnF;AAGD,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAGnB,UAAU,EAAE,UAAU;IASlC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;IAUvC,KAAK,IAAI,IAAI,IAAI,UAAU;IAM3B,QAAQ,IAAI,MAAM;IAK3B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAQ,GAAG,QAAmB,GAAG,UAAU;CAGnF;AAED,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,UAAU,EAAE,UAAU;CAInC"}
|
|
@@ -185,6 +185,14 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
185
185
|
};
|
|
186
186
|
coingeckoId: string;
|
|
187
187
|
};
|
|
188
|
+
/**
|
|
189
|
+
* Retrieves the ERC20 balance for a given address and token address.
|
|
190
|
+
* @param address The address to retrieve the balance for.
|
|
191
|
+
* @param tokenAddress The token address
|
|
192
|
+
* @param signerOrProvider A valid ethers.js Signer or Provider object.
|
|
193
|
+
* @param blockTag The block tag to retrieve the balance at.
|
|
194
|
+
* @returns The balance of the given address for the given token address.
|
|
195
|
+
*/
|
|
188
196
|
SOL: {
|
|
189
197
|
name: string;
|
|
190
198
|
symbol: string;
|
|
@@ -600,6 +608,14 @@ export declare function getTokenInfo(l2TokenAddress: string, chainId: number, to
|
|
|
600
608
|
};
|
|
601
609
|
coingeckoId: string;
|
|
602
610
|
};
|
|
611
|
+
/**
|
|
612
|
+
* Retrieves the ERC20 balance for a given address and token address.
|
|
613
|
+
* @param address The address to retrieve the balance for.
|
|
614
|
+
* @param tokenAddress The token address
|
|
615
|
+
* @param signerOrProvider A valid ethers.js Signer or Provider object.
|
|
616
|
+
* @param blockTag The block tag to retrieve the balance at.
|
|
617
|
+
* @returns The balance of the given address for the given token address.
|
|
618
|
+
*/
|
|
603
619
|
SOL: {
|
|
604
620
|
name: string;
|
|
605
621
|
symbol: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TokenUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAY,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,KAAK,gBAAgB,GAAG,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC;AAEpD,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAI5G;AAED,eAAO,MAAM,mBAAmB,mBACd,MAAM;;aAMvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAa/E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,WAC5B,MAAM,WACL,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgBjB;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOlF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAUjF"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import assert from "assert";
|
|
2
2
|
import { BytesLike, Contract, PopulatedTransaction, providers } from "ethers";
|
|
3
3
|
import { CHAIN_IDs } from "../../constants";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Deposit,
|
|
6
|
+
FillStatus,
|
|
7
|
+
FillWithBlock,
|
|
8
|
+
RelayData,
|
|
9
|
+
RelayExecutionEventInfo,
|
|
10
|
+
SpeedUpCommon,
|
|
11
|
+
} from "../../interfaces";
|
|
5
12
|
import {
|
|
6
13
|
bnUint32Max,
|
|
7
14
|
BigNumber,
|
|
15
|
+
EvmAddress,
|
|
8
16
|
toBN,
|
|
9
17
|
bnZero,
|
|
10
18
|
chunk,
|
|
@@ -12,7 +20,6 @@ import {
|
|
|
12
20
|
getRelayDataHash,
|
|
13
21
|
isDefined,
|
|
14
22
|
isUnsafeDepositId,
|
|
15
|
-
isZeroAddress,
|
|
16
23
|
getNetworkName,
|
|
17
24
|
paginatedEventQuery,
|
|
18
25
|
spreadEventWithBlockNumber,
|
|
@@ -22,53 +29,61 @@ import {
|
|
|
22
29
|
|
|
23
30
|
type BlockTag = providers.BlockTag;
|
|
24
31
|
|
|
32
|
+
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> &
|
|
33
|
+
Pick<Deposit, "speedUpSignature"> &
|
|
34
|
+
Partial<SpeedUpCommon> & {
|
|
35
|
+
destinationChainId: number;
|
|
36
|
+
recipient: EvmAddress;
|
|
37
|
+
outputToken: EvmAddress;
|
|
38
|
+
};
|
|
39
|
+
|
|
25
40
|
/**
|
|
26
41
|
* @param spokePool SpokePool Contract instance.
|
|
27
|
-
* @param
|
|
42
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
28
43
|
* @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
|
|
29
44
|
* @returns An Ethers UnsignedTransaction instance.
|
|
30
45
|
*/
|
|
31
46
|
export function populateV3Relay(
|
|
32
47
|
spokePool: Contract,
|
|
33
|
-
|
|
48
|
+
relayData: ProtoFill,
|
|
34
49
|
repaymentAddress: Address,
|
|
35
|
-
repaymentChainId =
|
|
50
|
+
repaymentChainId = relayData.destinationChainId
|
|
36
51
|
): Promise<PopulatedTransaction> {
|
|
37
52
|
assert(
|
|
38
53
|
repaymentAddress.isValidOn(repaymentChainId),
|
|
39
54
|
`Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
|
|
40
55
|
);
|
|
41
|
-
const
|
|
42
|
-
depositor:
|
|
43
|
-
recipient:
|
|
44
|
-
inputToken:
|
|
45
|
-
outputToken:
|
|
46
|
-
inputAmount:
|
|
47
|
-
outputAmount:
|
|
48
|
-
originChainId:
|
|
49
|
-
depositId:
|
|
50
|
-
fillDeadline:
|
|
51
|
-
exclusivityDeadline:
|
|
52
|
-
message:
|
|
53
|
-
exclusiveRelayer:
|
|
56
|
+
const evmRelayData = {
|
|
57
|
+
depositor: relayData.depositor.toBytes32(),
|
|
58
|
+
recipient: relayData.recipient.toBytes32(),
|
|
59
|
+
inputToken: relayData.inputToken.toBytes32(),
|
|
60
|
+
outputToken: relayData.outputToken.toBytes32(),
|
|
61
|
+
inputAmount: relayData.inputAmount,
|
|
62
|
+
outputAmount: relayData.outputAmount,
|
|
63
|
+
originChainId: relayData.originChainId,
|
|
64
|
+
depositId: relayData.depositId,
|
|
65
|
+
fillDeadline: relayData.fillDeadline,
|
|
66
|
+
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
67
|
+
message: relayData.message,
|
|
68
|
+
exclusiveRelayer: relayData.exclusiveRelayer.toBytes32(),
|
|
54
69
|
};
|
|
55
70
|
|
|
56
|
-
if (isDefined(
|
|
57
|
-
assert(isDefined(
|
|
58
|
-
assert(isDefined(
|
|
59
|
-
assert(isDefined(
|
|
71
|
+
if (isDefined(relayData.speedUpSignature)) {
|
|
72
|
+
assert(isDefined(relayData.updatedRecipient) && !relayData.updatedRecipient.isZeroAddress());
|
|
73
|
+
assert(isDefined(relayData.updatedOutputAmount));
|
|
74
|
+
assert(isDefined(relayData.updatedMessage));
|
|
60
75
|
return spokePool.populateTransaction.fillRelayWithUpdatedDeposit(
|
|
61
76
|
relayData,
|
|
62
77
|
repaymentChainId,
|
|
63
78
|
repaymentAddress.toBytes32(),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
relayData.updatedOutputAmount,
|
|
80
|
+
relayData.updatedRecipient.toBytes32(),
|
|
81
|
+
relayData.updatedMessage,
|
|
82
|
+
relayData.speedUpSignature
|
|
68
83
|
);
|
|
69
84
|
}
|
|
70
85
|
|
|
71
|
-
return spokePool.populateTransaction.fillRelay(
|
|
86
|
+
return spokePool.populateTransaction.fillRelay(evmRelayData, repaymentChainId, repaymentAddress.toBytes32());
|
|
72
87
|
}
|
|
73
88
|
|
|
74
89
|
/**
|
|
@@ -25,14 +25,7 @@ import assert from "assert";
|
|
|
25
25
|
import { arrayify, hexZeroPad, hexlify } from "ethers/lib/utils";
|
|
26
26
|
import { Logger } from "winston";
|
|
27
27
|
import { SYSTEM_PROGRAM_ADDRESS } from "@solana-program/system";
|
|
28
|
-
import {
|
|
29
|
-
Deposit,
|
|
30
|
-
DepositWithBlock,
|
|
31
|
-
FillStatus,
|
|
32
|
-
FillWithBlock,
|
|
33
|
-
RelayData,
|
|
34
|
-
RelayExecutionEventInfo,
|
|
35
|
-
} from "../../interfaces";
|
|
28
|
+
import { DepositWithBlock, FillStatus, FillWithBlock, RelayData, RelayExecutionEventInfo } from "../../interfaces";
|
|
36
29
|
import {
|
|
37
30
|
BigNumber,
|
|
38
31
|
EvmAddress,
|
|
@@ -62,6 +55,12 @@ import { SVMEventNames, SVMProvider } from "./types";
|
|
|
62
55
|
*/
|
|
63
56
|
export const SLOT_DURATION_MS = 400;
|
|
64
57
|
|
|
58
|
+
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
|
|
59
|
+
destinationChainId: number;
|
|
60
|
+
recipient: SvmAddress;
|
|
61
|
+
outputToken: SvmAddress;
|
|
62
|
+
};
|
|
63
|
+
|
|
65
64
|
/**
|
|
66
65
|
* Retrieves the chain time at a particular slot.
|
|
67
66
|
*/
|
|
@@ -378,22 +377,18 @@ export async function findFillEvent(
|
|
|
378
377
|
|
|
379
378
|
/**
|
|
380
379
|
* @param spokePool Address (program ID) of the SvmSpoke.
|
|
381
|
-
* @param
|
|
380
|
+
* @param relayData RelayData instance, supplemented with destinationChainId
|
|
382
381
|
* @param relayer Address of the relayer filling the deposit.
|
|
383
382
|
* @param repaymentChainId Optional repaymentChainId (defaults to destinationChainId).
|
|
384
383
|
* @returns An Ethers UnsignedTransaction instance.
|
|
385
384
|
*/
|
|
386
385
|
export async function fillRelayInstruction(
|
|
387
386
|
spokePool: SvmAddress,
|
|
388
|
-
|
|
389
|
-
recipient: SvmAddress;
|
|
390
|
-
outputToken: SvmAddress;
|
|
391
|
-
exclusiveRelayer: SvmAddress;
|
|
392
|
-
},
|
|
387
|
+
relayData: ProtoFill,
|
|
393
388
|
signer: TransactionSigner<string>,
|
|
394
389
|
recipientTokenAccount: Address<string>,
|
|
395
390
|
repaymentAddress: EvmAddress | SvmAddress = SvmAddress.from(signer.address),
|
|
396
|
-
repaymentChainId =
|
|
391
|
+
repaymentChainId = relayData.destinationChainId
|
|
397
392
|
) {
|
|
398
393
|
const program = toAddress(spokePool);
|
|
399
394
|
|
|
@@ -402,22 +397,22 @@ export async function fillRelayInstruction(
|
|
|
402
397
|
`Invalid repayment address for chain ${repaymentChainId}: ${repaymentAddress.toNative()}.`
|
|
403
398
|
);
|
|
404
399
|
|
|
405
|
-
const _relayDataHash = getRelayDataHash(
|
|
400
|
+
const _relayDataHash = getRelayDataHash(relayData, relayData.destinationChainId);
|
|
406
401
|
const relayDataHash = new Uint8Array(Buffer.from(_relayDataHash.slice(2), "hex"));
|
|
407
402
|
|
|
408
403
|
const relayer = SvmAddress.from(signer.address);
|
|
409
404
|
|
|
410
405
|
// Create ATA for the relayer and recipient token accounts
|
|
411
|
-
const relayerTokenAccount = await getAssociatedTokenAddress(relayer,
|
|
406
|
+
const relayerTokenAccount = await getAssociatedTokenAddress(relayer, relayData.outputToken);
|
|
412
407
|
|
|
413
408
|
const [statePda, fillStatusPda, eventAuthority] = await Promise.all([
|
|
414
409
|
getStatePda(program),
|
|
415
|
-
getFillStatusPda(program,
|
|
410
|
+
getFillStatusPda(program, relayData, relayData.destinationChainId),
|
|
416
411
|
getEventAuthority(program),
|
|
417
412
|
]);
|
|
418
413
|
|
|
419
414
|
const depositIdBuffer = new Uint8Array(32);
|
|
420
|
-
const shortenedBuffer = new Uint8Array(Buffer.from(
|
|
415
|
+
const shortenedBuffer = new Uint8Array(Buffer.from(relayData.depositId.toHexString().slice(2), "hex"));
|
|
421
416
|
depositIdBuffer.set(shortenedBuffer, 32 - shortenedBuffer.length);
|
|
422
417
|
|
|
423
418
|
const delegatePda = await getFillRelayDelegatePda(
|
|
@@ -428,11 +423,11 @@ export async function fillRelayInstruction(
|
|
|
428
423
|
);
|
|
429
424
|
|
|
430
425
|
const [recipient, outputToken, exclusiveRelayer, depositor, inputToken] = [
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
426
|
+
relayData.recipient,
|
|
427
|
+
relayData.outputToken,
|
|
428
|
+
relayData.exclusiveRelayer,
|
|
429
|
+
relayData.depositor,
|
|
430
|
+
relayData.inputToken,
|
|
436
431
|
].map(toAddress);
|
|
437
432
|
|
|
438
433
|
return SvmSpokeClient.getFillRelayInstruction({
|
|
@@ -452,13 +447,13 @@ export async function fillRelayInstruction(
|
|
|
452
447
|
exclusiveRelayer,
|
|
453
448
|
inputToken,
|
|
454
449
|
outputToken,
|
|
455
|
-
inputAmount:
|
|
456
|
-
outputAmount:
|
|
457
|
-
originChainId: BigInt(
|
|
458
|
-
fillDeadline:
|
|
459
|
-
exclusivityDeadline:
|
|
450
|
+
inputAmount: relayData.inputAmount.toBigInt(),
|
|
451
|
+
outputAmount: relayData.outputAmount.toBigInt(),
|
|
452
|
+
originChainId: BigInt(relayData.originChainId),
|
|
453
|
+
fillDeadline: relayData.fillDeadline,
|
|
454
|
+
exclusivityDeadline: relayData.exclusivityDeadline,
|
|
460
455
|
depositId: depositIdBuffer,
|
|
461
|
-
message: new Uint8Array(Buffer.from(
|
|
456
|
+
message: new Uint8Array(Buffer.from(relayData.message.slice(2), "hex")),
|
|
462
457
|
}),
|
|
463
458
|
repaymentChainId: some(BigInt(repaymentChainId)),
|
|
464
459
|
repaymentAddress: toAddress(repaymentAddress),
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
GetTransactionApi,
|
|
11
11
|
Signature,
|
|
12
12
|
} from "@solana/kit";
|
|
13
|
-
import { bs58, chainIsSvm, getMessageHash } from "../../utils";
|
|
13
|
+
import { bs58, chainIsSvm, getMessageHash, toAddressType } from "../../utils";
|
|
14
14
|
import { EventName, EventWithData, SVMProvider } from "./types";
|
|
15
15
|
import { decodeEvent, isDevnet } from "./utils";
|
|
16
16
|
import { Deposit, DepositWithTime, Fill, FillWithTime } from "../../interfaces";
|
|
@@ -252,7 +252,6 @@ export class SvmCpiEventsClient {
|
|
|
252
252
|
|
|
253
253
|
// Filter for FundsDeposited events only
|
|
254
254
|
const depositEvents = events?.filter((event) => event?.name === "FundsDeposited");
|
|
255
|
-
|
|
256
255
|
if (!txDetails || !depositEvents?.length) {
|
|
257
256
|
return;
|
|
258
257
|
}
|
|
@@ -261,13 +260,29 @@ export class SvmCpiEventsClient {
|
|
|
261
260
|
const unwrappedEventArgs = unwrapEventData(event as Record<string, unknown>, ["depositId"]) as Record<
|
|
262
261
|
"data",
|
|
263
262
|
Deposit
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
> &
|
|
264
|
+
Record<
|
|
265
|
+
"data",
|
|
266
|
+
{
|
|
267
|
+
depositor: string;
|
|
268
|
+
recipient: string;
|
|
269
|
+
exclusiveRelayer: string;
|
|
270
|
+
inputToken: string;
|
|
271
|
+
outputToken: string;
|
|
272
|
+
}
|
|
273
|
+
>;
|
|
274
|
+
|
|
275
|
+
const { data } = unwrappedEventArgs;
|
|
266
276
|
return {
|
|
267
|
-
...
|
|
277
|
+
...data,
|
|
278
|
+
depositor: toAddressType(data.depositor, data.originChainId),
|
|
279
|
+
recipient: toAddressType(data.recipient, data.destinationChainId),
|
|
280
|
+
exclusiveRelayer: toAddressType(data.exclusiveRelayer, data.destinationChainId),
|
|
281
|
+
inputToken: toAddressType(data.inputToken, data.originChainId),
|
|
282
|
+
outputToken: toAddressType(data.outputToken, data.destinationChainId),
|
|
268
283
|
depositTimestamp: Number(txDetails.blockTime),
|
|
269
284
|
originChainId,
|
|
270
|
-
messageHash: getMessageHash(
|
|
285
|
+
messageHash: getMessageHash(data.message),
|
|
271
286
|
blockNumber: Number(txDetails.slot),
|
|
272
287
|
txnIndex: 0,
|
|
273
288
|
txnRef: txSignature,
|
|
@@ -309,9 +324,26 @@ export class SvmCpiEventsClient {
|
|
|
309
324
|
}
|
|
310
325
|
|
|
311
326
|
return fillEvents.map((event) => {
|
|
312
|
-
const unwrappedEventData = unwrapEventData(event as Record<string, unknown>) as Record<"data", Fill
|
|
327
|
+
const unwrappedEventData = unwrapEventData(event as Record<string, unknown>) as Record<"data", Fill> &
|
|
328
|
+
Record<
|
|
329
|
+
"data",
|
|
330
|
+
{
|
|
331
|
+
depositor: string;
|
|
332
|
+
recipient: string;
|
|
333
|
+
exclusiveRelayer: string;
|
|
334
|
+
inputToken: string;
|
|
335
|
+
outputToken: string;
|
|
336
|
+
}
|
|
337
|
+
>;
|
|
338
|
+
|
|
339
|
+
const { data } = unwrappedEventData;
|
|
313
340
|
return {
|
|
314
|
-
...
|
|
341
|
+
...data,
|
|
342
|
+
depositor: toAddressType(data.depositor, data.originChainId),
|
|
343
|
+
recipient: toAddressType(data.recipient, data.destinationChainId),
|
|
344
|
+
exclusiveRelayer: toAddressType(data.exclusiveRelayer, data.destinationChainId),
|
|
345
|
+
inputToken: toAddressType(data.inputToken, data.originChainId),
|
|
346
|
+
outputToken: toAddressType(data.outputToken, data.destinationChainId),
|
|
315
347
|
fillTimestamp: Number(txDetails.blockTime),
|
|
316
348
|
blockNumber: Number(txDetails.slot),
|
|
317
349
|
txnRef: txSignature,
|
package/src/arch/svm/utils.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "@solana/kit";
|
|
18
18
|
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
19
19
|
import { FillType, RelayData } from "../../interfaces";
|
|
20
|
-
import { BigNumber,
|
|
20
|
+
import { BigNumber, getRelayDataHash, isUint8Array, Address as SdkAddress } from "../../utils";
|
|
21
21
|
import { EventName, SVMEventNames, SVMProvider } from "./types";
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -144,7 +144,7 @@ export function unwrapEventData(
|
|
|
144
144
|
}
|
|
145
145
|
// Handle strings (potential addresses)
|
|
146
146
|
if (typeof data === "string" && isAddress(data)) {
|
|
147
|
-
return
|
|
147
|
+
return ethers.utils.hexlify(bs58.decode(data));
|
|
148
148
|
}
|
|
149
149
|
// Handle objects
|
|
150
150
|
if (typeof data === "object") {
|