Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/agent-sdk/src/evm/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isAddress } from "viem";
import { getTokenInfo } from "./erc20";
import { type TokenInfo } from "./types";

type SymbolMapping = Record<string, TokenInfo>;
type SymbolMapping = Record<string, TokenInfo | undefined>;
type ChainId = number;
export type BlockchainMapping = Record<ChainId, SymbolMapping>;

Expand Down Expand Up @@ -36,7 +36,7 @@ export async function getTokenDetails(
chainId: number,
symbolOrAddress: string,
tokenMap?: BlockchainMapping,
): Promise<TokenInfo> {
): Promise<TokenInfo | undefined> {
if (isAddress(symbolOrAddress, { strict: false })) {
return getTokenInfo(chainId, symbolOrAddress);
}
Expand Down
5 changes: 5 additions & 0 deletions packages/agent-sdk/tests/evm/token.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ describe("getTokenDetails", () => {
);
expect(tokenDetails).toBeDefined();
});

it("should return the token details for a given symbol", async () => {
const tokenDetails = await getTokenDetails(43114, "UNI");
expect(tokenDetails).toBeUndefined();
});
});
Loading