@unicitylabs/sphere-sdk 0.16.0 → 0.17.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/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 +692 -268
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +69 -0
- package/dist/core/index.d.ts +69 -0
- package/dist/core/index.js +692 -268
- 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/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.d.cts +11 -0
- package/dist/impl/nodejs/index.d.ts +11 -0
- 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 +692 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +692 -268
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +767 -398
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +91 -14
- package/dist/modules/payments-v2/index.d.ts +91 -14
- package/dist/modules/payments-v2/index.js +767 -398
- 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
|
@@ -56,6 +56,31 @@ interface Token {
|
|
|
56
56
|
*/
|
|
57
57
|
suspectedSpent?: boolean;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
61
|
+
* `Token`: no amount, decimals or symbol, and never returned by `tokens()` or
|
|
62
|
+
* counted in `assets()`. `tokenType` names the token's CLASS and `tokenId` the
|
|
63
|
+
* instance (wallet-api#147). The payload is read with `payments.tokenData()`.
|
|
64
|
+
*/
|
|
65
|
+
interface CoinlessToken {
|
|
66
|
+
readonly tokenId: string;
|
|
67
|
+
readonly tokenType?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Class metadata resolved from the registry THIS wallet owns, when the type is
|
|
70
|
+
* recognised. Resolved here so callers never reach for a registry themselves:
|
|
71
|
+
* the process-global singleton is repointable by another Sphere's init, so a
|
|
72
|
+
* second wallet on another network would retarget it (#767).
|
|
73
|
+
*/
|
|
74
|
+
readonly name?: string;
|
|
75
|
+
readonly iconUrl?: string;
|
|
76
|
+
readonly stateHash: string;
|
|
77
|
+
/** #737: reserved by a converging transfer — not spendable right now. */
|
|
78
|
+
readonly transferring: boolean;
|
|
79
|
+
/** #625: proven spent on-chain; excluded from spend selection. */
|
|
80
|
+
readonly suspectedSpent?: boolean;
|
|
81
|
+
readonly createdAt: number;
|
|
82
|
+
readonly updatedAt: number;
|
|
83
|
+
}
|
|
59
84
|
interface Asset {
|
|
60
85
|
readonly coinId: string;
|
|
61
86
|
readonly symbol: string;
|
|
@@ -126,6 +151,8 @@ interface IncomingTransfer {
|
|
|
126
151
|
readonly senderPubkey: string;
|
|
127
152
|
readonly senderNametag?: string;
|
|
128
153
|
readonly tokens: Token[];
|
|
154
|
+
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
155
|
+
readonly coinless?: CoinlessToken[];
|
|
129
156
|
readonly memo?: string;
|
|
130
157
|
readonly receivedAt: number;
|
|
131
158
|
}
|
|
@@ -150,6 +177,13 @@ interface SendRequest {
|
|
|
150
177
|
coinId: string;
|
|
151
178
|
memo?: string;
|
|
152
179
|
}
|
|
180
|
+
/** 0.17.0's name for {@link SendWholeTokenRequest}. Kept so published imports compile. */
|
|
181
|
+
type SendCoinlessRequest = SendWholeTokenRequest;
|
|
182
|
+
interface SendWholeTokenRequest {
|
|
183
|
+
recipient: string;
|
|
184
|
+
tokenId: string;
|
|
185
|
+
memo?: string;
|
|
186
|
+
}
|
|
153
187
|
interface MintResult {
|
|
154
188
|
success: boolean;
|
|
155
189
|
tokenId?: string;
|
|
@@ -219,6 +253,8 @@ interface PendingTransfer {
|
|
|
219
253
|
recipient: string;
|
|
220
254
|
coinId: string;
|
|
221
255
|
amount: string;
|
|
256
|
+
/** Set instead of coinId/amount when the intent is a token-addressed spend. */
|
|
257
|
+
tokenId?: string;
|
|
222
258
|
legs: {
|
|
223
259
|
certified: number;
|
|
224
260
|
total: number;
|
|
@@ -234,11 +270,16 @@ interface PaymentsV2 {
|
|
|
234
270
|
tokens(filter?: {
|
|
235
271
|
coinId?: string;
|
|
236
272
|
}): Token[];
|
|
273
|
+
coinless(): CoinlessToken[];
|
|
274
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
237
275
|
history(page?: {
|
|
238
276
|
before?: string;
|
|
239
277
|
limit?: number;
|
|
240
278
|
}): Promise<HistoryPage>;
|
|
241
279
|
send(req: SendRequest): Promise<TransferResult>;
|
|
280
|
+
sendWholeToken(req: SendWholeTokenRequest): Promise<TransferResult>;
|
|
281
|
+
/** NFT-scoped twin: refuses a valued source. Connect's `send_nft` routes here. */
|
|
282
|
+
sendCoinless(req: SendWholeTokenRequest): Promise<TransferResult>;
|
|
242
283
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
243
284
|
receive(): Promise<{
|
|
244
285
|
transfers: IncomingTransfer[];
|
|
@@ -278,7 +319,9 @@ interface InventoryItem {
|
|
|
278
319
|
status: 'active' | 'removed';
|
|
279
320
|
seq: number;
|
|
280
321
|
stateHash: string;
|
|
322
|
+
/** Absent for a tombstone AND for an active COINLESS token — read `status`, not this. */
|
|
281
323
|
assets?: InventoryAsset[];
|
|
324
|
+
tokenType?: string;
|
|
282
325
|
}
|
|
283
326
|
interface InventoryPage {
|
|
284
327
|
cursor: number;
|
|
@@ -362,23 +405,32 @@ interface RetryableAckError extends Error {
|
|
|
362
405
|
}
|
|
363
406
|
declare function isRetryableAckError(err: unknown): err is RetryableAckError;
|
|
364
407
|
|
|
365
|
-
interface
|
|
408
|
+
interface IntentPayloadBase {
|
|
366
409
|
v: 2;
|
|
367
410
|
recipient: string;
|
|
368
|
-
coinId: string;
|
|
369
|
-
amount: string;
|
|
370
411
|
memo?: string;
|
|
371
412
|
direct: string[];
|
|
413
|
+
spentStates?: Record<string, {
|
|
414
|
+
local: string;
|
|
415
|
+
protocol: string;
|
|
416
|
+
}>;
|
|
417
|
+
}
|
|
418
|
+
interface CoinIntentPayload extends IntentPayloadBase {
|
|
419
|
+
kind: 'coin';
|
|
420
|
+
coinId: string;
|
|
421
|
+
amount: string;
|
|
372
422
|
split?: {
|
|
373
423
|
tokenId: string;
|
|
374
424
|
splitAmount: string;
|
|
375
425
|
remainderAmount: string;
|
|
376
426
|
};
|
|
377
|
-
spentStates?: Record<string, {
|
|
378
|
-
local: string;
|
|
379
|
-
protocol: string;
|
|
380
|
-
}>;
|
|
381
427
|
}
|
|
428
|
+
interface WholeIntentPayload extends IntentPayloadBase {
|
|
429
|
+
kind: 'whole' | 'coinless';
|
|
430
|
+
direct: [string];
|
|
431
|
+
split?: undefined;
|
|
432
|
+
}
|
|
433
|
+
type IntentPayload = CoinIntentPayload | WholeIntentPayload;
|
|
382
434
|
interface PlannedOp {
|
|
383
435
|
kind: 'direct' | 'split';
|
|
384
436
|
opIndex: number;
|
|
@@ -558,6 +610,9 @@ declare const STORE_KEYS: {
|
|
|
558
610
|
readonly knownSpends: "known-spends";
|
|
559
611
|
};
|
|
560
612
|
|
|
613
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
614
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
615
|
+
|
|
561
616
|
/**
|
|
562
617
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
563
618
|
*
|
|
@@ -618,6 +673,22 @@ interface SphereToken {
|
|
|
618
673
|
readonly blob: TokenBlob;
|
|
619
674
|
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
620
675
|
readonly value: SphereValue | null;
|
|
676
|
+
/**
|
|
677
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
678
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
679
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
680
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
681
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
682
|
+
* envelope never reaches this field: it throws during classification.
|
|
683
|
+
*/
|
|
684
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
685
|
+
/**
|
|
686
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
687
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
688
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
689
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
690
|
+
*/
|
|
691
|
+
readonly tokenType: string;
|
|
621
692
|
}
|
|
622
693
|
interface MintParams {
|
|
623
694
|
/** Recipient's 33-byte compressed chain pubkey; engine derives the predicate. */
|
|
@@ -1003,6 +1074,11 @@ interface RegistryReader {
|
|
|
1003
1074
|
getName(coinId: string): string;
|
|
1004
1075
|
getDecimals(coinId: string): number;
|
|
1005
1076
|
getIconUrl(coinId: string): string | null;
|
|
1077
|
+
/** Coinless token CLASS metadata, keyed by token type — a separate namespace. */
|
|
1078
|
+
getTypeMeta?(tokenType: string): {
|
|
1079
|
+
name: string;
|
|
1080
|
+
iconUrl: string | null;
|
|
1081
|
+
} | null;
|
|
1006
1082
|
}
|
|
1007
1083
|
interface PriceQuote {
|
|
1008
1084
|
readonly priceUsd: number;
|
|
@@ -1152,6 +1228,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1152
1228
|
tokens(filter?: {
|
|
1153
1229
|
coinId?: string;
|
|
1154
1230
|
}): Token[];
|
|
1231
|
+
coinless(): CoinlessToken[];
|
|
1232
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
1155
1233
|
history(page?: {
|
|
1156
1234
|
before?: string;
|
|
1157
1235
|
limit?: number;
|
|
@@ -1164,6 +1242,9 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1164
1242
|
discardPrewarm(): void;
|
|
1165
1243
|
private warmDeps;
|
|
1166
1244
|
send(request: SendRequest): Promise<TransferResult>;
|
|
1245
|
+
sendWholeToken(request: SendWholeTokenRequest): Promise<TransferResult>;
|
|
1246
|
+
/** NFT-scoped twin: refuses a valued source. */
|
|
1247
|
+
sendCoinless(request: SendWholeTokenRequest): Promise<TransferResult>;
|
|
1167
1248
|
receive(): Promise<{
|
|
1168
1249
|
transfers: IncomingTransfer[];
|
|
1169
1250
|
}>;
|
|
@@ -1175,9 +1256,10 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1175
1256
|
private runConvergencePass;
|
|
1176
1257
|
private convergeBody;
|
|
1177
1258
|
private nowMs;
|
|
1259
|
+
private mintDeps;
|
|
1178
1260
|
/** The ONE place a send() outcome is shaped: success emits in finishSend, a
|
|
1179
1261
|
* CLEAN rejection emits `transfer:updated{status:'failed'}` here (§4). */
|
|
1180
|
-
private
|
|
1262
|
+
private runJob;
|
|
1181
1263
|
/** Only a CLEAN failure (nothing certified, classifyError 'other') is 'failed'.
|
|
1182
1264
|
* Keep-open/partial/conflict outcomes are pending/converging — labelling them
|
|
1183
1265
|
* 'failed' invites a dApp re-send, i.e. a double-pay (#631/#676). */
|
|
@@ -1209,13 +1291,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1209
1291
|
private accumulate;
|
|
1210
1292
|
private finishSend;
|
|
1211
1293
|
/** Nothing delivered → UNWRAPPED; after ≥1 delivered leg every failure surfaces as PartialSendConflictError over the settled set. */
|
|
1212
|
-
private partialize;
|
|
1213
|
-
/** #441: possibly-committed errors must carry the transferId for the settling journal. */
|
|
1214
|
-
private stampTransferId;
|
|
1215
1294
|
private softAbort;
|
|
1216
1295
|
private mintInner;
|
|
1217
|
-
private mintUnderJournal;
|
|
1218
|
-
private finalizeMint;
|
|
1219
1296
|
/** @returns how many journal entries were RESOLVED (cleared) — heartbeat progress. */
|
|
1220
1297
|
private replayMints;
|
|
1221
1298
|
private replayMint;
|
|
@@ -1230,4 +1307,4 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1230
1307
|
declare const HEARTBEAT_SEED_MS = 5000;
|
|
1231
1308
|
declare const HEARTBEAT_CAP_MS = 120000;
|
|
1232
1309
|
|
|
1233
|
-
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type CheckpointReseeder, type ConnectionStatus, type DeliverOptions, type DeliveryJournalEntry, type DeliveryPort, type DeliveryReceipt, type DeterministicMintCapable, type FacadeClient, type FacadeSession, HEARTBEAT_CAP_MS, HEARTBEAT_SEED_MS, type HistoryEntry, type HistoryPage, type IncomingDelivery, type IntentBackstopEntry, type IntentPayload, type InventoryAsset, type InventoryItem, type InventoryPage, MAX_RESELECT, type MintJournalEntry, type MintResult, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingTransfer, type PlannedOp, type RecipientInfo, type RetryableAckError, STORE_KEYS, type ScopedKV, type SendRequest, type SettlingLink, type ShortfallEntry, type StoragePort, type StreamCursor, type StreamName, createScopedKV, isRetryableAckError, supportsDeterministicMint, sweepSupersededState };
|
|
1310
|
+
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type CheckpointReseeder, type ConnectionStatus, type DeliverOptions, type DeliveryJournalEntry, type DeliveryPort, type DeliveryReceipt, type DeterministicMintCapable, type FacadeClient, type FacadeSession, HEARTBEAT_CAP_MS, HEARTBEAT_SEED_MS, type HistoryEntry, type HistoryPage, type IncomingDelivery, type IntentBackstopEntry, type IntentPayload, type InventoryAsset, type InventoryItem, type InventoryPage, MAX_RESELECT, type MintJournalEntry, type MintResult, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingTransfer, type PlannedOp, type RecipientInfo, type RetryableAckError, STORE_KEYS, type ScopedKV, type SendCoinlessRequest, type SendRequest, type SendWholeTokenRequest, type SettlingLink, type ShortfallEntry, type StoragePort, type StreamCursor, type StreamName, createScopedKV, isRetryableAckError, supportsDeterministicMint, sweepSupersededState };
|
|
@@ -56,6 +56,31 @@ interface Token {
|
|
|
56
56
|
*/
|
|
57
57
|
suspectedSpent?: boolean;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
61
|
+
* `Token`: no amount, decimals or symbol, and never returned by `tokens()` or
|
|
62
|
+
* counted in `assets()`. `tokenType` names the token's CLASS and `tokenId` the
|
|
63
|
+
* instance (wallet-api#147). The payload is read with `payments.tokenData()`.
|
|
64
|
+
*/
|
|
65
|
+
interface CoinlessToken {
|
|
66
|
+
readonly tokenId: string;
|
|
67
|
+
readonly tokenType?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Class metadata resolved from the registry THIS wallet owns, when the type is
|
|
70
|
+
* recognised. Resolved here so callers never reach for a registry themselves:
|
|
71
|
+
* the process-global singleton is repointable by another Sphere's init, so a
|
|
72
|
+
* second wallet on another network would retarget it (#767).
|
|
73
|
+
*/
|
|
74
|
+
readonly name?: string;
|
|
75
|
+
readonly iconUrl?: string;
|
|
76
|
+
readonly stateHash: string;
|
|
77
|
+
/** #737: reserved by a converging transfer — not spendable right now. */
|
|
78
|
+
readonly transferring: boolean;
|
|
79
|
+
/** #625: proven spent on-chain; excluded from spend selection. */
|
|
80
|
+
readonly suspectedSpent?: boolean;
|
|
81
|
+
readonly createdAt: number;
|
|
82
|
+
readonly updatedAt: number;
|
|
83
|
+
}
|
|
59
84
|
interface Asset {
|
|
60
85
|
readonly coinId: string;
|
|
61
86
|
readonly symbol: string;
|
|
@@ -126,6 +151,8 @@ interface IncomingTransfer {
|
|
|
126
151
|
readonly senderPubkey: string;
|
|
127
152
|
readonly senderNametag?: string;
|
|
128
153
|
readonly tokens: Token[];
|
|
154
|
+
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
155
|
+
readonly coinless?: CoinlessToken[];
|
|
129
156
|
readonly memo?: string;
|
|
130
157
|
readonly receivedAt: number;
|
|
131
158
|
}
|
|
@@ -150,6 +177,13 @@ interface SendRequest {
|
|
|
150
177
|
coinId: string;
|
|
151
178
|
memo?: string;
|
|
152
179
|
}
|
|
180
|
+
/** 0.17.0's name for {@link SendWholeTokenRequest}. Kept so published imports compile. */
|
|
181
|
+
type SendCoinlessRequest = SendWholeTokenRequest;
|
|
182
|
+
interface SendWholeTokenRequest {
|
|
183
|
+
recipient: string;
|
|
184
|
+
tokenId: string;
|
|
185
|
+
memo?: string;
|
|
186
|
+
}
|
|
153
187
|
interface MintResult {
|
|
154
188
|
success: boolean;
|
|
155
189
|
tokenId?: string;
|
|
@@ -219,6 +253,8 @@ interface PendingTransfer {
|
|
|
219
253
|
recipient: string;
|
|
220
254
|
coinId: string;
|
|
221
255
|
amount: string;
|
|
256
|
+
/** Set instead of coinId/amount when the intent is a token-addressed spend. */
|
|
257
|
+
tokenId?: string;
|
|
222
258
|
legs: {
|
|
223
259
|
certified: number;
|
|
224
260
|
total: number;
|
|
@@ -234,11 +270,16 @@ interface PaymentsV2 {
|
|
|
234
270
|
tokens(filter?: {
|
|
235
271
|
coinId?: string;
|
|
236
272
|
}): Token[];
|
|
273
|
+
coinless(): CoinlessToken[];
|
|
274
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
237
275
|
history(page?: {
|
|
238
276
|
before?: string;
|
|
239
277
|
limit?: number;
|
|
240
278
|
}): Promise<HistoryPage>;
|
|
241
279
|
send(req: SendRequest): Promise<TransferResult>;
|
|
280
|
+
sendWholeToken(req: SendWholeTokenRequest): Promise<TransferResult>;
|
|
281
|
+
/** NFT-scoped twin: refuses a valued source. Connect's `send_nft` routes here. */
|
|
282
|
+
sendCoinless(req: SendWholeTokenRequest): Promise<TransferResult>;
|
|
242
283
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
243
284
|
receive(): Promise<{
|
|
244
285
|
transfers: IncomingTransfer[];
|
|
@@ -278,7 +319,9 @@ interface InventoryItem {
|
|
|
278
319
|
status: 'active' | 'removed';
|
|
279
320
|
seq: number;
|
|
280
321
|
stateHash: string;
|
|
322
|
+
/** Absent for a tombstone AND for an active COINLESS token — read `status`, not this. */
|
|
281
323
|
assets?: InventoryAsset[];
|
|
324
|
+
tokenType?: string;
|
|
282
325
|
}
|
|
283
326
|
interface InventoryPage {
|
|
284
327
|
cursor: number;
|
|
@@ -362,23 +405,32 @@ interface RetryableAckError extends Error {
|
|
|
362
405
|
}
|
|
363
406
|
declare function isRetryableAckError(err: unknown): err is RetryableAckError;
|
|
364
407
|
|
|
365
|
-
interface
|
|
408
|
+
interface IntentPayloadBase {
|
|
366
409
|
v: 2;
|
|
367
410
|
recipient: string;
|
|
368
|
-
coinId: string;
|
|
369
|
-
amount: string;
|
|
370
411
|
memo?: string;
|
|
371
412
|
direct: string[];
|
|
413
|
+
spentStates?: Record<string, {
|
|
414
|
+
local: string;
|
|
415
|
+
protocol: string;
|
|
416
|
+
}>;
|
|
417
|
+
}
|
|
418
|
+
interface CoinIntentPayload extends IntentPayloadBase {
|
|
419
|
+
kind: 'coin';
|
|
420
|
+
coinId: string;
|
|
421
|
+
amount: string;
|
|
372
422
|
split?: {
|
|
373
423
|
tokenId: string;
|
|
374
424
|
splitAmount: string;
|
|
375
425
|
remainderAmount: string;
|
|
376
426
|
};
|
|
377
|
-
spentStates?: Record<string, {
|
|
378
|
-
local: string;
|
|
379
|
-
protocol: string;
|
|
380
|
-
}>;
|
|
381
427
|
}
|
|
428
|
+
interface WholeIntentPayload extends IntentPayloadBase {
|
|
429
|
+
kind: 'whole' | 'coinless';
|
|
430
|
+
direct: [string];
|
|
431
|
+
split?: undefined;
|
|
432
|
+
}
|
|
433
|
+
type IntentPayload = CoinIntentPayload | WholeIntentPayload;
|
|
382
434
|
interface PlannedOp {
|
|
383
435
|
kind: 'direct' | 'split';
|
|
384
436
|
opIndex: number;
|
|
@@ -558,6 +610,9 @@ declare const STORE_KEYS: {
|
|
|
558
610
|
readonly knownSpends: "known-spends";
|
|
559
611
|
};
|
|
560
612
|
|
|
613
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
614
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
615
|
+
|
|
561
616
|
/**
|
|
562
617
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
563
618
|
*
|
|
@@ -618,6 +673,22 @@ interface SphereToken {
|
|
|
618
673
|
readonly blob: TokenBlob;
|
|
619
674
|
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
620
675
|
readonly value: SphereValue | null;
|
|
676
|
+
/**
|
|
677
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
678
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
679
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
680
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
681
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
682
|
+
* envelope never reaches this field: it throws during classification.
|
|
683
|
+
*/
|
|
684
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
685
|
+
/**
|
|
686
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
687
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
688
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
689
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
690
|
+
*/
|
|
691
|
+
readonly tokenType: string;
|
|
621
692
|
}
|
|
622
693
|
interface MintParams {
|
|
623
694
|
/** Recipient's 33-byte compressed chain pubkey; engine derives the predicate. */
|
|
@@ -1003,6 +1074,11 @@ interface RegistryReader {
|
|
|
1003
1074
|
getName(coinId: string): string;
|
|
1004
1075
|
getDecimals(coinId: string): number;
|
|
1005
1076
|
getIconUrl(coinId: string): string | null;
|
|
1077
|
+
/** Coinless token CLASS metadata, keyed by token type — a separate namespace. */
|
|
1078
|
+
getTypeMeta?(tokenType: string): {
|
|
1079
|
+
name: string;
|
|
1080
|
+
iconUrl: string | null;
|
|
1081
|
+
} | null;
|
|
1006
1082
|
}
|
|
1007
1083
|
interface PriceQuote {
|
|
1008
1084
|
readonly priceUsd: number;
|
|
@@ -1152,6 +1228,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1152
1228
|
tokens(filter?: {
|
|
1153
1229
|
coinId?: string;
|
|
1154
1230
|
}): Token[];
|
|
1231
|
+
coinless(): CoinlessToken[];
|
|
1232
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
1155
1233
|
history(page?: {
|
|
1156
1234
|
before?: string;
|
|
1157
1235
|
limit?: number;
|
|
@@ -1164,6 +1242,9 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1164
1242
|
discardPrewarm(): void;
|
|
1165
1243
|
private warmDeps;
|
|
1166
1244
|
send(request: SendRequest): Promise<TransferResult>;
|
|
1245
|
+
sendWholeToken(request: SendWholeTokenRequest): Promise<TransferResult>;
|
|
1246
|
+
/** NFT-scoped twin: refuses a valued source. */
|
|
1247
|
+
sendCoinless(request: SendWholeTokenRequest): Promise<TransferResult>;
|
|
1167
1248
|
receive(): Promise<{
|
|
1168
1249
|
transfers: IncomingTransfer[];
|
|
1169
1250
|
}>;
|
|
@@ -1175,9 +1256,10 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1175
1256
|
private runConvergencePass;
|
|
1176
1257
|
private convergeBody;
|
|
1177
1258
|
private nowMs;
|
|
1259
|
+
private mintDeps;
|
|
1178
1260
|
/** The ONE place a send() outcome is shaped: success emits in finishSend, a
|
|
1179
1261
|
* CLEAN rejection emits `transfer:updated{status:'failed'}` here (§4). */
|
|
1180
|
-
private
|
|
1262
|
+
private runJob;
|
|
1181
1263
|
/** Only a CLEAN failure (nothing certified, classifyError 'other') is 'failed'.
|
|
1182
1264
|
* Keep-open/partial/conflict outcomes are pending/converging — labelling them
|
|
1183
1265
|
* 'failed' invites a dApp re-send, i.e. a double-pay (#631/#676). */
|
|
@@ -1209,13 +1291,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1209
1291
|
private accumulate;
|
|
1210
1292
|
private finishSend;
|
|
1211
1293
|
/** Nothing delivered → UNWRAPPED; after ≥1 delivered leg every failure surfaces as PartialSendConflictError over the settled set. */
|
|
1212
|
-
private partialize;
|
|
1213
|
-
/** #441: possibly-committed errors must carry the transferId for the settling journal. */
|
|
1214
|
-
private stampTransferId;
|
|
1215
1294
|
private softAbort;
|
|
1216
1295
|
private mintInner;
|
|
1217
|
-
private mintUnderJournal;
|
|
1218
|
-
private finalizeMint;
|
|
1219
1296
|
/** @returns how many journal entries were RESOLVED (cleared) — heartbeat progress. */
|
|
1220
1297
|
private replayMints;
|
|
1221
1298
|
private replayMint;
|
|
@@ -1230,4 +1307,4 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1230
1307
|
declare const HEARTBEAT_SEED_MS = 5000;
|
|
1231
1308
|
declare const HEARTBEAT_CAP_MS = 120000;
|
|
1232
1309
|
|
|
1233
|
-
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type CheckpointReseeder, type ConnectionStatus, type DeliverOptions, type DeliveryJournalEntry, type DeliveryPort, type DeliveryReceipt, type DeterministicMintCapable, type FacadeClient, type FacadeSession, HEARTBEAT_CAP_MS, HEARTBEAT_SEED_MS, type HistoryEntry, type HistoryPage, type IncomingDelivery, type IntentBackstopEntry, type IntentPayload, type InventoryAsset, type InventoryItem, type InventoryPage, MAX_RESELECT, type MintJournalEntry, type MintResult, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingTransfer, type PlannedOp, type RecipientInfo, type RetryableAckError, STORE_KEYS, type ScopedKV, type SendRequest, type SettlingLink, type ShortfallEntry, type StoragePort, type StreamCursor, type StreamName, createScopedKV, isRetryableAckError, supportsDeterministicMint, sweepSupersededState };
|
|
1310
|
+
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type CheckpointReseeder, type ConnectionStatus, type DeliverOptions, type DeliveryJournalEntry, type DeliveryPort, type DeliveryReceipt, type DeterministicMintCapable, type FacadeClient, type FacadeSession, HEARTBEAT_CAP_MS, HEARTBEAT_SEED_MS, type HistoryEntry, type HistoryPage, type IncomingDelivery, type IntentBackstopEntry, type IntentPayload, type InventoryAsset, type InventoryItem, type InventoryPage, MAX_RESELECT, type MintJournalEntry, type MintResult, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingTransfer, type PlannedOp, type RecipientInfo, type RetryableAckError, STORE_KEYS, type ScopedKV, type SendCoinlessRequest, type SendRequest, type SendWholeTokenRequest, type SettlingLink, type ShortfallEntry, type StoragePort, type StreamCursor, type StreamName, createScopedKV, isRetryableAckError, supportsDeterministicMint, sweepSupersededState };
|