otomato-sdk 2.0.459 → 2.0.461
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/src/constants/Blocks.js +179 -17
- package/dist/src/constants/version.js +1 -1
- package/dist/src/utils/helpers.js +14 -1
- package/dist/types/src/constants/Blocks.d.ts +56 -0
- package/dist/types/src/constants/version.d.ts +1 -1
- package/dist/types/src/utils/helpers.d.ts +1 -0
- package/package.json +1 -1
|
@@ -525,14 +525,27 @@ export async function getTokenInfo(tokenAddress, provider) {
|
|
|
525
525
|
throw new Error(`Failed to fetch token info for ${tokenAddress}: ${error.message}`);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
+
/**
|
|
529
|
+
* In-memory cache for token info. Token symbol, decimals, and name are
|
|
530
|
+
* immutable on-chain, so we cache indefinitely within the process lifetime.
|
|
531
|
+
*/
|
|
532
|
+
const tokenInfoCache = new Map();
|
|
528
533
|
/**
|
|
529
534
|
* Fetches token info with fallback values if contract call fails.
|
|
535
|
+
* Results are cached in-memory to avoid redundant RPC calls for immutable data.
|
|
530
536
|
*/
|
|
531
537
|
export async function getTokenInfoWithFallback(tokenAddress, provider) {
|
|
538
|
+
const cacheKey = tokenAddress.toLowerCase();
|
|
539
|
+
const cached = tokenInfoCache.get(cacheKey);
|
|
540
|
+
if (cached)
|
|
541
|
+
return cached;
|
|
532
542
|
try {
|
|
533
|
-
|
|
543
|
+
const info = await getTokenInfo(tokenAddress, provider);
|
|
544
|
+
tokenInfoCache.set(cacheKey, info);
|
|
545
|
+
return info;
|
|
534
546
|
}
|
|
535
547
|
catch (error) {
|
|
548
|
+
// Don't cache fallback values — next call might succeed with a working provider
|
|
536
549
|
const truncatedAddress = `${tokenAddress.slice(0, 6)}...${tokenAddress.slice(-4)}`;
|
|
537
550
|
return {
|
|
538
551
|
symbol: truncatedAddress,
|
|
@@ -1018,6 +1018,62 @@ export declare const TRIGGERS: {
|
|
|
1018
1018
|
blockId: number;
|
|
1019
1019
|
image: string;
|
|
1020
1020
|
};
|
|
1021
|
+
V3_SUPPLY_CAP_CHANGE: {
|
|
1022
|
+
name: string;
|
|
1023
|
+
dynamicName: string;
|
|
1024
|
+
description: string;
|
|
1025
|
+
type: number;
|
|
1026
|
+
prototype: string;
|
|
1027
|
+
method: string;
|
|
1028
|
+
parameters: Parameter[];
|
|
1029
|
+
output: {
|
|
1030
|
+
previousCap: string;
|
|
1031
|
+
newCap: string;
|
|
1032
|
+
direction: string;
|
|
1033
|
+
timestamp: string;
|
|
1034
|
+
};
|
|
1035
|
+
examples: {
|
|
1036
|
+
name: string;
|
|
1037
|
+
description: string;
|
|
1038
|
+
parameters: ({
|
|
1039
|
+
key: string;
|
|
1040
|
+
value: number;
|
|
1041
|
+
} | {
|
|
1042
|
+
key: string;
|
|
1043
|
+
value: string;
|
|
1044
|
+
})[];
|
|
1045
|
+
}[];
|
|
1046
|
+
blockId: number;
|
|
1047
|
+
image: string;
|
|
1048
|
+
};
|
|
1049
|
+
V3_BORROW_CAP_CHANGE: {
|
|
1050
|
+
name: string;
|
|
1051
|
+
dynamicName: string;
|
|
1052
|
+
description: string;
|
|
1053
|
+
type: number;
|
|
1054
|
+
prototype: string;
|
|
1055
|
+
method: string;
|
|
1056
|
+
parameters: Parameter[];
|
|
1057
|
+
output: {
|
|
1058
|
+
previousCap: string;
|
|
1059
|
+
newCap: string;
|
|
1060
|
+
direction: string;
|
|
1061
|
+
timestamp: string;
|
|
1062
|
+
};
|
|
1063
|
+
examples: {
|
|
1064
|
+
name: string;
|
|
1065
|
+
description: string;
|
|
1066
|
+
parameters: ({
|
|
1067
|
+
key: string;
|
|
1068
|
+
value: number;
|
|
1069
|
+
} | {
|
|
1070
|
+
key: string;
|
|
1071
|
+
value: string;
|
|
1072
|
+
})[];
|
|
1073
|
+
}[];
|
|
1074
|
+
blockId: number;
|
|
1075
|
+
image: string;
|
|
1076
|
+
};
|
|
1021
1077
|
};
|
|
1022
1078
|
MOONWELL: {
|
|
1023
1079
|
description: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.461";
|
|
2
2
|
export declare function compareVersions(v1: string, v2: string): number;
|
|
@@ -144,6 +144,7 @@ export interface TokenInfo {
|
|
|
144
144
|
export declare function getTokenInfo(tokenAddress: string, provider: ethers.Provider): Promise<TokenInfo>;
|
|
145
145
|
/**
|
|
146
146
|
* Fetches token info with fallback values if contract call fails.
|
|
147
|
+
* Results are cached in-memory to avoid redundant RPC calls for immutable data.
|
|
147
148
|
*/
|
|
148
149
|
export declare function getTokenInfoWithFallback(tokenAddress: string, provider: ethers.Provider): Promise<TokenInfo>;
|
|
149
150
|
/**
|