@across-protocol/sdk 4.3.90 → 4.3.92
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/constants.d.ts +1 -10
- package/dist/cjs/constants.js +26 -18
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/gasPriceOracle/oracle.js +1 -0
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/priceClient/adapters/default.d.ts +9 -2
- package/dist/cjs/priceClient/adapters/default.js +17 -6
- package/dist/cjs/priceClient/adapters/default.js.map +1 -1
- package/dist/cjs/priceClient/priceClient.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +18 -0
- 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/relayFeeCalculator.d.ts +18 -0
- package/dist/cjs/typechain.d.ts +1 -1
- package/dist/cjs/typechain.js +1 -1
- package/dist/cjs/typechain.js.map +1 -1
- package/dist/cjs/utils/Multicall.js +1 -0
- package/dist/cjs/utils/Multicall.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/TokenUtils.d.ts +36 -0
- package/dist/esm/constants.d.ts +1 -10
- package/dist/esm/constants.js +30 -20
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/gasPriceOracle/oracle.js +1 -0
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/priceClient/adapters/default.d.ts +9 -6
- package/dist/esm/priceClient/adapters/default.js +17 -10
- package/dist/esm/priceClient/adapters/default.js.map +1 -1
- package/dist/esm/priceClient/priceClient.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +18 -0
- 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/relayFeeCalculator.d.ts +18 -0
- package/dist/esm/typechain.d.ts +1 -1
- package/dist/esm/typechain.js +1 -1
- package/dist/esm/typechain.js.map +1 -1
- package/dist/esm/utils/Multicall.js +1 -0
- package/dist/esm/utils/Multicall.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/TokenUtils.d.ts +36 -0
- package/dist/types/constants.d.ts +1 -10
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/priceClient/adapters/default.d.ts +9 -6
- package/dist/types/priceClient/adapters/default.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +18 -0
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +18 -0
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/typechain.d.ts +1 -1
- package/dist/types/typechain.d.ts.map +1 -1
- package/dist/types/utils/Multicall.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +36 -0
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/constants.ts +19 -10
- package/src/gasPriceOracle/oracle.ts +1 -0
- package/src/priceClient/adapters/default.ts +15 -9
- package/src/priceClient/priceClient.ts +1 -1
- package/src/relayFeeCalculator/chain-queries/factory.ts +2 -2
- package/src/typechain.ts +1 -1
- package/src/utils/Multicall.ts +1 -0
- package/src/utils/NetworkUtils.ts +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.92",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"files": [
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
108
|
"@across-protocol/across-token": "^1.0.0",
|
|
109
|
-
"@across-protocol/constants": "^3.1.
|
|
110
|
-
"@across-protocol/contracts": "^4.1.
|
|
109
|
+
"@across-protocol/constants": "^3.1.87",
|
|
110
|
+
"@across-protocol/contracts": "^4.1.13",
|
|
111
111
|
"@coral-xyz/anchor": "^0.30.1",
|
|
112
112
|
"@eth-optimism/sdk": "^3.3.1",
|
|
113
113
|
"@ethersproject/bignumber": "^5.7.0",
|
package/src/constants.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { constants as ethersConstants } from "ethers";
|
|
2
|
-
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
|
|
2
|
+
import { CHAIN_IDs, PUBLIC_NETWORKS, TOKEN_SYMBOLS_MAP } from "@across-protocol/constants";
|
|
3
|
+
import { chainIsEvm } from "./utils/NetworkUtils";
|
|
3
4
|
|
|
4
5
|
export {
|
|
5
6
|
CCTP_NO_DOMAIN,
|
|
@@ -87,16 +88,24 @@ export const STABLE_COIN_SYMBOLS = [
|
|
|
87
88
|
TOKEN_SYMBOLS_MAP.WGHO.symbol,
|
|
88
89
|
];
|
|
89
90
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
const resolveCustomGasTokens = () => {
|
|
92
|
+
// Lens & Lens Sepolia are exceptional; every other EVM
|
|
93
|
+
// custom gas token can be inferred from the chain defs.
|
|
94
|
+
const overrides = {
|
|
95
|
+
[CHAIN_IDs.LENS]: "GHO",
|
|
96
|
+
[CHAIN_IDs.LENS_SEPOLIA]: "GHO",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return Object.keys(PUBLIC_NETWORKS)
|
|
100
|
+
.map(Number)
|
|
101
|
+
.filter(chainIsEvm)
|
|
102
|
+
.map((chainId) => {
|
|
103
|
+
const { nativeToken } = PUBLIC_NETWORKS[chainId];
|
|
104
|
+
return overrides[chainId] ?? nativeToken;
|
|
105
|
+
})
|
|
106
|
+
.filter((nativeToken) => nativeToken !== "ETH");
|
|
99
107
|
};
|
|
108
|
+
export const CUSTOM_GAS_TOKENS = resolveCustomGasTokens();
|
|
100
109
|
|
|
101
110
|
// Blocks where SpokePools were upgraded from v2 to v2.5. This is where the fillStatus mapping
|
|
102
111
|
// was introduced. This mapping should only be updated on subsequent upgrades where there are
|
|
@@ -108,6 +108,7 @@ function _getEthersGasPriceEstimate(
|
|
|
108
108
|
[CHAIN_IDs.ARBITRUM]: arbitrum.eip1559,
|
|
109
109
|
[CHAIN_IDs.BSC]: ethereum.legacy,
|
|
110
110
|
[CHAIN_IDs.MAINNET]: ethereum.eip1559,
|
|
111
|
+
[CHAIN_IDs.MONAD]: ethereum.eip1559,
|
|
111
112
|
[CHAIN_IDs.PLASMA]: ethereum.eip1559,
|
|
112
113
|
[CHAIN_IDs.POLYGON]: polygon.gasStation,
|
|
113
114
|
[CHAIN_IDs.SCROLL]: ethereum.legacy,
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { PriceFeedAdapter, TokenPrice } from "../priceClient";
|
|
2
2
|
import { BaseHTTPAdapter } from "./baseAdapter";
|
|
3
3
|
|
|
4
|
+
type DefaultPrice = { [currency: string]: { [address: string]: number } };
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Fallback price adapter to unconditionally return 0 on all input addresses.
|
|
6
8
|
* This adapter can be used as a last-resort to default to a token price of 0
|
|
7
9
|
* in case all other adapters fail to resolve a token price.
|
|
8
|
-
*
|
|
9
|
-
* Note: This adapter could be augmented to permit returning a custom price on a per-token bsis.
|
|
10
|
-
* This would allow the caller to peg token prices, which has been a use cases in the Across API.
|
|
11
|
-
* That's left as an open possibility for now.
|
|
12
10
|
*/
|
|
13
11
|
export class PriceFeed extends BaseHTTPAdapter implements PriceFeedAdapter {
|
|
14
|
-
constructor() {
|
|
12
|
+
constructor(private readonly prices: DefaultPrice = {}) {
|
|
15
13
|
super("Default Adapter", "127.0.0.1", {});
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
async getPriceByAddress(address: string, currency: string): Promise<TokenPrice> {
|
|
19
|
-
const price = await this.getPricesByAddress([address], currency);
|
|
20
|
-
return price
|
|
17
|
+
const [price] = await this.getPricesByAddress([address], currency);
|
|
18
|
+
return price;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
getPricesByAddress(addresses: string[],
|
|
24
|
-
return Promise.resolve(
|
|
21
|
+
getPricesByAddress(addresses: string[], currency: string): Promise<TokenPrice[]> {
|
|
22
|
+
return Promise.resolve(
|
|
23
|
+
addresses.map((address) => {
|
|
24
|
+
return {
|
|
25
|
+
address,
|
|
26
|
+
price: this.prices[currency]?.[address] ?? 0,
|
|
27
|
+
timestamp: 0,
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
);
|
|
25
31
|
}
|
|
26
32
|
}
|
|
@@ -164,7 +164,7 @@ export class PriceClient implements PriceFeedAdapter {
|
|
|
164
164
|
const skipped: { [token: string]: string } = {}; // Includes reason for skipping
|
|
165
165
|
const now = msToS(Date.now());
|
|
166
166
|
|
|
167
|
-
expected.forEach((address
|
|
167
|
+
expected.forEach((address) => {
|
|
168
168
|
const addr = address.toLowerCase(); // for internal priceCache lookup.
|
|
169
169
|
const tokenPrice: TokenPrice | undefined = prices.find((price) => price?.address?.toLowerCase() === addr);
|
|
170
170
|
|
|
@@ -4,7 +4,7 @@ import { getDeployedAddress } from "@across-protocol/contracts";
|
|
|
4
4
|
import { asL2Provider } from "@eth-optimism/sdk";
|
|
5
5
|
import { providers } from "ethers";
|
|
6
6
|
import { CUSTOM_GAS_TOKENS } from "../../constants";
|
|
7
|
-
import { chainIsOPStack, isDefined, chainIsSvm, SvmAddress } from "../../utils";
|
|
7
|
+
import { chainIsEvm, chainIsOPStack, isDefined, chainIsSvm, SvmAddress } from "../../utils";
|
|
8
8
|
import { QueryBase } from "./baseQuery";
|
|
9
9
|
import { SVMProvider as svmProvider } from "../../arch/svm";
|
|
10
10
|
import { DEFAULT_LOGGER, getDefaultRelayer, Logger } from "../relayFeeCalculator";
|
|
@@ -33,7 +33,7 @@ export class QueryBase__factory {
|
|
|
33
33
|
assert(isDefined(spokePoolAddress));
|
|
34
34
|
|
|
35
35
|
const customGasTokenSymbol = CUSTOM_GAS_TOKENS[chainId];
|
|
36
|
-
if (customGasTokenSymbol) {
|
|
36
|
+
if (chainIsEvm(chainId) && isDefined(customGasTokenSymbol)) {
|
|
37
37
|
assert(relayerAddress.isEVM());
|
|
38
38
|
return new CustomGasTokenQueries({
|
|
39
39
|
queryBaseArgs: [
|
package/src/typechain.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { AcrossMerkleDistributor__factory } from "@across-protocol/contracts/dis
|
|
|
10
10
|
export { AcrossConfigStore__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/AcrossConfigStore__factory";
|
|
11
11
|
export { HubPool__factory } from "@across-protocol/contracts/dist/typechain/factories/contracts/HubPool__factory";
|
|
12
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/token/ERC20/ERC20__factory";
|
|
13
|
+
export { ERC20__factory } from "@across-protocol/contracts/dist/typechain/factories/@openzeppelin/contracts-v4/token/ERC20/ERC20__factory";
|
|
14
14
|
|
|
15
15
|
export { AcceleratingDistributor__factory } from "@across-protocol/across-token/dist/typechain/factories/AcceleratingDistributor__factory";
|
|
16
16
|
export { ClaimAndStake__factory } from "@across-protocol/across-token/dist/typechain/factories/ClaimAndStake__factory";
|
package/src/utils/Multicall.ts
CHANGED
|
@@ -155,7 +155,7 @@ export function chainIsCCTPEnabled(chainId: number): boolean {
|
|
|
155
155
|
export function chainIsOFTEnabled(chainId: number): boolean {
|
|
156
156
|
// Add chainIds to oftEnabled as they are supported by the protocol.
|
|
157
157
|
// This is backwards vs. CCTP logic because Across support for OFTs is limited vs. OFT deployments.
|
|
158
|
-
const oftEnabled = [CHAIN_IDs.ARBITRUM, CHAIN_IDs.POLYGON, CHAIN_IDs.HYPEREVM, CHAIN_IDs.PLASMA];
|
|
158
|
+
const oftEnabled = [CHAIN_IDs.ARBITRUM, CHAIN_IDs.POLYGON, CHAIN_IDs.HYPEREVM, CHAIN_IDs.MONAD, CHAIN_IDs.PLASMA];
|
|
159
159
|
return oftEnabled.includes(chainId) && PRODUCTION_NETWORKS[chainId]?.oftEid !== OFT_NO_EID;
|
|
160
160
|
}
|
|
161
161
|
|