@across-protocol/sdk 4.1.35 → 4.1.37
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/HubPoolClient.js +18 -12
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +45 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +45 -0
- package/dist/cjs/utils/Multicall.js +2 -1
- package/dist/cjs/utils/Multicall.js.map +1 -1
- package/dist/cjs/utils/ObjectUtils.d.ts +1 -0
- package/dist/cjs/utils/ObjectUtils.js +14 -1
- package/dist/cjs/utils/ObjectUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +90 -0
- package/dist/esm/clients/HubPoolClient.js +24 -14
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +45 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +45 -0
- package/dist/esm/utils/Multicall.js +2 -1
- package/dist/esm/utils/Multicall.js.map +1 -1
- package/dist/esm/utils/ObjectUtils.d.ts +1 -0
- package/dist/esm/utils/ObjectUtils.js +13 -0
- package/dist/esm/utils/ObjectUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +90 -0
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +45 -0
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +45 -0
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/Multicall.d.ts.map +1 -1
- package/dist/types/utils/ObjectUtils.d.ts +1 -0
- package/dist/types/utils/ObjectUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +90 -0
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/clients/HubPoolClient.ts +28 -17
- package/src/utils/Multicall.ts +1 -0
- package/src/utils/ObjectUtils.ts +14 -0
|
@@ -168,6 +168,51 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
168
168
|
};
|
|
169
169
|
coingeckoId: string;
|
|
170
170
|
};
|
|
171
|
+
"TATARA-USDC": {
|
|
172
|
+
name: string;
|
|
173
|
+
symbol: string;
|
|
174
|
+
decimals: number;
|
|
175
|
+
addresses: {
|
|
176
|
+
[x: number]: string;
|
|
177
|
+
};
|
|
178
|
+
coingeckoId: string;
|
|
179
|
+
};
|
|
180
|
+
"TATARA-USDS": {
|
|
181
|
+
name: string;
|
|
182
|
+
symbol: string;
|
|
183
|
+
decimals: number;
|
|
184
|
+
addresses: {
|
|
185
|
+
[x: number]: string;
|
|
186
|
+
};
|
|
187
|
+
coingeckoId: string;
|
|
188
|
+
};
|
|
189
|
+
"TATARA-USDT": {
|
|
190
|
+
name: string;
|
|
191
|
+
symbol: string;
|
|
192
|
+
decimals: number;
|
|
193
|
+
addresses: {
|
|
194
|
+
[x: number]: string;
|
|
195
|
+
};
|
|
196
|
+
coingeckoId: string;
|
|
197
|
+
};
|
|
198
|
+
"TATARA-WBTC": {
|
|
199
|
+
name: string;
|
|
200
|
+
symbol: string;
|
|
201
|
+
decimals: number;
|
|
202
|
+
addresses: {
|
|
203
|
+
[x: number]: string;
|
|
204
|
+
};
|
|
205
|
+
coingeckoId: string;
|
|
206
|
+
};
|
|
207
|
+
"TATARA-WETH": {
|
|
208
|
+
name: string;
|
|
209
|
+
symbol: string;
|
|
210
|
+
decimals: number;
|
|
211
|
+
addresses: {
|
|
212
|
+
[x: number]: string;
|
|
213
|
+
};
|
|
214
|
+
coingeckoId: string;
|
|
215
|
+
};
|
|
171
216
|
UMA: {
|
|
172
217
|
name: string;
|
|
173
218
|
symbol: string;
|
|
@@ -452,6 +497,51 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
452
497
|
};
|
|
453
498
|
coingeckoId: string;
|
|
454
499
|
};
|
|
500
|
+
"TATARA-USDC": {
|
|
501
|
+
name: string;
|
|
502
|
+
symbol: string;
|
|
503
|
+
decimals: number;
|
|
504
|
+
addresses: {
|
|
505
|
+
[x: number]: string;
|
|
506
|
+
};
|
|
507
|
+
coingeckoId: string;
|
|
508
|
+
};
|
|
509
|
+
"TATARA-USDS": {
|
|
510
|
+
name: string;
|
|
511
|
+
symbol: string;
|
|
512
|
+
decimals: number;
|
|
513
|
+
addresses: {
|
|
514
|
+
[x: number]: string;
|
|
515
|
+
};
|
|
516
|
+
coingeckoId: string;
|
|
517
|
+
};
|
|
518
|
+
"TATARA-USDT": {
|
|
519
|
+
name: string;
|
|
520
|
+
symbol: string;
|
|
521
|
+
decimals: number;
|
|
522
|
+
addresses: {
|
|
523
|
+
[x: number]: string;
|
|
524
|
+
};
|
|
525
|
+
coingeckoId: string;
|
|
526
|
+
};
|
|
527
|
+
"TATARA-WBTC": {
|
|
528
|
+
name: string;
|
|
529
|
+
symbol: string;
|
|
530
|
+
decimals: number;
|
|
531
|
+
addresses: {
|
|
532
|
+
[x: number]: string;
|
|
533
|
+
};
|
|
534
|
+
coingeckoId: string;
|
|
535
|
+
};
|
|
536
|
+
"TATARA-WETH": {
|
|
537
|
+
name: string;
|
|
538
|
+
symbol: string;
|
|
539
|
+
decimals: number;
|
|
540
|
+
addresses: {
|
|
541
|
+
[x: number]: string;
|
|
542
|
+
};
|
|
543
|
+
coingeckoId: string;
|
|
544
|
+
};
|
|
455
545
|
UMA: {
|
|
456
546
|
name: string;
|
|
457
547
|
symbol: string;
|
|
@@ -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,EAAY,SAAS,EAAE,MAAM,EAAE,MAAM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C,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAc7E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOlF;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAa/E"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.37",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"files": [
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@across-protocol/across-token": "^1.0.0",
|
|
107
|
-
"@across-protocol/constants": "^3.1.
|
|
108
|
-
"@across-protocol/contracts": "^4.0.
|
|
107
|
+
"@across-protocol/constants": "^3.1.46",
|
|
108
|
+
"@across-protocol/contracts": "^4.0.5",
|
|
109
109
|
"@coral-xyz/anchor": "^0.30.1",
|
|
110
110
|
"@eth-optimism/sdk": "^3.3.1",
|
|
111
111
|
"@ethersproject/bignumber": "^5.7.0",
|
|
@@ -2,7 +2,7 @@ import assert from "assert";
|
|
|
2
2
|
import { Contract, EventFilter } from "ethers";
|
|
3
3
|
import _ from "lodash";
|
|
4
4
|
import winston from "winston";
|
|
5
|
-
import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL } from "../constants";
|
|
5
|
+
import { DEFAULT_CACHING_SAFE_LAG, DEFAULT_CACHING_TTL, ZERO_ADDRESS } from "../constants";
|
|
6
6
|
import {
|
|
7
7
|
CachingMechanismInterface,
|
|
8
8
|
CancelledRootBundle,
|
|
@@ -44,6 +44,8 @@ import {
|
|
|
44
44
|
getTokenInfo,
|
|
45
45
|
getUsdcSymbol,
|
|
46
46
|
getL1TokenInfo,
|
|
47
|
+
compareAddressesSimple,
|
|
48
|
+
deleteFromJson,
|
|
47
49
|
} from "../utils";
|
|
48
50
|
import { AcrossConfigStoreClient as ConfigStoreClient } from "./AcrossConfigStoreClient/AcrossConfigStoreClient";
|
|
49
51
|
import { BaseAbstractClient, isUpdateFailureReason, UpdateFailureReason } from "./BaseAbstractClient";
|
|
@@ -918,21 +920,30 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
918
920
|
if (eventsToQuery.includes("SetPoolRebalanceRoute")) {
|
|
919
921
|
for (const event of events["SetPoolRebalanceRoute"]) {
|
|
920
922
|
const args = spreadEventWithBlockNumber(event) as SetPoolRebalanceRoot;
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
[args.l1Token, args.destinationChainId],
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
923
|
+
// If the destination token is set to the zero address in an event, then this means Across should no longer
|
|
924
|
+
// rebalance to this chain.
|
|
925
|
+
if (args.destinationToken !== ZERO_ADDRESS) {
|
|
926
|
+
assign(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], args.destinationToken);
|
|
927
|
+
assign(
|
|
928
|
+
this.l1TokensToDestinationTokensWithBlock,
|
|
929
|
+
[args.l1Token, args.destinationChainId],
|
|
930
|
+
[
|
|
931
|
+
{
|
|
932
|
+
l1Token: args.l1Token,
|
|
933
|
+
l2Token: args.destinationToken,
|
|
934
|
+
blockNumber: args.blockNumber,
|
|
935
|
+
transactionIndex: args.transactionIndex,
|
|
936
|
+
logIndex: args.logIndex,
|
|
937
|
+
transactionHash: args.transactionHash,
|
|
938
|
+
},
|
|
939
|
+
]
|
|
940
|
+
);
|
|
941
|
+
} else {
|
|
942
|
+
// Clear out the mapping for the L1 token entirely. If there is an empty dict after removing the
|
|
943
|
+
// destination chain ID mapping, delete the dict.
|
|
944
|
+
deleteFromJson(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId]);
|
|
945
|
+
deleteFromJson(this.l1TokensToDestinationTokensWithBlock, [args.l1Token, args.destinationChainId]);
|
|
946
|
+
}
|
|
936
947
|
}
|
|
937
948
|
}
|
|
938
949
|
|
|
@@ -953,7 +964,7 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
953
964
|
),
|
|
954
965
|
]);
|
|
955
966
|
for (const info of tokenInfo) {
|
|
956
|
-
if (!this.l1Tokens.find((token) => token.
|
|
967
|
+
if (!this.l1Tokens.find((token) => compareAddressesSimple(token.address, info.address))) {
|
|
957
968
|
if (info.decimals > 0 && info.decimals <= 18) {
|
|
958
969
|
this.l1Tokens.push(info);
|
|
959
970
|
} else {
|
package/src/utils/Multicall.ts
CHANGED
package/src/utils/ObjectUtils.ts
CHANGED
|
@@ -31,6 +31,20 @@ export function assign(obj: any, keyPath: any[], value: any): void {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
// Trims `obj` by deleting `value` and all empty dictionaries produced from that deletion.
|
|
35
|
+
export function deleteFromJson(obj: Record<string | number, unknown>, keyPath: (string | number)[]): void {
|
|
36
|
+
const lastKeyIndex = keyPath.length - 1;
|
|
37
|
+
let _obj = obj; // Copy the pointer.
|
|
38
|
+
for (let i = 0; i < lastKeyIndex; ++i) {
|
|
39
|
+
const key = keyPath[i];
|
|
40
|
+
_obj = obj[key] as Record<string | number, unknown>;
|
|
41
|
+
}
|
|
42
|
+
delete _obj[keyPath[lastKeyIndex]];
|
|
43
|
+
if (lastKeyIndex !== 0 && Object.values(_obj).length === 0) {
|
|
44
|
+
deleteFromJson(obj, keyPath.slice(0, lastKeyIndex));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
// Refactor to be more generalized with N props
|
|
35
49
|
export function groupObjectCountsByThreeProps(
|
|
36
50
|
objects: any[],
|