@unicitylabs/sphere-sdk 0.1.4 → 0.1.6
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/README.md +90 -8
- package/dist/core/index.cjs +542 -175
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +32 -6
- package/dist/core/index.d.ts +32 -6
- package/dist/core/index.js +542 -175
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +141 -122
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +143 -122
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/browser/ipfs.cjs +28 -33
- package/dist/impl/browser/ipfs.cjs.map +1 -1
- package/dist/impl/browser/ipfs.js +28 -33
- package/dist/impl/browser/ipfs.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +160 -123
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +11 -2
- package/dist/impl/nodejs/index.d.ts +11 -2
- package/dist/impl/nodejs/index.js +160 -123
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/index.cjs +584 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +788 -218
- package/dist/index.d.ts +788 -218
- package/dist/index.js +575 -174
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -308,6 +308,8 @@ interface Token {
|
|
|
308
308
|
readonly coinId: string;
|
|
309
309
|
readonly symbol: string;
|
|
310
310
|
readonly name: string;
|
|
311
|
+
readonly decimals: number;
|
|
312
|
+
readonly iconUrl?: string;
|
|
311
313
|
readonly amount: string;
|
|
312
314
|
status: TokenStatus;
|
|
313
315
|
readonly createdAt: number;
|
|
@@ -1366,6 +1368,14 @@ declare class PaymentsModule {
|
|
|
1366
1368
|
* Get coin name from coinId
|
|
1367
1369
|
*/
|
|
1368
1370
|
private getCoinName;
|
|
1371
|
+
/**
|
|
1372
|
+
* Get coin decimals from coinId
|
|
1373
|
+
*/
|
|
1374
|
+
private getCoinDecimals;
|
|
1375
|
+
/**
|
|
1376
|
+
* Get coin icon URL from coinId
|
|
1377
|
+
*/
|
|
1378
|
+
private getCoinIconUrl;
|
|
1369
1379
|
/**
|
|
1370
1380
|
* Send a payment request to someone
|
|
1371
1381
|
* @param recipientPubkeyOrNametag - Recipient's pubkey or @nametag
|
|
@@ -1912,6 +1922,7 @@ declare class Sphere {
|
|
|
1912
1922
|
private _derivationMode;
|
|
1913
1923
|
private _basePath;
|
|
1914
1924
|
private _currentAddressIndex;
|
|
1925
|
+
/** Map of addressId -> (nametagIndex -> nametag). Supports multiple nametags per address (e.g., from Nostr recovery) */
|
|
1915
1926
|
private _addressNametags;
|
|
1916
1927
|
private _storage;
|
|
1917
1928
|
private _tokenStorageProviders;
|
|
@@ -1965,6 +1976,7 @@ declare class Sphere {
|
|
|
1965
1976
|
static import(options: SphereImportOptions): Promise<Sphere>;
|
|
1966
1977
|
/**
|
|
1967
1978
|
* Clear wallet data from storage
|
|
1979
|
+
* Note: Token data is cleared via TokenStorageProvider, not here
|
|
1968
1980
|
*/
|
|
1969
1981
|
static clear(storage: StorageProvider): Promise<void>;
|
|
1970
1982
|
/**
|
|
@@ -2183,18 +2195,29 @@ declare class Sphere {
|
|
|
2183
2195
|
*/
|
|
2184
2196
|
getCurrentAddressIndex(): number;
|
|
2185
2197
|
/**
|
|
2186
|
-
* Get nametag for a specific address
|
|
2198
|
+
* Get primary nametag for a specific address
|
|
2187
2199
|
*
|
|
2188
|
-
* @param
|
|
2189
|
-
* @returns
|
|
2200
|
+
* @param addressId - Address identifier (DIRECT://xxx), defaults to current address
|
|
2201
|
+
* @returns Primary nametag (index 0) or undefined if not registered
|
|
2190
2202
|
*/
|
|
2191
|
-
getNametagForAddress(
|
|
2203
|
+
getNametagForAddress(addressId?: string): string | undefined;
|
|
2204
|
+
/**
|
|
2205
|
+
* Get all nametags for a specific address
|
|
2206
|
+
*
|
|
2207
|
+
* @param addressId - Address identifier (DIRECT://xxx), defaults to current address
|
|
2208
|
+
* @returns Map of nametagIndex to nametag, or undefined if no nametags
|
|
2209
|
+
*/
|
|
2210
|
+
getNametagsForAddress(addressId?: string): Map<number, string> | undefined;
|
|
2192
2211
|
/**
|
|
2193
2212
|
* Get all registered address nametags
|
|
2194
2213
|
*
|
|
2195
|
-
* @returns Map of
|
|
2214
|
+
* @returns Map of addressId to (nametagIndex -> nametag)
|
|
2215
|
+
*/
|
|
2216
|
+
getAllAddressNametags(): Map<string, Map<number, string>>;
|
|
2217
|
+
/**
|
|
2218
|
+
* Get current address identifier (DIRECT://xxx format)
|
|
2196
2219
|
*/
|
|
2197
|
-
|
|
2220
|
+
private getCurrentAddressId;
|
|
2198
2221
|
/**
|
|
2199
2222
|
* Switch to a different address by index
|
|
2200
2223
|
* This changes the active identity to the derived address at the specified index.
|
|
@@ -2320,6 +2343,7 @@ declare class Sphere {
|
|
|
2320
2343
|
registerNametag(nametag: string): Promise<void>;
|
|
2321
2344
|
/**
|
|
2322
2345
|
* Persist address nametags to storage
|
|
2346
|
+
* Format: { "DIRECT://abc...xyz": { "0": "alice", "1": "alice2" }, ... }
|
|
2323
2347
|
*/
|
|
2324
2348
|
private persistAddressNametags;
|
|
2325
2349
|
/**
|
|
@@ -2349,6 +2373,8 @@ declare class Sphere {
|
|
|
2349
2373
|
isNametagAvailable(nametag: string): Promise<boolean>;
|
|
2350
2374
|
/**
|
|
2351
2375
|
* Load address nametags from storage
|
|
2376
|
+
* Supports new format: { "DIRECT://abc...xyz": { "0": "alice" } }
|
|
2377
|
+
* And legacy format: { "0": "alice" } (migrates to new format on save)
|
|
2352
2378
|
*/
|
|
2353
2379
|
private loadAddressNametags;
|
|
2354
2380
|
/**
|
package/dist/core/index.d.ts
CHANGED
|
@@ -308,6 +308,8 @@ interface Token {
|
|
|
308
308
|
readonly coinId: string;
|
|
309
309
|
readonly symbol: string;
|
|
310
310
|
readonly name: string;
|
|
311
|
+
readonly decimals: number;
|
|
312
|
+
readonly iconUrl?: string;
|
|
311
313
|
readonly amount: string;
|
|
312
314
|
status: TokenStatus;
|
|
313
315
|
readonly createdAt: number;
|
|
@@ -1366,6 +1368,14 @@ declare class PaymentsModule {
|
|
|
1366
1368
|
* Get coin name from coinId
|
|
1367
1369
|
*/
|
|
1368
1370
|
private getCoinName;
|
|
1371
|
+
/**
|
|
1372
|
+
* Get coin decimals from coinId
|
|
1373
|
+
*/
|
|
1374
|
+
private getCoinDecimals;
|
|
1375
|
+
/**
|
|
1376
|
+
* Get coin icon URL from coinId
|
|
1377
|
+
*/
|
|
1378
|
+
private getCoinIconUrl;
|
|
1369
1379
|
/**
|
|
1370
1380
|
* Send a payment request to someone
|
|
1371
1381
|
* @param recipientPubkeyOrNametag - Recipient's pubkey or @nametag
|
|
@@ -1912,6 +1922,7 @@ declare class Sphere {
|
|
|
1912
1922
|
private _derivationMode;
|
|
1913
1923
|
private _basePath;
|
|
1914
1924
|
private _currentAddressIndex;
|
|
1925
|
+
/** Map of addressId -> (nametagIndex -> nametag). Supports multiple nametags per address (e.g., from Nostr recovery) */
|
|
1915
1926
|
private _addressNametags;
|
|
1916
1927
|
private _storage;
|
|
1917
1928
|
private _tokenStorageProviders;
|
|
@@ -1965,6 +1976,7 @@ declare class Sphere {
|
|
|
1965
1976
|
static import(options: SphereImportOptions): Promise<Sphere>;
|
|
1966
1977
|
/**
|
|
1967
1978
|
* Clear wallet data from storage
|
|
1979
|
+
* Note: Token data is cleared via TokenStorageProvider, not here
|
|
1968
1980
|
*/
|
|
1969
1981
|
static clear(storage: StorageProvider): Promise<void>;
|
|
1970
1982
|
/**
|
|
@@ -2183,18 +2195,29 @@ declare class Sphere {
|
|
|
2183
2195
|
*/
|
|
2184
2196
|
getCurrentAddressIndex(): number;
|
|
2185
2197
|
/**
|
|
2186
|
-
* Get nametag for a specific address
|
|
2198
|
+
* Get primary nametag for a specific address
|
|
2187
2199
|
*
|
|
2188
|
-
* @param
|
|
2189
|
-
* @returns
|
|
2200
|
+
* @param addressId - Address identifier (DIRECT://xxx), defaults to current address
|
|
2201
|
+
* @returns Primary nametag (index 0) or undefined if not registered
|
|
2190
2202
|
*/
|
|
2191
|
-
getNametagForAddress(
|
|
2203
|
+
getNametagForAddress(addressId?: string): string | undefined;
|
|
2204
|
+
/**
|
|
2205
|
+
* Get all nametags for a specific address
|
|
2206
|
+
*
|
|
2207
|
+
* @param addressId - Address identifier (DIRECT://xxx), defaults to current address
|
|
2208
|
+
* @returns Map of nametagIndex to nametag, or undefined if no nametags
|
|
2209
|
+
*/
|
|
2210
|
+
getNametagsForAddress(addressId?: string): Map<number, string> | undefined;
|
|
2192
2211
|
/**
|
|
2193
2212
|
* Get all registered address nametags
|
|
2194
2213
|
*
|
|
2195
|
-
* @returns Map of
|
|
2214
|
+
* @returns Map of addressId to (nametagIndex -> nametag)
|
|
2215
|
+
*/
|
|
2216
|
+
getAllAddressNametags(): Map<string, Map<number, string>>;
|
|
2217
|
+
/**
|
|
2218
|
+
* Get current address identifier (DIRECT://xxx format)
|
|
2196
2219
|
*/
|
|
2197
|
-
|
|
2220
|
+
private getCurrentAddressId;
|
|
2198
2221
|
/**
|
|
2199
2222
|
* Switch to a different address by index
|
|
2200
2223
|
* This changes the active identity to the derived address at the specified index.
|
|
@@ -2320,6 +2343,7 @@ declare class Sphere {
|
|
|
2320
2343
|
registerNametag(nametag: string): Promise<void>;
|
|
2321
2344
|
/**
|
|
2322
2345
|
* Persist address nametags to storage
|
|
2346
|
+
* Format: { "DIRECT://abc...xyz": { "0": "alice", "1": "alice2" }, ... }
|
|
2323
2347
|
*/
|
|
2324
2348
|
private persistAddressNametags;
|
|
2325
2349
|
/**
|
|
@@ -2349,6 +2373,8 @@ declare class Sphere {
|
|
|
2349
2373
|
isNametagAvailable(nametag: string): Promise<boolean>;
|
|
2350
2374
|
/**
|
|
2351
2375
|
* Load address nametags from storage
|
|
2376
|
+
* Supports new format: { "DIRECT://abc...xyz": { "0": "alice" } }
|
|
2377
|
+
* And legacy format: { "0": "alice" } (migrates to new format on save)
|
|
2352
2378
|
*/
|
|
2353
2379
|
private loadAddressNametags;
|
|
2354
2380
|
/**
|