@unicitylabs/sphere-sdk 0.16.0-dev.2 → 0.17.0
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/connect/index.cjs +11 -5
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.cts +4 -1
- package/dist/connect/index.d.ts +4 -1
- package/dist/connect/index.js +11 -5
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +568 -172
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +67 -0
- package/dist/core/index.d.ts +67 -0
- package/dist/core/index.js +568 -172
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +11 -5
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.d.cts +3 -1
- package/dist/impl/browser/connect/index.d.ts +3 -1
- package/dist/impl/browser/connect/index.js +11 -5
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +2 -2
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +2 -2
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/connect/index.cjs +10 -4
- package/dist/impl/nodejs/connect/index.cjs.map +1 -1
- package/dist/impl/nodejs/connect/index.d.cts +1 -1
- package/dist/impl/nodejs/connect/index.d.ts +1 -1
- package/dist/impl/nodejs/connect/index.js +10 -4
- package/dist/impl/nodejs/connect/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs +19 -3
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +11 -0
- package/dist/impl/nodejs/index.d.ts +11 -0
- package/dist/impl/nodejs/index.js +19 -3
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/impl/shared/wallet-api/index.d.cts +11 -0
- package/dist/impl/shared/wallet-api/index.d.ts +11 -0
- package/dist/impl/wallet-api-v2/index.cjs +2 -0
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.d.cts +13 -0
- package/dist/impl/wallet-api-v2/index.d.ts +13 -0
- package/dist/impl/wallet-api-v2/index.js +2 -0
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +568 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -1
- package/dist/index.d.ts +61 -1
- package/dist/index.js +568 -172
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +609 -269
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +88 -13
- package/dist/modules/payments-v2/index.d.ts +88 -13
- package/dist/modules/payments-v2/index.js +609 -269
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs +132 -34
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.d.cts +19 -0
- package/dist/token-engine/index.d.ts +19 -0
- package/dist/token-engine/index.js +132 -34
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -89,6 +89,11 @@ interface SendRequest {
|
|
|
89
89
|
coinId: string;
|
|
90
90
|
memo?: string;
|
|
91
91
|
}
|
|
92
|
+
interface SendCoinlessRequest {
|
|
93
|
+
recipient: string;
|
|
94
|
+
tokenId: string;
|
|
95
|
+
memo?: string;
|
|
96
|
+
}
|
|
92
97
|
interface MintResult {
|
|
93
98
|
success: boolean;
|
|
94
99
|
tokenId?: string;
|
|
@@ -158,6 +163,8 @@ interface PendingTransfer {
|
|
|
158
163
|
recipient: string;
|
|
159
164
|
coinId: string;
|
|
160
165
|
amount: string;
|
|
166
|
+
/** Set instead of coinId/amount when the intent is a token-addressed spend. */
|
|
167
|
+
tokenId?: string;
|
|
161
168
|
legs: {
|
|
162
169
|
certified: number;
|
|
163
170
|
total: number;
|
|
@@ -173,11 +180,14 @@ interface PaymentsV2 {
|
|
|
173
180
|
tokens(filter?: {
|
|
174
181
|
coinId?: string;
|
|
175
182
|
}): Token[];
|
|
183
|
+
coinless(): CoinlessToken[];
|
|
184
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
176
185
|
history(page?: {
|
|
177
186
|
before?: string;
|
|
178
187
|
limit?: number;
|
|
179
188
|
}): Promise<HistoryPage>;
|
|
180
189
|
send(req: SendRequest): Promise<TransferResult>;
|
|
190
|
+
sendCoinless(req: SendCoinlessRequest): Promise<TransferResult>;
|
|
181
191
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
182
192
|
receive(): Promise<{
|
|
183
193
|
transfers: IncomingTransfer[];
|
|
@@ -526,6 +536,31 @@ interface Token {
|
|
|
526
536
|
*/
|
|
527
537
|
suspectedSpent?: boolean;
|
|
528
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
541
|
+
* `Token`: no amount, decimals or symbol, and never returned by `tokens()` or
|
|
542
|
+
* counted in `assets()`. `tokenType` names the token's CLASS and `tokenId` the
|
|
543
|
+
* instance (wallet-api#147). The payload is read with `payments.tokenData()`.
|
|
544
|
+
*/
|
|
545
|
+
interface CoinlessToken {
|
|
546
|
+
readonly tokenId: string;
|
|
547
|
+
readonly tokenType?: string;
|
|
548
|
+
/**
|
|
549
|
+
* Class metadata resolved from the registry THIS wallet owns, when the type is
|
|
550
|
+
* recognised. Resolved here so callers never reach for a registry themselves:
|
|
551
|
+
* the process-global singleton is repointable by another Sphere's init, so a
|
|
552
|
+
* second wallet on another network would retarget it (#767).
|
|
553
|
+
*/
|
|
554
|
+
readonly name?: string;
|
|
555
|
+
readonly iconUrl?: string;
|
|
556
|
+
readonly stateHash: string;
|
|
557
|
+
/** #737: reserved by a converging transfer — not spendable right now. */
|
|
558
|
+
readonly transferring: boolean;
|
|
559
|
+
/** #625: proven spent on-chain; excluded from spend selection. */
|
|
560
|
+
readonly suspectedSpent?: boolean;
|
|
561
|
+
readonly createdAt: number;
|
|
562
|
+
readonly updatedAt: number;
|
|
563
|
+
}
|
|
529
564
|
interface Asset {
|
|
530
565
|
readonly coinId: string;
|
|
531
566
|
readonly symbol: string;
|
|
@@ -596,6 +631,8 @@ interface IncomingTransfer {
|
|
|
596
631
|
readonly senderPubkey: string;
|
|
597
632
|
readonly senderNametag?: string;
|
|
598
633
|
readonly tokens: Token[];
|
|
634
|
+
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
635
|
+
readonly coinless?: CoinlessToken[];
|
|
599
636
|
readonly memo?: string;
|
|
600
637
|
readonly receivedAt: number;
|
|
601
638
|
}
|
|
@@ -2292,6 +2329,9 @@ interface DerivedAddressInfo {
|
|
|
2292
2329
|
*/
|
|
2293
2330
|
declare function discoverAddressesImpl(deriveTransportPubkey: (index: number) => DerivedAddressInfo, batchResolve: (transportPubkeys: string[]) => Promise<PeerInfo[]>, options?: DiscoverAddressesOptions): Promise<DiscoverAddressesResult>;
|
|
2294
2331
|
|
|
2332
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
2333
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
2334
|
+
|
|
2295
2335
|
/**
|
|
2296
2336
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
2297
2337
|
*
|
|
@@ -2352,6 +2392,22 @@ interface SphereToken {
|
|
|
2352
2392
|
readonly blob: TokenBlob;
|
|
2353
2393
|
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
2354
2394
|
readonly value: SphereValue | null;
|
|
2395
|
+
/**
|
|
2396
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
2397
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
2398
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
2399
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
2400
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
2401
|
+
* envelope never reaches this field: it throws during classification.
|
|
2402
|
+
*/
|
|
2403
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
2404
|
+
/**
|
|
2405
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
2406
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
2407
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
2408
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
2409
|
+
*/
|
|
2410
|
+
readonly tokenType: string;
|
|
2355
2411
|
}
|
|
2356
2412
|
interface MintParams {
|
|
2357
2413
|
/** Recipient's 33-byte compressed chain pubkey; engine derives the predicate. */
|
|
@@ -2767,7 +2823,18 @@ interface InventoryItemWire {
|
|
|
2767
2823
|
status: 'active' | 'removed';
|
|
2768
2824
|
seq: number;
|
|
2769
2825
|
stateHash: string;
|
|
2826
|
+
/**
|
|
2827
|
+
* Omitted for a tombstone AND for an ACTIVE COINLESS token (wallet-api#140),
|
|
2828
|
+
* so absence is never "removed" or "not loaded" — discriminate on `status`.
|
|
2829
|
+
*/
|
|
2770
2830
|
assets?: AssetWire[];
|
|
2831
|
+
/**
|
|
2832
|
+
* Genesis `TokenType`, lowercase hex (1-64 bytes ⇒ 2-128 chars). Names the
|
|
2833
|
+
* token's CLASS, not the instance (wallet-api#147). Absent on rows written
|
|
2834
|
+
* before wallet-api migration 0015. An unrecognised type is legitimate: never
|
|
2835
|
+
* reject or hide a token for it.
|
|
2836
|
+
*/
|
|
2837
|
+
tokenType?: string;
|
|
2771
2838
|
}
|
|
2772
2839
|
interface InventoryPageWire {
|
|
2773
2840
|
cursor: number;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -89,6 +89,11 @@ interface SendRequest {
|
|
|
89
89
|
coinId: string;
|
|
90
90
|
memo?: string;
|
|
91
91
|
}
|
|
92
|
+
interface SendCoinlessRequest {
|
|
93
|
+
recipient: string;
|
|
94
|
+
tokenId: string;
|
|
95
|
+
memo?: string;
|
|
96
|
+
}
|
|
92
97
|
interface MintResult {
|
|
93
98
|
success: boolean;
|
|
94
99
|
tokenId?: string;
|
|
@@ -158,6 +163,8 @@ interface PendingTransfer {
|
|
|
158
163
|
recipient: string;
|
|
159
164
|
coinId: string;
|
|
160
165
|
amount: string;
|
|
166
|
+
/** Set instead of coinId/amount when the intent is a token-addressed spend. */
|
|
167
|
+
tokenId?: string;
|
|
161
168
|
legs: {
|
|
162
169
|
certified: number;
|
|
163
170
|
total: number;
|
|
@@ -173,11 +180,14 @@ interface PaymentsV2 {
|
|
|
173
180
|
tokens(filter?: {
|
|
174
181
|
coinId?: string;
|
|
175
182
|
}): Token[];
|
|
183
|
+
coinless(): CoinlessToken[];
|
|
184
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
176
185
|
history(page?: {
|
|
177
186
|
before?: string;
|
|
178
187
|
limit?: number;
|
|
179
188
|
}): Promise<HistoryPage>;
|
|
180
189
|
send(req: SendRequest): Promise<TransferResult>;
|
|
190
|
+
sendCoinless(req: SendCoinlessRequest): Promise<TransferResult>;
|
|
181
191
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
182
192
|
receive(): Promise<{
|
|
183
193
|
transfers: IncomingTransfer[];
|
|
@@ -526,6 +536,31 @@ interface Token {
|
|
|
526
536
|
*/
|
|
527
537
|
suspectedSpent?: boolean;
|
|
528
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
541
|
+
* `Token`: no amount, decimals or symbol, and never returned by `tokens()` or
|
|
542
|
+
* counted in `assets()`. `tokenType` names the token's CLASS and `tokenId` the
|
|
543
|
+
* instance (wallet-api#147). The payload is read with `payments.tokenData()`.
|
|
544
|
+
*/
|
|
545
|
+
interface CoinlessToken {
|
|
546
|
+
readonly tokenId: string;
|
|
547
|
+
readonly tokenType?: string;
|
|
548
|
+
/**
|
|
549
|
+
* Class metadata resolved from the registry THIS wallet owns, when the type is
|
|
550
|
+
* recognised. Resolved here so callers never reach for a registry themselves:
|
|
551
|
+
* the process-global singleton is repointable by another Sphere's init, so a
|
|
552
|
+
* second wallet on another network would retarget it (#767).
|
|
553
|
+
*/
|
|
554
|
+
readonly name?: string;
|
|
555
|
+
readonly iconUrl?: string;
|
|
556
|
+
readonly stateHash: string;
|
|
557
|
+
/** #737: reserved by a converging transfer — not spendable right now. */
|
|
558
|
+
readonly transferring: boolean;
|
|
559
|
+
/** #625: proven spent on-chain; excluded from spend selection. */
|
|
560
|
+
readonly suspectedSpent?: boolean;
|
|
561
|
+
readonly createdAt: number;
|
|
562
|
+
readonly updatedAt: number;
|
|
563
|
+
}
|
|
529
564
|
interface Asset {
|
|
530
565
|
readonly coinId: string;
|
|
531
566
|
readonly symbol: string;
|
|
@@ -596,6 +631,8 @@ interface IncomingTransfer {
|
|
|
596
631
|
readonly senderPubkey: string;
|
|
597
632
|
readonly senderNametag?: string;
|
|
598
633
|
readonly tokens: Token[];
|
|
634
|
+
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
635
|
+
readonly coinless?: CoinlessToken[];
|
|
599
636
|
readonly memo?: string;
|
|
600
637
|
readonly receivedAt: number;
|
|
601
638
|
}
|
|
@@ -2292,6 +2329,9 @@ interface DerivedAddressInfo {
|
|
|
2292
2329
|
*/
|
|
2293
2330
|
declare function discoverAddressesImpl(deriveTransportPubkey: (index: number) => DerivedAddressInfo, batchResolve: (transportPubkeys: string[]) => Promise<PeerInfo[]>, options?: DiscoverAddressesOptions): Promise<DiscoverAddressesResult>;
|
|
2294
2331
|
|
|
2332
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
2333
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
2334
|
+
|
|
2295
2335
|
/**
|
|
2296
2336
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
2297
2337
|
*
|
|
@@ -2352,6 +2392,22 @@ interface SphereToken {
|
|
|
2352
2392
|
readonly blob: TokenBlob;
|
|
2353
2393
|
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
2354
2394
|
readonly value: SphereValue | null;
|
|
2395
|
+
/**
|
|
2396
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
2397
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
2398
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
2399
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
2400
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
2401
|
+
* envelope never reaches this field: it throws during classification.
|
|
2402
|
+
*/
|
|
2403
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
2404
|
+
/**
|
|
2405
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
2406
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
2407
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
2408
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
2409
|
+
*/
|
|
2410
|
+
readonly tokenType: string;
|
|
2355
2411
|
}
|
|
2356
2412
|
interface MintParams {
|
|
2357
2413
|
/** Recipient's 33-byte compressed chain pubkey; engine derives the predicate. */
|
|
@@ -2767,7 +2823,18 @@ interface InventoryItemWire {
|
|
|
2767
2823
|
status: 'active' | 'removed';
|
|
2768
2824
|
seq: number;
|
|
2769
2825
|
stateHash: string;
|
|
2826
|
+
/**
|
|
2827
|
+
* Omitted for a tombstone AND for an ACTIVE COINLESS token (wallet-api#140),
|
|
2828
|
+
* so absence is never "removed" or "not loaded" — discriminate on `status`.
|
|
2829
|
+
*/
|
|
2770
2830
|
assets?: AssetWire[];
|
|
2831
|
+
/**
|
|
2832
|
+
* Genesis `TokenType`, lowercase hex (1-64 bytes ⇒ 2-128 chars). Names the
|
|
2833
|
+
* token's CLASS, not the instance (wallet-api#147). Absent on rows written
|
|
2834
|
+
* before wallet-api migration 0015. An unrecognised type is legitimate: never
|
|
2835
|
+
* reject or hide a token for it.
|
|
2836
|
+
*/
|
|
2837
|
+
tokenType?: string;
|
|
2771
2838
|
}
|
|
2772
2839
|
interface InventoryPageWire {
|
|
2773
2840
|
cursor: number;
|