@across-protocol/sdk 4.3.113-alpha.2 → 4.3.113
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/svm/SpokeUtils.d.ts +16 -1
- package/dist/cjs/arch/svm/SpokeUtils.js +63 -8
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/encoders.d.ts +1 -0
- package/dist/cjs/arch/svm/encoders.js +4 -0
- package/dist/cjs/arch/svm/encoders.js.map +1 -1
- package/dist/cjs/arch/svm/utils.d.ts +1 -0
- package/dist/cjs/arch/svm/utils.js +17 -0
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/constants.js +0 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/providers/solana/utils.d.ts +56 -0
- package/dist/cjs/providers/solana/utils.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -0
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js +100 -27
- package/dist/cjs/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/cjs/typechain.d.ts +11 -10
- package/dist/cjs/typechain.js +5 -5
- package/dist/cjs/typechain.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +1 -1
- package/dist/cjs/utils/AddressUtils.js +2 -2
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +35 -1
- package/dist/esm/arch/svm/SpokeUtils.js +80 -8
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/encoders.d.ts +1 -0
- package/dist/esm/arch/svm/encoders.js +3 -0
- package/dist/esm/arch/svm/encoders.js.map +1 -1
- package/dist/esm/arch/svm/utils.d.ts +6 -0
- package/dist/esm/arch/svm/utils.js +21 -0
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/constants.js +0 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/providers/solana/utils.d.ts +56 -0
- package/dist/esm/providers/solana/utils.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -0
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js +106 -31
- package/dist/esm/relayFeeCalculator/chain-queries/svmQuery.js.map +1 -1
- package/dist/esm/typechain.d.ts +11 -10
- package/dist/esm/typechain.js +5 -5
- package/dist/esm/typechain.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +1 -1
- package/dist/esm/utils/AddressUtils.js +2 -2
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +35 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/encoders.d.ts +1 -0
- package/dist/types/arch/svm/encoders.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +6 -0
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/providers/solana/utils.d.ts +56 -0
- package/dist/types/providers/solana/utils.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts +6 -0
- package/dist/types/relayFeeCalculator/chain-queries/svmQuery.d.ts.map +1 -1
- package/dist/types/typechain.d.ts +11 -10
- package/dist/types/typechain.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +1 -1
- package/dist/types/utils/AddressUtils.d.ts.map +1 -1
- package/package.json +11 -14
- package/src/arch/svm/SpokeUtils.ts +77 -3
- package/src/arch/svm/encoders.ts +4 -0
- package/src/arch/svm/utils.ts +13 -0
- package/src/constants.ts +0 -1
- package/src/providers/solana/utils.ts +44 -0
- package/src/relayFeeCalculator/chain-queries/svmQuery.ts +121 -5
- package/src/typechain.ts +12 -10
- package/src/utils/AddressUtils.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"svmQuery.d.ts","sourceRoot":"","sources":["../../../../src/relayFeeCalculator/chain-queries/svmQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAQjB,KAAK,4BAA4B,EACjC,KAAK,uCAAuC,EAC7C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EASZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAkB,MAAM,aAAa,CAAC;AACpH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,IAAI,CAAC;AAMvC;;;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,EAAE,MAAM;IACpC,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY;IACrC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;IArBxC,SAAS,CAAC,oBAAoB,gXAAC;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,EAAE,MAAM,YAAA,EAC3B,aAAa,CAAC,EAAE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9B,EACD,OAAO,EAAE,UAAU,EACnB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,UAAU,GAC3B,OAAO,CAAC,MAAM,CAAC;CAiEnB"}
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
* Currently, the packages `@across-protocol/contracts` and `@across-protocol/across-token` are not optimized for tree-shaking
|
|
4
4
|
* and contain modules that are not compatible in a browser environment. This is a temporary solution until we can fix the issue upstream.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
6
|
+
import type { TypedEvent, TypedEventFilter } from "@across-protocol/contracts/dist/typechain/common";
|
|
7
|
+
export type { TypedEvent, TypedEventFilter };
|
|
8
|
+
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
|
|
9
|
+
export { AcrossConfigStore__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/AcrossConfigStore__factory";
|
|
10
|
+
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
|
|
11
|
+
export { SpokePool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePool__factory";
|
|
12
|
+
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts-v4/token/ERC20/ERC20__factory";
|
|
12
13
|
export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
|
|
13
14
|
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
|
|
14
15
|
export { MerkleDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/MerkleDistributor__factory";
|
|
15
|
-
export type { AcrossMerkleDistributor, AcrossMerkleDistributorInterface, } from "@across-protocol/contracts/dist/typechain/AcrossMerkleDistributor";
|
|
16
|
-
export type { AcrossConfigStore, AcrossConfigStoreInterface, } from "@across-protocol/contracts/dist/typechain/AcrossConfigStore";
|
|
17
|
-
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts/dist/typechain/HubPool";
|
|
18
|
-
export type { SpokePool, SpokePoolInterface, V3FundsDepositedEvent, FilledV3RelayEvent, } from "@across-protocol/contracts/dist/typechain/SpokePool";
|
|
16
|
+
export type { AcrossMerkleDistributor, AcrossMerkleDistributorInterface, } from "@across-protocol/contracts/dist/typechain/contracts/merkle-distributor/AcrossMerkleDistributor";
|
|
17
|
+
export type { AcrossConfigStore, AcrossConfigStoreInterface, } from "@across-protocol/contracts/dist/typechain/contracts/AcrossConfigStore";
|
|
18
|
+
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts/dist/typechain/contracts/HubPool";
|
|
19
|
+
export type { SpokePool, SpokePoolInterface, V3FundsDepositedEvent, FilledV3RelayEvent, } from "@across-protocol/contracts/dist/typechain/contracts/SpokePool";
|
|
19
20
|
export type { AcceleratingDistributor, AcceleratingDistributorInterface, } from "@across-protocol/across-token/dist/typechain/AcceleratingDistributor";
|
|
20
21
|
export type { ClaimAndStake, ClaimAndStakeInterface } from "@across-protocol/across-token/dist/typechain/ClaimAndStake";
|
|
21
22
|
export type { MerkleDistributor, MerkleDistributorInterface, } from "@across-protocol/across-token/dist/typechain/MerkleDistributor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typechain.d.ts","sourceRoot":"","sources":["../../src/typechain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"typechain.d.ts","sourceRoot":"","sources":["../../src/typechain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAErG,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;AAC7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,mHAAmH,CAAC;AACrK,OAAO,EAAE,0BAA0B,EAAE,MAAM,0FAA0F,CAAC;AACtI,OAAO,EAAE,gBAAgB,EAAE,MAAM,gFAAgF,CAAC;AAClH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kFAAkF,CAAC;AACtH,OAAO,EAAE,cAAc,EAAE,MAAM,2GAA2G,CAAC;AAE3I,OAAO,EAAE,gCAAgC,EAAE,MAAM,yFAAyF,CAAC;AAC3I,OAAO,EAAE,sBAAsB,EAAE,MAAM,+EAA+E,CAAC;AACvH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mFAAmF,CAAC;AAE/H,YAAY,EACV,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,gGAAgG,CAAC;AACxG,YAAY,EACV,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,uEAAuE,CAAC;AAC/E,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAC7G,YAAY,EACV,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,+DAA+D,CAAC;AAEvE,YAAY,EACV,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,sEAAsE,CAAC;AAC9E,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,4DAA4D,CAAC;AACxH,YAAY,EACV,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,gEAAgE,CAAC"}
|
|
@@ -48,7 +48,7 @@ export declare abstract class Address {
|
|
|
48
48
|
toString(): string;
|
|
49
49
|
isZeroAddress(): boolean;
|
|
50
50
|
forceSvmAddress(): SvmAddress;
|
|
51
|
-
eq(other
|
|
51
|
+
eq(other?: Address): boolean;
|
|
52
52
|
compare(otherAddress: Address): 1 | -1 | 0;
|
|
53
53
|
isEVM(): this is EvmAddress;
|
|
54
54
|
isSVM(): this is SvmAddress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/AddressUtils.ts"],"names":[],"mappings":"AACA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AC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;CAGzC;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,GAAG,UAAU;CAGzC;AAED,qBAAa,UAAW,SAAQ,OAAO;IACrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAEnB,UAAU,EAAE,UAAU;CAInC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.3.113
|
|
4
|
+
"version": "4.3.113",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -56,14 +56,13 @@
|
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@coral-xyz/borsh": "^0.30.1",
|
|
60
59
|
"@defi-wonderland/smock": "^2.4.0",
|
|
61
|
-
"@
|
|
60
|
+
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
|
|
62
61
|
"@nomiclabs/hardhat-ethers": "^2.2.1",
|
|
63
62
|
"@nomiclabs/hardhat-etherscan": "^3.1.7",
|
|
64
|
-
"@nomiclabs/hardhat-waffle": "^2.0.3",
|
|
65
63
|
"@openzeppelin/hardhat-upgrades": "^1.28.0",
|
|
66
64
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
65
|
+
"@solana/web3.js": "^1.31.0",
|
|
67
66
|
"@typechain/ethers-v5": "^11.1.1",
|
|
68
67
|
"@typechain/hardhat": "^6.1.6",
|
|
69
68
|
"@types/async": "^3.2.24",
|
|
@@ -71,6 +70,8 @@
|
|
|
71
70
|
"@types/dotenv": "^8.2.0",
|
|
72
71
|
"@types/lodash": "^4.14.199",
|
|
73
72
|
"@types/lodash.get": "^4.4.7",
|
|
73
|
+
"@types/mocha": "^10.0.1",
|
|
74
|
+
"@types/node": "^24.3.0",
|
|
74
75
|
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
|
75
76
|
"@typescript-eslint/parser": "^6.6.0",
|
|
76
77
|
"arlocal": "^1.1.65",
|
|
@@ -89,7 +90,6 @@
|
|
|
89
90
|
"eslint-plugin-node": "^11.1.0",
|
|
90
91
|
"eslint-plugin-prettier": "^5.0.0",
|
|
91
92
|
"eslint-plugin-promise": "^6.1.1",
|
|
92
|
-
"ethereum-waffle": "^4.0.10",
|
|
93
93
|
"hardhat": "^2.28.0",
|
|
94
94
|
"hardhat-deploy": "^0.11.2",
|
|
95
95
|
"hardhat-gas-reporter": "^1.0.8",
|
|
@@ -104,14 +104,12 @@
|
|
|
104
104
|
"ts-jest": "^29.1.1",
|
|
105
105
|
"ts-node": "^10.9.1",
|
|
106
106
|
"typechain": "^8.3.1",
|
|
107
|
-
"typescript": "^5.9"
|
|
108
|
-
"winston": "^3.17.0",
|
|
109
|
-
"winston-transport": "^4.9.0"
|
|
107
|
+
"typescript": "^5.9"
|
|
110
108
|
},
|
|
111
109
|
"dependencies": {
|
|
112
110
|
"@across-protocol/across-token": "^1.0.0",
|
|
113
111
|
"@across-protocol/constants": "^3.1.97",
|
|
114
|
-
"@across-protocol/contracts": "4.1.
|
|
112
|
+
"@across-protocol/contracts": "4.1.20",
|
|
115
113
|
"@coral-xyz/anchor": "^0.30.1",
|
|
116
114
|
"@eth-optimism/sdk": "^3.3.1",
|
|
117
115
|
"@ethersproject/bignumber": "^5.7.0",
|
|
@@ -119,15 +117,12 @@
|
|
|
119
117
|
"@pinata/sdk": "^2.1.0",
|
|
120
118
|
"@solana-program/system": "^0.7.0",
|
|
121
119
|
"@solana-program/token-2022": "^0.4.0",
|
|
120
|
+
"@solana-program/compute-budget": "^0.8.0",
|
|
122
121
|
"@solana/kit": "^2.3.0",
|
|
123
|
-
"@solana/web3.js": "^1.31.0",
|
|
124
|
-
"@types/mocha": "^10.0.1",
|
|
125
|
-
"@types/node": "^24.3.0",
|
|
126
122
|
"@uma/contracts-node": "^0.4.26",
|
|
127
123
|
"arweave": "^1.14.4",
|
|
128
124
|
"async": "^3.2.5",
|
|
129
125
|
"axios": "^0.27.2",
|
|
130
|
-
"big-number": "^2.0.0",
|
|
131
126
|
"bs58": "^6.0.0",
|
|
132
127
|
"decimal.js": "^10.3.1",
|
|
133
128
|
"ethers": "^5.7.2",
|
|
@@ -136,7 +131,9 @@
|
|
|
136
131
|
"node-gyp": "^11.0.0",
|
|
137
132
|
"superstruct": "^0.15.4",
|
|
138
133
|
"tslib": "^2.6.2",
|
|
139
|
-
"viem": "^2.21.15"
|
|
134
|
+
"viem": "^2.21.15",
|
|
135
|
+
"winston": "^3.17.0",
|
|
136
|
+
"winston-transport": "^4.9.0"
|
|
140
137
|
},
|
|
141
138
|
"publishConfig": {
|
|
142
139
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
pipe,
|
|
33
33
|
signTransactionMessageWithSigners,
|
|
34
34
|
some,
|
|
35
|
+
compileTransaction,
|
|
35
36
|
type TransactionSigner,
|
|
36
37
|
type WritableAccount,
|
|
37
38
|
type ReadonlyAccount,
|
|
@@ -102,6 +103,8 @@ import {
|
|
|
102
103
|
*/
|
|
103
104
|
export const SLOT_DURATION_MS = 400;
|
|
104
105
|
|
|
106
|
+
export const SOLANA_TX_SIZE_LIMIT = 1232;
|
|
107
|
+
|
|
105
108
|
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
|
|
106
109
|
destinationChainId: number;
|
|
107
110
|
recipient: SvmAddress;
|
|
@@ -526,7 +529,7 @@ export async function fillRelayInstruction(
|
|
|
526
529
|
return SvmSpokeClient.getFillRelayInstruction({
|
|
527
530
|
signer,
|
|
528
531
|
state: statePda,
|
|
529
|
-
delegate:
|
|
532
|
+
delegate: delegatePda,
|
|
530
533
|
mint: svmRelayData.outputToken,
|
|
531
534
|
relayerTokenAccount: relayerTokenAccount,
|
|
532
535
|
recipientTokenAccount: recipientTokenAccount,
|
|
@@ -695,6 +698,8 @@ export async function getIPFillRelayTx(
|
|
|
695
698
|
getEventAuthority(program),
|
|
696
699
|
]);
|
|
697
700
|
|
|
701
|
+
const recipientAtaEncodedAccount = await fetchEncodedAccount(solanaClient, recipientAta);
|
|
702
|
+
|
|
698
703
|
// Add remaining accounts if the relayData has a non-empty message.
|
|
699
704
|
// @dev ! since in the context of creating a `fillRelayTx`, `relayData` must be defined.
|
|
700
705
|
const remainingAccounts: (WritableAccount | ReadonlyAccount)[] = [];
|
|
@@ -738,7 +743,7 @@ export async function getIPFillRelayTx(
|
|
|
738
743
|
fillInput,
|
|
739
744
|
{ outputAmount: relayData.outputAmount.toBigInt(), recipient: toAddress(relayData.recipient) },
|
|
740
745
|
mintInfo.data.decimals,
|
|
741
|
-
|
|
746
|
+
!recipientAtaEncodedAccount.exists,
|
|
742
747
|
remainingAccounts
|
|
743
748
|
);
|
|
744
749
|
}
|
|
@@ -1082,10 +1087,34 @@ async function fetchBatchFillStatusFromPdaAccounts(
|
|
|
1082
1087
|
return fillStatuses;
|
|
1083
1088
|
}
|
|
1084
1089
|
|
|
1090
|
+
export async function getIPForFillRelayTxs(
|
|
1091
|
+
spokePool: SvmAddress,
|
|
1092
|
+
relayData: RelayData,
|
|
1093
|
+
repaymentChainId: number,
|
|
1094
|
+
repaymentAddress: SdkAddress,
|
|
1095
|
+
signer: TransactionSigner<string>,
|
|
1096
|
+
provider: SVMProvider
|
|
1097
|
+
) {
|
|
1098
|
+
const ixs = await getFillRelayViaInstructionParamsInstructions(
|
|
1099
|
+
toAddress(spokePool),
|
|
1100
|
+
relayData,
|
|
1101
|
+
repaymentChainId,
|
|
1102
|
+
repaymentAddress,
|
|
1103
|
+
signer,
|
|
1104
|
+
provider
|
|
1105
|
+
);
|
|
1106
|
+
const txns = await mapAsync(ixs, async (ix) => {
|
|
1107
|
+
return pipe(await createDefaultTransaction(provider, signer), (tx) => appendTransactionMessageInstruction(ix, tx));
|
|
1108
|
+
});
|
|
1109
|
+
return txns;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1085
1112
|
/**
|
|
1086
1113
|
* Returns a set of instructions to execute to fill a relay via instruction params.
|
|
1087
1114
|
* @param spokePool The program ID of the Solana spoke pool.
|
|
1088
1115
|
* @param relayData The relay data to write to the instruction params PDA.
|
|
1116
|
+
* @param repaymentChainId: The chain ID to take repayment.
|
|
1117
|
+
* @param repaymentAddress: The address to receive repayment on the specified repayment chain.
|
|
1089
1118
|
* @param signer The transaction signer and authority of the instruction params PDA.
|
|
1090
1119
|
* @param maxWriteSize The maximum fragment size to write to instruction params.
|
|
1091
1120
|
*/
|
|
@@ -1095,9 +1124,11 @@ export async function getFillRelayViaInstructionParamsInstructions(
|
|
|
1095
1124
|
repaymentChainId: number,
|
|
1096
1125
|
repaymentAddress: SdkAddress,
|
|
1097
1126
|
signer: TransactionSigner<string>,
|
|
1127
|
+
provider: SVMProvider,
|
|
1098
1128
|
maxWriteSize = 450
|
|
1099
1129
|
): Promise<IInstruction[]> {
|
|
1100
1130
|
const instructionParams = await getInstructionParamsPda(spokePool, signer.address);
|
|
1131
|
+
const encodedInstructionParams = await fetchEncodedAccount(provider, instructionParams);
|
|
1101
1132
|
|
|
1102
1133
|
const relayDataEncoder = SvmSpokeClient.getFillRelayParamsEncoder();
|
|
1103
1134
|
const svmRelayData = toSvmRelayData(relayData);
|
|
@@ -1126,7 +1157,9 @@ export async function getFillRelayViaInstructionParamsInstructions(
|
|
|
1126
1157
|
});
|
|
1127
1158
|
instructions.push(writeInstructionParamsIx);
|
|
1128
1159
|
}
|
|
1129
|
-
return
|
|
1160
|
+
return encodedInstructionParams.exists
|
|
1161
|
+
? [SvmSpokeClient.getCloseInstructionParamsInstruction({ signer, instructionParams }), ...instructions]
|
|
1162
|
+
: instructions;
|
|
1130
1163
|
}
|
|
1131
1164
|
|
|
1132
1165
|
/**
|
|
@@ -1415,6 +1448,47 @@ export async function getCCTPDepositAccounts(
|
|
|
1415
1448
|
};
|
|
1416
1449
|
}
|
|
1417
1450
|
|
|
1451
|
+
/**
|
|
1452
|
+
* Returns true if the input deposit's corresponding relay data would result in a transaction size
|
|
1453
|
+
* that is larger than the Solana transaction size limit.
|
|
1454
|
+
* @param fillRelayTx The compilable fill relay transaction to check.
|
|
1455
|
+
* @returns Object containing a boolean if the input deposit requires a multipart fill, false otherwise and
|
|
1456
|
+
* the number of bytes in the serialized transaction.
|
|
1457
|
+
*/
|
|
1458
|
+
export function isSVMFillTooLarge(fillRelayTx: CompilableTransactionMessage): {
|
|
1459
|
+
tooLarge: boolean;
|
|
1460
|
+
sizeBytes: number;
|
|
1461
|
+
} {
|
|
1462
|
+
const sizeBytes = calculateFillSizeBytes(fillRelayTx);
|
|
1463
|
+
return {
|
|
1464
|
+
tooLarge: sizeBytes > SOLANA_TX_SIZE_LIMIT,
|
|
1465
|
+
sizeBytes,
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Returns the byte size of a base64 transaction.
|
|
1471
|
+
* @param base64TxString base64 serialized Solana transaction.
|
|
1472
|
+
* @returns The number of bytes in the transaction.
|
|
1473
|
+
*/
|
|
1474
|
+
export function base64StrToByteSize(base64TxString: string): number {
|
|
1475
|
+
// base64 string has 6 bits per character, so every 4 symbols represent 3 bytes
|
|
1476
|
+
// However, we also need to account for padding: https://en.wikipedia.org/wiki/Base64#Padding
|
|
1477
|
+
const paddingLen = base64TxString.endsWith("==") ? 2 : base64TxString.endsWith("=") ? 1 : 0;
|
|
1478
|
+
return (base64TxString.length * 3) / 4 - paddingLen;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* Returns the size of the fill relay transaction using the input relayData.
|
|
1483
|
+
* @param fillTx The compilable fill relay transaction.
|
|
1484
|
+
* @returns The number of bytes in the serialized fillRelay transaction.
|
|
1485
|
+
*/
|
|
1486
|
+
export function calculateFillSizeBytes(fillTx: CompilableTransactionMessage): number {
|
|
1487
|
+
const signedTransaction = compileTransaction(fillTx);
|
|
1488
|
+
const serializedTx = getBase64EncodedWireTransaction(signedTransaction);
|
|
1489
|
+
return base64StrToByteSize(serializedTx);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1418
1492
|
/**
|
|
1419
1493
|
* Returns the account metas for a deposit message.
|
|
1420
1494
|
* @param message The CCTP message.
|
package/src/arch/svm/encoders.ts
CHANGED
|
@@ -62,6 +62,10 @@ export function getHandlerMessageEncoder(): Encoder<Array<CompiledIx>> {
|
|
|
62
62
|
return getArrayEncoder(getCompiledIxEncoder());
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export function getHandlerMessageDecoder(): Decoder<Array<CompiledIx>> {
|
|
66
|
+
return getArrayDecoder(getCompiledIxDecoder());
|
|
67
|
+
}
|
|
68
|
+
|
|
65
69
|
export function getCompiledIxEncoder(): Encoder<CompiledIx> {
|
|
66
70
|
return getStructEncoder([
|
|
67
71
|
["program_id_index", getU8Encoder()],
|
package/src/arch/svm/utils.ts
CHANGED
|
@@ -367,6 +367,19 @@ export async function getEventAuthority(programId: Address): Promise<Address> {
|
|
|
367
367
|
return eventAuthority;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
+
/**
|
|
371
|
+
* Returns the PDA for the handler signer.
|
|
372
|
+
* @param programId The multicall handler program ID.
|
|
373
|
+
* @returns The PDA for the State account.
|
|
374
|
+
*/
|
|
375
|
+
export async function getHandlerSignerPda(programId: Address): Promise<Address> {
|
|
376
|
+
const [handlerSignerPda] = await getProgramDerivedAddress({
|
|
377
|
+
programAddress: programId,
|
|
378
|
+
seeds: ["handler_signer"],
|
|
379
|
+
});
|
|
380
|
+
return handlerSignerPda;
|
|
381
|
+
}
|
|
382
|
+
|
|
370
383
|
/**
|
|
371
384
|
* Returns the PDA for the Self Authority.
|
|
372
385
|
* @returns The PDA for the Self Authority.
|
package/src/constants.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RpcTransport } from "@solana/rpc-spec";
|
|
2
|
+
import { SolanaRpcApi } from "@solana/kit";
|
|
2
3
|
import { isSolanaError, SVM_SLOT_SKIPPED, SVM_LONG_TERM_STORAGE_SLOT_SKIPPED } from "../../arch/svm";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -14,6 +15,49 @@ export interface SolanaRateLimitTask {
|
|
|
14
15
|
reject: (err: unknown) => void;
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
export type TransactionResult = {
|
|
19
|
+
err: string | undefined;
|
|
20
|
+
logs: Array<string>;
|
|
21
|
+
postExecutionAccounts: ExecutionAccounts[];
|
|
22
|
+
preExecutionAccounts: ExecutionAccounts[];
|
|
23
|
+
returnData: string | undefined;
|
|
24
|
+
unitsConsumed: bigint;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type ExecutionAccounts = {
|
|
28
|
+
data: [string, string];
|
|
29
|
+
executable: boolean;
|
|
30
|
+
lamports: bigint;
|
|
31
|
+
owner: string;
|
|
32
|
+
rentEpoch: bigint;
|
|
33
|
+
space: bigint;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// `simulateBundle` minimal response struct.
|
|
37
|
+
export type SolanaBundleSimulation = {
|
|
38
|
+
context: { apiVersion: string; slot: bigint };
|
|
39
|
+
value: {
|
|
40
|
+
summary: "succeeded" | { failed: { error: { TransactionFailure: [Array<bigint>, string] }; tx_signature: string } };
|
|
41
|
+
transactionResults: Array<TransactionResult>;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type SimulationOpts = {
|
|
46
|
+
simulationBank?: string;
|
|
47
|
+
skipSigVerify?: boolean;
|
|
48
|
+
replaceRecentBlockhash?: boolean;
|
|
49
|
+
accounts?: { addresses: string[]; encoding: string };
|
|
50
|
+
// pre/post Execution accounts must be defined if any other opt is defined.
|
|
51
|
+
preExecutionAccountsConfigs: Array<{ accountIndex: number; addresses: string[] } | undefined>;
|
|
52
|
+
postExecutionAccountsConfigs: Array<{ accountIndex: number; addresses: string[] } | undefined>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Minimal extension of a Solana RPC Api which also supports some JITO RPC endpoints.
|
|
56
|
+
export interface JitoInterface extends SolanaRpcApi {
|
|
57
|
+
// Simulate an array of base64 encoded transactions
|
|
58
|
+
simulateBundle(transactions: { encodedTransactions: string[] }, opts?: SimulationOpts): SolanaBundleSimulation;
|
|
59
|
+
}
|
|
60
|
+
|
|
17
61
|
/**
|
|
18
62
|
* Determine whether a Solana RPC error indicates an unrecoverable error that should not be retried.
|
|
19
63
|
* @param method RPC method name.
|
|
@@ -4,19 +4,36 @@ import {
|
|
|
4
4
|
TransactionSigner,
|
|
5
5
|
fetchEncodedAccount,
|
|
6
6
|
isSome,
|
|
7
|
+
Rpc,
|
|
8
|
+
pipe,
|
|
9
|
+
appendTransactionMessageInstruction,
|
|
10
|
+
compileTransaction,
|
|
11
|
+
getBase64EncodedWireTransaction,
|
|
7
12
|
type CompilableTransactionMessage,
|
|
8
13
|
type TransactionMessageWithBlockhashLifetime,
|
|
9
14
|
} from "@solana/kit";
|
|
10
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
SVMProvider,
|
|
17
|
+
SolanaVoidSigner,
|
|
18
|
+
getFillRelayTx,
|
|
19
|
+
getIPFillRelayTx,
|
|
20
|
+
getFillRelayViaInstructionParamsInstructions,
|
|
21
|
+
toAddress,
|
|
22
|
+
createDefaultTransaction,
|
|
23
|
+
getAssociatedTokenAddress,
|
|
24
|
+
isSVMFillTooLarge,
|
|
25
|
+
} from "../../arch/svm";
|
|
26
|
+
import { JitoInterface } from "../../providers/solana";
|
|
11
27
|
import { Coingecko } from "../../coingecko";
|
|
12
28
|
import { CHAIN_IDs } from "../../constants";
|
|
13
29
|
import { getGasPriceEstimate } from "../../gasPriceOracle";
|
|
14
30
|
import { RelayData } from "../../interfaces";
|
|
15
|
-
import { Address, BigNumber, BigNumberish, SvmAddress, TransactionCostEstimate, toBN } from "../../utils";
|
|
31
|
+
import { Address, BigNumber, BigNumberish, SvmAddress, TransactionCostEstimate, toBN, mapAsync } from "../../utils";
|
|
16
32
|
import { Logger, QueryInterface, getDefaultRelayer } from "../relayFeeCalculator";
|
|
17
33
|
import { SymbolMappingType } from "./";
|
|
18
34
|
import { TOKEN_PROGRAM_ADDRESS } from "@solana-program/token";
|
|
19
35
|
import { TOKEN_2022_PROGRAM_ADDRESS, getTokenSize, fetchMint, Extension } from "@solana-program/token-2022";
|
|
36
|
+
import { getSetComputeUnitLimitInstruction } from "@solana-program/compute-budget";
|
|
20
37
|
import { arch } from "../..";
|
|
21
38
|
|
|
22
39
|
/**
|
|
@@ -79,15 +96,36 @@ export class SvmQuery implements QueryInterface {
|
|
|
79
96
|
assert(relayer.isSVM());
|
|
80
97
|
|
|
81
98
|
const [repaymentChainId, repaymentAddress] = [destinationChainId, relayer]; // These are not important for gas cost simulation.
|
|
82
|
-
|
|
99
|
+
|
|
100
|
+
// For solana, we algorithmically estimate gas based on the size of the message.
|
|
101
|
+
const _fillRelayTx = await this.getFillRelayTx(
|
|
83
102
|
{ ...relayData, recipient, outputToken, exclusiveRelayer },
|
|
84
103
|
SolanaVoidSigner(relayer.toBase58()),
|
|
85
104
|
repaymentChainId,
|
|
86
105
|
repaymentAddress
|
|
87
106
|
);
|
|
88
107
|
|
|
89
|
-
const
|
|
90
|
-
|
|
108
|
+
const fillTooLarge = isSVMFillTooLarge(_fillRelayTx);
|
|
109
|
+
// If the fill is too large, we need to construct a dummy fill relay transaction which estimates the priority fee of the fillRelay instruction call. To guarantee
|
|
110
|
+
// that the transaction won't be too large, we overwrite the message with empty bytes.
|
|
111
|
+
const fillRelayTx = fillTooLarge.tooLarge
|
|
112
|
+
? await this.getFillRelayTx(
|
|
113
|
+
{ ...relayData, recipient, outputToken, exclusiveRelayer, message: "0x" },
|
|
114
|
+
SolanaVoidSigner(relayer.toBase58()),
|
|
115
|
+
repaymentChainId,
|
|
116
|
+
repaymentAddress
|
|
117
|
+
)
|
|
118
|
+
: _fillRelayTx;
|
|
119
|
+
|
|
120
|
+
const [_computeUnitsConsumed, gasPriceEstimate, tokenAccountInfo] = await Promise.all([
|
|
121
|
+
fillTooLarge.tooLarge
|
|
122
|
+
? this.estimateComputeUnits(
|
|
123
|
+
{ ...relayData, recipient, outputToken, exclusiveRelayer },
|
|
124
|
+
relayer,
|
|
125
|
+
repaymentChainId,
|
|
126
|
+
repaymentAddress
|
|
127
|
+
)
|
|
128
|
+
: this.computeUnitEstimator(fillRelayTx),
|
|
91
129
|
getGasPriceEstimate(this.provider, {
|
|
92
130
|
unsignedTx: fillRelayTx,
|
|
93
131
|
baseFeeMultiplier: options.baseFeeMultiplier,
|
|
@@ -95,6 +133,7 @@ export class SvmQuery implements QueryInterface {
|
|
|
95
133
|
}),
|
|
96
134
|
this.provider.getAccountInfo(toAddress(outputToken), { encoding: "base58" }).send(),
|
|
97
135
|
]);
|
|
136
|
+
const computeUnitsConsumed = toBN(_computeUnitsConsumed);
|
|
98
137
|
|
|
99
138
|
// If the owner of the token account is not the token program, then we can assume that it is the 2022 token program address, in which
|
|
100
139
|
// case we need to determine the extensions the token has to properly calculate rent exemption.
|
|
@@ -213,4 +252,81 @@ export class SvmQuery implements QueryInterface {
|
|
|
213
252
|
if (!this.symbolMapping[tokenSymbol]) throw new Error(`${tokenSymbol} does not exist in mapping`);
|
|
214
253
|
return this.symbolMapping[tokenSymbol].decimals;
|
|
215
254
|
}
|
|
255
|
+
|
|
256
|
+
// The fill is too large; we need to simulate the transaction in a bundle.
|
|
257
|
+
async estimateComputeUnits(
|
|
258
|
+
relayData: RelayData & {
|
|
259
|
+
destinationChainId: number;
|
|
260
|
+
recipient: SvmAddress;
|
|
261
|
+
outputToken: SvmAddress;
|
|
262
|
+
exclusiveRelayer: SvmAddress;
|
|
263
|
+
},
|
|
264
|
+
relayer: SvmAddress,
|
|
265
|
+
repaymentChainId: number,
|
|
266
|
+
repaymentAddress: SvmAddress
|
|
267
|
+
): Promise<bigint> {
|
|
268
|
+
// @dev There is no way to tell if the RPC supports the JITO interface without querying the rpc directly.
|
|
269
|
+
// Cast the rpc type to support JITO and attempt to call `simulateBundle`. Throw and error if it fails, since
|
|
270
|
+
// the transaction message cannot be simulated otherwise.
|
|
271
|
+
const provider = this.provider as Rpc<JitoInterface>;
|
|
272
|
+
|
|
273
|
+
const spokePoolAddr = toAddress(this.spokePool);
|
|
274
|
+
const voidSigner = SolanaVoidSigner(relayer.toBase58());
|
|
275
|
+
|
|
276
|
+
const [instructionParamsIxs, _fillRelayTx] = await Promise.all([
|
|
277
|
+
getFillRelayViaInstructionParamsInstructions(
|
|
278
|
+
spokePoolAddr,
|
|
279
|
+
relayData,
|
|
280
|
+
repaymentChainId,
|
|
281
|
+
repaymentAddress,
|
|
282
|
+
voidSigner,
|
|
283
|
+
provider
|
|
284
|
+
),
|
|
285
|
+
getIPFillRelayTx(this.spokePool, provider, relayData, voidSigner, repaymentChainId, repaymentAddress),
|
|
286
|
+
]);
|
|
287
|
+
|
|
288
|
+
// Set a high compute unit limit for the fill relay transaction so that the simulation won't fail because
|
|
289
|
+
// it ran out of CUs.
|
|
290
|
+
const computeUnitLimitIx = getSetComputeUnitLimitInstruction({ units: 10_000_000 });
|
|
291
|
+
const fillRelayTx = pipe(_fillRelayTx, (tx) => appendTransactionMessageInstruction(computeUnitLimitIx, tx));
|
|
292
|
+
|
|
293
|
+
const instructionParamsTxs = await mapAsync(instructionParamsIxs, async (ix) => {
|
|
294
|
+
return pipe(await createDefaultTransaction(provider, voidSigner), (tx) =>
|
|
295
|
+
appendTransactionMessageInstruction(ix, tx)
|
|
296
|
+
);
|
|
297
|
+
});
|
|
298
|
+
const bundleTxns = [...instructionParamsTxs, fillRelayTx].map((txn) => {
|
|
299
|
+
const compiled = compileTransaction(txn);
|
|
300
|
+
return getBase64EncodedWireTransaction(compiled);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
// Define execution accounts for the relayer simulation.
|
|
304
|
+
const executionAccounts = bundleTxns.map(() => {
|
|
305
|
+
return { accountIndex: 0, addresses: [this.spokePool.toBase58(), relayer.toBase58()] };
|
|
306
|
+
});
|
|
307
|
+
const simulateBundleResponse = await provider
|
|
308
|
+
.simulateBundle(
|
|
309
|
+
{
|
|
310
|
+
encodedTransactions: bundleTxns,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
skipSigVerify: true,
|
|
314
|
+
preExecutionAccountsConfigs: executionAccounts,
|
|
315
|
+
postExecutionAccountsConfigs: executionAccounts,
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
.send();
|
|
319
|
+
|
|
320
|
+
// If the bundle simulation failed, then return data from the failure.
|
|
321
|
+
if (simulateBundleResponse.value.summary !== "succeeded") {
|
|
322
|
+
const { TransactionFailure: failure } = simulateBundleResponse.value.summary.failed.error;
|
|
323
|
+
throw new Error(`simulateBundle failed with result: ${failure[1]}`);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const totalCuSpent = simulateBundleResponse.value.transactionResults.reduce(
|
|
327
|
+
(sum, res) => res.unitsConsumed + sum,
|
|
328
|
+
BigInt(0)
|
|
329
|
+
);
|
|
330
|
+
return totalCuSpent;
|
|
331
|
+
}
|
|
216
332
|
}
|
package/src/typechain.ts
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
* Currently, the packages `@across-protocol/contracts` and `@across-protocol/across-token` are not optimized for tree-shaking
|
|
4
4
|
* and contain modules that are not compatible in a browser environment. This is a temporary solution until we can fix the issue upstream.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
6
|
+
import type { TypedEvent, TypedEventFilter } from "@across-protocol/contracts/dist/typechain/common";
|
|
7
|
+
|
|
8
|
+
export type { TypedEvent, TypedEventFilter };
|
|
9
|
+
export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/merkle-distributor/AcrossMerkleDistributor__factory";
|
|
10
|
+
export { AcrossConfigStore__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/AcrossConfigStore__factory";
|
|
11
|
+
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
|
|
12
|
+
export { SpokePool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/SpokePool__factory";
|
|
13
|
+
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts-v4/token/ERC20/ERC20__factory";
|
|
12
14
|
|
|
13
15
|
export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
|
|
14
16
|
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
|
|
@@ -17,18 +19,18 @@ export { MerkleDistributor__factory } from "@across-protocol/across-token/dist/t
|
|
|
17
19
|
export type {
|
|
18
20
|
AcrossMerkleDistributor,
|
|
19
21
|
AcrossMerkleDistributorInterface,
|
|
20
|
-
} from "@across-protocol/contracts/dist/typechain/AcrossMerkleDistributor";
|
|
22
|
+
} from "@across-protocol/contracts/dist/typechain/contracts/merkle-distributor/AcrossMerkleDistributor";
|
|
21
23
|
export type {
|
|
22
24
|
AcrossConfigStore,
|
|
23
25
|
AcrossConfigStoreInterface,
|
|
24
|
-
} from "@across-protocol/contracts/dist/typechain/AcrossConfigStore";
|
|
25
|
-
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts/dist/typechain/HubPool";
|
|
26
|
+
} from "@across-protocol/contracts/dist/typechain/contracts/AcrossConfigStore";
|
|
27
|
+
export type { HubPool, HubPoolInterface } from "@across-protocol/contracts/dist/typechain/contracts/HubPool";
|
|
26
28
|
export type {
|
|
27
29
|
SpokePool,
|
|
28
30
|
SpokePoolInterface,
|
|
29
31
|
V3FundsDepositedEvent,
|
|
30
32
|
FilledV3RelayEvent,
|
|
31
|
-
} from "@across-protocol/contracts/dist/typechain/SpokePool";
|
|
33
|
+
} from "@across-protocol/contracts/dist/typechain/contracts/SpokePool";
|
|
32
34
|
|
|
33
35
|
export type {
|
|
34
36
|
AcceleratingDistributor,
|
|
@@ -135,7 +135,7 @@ export abstract class Address {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
static isAddress(obj: unknown): obj is Address {
|
|
138
|
-
return "
|
|
138
|
+
return typeof obj === "object" && obj !== null && "__address_type_brand" in obj;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
public toJSON() {
|
|
@@ -212,8 +212,8 @@ export abstract class Address {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// Checks if the other address is equivalent to this address.
|
|
215
|
-
eq(other
|
|
216
|
-
return this.toString() === other
|
|
215
|
+
eq(other?: Address): boolean {
|
|
216
|
+
return this.toString() === other?.toString();
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// Compares Addresses by first converting them to BigNumbers.
|