@across-protocol/sdk 3.1.2 → 3.1.3
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/clients/SpokePoolClient.d.ts +2 -1
- package/dist/cjs/clients/SpokePoolClient.js +9 -3
- package/dist/cjs/clients/SpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +2 -1
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +16 -8
- package/dist/cjs/relayFeeCalculator/chain-queries/polygon.d.ts +16 -8
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +16 -8
- package/dist/cjs/utils/BlockUtils.js +1 -0
- package/dist/cjs/utils/BlockUtils.js.map +1 -1
- package/dist/cjs/utils/NetworkUtils.js +4 -4
- package/dist/cjs/utils/NetworkUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +32 -16
- package/dist/esm/clients/SpokePoolClient.d.ts +8 -1
- package/dist/esm/clients/SpokePoolClient.js +15 -3
- package/dist/esm/clients/SpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +2 -1
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +16 -8
- package/dist/esm/relayFeeCalculator/chain-queries/polygon.d.ts +16 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +16 -8
- package/dist/esm/utils/BlockUtils.js +1 -0
- package/dist/esm/utils/BlockUtils.js.map +1 -1
- package/dist/esm/utils/NetworkUtils.js +4 -4
- package/dist/esm/utils/NetworkUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +34 -30
- package/dist/types/clients/SpokePoolClient.d.ts +8 -1
- package/dist/types/clients/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +2 -1
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +16 -8
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/polygon.d.ts +16 -8
- package/dist/types/relayFeeCalculator/chain-queries/polygon.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +16 -8
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/BlockUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +34 -30
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/clients/SpokePoolClient.ts +17 -3
- package/src/interfaces/SpokePool.ts +2 -1
- package/src/utils/BlockUtils.ts +1 -0
- package/src/utils/NetworkUtils.ts +4 -4
|
@@ -78,6 +78,14 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
78
78
|
[x: number]: string;
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
+
LSK: {
|
|
82
|
+
name: string;
|
|
83
|
+
symbol: string;
|
|
84
|
+
decimals: number;
|
|
85
|
+
addresses: {
|
|
86
|
+
[x: number]: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
81
89
|
MATIC: {
|
|
82
90
|
name: string;
|
|
83
91
|
symbol: string;
|
|
@@ -86,6 +94,14 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
86
94
|
[x: number]: string;
|
|
87
95
|
};
|
|
88
96
|
};
|
|
97
|
+
OP: {
|
|
98
|
+
name: string;
|
|
99
|
+
symbol: string;
|
|
100
|
+
decimals: number;
|
|
101
|
+
addresses: {
|
|
102
|
+
[x: number]: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
89
105
|
POOL: {
|
|
90
106
|
name: string;
|
|
91
107
|
symbol: string;
|
|
@@ -120,13 +136,7 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
120
136
|
};
|
|
121
137
|
"USDC.e": {
|
|
122
138
|
name: string;
|
|
123
|
-
symbol: string;
|
|
124
|
-
* Returns the contract address for a given token symbol and chainId.
|
|
125
|
-
* @param symbol A case-insensitive token symbol.
|
|
126
|
-
* @param chainId The chainId to resolve the contract address for.
|
|
127
|
-
* @param tokenMapping A parameter to determine where to source token information. Defaults to the constants variant.
|
|
128
|
-
* @returns The contract address for the given token symbol and chainId, or undefined if the token symbol is not supported.
|
|
129
|
-
*/
|
|
139
|
+
symbol: string;
|
|
130
140
|
decimals: number;
|
|
131
141
|
addresses: {
|
|
132
142
|
[x: number]: string;
|
|
@@ -172,14 +182,6 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
172
182
|
[x: number]: string;
|
|
173
183
|
};
|
|
174
184
|
};
|
|
175
|
-
OP: {
|
|
176
|
-
name: string;
|
|
177
|
-
symbol: string;
|
|
178
|
-
decimals: number;
|
|
179
|
-
addresses: {
|
|
180
|
-
[x: number]: string;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
185
|
}) => string | undefined;
|
|
184
186
|
export declare function getTokenInformationFromAddress(address: string, tokenMapping?: {
|
|
185
187
|
ACX: {
|
|
@@ -238,6 +240,14 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
238
240
|
[x: number]: string;
|
|
239
241
|
};
|
|
240
242
|
};
|
|
243
|
+
LSK: {
|
|
244
|
+
name: string;
|
|
245
|
+
symbol: string;
|
|
246
|
+
decimals: number;
|
|
247
|
+
addresses: {
|
|
248
|
+
[x: number]: string;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
241
251
|
MATIC: {
|
|
242
252
|
name: string;
|
|
243
253
|
symbol: string;
|
|
@@ -246,6 +256,14 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
246
256
|
[x: number]: string;
|
|
247
257
|
};
|
|
248
258
|
};
|
|
259
|
+
OP: {
|
|
260
|
+
name: string;
|
|
261
|
+
symbol: string;
|
|
262
|
+
decimals: number;
|
|
263
|
+
addresses: {
|
|
264
|
+
[x: number]: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
249
267
|
POOL: {
|
|
250
268
|
name: string;
|
|
251
269
|
symbol: string;
|
|
@@ -280,13 +298,7 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
280
298
|
};
|
|
281
299
|
"USDC.e": {
|
|
282
300
|
name: string;
|
|
283
|
-
symbol: string;
|
|
284
|
-
* Returns the contract address for a given token symbol and chainId.
|
|
285
|
-
* @param symbol A case-insensitive token symbol.
|
|
286
|
-
* @param chainId The chainId to resolve the contract address for.
|
|
287
|
-
* @param tokenMapping A parameter to determine where to source token information. Defaults to the constants variant.
|
|
288
|
-
* @returns The contract address for the given token symbol and chainId, or undefined if the token symbol is not supported.
|
|
289
|
-
*/
|
|
301
|
+
symbol: string;
|
|
290
302
|
decimals: number;
|
|
291
303
|
addresses: {
|
|
292
304
|
[x: number]: string;
|
|
@@ -332,14 +344,6 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
332
344
|
[x: number]: string;
|
|
333
345
|
};
|
|
334
346
|
};
|
|
335
|
-
OP: {
|
|
336
|
-
name: string;
|
|
337
|
-
symbol: string;
|
|
338
|
-
decimals: number;
|
|
339
|
-
addresses: {
|
|
340
|
-
[x: number]: string;
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
347
|
}): L1Token | undefined;
|
|
344
348
|
/**
|
|
345
349
|
* Retrieves the ERC20 balance for a given address and token address.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAY,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAMxC,K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;;;;;;;;;;;;;;;;;;MAEd,MAAM,GAAG,SAIX,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoB,GAAG,OAAO,GAAG,SAAS,CAWrH;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,GAAE,QAAmB,GAC5B,OAAO,CAAC,SAAS,CAAC,CAGpB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.3",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"files": [
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@across-protocol/across-token": "^1.0.0",
|
|
102
|
-
"@across-protocol/constants": "^3.
|
|
102
|
+
"@across-protocol/constants": "^3.1.1",
|
|
103
103
|
"@across-protocol/contracts": "^3.0.1",
|
|
104
104
|
"@eth-optimism/sdk": "^3.3.1",
|
|
105
105
|
"@pinata/sdk": "^2.1.0",
|
|
@@ -546,7 +546,8 @@ export class SpokePoolClient extends BaseAbstractClient {
|
|
|
546
546
|
// Derive and append the common properties that are not part of the onchain event.
|
|
547
547
|
const { quoteBlock: quoteBlockNumber } = dataForQuoteTime[index];
|
|
548
548
|
const deposit = { ...(rawDeposit as DepositWithBlock), originChainId: this.chainId, quoteBlockNumber };
|
|
549
|
-
deposit.
|
|
549
|
+
deposit.fromLiteChain = this.isOriginLiteChain(deposit);
|
|
550
|
+
deposit.toLiteChain = this.isDestinationLiteChain(deposit);
|
|
550
551
|
if (deposit.outputToken === ZERO_ADDRESS) {
|
|
551
552
|
deposit.outputToken = this.getDestinationTokenForDeposit(deposit);
|
|
552
553
|
}
|
|
@@ -843,7 +844,8 @@ export class SpokePoolClient extends BaseAbstractClient {
|
|
|
843
844
|
? this.getDestinationTokenForDeposit({ ...partialDeposit, originChainId: this.chainId })
|
|
844
845
|
: partialDeposit.outputToken,
|
|
845
846
|
};
|
|
846
|
-
deposit.
|
|
847
|
+
deposit.fromLiteChain = this.isOriginLiteChain(deposit);
|
|
848
|
+
deposit.toLiteChain = this.isDestinationLiteChain(deposit);
|
|
847
849
|
|
|
848
850
|
this.logger.debug({
|
|
849
851
|
at: "SpokePoolClient#findDeposit",
|
|
@@ -861,7 +863,19 @@ export class SpokePoolClient extends BaseAbstractClient {
|
|
|
861
863
|
* @returns True if the deposit originates from a lite chain, false otherwise. If the hub pool client is not defined,
|
|
862
864
|
* this method will return false.
|
|
863
865
|
*/
|
|
864
|
-
protected
|
|
866
|
+
protected isOriginLiteChain(deposit: DepositWithBlock): boolean {
|
|
865
867
|
return this.configStoreClient?.isChainLiteChainAtTimestamp(deposit.originChainId, deposit.quoteTimestamp) ?? false;
|
|
866
868
|
}
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Determines whether the deposit destination chain is a lite chain.
|
|
872
|
+
* @param deposit The deposit to evaluate.
|
|
873
|
+
* @returns True if the deposit is destined to a lite chain, false otherwise. If the hub pool client is not defined,
|
|
874
|
+
* this method will return false.
|
|
875
|
+
*/
|
|
876
|
+
protected isDestinationLiteChain(deposit: DepositWithBlock): boolean {
|
|
877
|
+
return (
|
|
878
|
+
this.configStoreClient?.isChainLiteChainAtTimestamp(deposit.destinationChainId, deposit.quoteTimestamp) ?? false
|
|
879
|
+
);
|
|
880
|
+
}
|
|
867
881
|
}
|
|
@@ -28,7 +28,8 @@ export interface Deposit extends RelayData {
|
|
|
28
28
|
updatedRecipient?: string;
|
|
29
29
|
updatedOutputAmount?: BigNumber;
|
|
30
30
|
updatedMessage?: string;
|
|
31
|
-
|
|
31
|
+
fromLiteChain: boolean;
|
|
32
|
+
toLiteChain: boolean;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
export interface DepositWithBlock extends Deposit, SortableEvent {
|
package/src/utils/BlockUtils.ts
CHANGED
|
@@ -36,6 +36,7 @@ const now = getCurrentTime(); // Seed the cache with initial values.
|
|
|
36
36
|
const blockTimes: { [chainId: number]: BlockTimeAverage } = {
|
|
37
37
|
[CHAIN_IDs.BASE]: { average: 2, timestamp: now, blockRange: 1 },
|
|
38
38
|
[CHAIN_IDs.LINEA]: { average: 3, timestamp: now, blockRange: 1 },
|
|
39
|
+
[CHAIN_IDs.LISK]: { average: 2, timestamp: now, blockRange: 1 },
|
|
39
40
|
[CHAIN_IDs.MAINNET]: { average: 12.5, timestamp: now, blockRange: 1 },
|
|
40
41
|
[CHAIN_IDs.MODE]: { average: 2, timestamp: now, blockRange: 1 },
|
|
41
42
|
[CHAIN_IDs.OPTIMISM]: { average: 2, timestamp: now, blockRange: 1 },
|
|
@@ -60,11 +60,11 @@ export function chainIsOPStack(chainId: number): boolean {
|
|
|
60
60
|
return [
|
|
61
61
|
CHAIN_IDs.OPTIMISM,
|
|
62
62
|
CHAIN_IDs.BASE,
|
|
63
|
+
CHAIN_IDs.LISK,
|
|
63
64
|
CHAIN_IDs.MODE,
|
|
64
|
-
CHAIN_IDs.OPTIMISM_GOERLI,
|
|
65
|
-
CHAIN_IDs.BASE_GOERLI,
|
|
66
65
|
CHAIN_IDs.OPTIMISM_SEPOLIA,
|
|
67
66
|
CHAIN_IDs.BASE_SEPOLIA,
|
|
67
|
+
CHAIN_IDs.LISK_SEPOLIA,
|
|
68
68
|
CHAIN_IDs.MODE_SEPOLIA,
|
|
69
69
|
].includes(chainId);
|
|
70
70
|
}
|
|
@@ -75,7 +75,7 @@ export function chainIsOPStack(chainId: number): boolean {
|
|
|
75
75
|
* @returns True if chainId is an Arbitrum chain, otherwise false.
|
|
76
76
|
*/
|
|
77
77
|
export function chainIsArbitrum(chainId: number): boolean {
|
|
78
|
-
return [CHAIN_IDs.ARBITRUM, CHAIN_IDs.
|
|
78
|
+
return [CHAIN_IDs.ARBITRUM, CHAIN_IDs.ARBITRUM_SEPOLIA].includes(chainId);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -84,7 +84,7 @@ export function chainIsArbitrum(chainId: number): boolean {
|
|
|
84
84
|
* @returns True if chainId is a Linea chain, otherwise false.
|
|
85
85
|
*/
|
|
86
86
|
export function chainIsLinea(chainId: number): boolean {
|
|
87
|
-
return [CHAIN_IDs.LINEA
|
|
87
|
+
return [CHAIN_IDs.LINEA].includes(chainId);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|