@1sat/wallet-toolbox 0.0.32 → 0.0.34
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.
|
@@ -2,12 +2,21 @@ import { BaseClient } from "./BaseClient";
|
|
|
2
2
|
import type { ClientOptions } from "../types";
|
|
3
3
|
/** Topic manager metadata returned by listTopicManagers */
|
|
4
4
|
export interface TopicManagerInfo {
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: string;
|
|
5
8
|
[key: string]: unknown;
|
|
6
9
|
}
|
|
7
10
|
/** Lookup service provider metadata returned by listLookupServiceProviders */
|
|
8
11
|
export interface LookupServiceInfo {
|
|
9
12
|
[key: string]: unknown;
|
|
10
13
|
}
|
|
14
|
+
/** BSV-21 token info extracted from topic managers */
|
|
15
|
+
export interface Bsv21TokenInfo {
|
|
16
|
+
tokenId: string;
|
|
17
|
+
symbol?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
}
|
|
11
20
|
/**
|
|
12
21
|
* Client for overlay service routes.
|
|
13
22
|
* Handles topic manager queries and overlay lookups.
|
|
@@ -28,4 +37,9 @@ export declare class OverlayClient extends BaseClient {
|
|
|
28
37
|
* Extracts tokenIds from topics matching the `tm_{tokenId}` pattern.
|
|
29
38
|
*/
|
|
30
39
|
getActiveBsv21TokenIds(): Promise<string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Get active BSV-21 tokens with metadata from topic managers.
|
|
42
|
+
* Returns tokenId, symbol (from name), and icon for each active token.
|
|
43
|
+
*/
|
|
44
|
+
getActiveBsv21Tokens(): Promise<Bsv21TokenInfo[]>;
|
|
31
45
|
}
|
|
@@ -12,13 +12,13 @@ export class OverlayClient extends BaseClient {
|
|
|
12
12
|
* BSV-21 tokens have topic managers named `tm_{tokenId}`.
|
|
13
13
|
*/
|
|
14
14
|
async listTopicManagers() {
|
|
15
|
-
return this.request("/overlay/listTopicManagers");
|
|
15
|
+
return this.request("/1sat/overlay/listTopicManagers");
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* List all registered lookup service providers.
|
|
19
19
|
*/
|
|
20
20
|
async listLookupServiceProviders() {
|
|
21
|
-
return this.request("/overlay/listLookupServiceProviders");
|
|
21
|
+
return this.request("/1sat/overlay/listLookupServiceProviders");
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Get list of active BSV-21 token IDs from topic managers.
|
|
@@ -34,4 +34,22 @@ export class OverlayClient extends BaseClient {
|
|
|
34
34
|
}
|
|
35
35
|
return tokenIds;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Get active BSV-21 tokens with metadata from topic managers.
|
|
39
|
+
* Returns tokenId, symbol (from name), and icon for each active token.
|
|
40
|
+
*/
|
|
41
|
+
async getActiveBsv21Tokens() {
|
|
42
|
+
const topicManagers = await this.listTopicManagers();
|
|
43
|
+
const tokens = [];
|
|
44
|
+
for (const [topic, info] of Object.entries(topicManagers)) {
|
|
45
|
+
if (topic.startsWith("tm_")) {
|
|
46
|
+
tokens.push({
|
|
47
|
+
tokenId: topic.slice(3),
|
|
48
|
+
symbol: info.name,
|
|
49
|
+
icon: info.icon,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return tokens;
|
|
54
|
+
}
|
|
37
55
|
}
|