@unicitylabs/uniclaw 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/assets.ts +10 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unicitylabs/uniclaw",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Unicity wallet identity and encrypted DMs for OpenClaw agents — powered by Sphere SDK",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/assets.ts CHANGED
@@ -50,9 +50,10 @@ function loadRegistry(): AssetRegistry {
50
50
  const name = entry.name;
51
51
  const symbol = entry.symbol;
52
52
 
53
- // Map both name and symbol (lowercase) to the faucet coin name
53
+ // Map name, symbol (lowercase), and coin id to the faucet coin name
54
54
  aliases.set(name.toLowerCase(), name);
55
55
  aliases.set(symbol.toLowerCase(), name);
56
+ aliases.set(entry.id, name);
56
57
 
57
58
  // Store display symbol and decimals
58
59
  symbols.set(name, symbol);
@@ -73,16 +74,18 @@ export function resolveCoinId(input: string): string | null {
73
74
  return registry.aliases.get(input.toLowerCase().trim()) ?? null;
74
75
  }
75
76
 
76
- /** Get display symbol for a faucet coin name */
77
- export function getCoinSymbol(coinName: string): string {
77
+ /** Get display symbol for a coin (accepts name, symbol, or coin id) */
78
+ export function getCoinSymbol(coin: string): string {
78
79
  const registry = loadRegistry();
79
- return registry.symbols.get(coinName) ?? coinName.toUpperCase();
80
+ const name = registry.aliases.get(coin) ?? registry.aliases.get(coin.toLowerCase()) ?? coin;
81
+ return registry.symbols.get(name) ?? coin.toUpperCase();
80
82
  }
81
83
 
82
- /** Get decimals for a faucet coin name */
83
- export function getCoinDecimals(coinName: string): number | undefined {
84
+ /** Get decimals for a coin (accepts name, symbol, or coin id) */
85
+ export function getCoinDecimals(coin: string): number | undefined {
84
86
  const registry = loadRegistry();
85
- return registry.decimals.get(coinName);
87
+ const name = registry.aliases.get(coin) ?? registry.aliases.get(coin.toLowerCase());
88
+ return name ? registry.decimals.get(name) : registry.decimals.get(coin);
86
89
  }
87
90
 
88
91
  /** Get list of all available symbols for display */