File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,19 @@ export class AlexSDK {
55
55
return this . getTokenInfos ( ) ;
56
56
}
57
57
58
+ /**
59
+ * Fetch the token info for a given token address.
60
+ * @param tokenAddress - The address of the token to fetch info for. e.g SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex
61
+ * @returns A promise that resolves to a `TokenInfo` object or `null` if the token is not found.
62
+ */
63
+ async fetchTokenInfo ( tokenAddress : string ) : Promise < TokenInfo | null > {
64
+ return (
65
+ ( await this . getTokenInfos ( ) ) . find (
66
+ ( x ) => x . underlyingToken . split ( '::' ) [ 0 ] === tokenAddress . split ( '::' ) [ 0 ]
67
+ ) ?? null
68
+ ) ;
69
+ }
70
+
58
71
private async getPrices ( ) : Promise < PriceData [ ] > {
59
72
return getPrices ( await this . getTokenInfos ( ) ) ;
60
73
}
You can’t perform that action at this time.
0 commit comments