Skip to content

Commit 99c95f6

Browse files
committed
fix: onchain allocator cache
1 parent 6871736 commit 99c95f6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/utils/onchain-allocator.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ const extractEddsaSignature = (rawNearSignature: string): string => {
181181

182182
let _getSignerCache = new Map<string, string>();
183183
export const getSigner = async (chainId: string) => {
184-
const vmType = await getChain(chainId).then((c) => c.vmType);
185-
if (_getSignerCache.has(vmType)) {
186-
return _getSignerCache.get(vmType)!;
184+
if (_getSignerCache.has(chainId)) {
185+
return _getSignerCache.get(chainId)!;
187186
}
188187

188+
const vmType = await getChain(chainId).then((c) => c.id);
189+
189190
let domainId: number | undefined;
190191
switch (vmType) {
191192
case "ethereum-vm":
@@ -226,7 +227,7 @@ export const getSigner = async (chainId: string) => {
226227
case "ethereum-vm":
227228
case "hyperliquid-vm": {
228229
_getSignerCache.set(
229-
vmType,
230+
chainId,
230231
publicKeyToAddress(
231232
`0x04${Buffer.from(bs58.decode(publicKey)).toString("hex")}`
232233
).toLowerCase()
@@ -236,7 +237,7 @@ export const getSigner = async (chainId: string) => {
236237
}
237238

238239
case "solana-vm": {
239-
_getSignerCache.set(vmType, publicKey);
240+
_getSignerCache.set(chainId, publicKey);
240241

241242
break;
242243
}
@@ -246,7 +247,7 @@ export const getSigner = async (chainId: string) => {
246247
}
247248
}
248249

249-
return _getSignerCache.get(vmType)!;
250+
return _getSignerCache.get(chainId)!;
250251
};
251252

252253
export const getSignature = async (id: string) => {

0 commit comments

Comments
 (0)