@medialane/sdk 0.111.0 → 0.111.1

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/index.d.cts CHANGED
@@ -425,8 +425,8 @@ declare function shortenAddress(chain: Chain, address: string, chars?: number):
425
425
  type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
426
426
  declare function parseAmount(human: string, decimals: number): string;
427
427
  declare function formatAmount(raw: string, decimals: number): string;
428
- declare function getTokenByAddress(address: string): SupportedToken | undefined;
429
- declare function getTokenBySymbol(symbol: string): SupportedToken | undefined;
428
+ declare function getTokenByAddress(address: string | null | undefined): SupportedToken | undefined;
429
+ declare function getTokenBySymbol(symbol: string | null | undefined): SupportedToken | undefined;
430
430
  declare function getListableTokens(): ReadonlyArray<SupportedToken>;
431
431
 
432
432
  declare function stringifyBigInts(obj: unknown): unknown;
package/dist/index.d.ts CHANGED
@@ -425,8 +425,8 @@ declare function shortenAddress(chain: Chain, address: string, chars?: number):
425
425
  type SupportedToken = (typeof SUPPORTED_TOKENS)[number];
426
426
  declare function parseAmount(human: string, decimals: number): string;
427
427
  declare function formatAmount(raw: string, decimals: number): string;
428
- declare function getTokenByAddress(address: string): SupportedToken | undefined;
429
- declare function getTokenBySymbol(symbol: string): SupportedToken | undefined;
428
+ declare function getTokenByAddress(address: string | null | undefined): SupportedToken | undefined;
429
+ declare function getTokenBySymbol(symbol: string | null | undefined): SupportedToken | undefined;
430
430
  declare function getListableTokens(): ReadonlyArray<SupportedToken>;
431
431
 
432
432
  declare function stringifyBigInts(obj: unknown): unknown;
package/dist/index.js CHANGED
@@ -1245,6 +1245,7 @@ function formatAmount(raw, decimals) {
1245
1245
  return fractional ? `${whole}.${fractional}` : whole.toString();
1246
1246
  }
1247
1247
  function getTokenByAddress(address) {
1248
+ if (typeof address !== "string" || address.trim() === "") return void 0;
1248
1249
  let target = null;
1249
1250
  try {
1250
1251
  target = BigInt(address);
@@ -1262,6 +1263,7 @@ function getTokenByAddress(address) {
1262
1263
  });
1263
1264
  }
1264
1265
  function getTokenBySymbol(symbol) {
1266
+ if (typeof symbol !== "string") return void 0;
1265
1267
  const upper = symbol.toUpperCase();
1266
1268
  return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
1267
1269
  }