@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
|
@@ -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,11 @@ interface SendRequest {
|
|
|
150
177
|
coinId: string;
|
|
151
178
|
memo?: string;
|
|
152
179
|
}
|
|
180
|
+
interface SendCoinlessRequest {
|
|
181
|
+
recipient: string;
|
|
182
|
+
tokenId: string;
|
|
183
|
+
memo?: string;
|
|
184
|
+
}
|
|
153
185
|
interface MintResult {
|
|
154
186
|
success: boolean;
|
|
155
187
|
tokenId?: string;
|
|
@@ -219,6 +251,8 @@ interface PendingTransfer {
|
|
|
219
251
|
recipient: string;
|
|
220
252
|
coinId: string;
|
|
221
253
|
amount: string;
|
|
254
|
+
/** Set instead of coinId/amount when the intent is a token-addressed spend. */
|
|
255
|
+
tokenId?: string;
|
|
222
256
|
legs: {
|
|
223
257
|
certified: number;
|
|
224
258
|
total: number;
|
|
@@ -234,11 +268,14 @@ interface PaymentsV2 {
|
|
|
234
268
|
tokens(filter?: {
|
|
235
269
|
coinId?: string;
|
|
236
270
|
}): Token[];
|
|
271
|
+
coinless(): CoinlessToken[];
|
|
272
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
237
273
|
history(page?: {
|
|
238
274
|
before?: string;
|
|
239
275
|
limit?: number;
|
|
240
276
|
}): Promise<HistoryPage>;
|
|
241
277
|
send(req: SendRequest): Promise<TransferResult>;
|
|
278
|
+
sendCoinless(req: SendCoinlessRequest): Promise<TransferResult>;
|
|
242
279
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
243
280
|
receive(): Promise<{
|
|
244
281
|
transfers: IncomingTransfer[];
|
|
@@ -278,7 +315,9 @@ interface InventoryItem {
|
|
|
278
315
|
status: 'active' | 'removed';
|
|
279
316
|
seq: number;
|
|
280
317
|
stateHash: string;
|
|
318
|
+
/** Absent for a tombstone AND for an active COINLESS token — read `status`, not this. */
|
|
281
319
|
assets?: InventoryAsset[];
|
|
320
|
+
tokenType?: string;
|
|
282
321
|
}
|
|
283
322
|
interface InventoryPage {
|
|
284
323
|
cursor: number;
|
|
@@ -362,23 +401,33 @@ interface RetryableAckError extends Error {
|
|
|
362
401
|
}
|
|
363
402
|
declare function isRetryableAckError(err: unknown): err is RetryableAckError;
|
|
364
403
|
|
|
365
|
-
interface
|
|
404
|
+
interface IntentPayloadBase {
|
|
366
405
|
v: 2;
|
|
367
406
|
recipient: string;
|
|
368
|
-
coinId: string;
|
|
369
|
-
amount: string;
|
|
370
407
|
memo?: string;
|
|
371
408
|
direct: string[];
|
|
409
|
+
spentStates?: Record<string, {
|
|
410
|
+
local: string;
|
|
411
|
+
protocol: string;
|
|
412
|
+
}>;
|
|
413
|
+
}
|
|
414
|
+
interface CoinIntentPayload extends IntentPayloadBase {
|
|
415
|
+
kind: 'coin';
|
|
416
|
+
coinId: string;
|
|
417
|
+
amount: string;
|
|
372
418
|
split?: {
|
|
373
419
|
tokenId: string;
|
|
374
420
|
splitAmount: string;
|
|
375
421
|
remainderAmount: string;
|
|
376
422
|
};
|
|
377
|
-
spentStates?: Record<string, {
|
|
378
|
-
local: string;
|
|
379
|
-
protocol: string;
|
|
380
|
-
}>;
|
|
381
423
|
}
|
|
424
|
+
interface CoinlessIntentPayload extends IntentPayloadBase {
|
|
425
|
+
kind: 'coinless';
|
|
426
|
+
direct: [string];
|
|
427
|
+
split?: undefined;
|
|
428
|
+
}
|
|
429
|
+
/** `kind` is REQUIRED on both arms: a missed writer must be a compile error. */
|
|
430
|
+
type IntentPayload = CoinIntentPayload | CoinlessIntentPayload;
|
|
382
431
|
interface PlannedOp {
|
|
383
432
|
kind: 'direct' | 'split';
|
|
384
433
|
opIndex: number;
|
|
@@ -558,6 +607,9 @@ declare const STORE_KEYS: {
|
|
|
558
607
|
readonly knownSpends: "known-spends";
|
|
559
608
|
};
|
|
560
609
|
|
|
610
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
611
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
612
|
+
|
|
561
613
|
/**
|
|
562
614
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
563
615
|
*
|
|
@@ -618,6 +670,22 @@ interface SphereToken {
|
|
|
618
670
|
readonly blob: TokenBlob;
|
|
619
671
|
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
620
672
|
readonly value: SphereValue | null;
|
|
673
|
+
/**
|
|
674
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
675
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
676
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
677
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
678
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
679
|
+
* envelope never reaches this field: it throws during classification.
|
|
680
|
+
*/
|
|
681
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
682
|
+
/**
|
|
683
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
684
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
685
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
686
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
687
|
+
*/
|
|
688
|
+
readonly tokenType: string;
|
|
621
689
|
}
|
|
622
690
|
interface MintParams {
|
|
623
691
|
/** Recipient's 33-byte compressed chain pubkey; engine derives the predicate. */
|
|
@@ -1003,6 +1071,11 @@ interface RegistryReader {
|
|
|
1003
1071
|
getName(coinId: string): string;
|
|
1004
1072
|
getDecimals(coinId: string): number;
|
|
1005
1073
|
getIconUrl(coinId: string): string | null;
|
|
1074
|
+
/** Coinless token CLASS metadata, keyed by token type — a separate namespace. */
|
|
1075
|
+
getTypeMeta?(tokenType: string): {
|
|
1076
|
+
name: string;
|
|
1077
|
+
iconUrl: string | null;
|
|
1078
|
+
} | null;
|
|
1006
1079
|
}
|
|
1007
1080
|
interface PriceQuote {
|
|
1008
1081
|
readonly priceUsd: number;
|
|
@@ -1152,6 +1225,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1152
1225
|
tokens(filter?: {
|
|
1153
1226
|
coinId?: string;
|
|
1154
1227
|
}): Token[];
|
|
1228
|
+
coinless(): CoinlessToken[];
|
|
1229
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
1155
1230
|
history(page?: {
|
|
1156
1231
|
before?: string;
|
|
1157
1232
|
limit?: number;
|
|
@@ -1164,6 +1239,7 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1164
1239
|
discardPrewarm(): void;
|
|
1165
1240
|
private warmDeps;
|
|
1166
1241
|
send(request: SendRequest): Promise<TransferResult>;
|
|
1242
|
+
sendCoinless(request: SendCoinlessRequest): Promise<TransferResult>;
|
|
1167
1243
|
receive(): Promise<{
|
|
1168
1244
|
transfers: IncomingTransfer[];
|
|
1169
1245
|
}>;
|
|
@@ -1175,9 +1251,13 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1175
1251
|
private runConvergencePass;
|
|
1176
1252
|
private convergeBody;
|
|
1177
1253
|
private nowMs;
|
|
1254
|
+
private mintDeps;
|
|
1178
1255
|
/** The ONE place a send() outcome is shaped: success emits in finishSend, a
|
|
1179
1256
|
* CLEAN rejection emits `transfer:updated{status:'failed'}` here (§4). */
|
|
1180
1257
|
private sendOutcome;
|
|
1258
|
+
/** A token spend has no amount; '0' keeps the shortfall arithmetic total-free. */
|
|
1259
|
+
private sendCoinlessOutcome;
|
|
1260
|
+
private runJob;
|
|
1181
1261
|
/** Only a CLEAN failure (nothing certified, classifyError 'other') is 'failed'.
|
|
1182
1262
|
* Keep-open/partial/conflict outcomes are pending/converging — labelling them
|
|
1183
1263
|
* 'failed' invites a dApp re-send, i.e. a double-pay (#631/#676). */
|
|
@@ -1209,13 +1289,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1209
1289
|
private accumulate;
|
|
1210
1290
|
private finishSend;
|
|
1211
1291
|
/** 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
1292
|
private softAbort;
|
|
1216
1293
|
private mintInner;
|
|
1217
|
-
private mintUnderJournal;
|
|
1218
|
-
private finalizeMint;
|
|
1219
1294
|
/** @returns how many journal entries were RESOLVED (cleared) — heartbeat progress. */
|
|
1220
1295
|
private replayMints;
|
|
1221
1296
|
private replayMint;
|
|
@@ -1230,4 +1305,4 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1230
1305
|
declare const HEARTBEAT_SEED_MS = 5000;
|
|
1231
1306
|
declare const HEARTBEAT_CAP_MS = 120000;
|
|
1232
1307
|
|
|
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 };
|
|
1308
|
+
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 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,11 @@ interface SendRequest {
|
|
|
150
177
|
coinId: string;
|
|
151
178
|
memo?: string;
|
|
152
179
|
}
|
|
180
|
+
interface SendCoinlessRequest {
|
|
181
|
+
recipient: string;
|
|
182
|
+
tokenId: string;
|
|
183
|
+
memo?: string;
|
|
184
|
+
}
|
|
153
185
|
interface MintResult {
|
|
154
186
|
success: boolean;
|
|
155
187
|
tokenId?: string;
|
|
@@ -219,6 +251,8 @@ interface PendingTransfer {
|
|
|
219
251
|
recipient: string;
|
|
220
252
|
coinId: string;
|
|
221
253
|
amount: string;
|
|
254
|
+
/** Set instead of coinId/amount when the intent is a token-addressed spend. */
|
|
255
|
+
tokenId?: string;
|
|
222
256
|
legs: {
|
|
223
257
|
certified: number;
|
|
224
258
|
total: number;
|
|
@@ -234,11 +268,14 @@ interface PaymentsV2 {
|
|
|
234
268
|
tokens(filter?: {
|
|
235
269
|
coinId?: string;
|
|
236
270
|
}): Token[];
|
|
271
|
+
coinless(): CoinlessToken[];
|
|
272
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
237
273
|
history(page?: {
|
|
238
274
|
before?: string;
|
|
239
275
|
limit?: number;
|
|
240
276
|
}): Promise<HistoryPage>;
|
|
241
277
|
send(req: SendRequest): Promise<TransferResult>;
|
|
278
|
+
sendCoinless(req: SendCoinlessRequest): Promise<TransferResult>;
|
|
242
279
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
243
280
|
receive(): Promise<{
|
|
244
281
|
transfers: IncomingTransfer[];
|
|
@@ -278,7 +315,9 @@ interface InventoryItem {
|
|
|
278
315
|
status: 'active' | 'removed';
|
|
279
316
|
seq: number;
|
|
280
317
|
stateHash: string;
|
|
318
|
+
/** Absent for a tombstone AND for an active COINLESS token — read `status`, not this. */
|
|
281
319
|
assets?: InventoryAsset[];
|
|
320
|
+
tokenType?: string;
|
|
282
321
|
}
|
|
283
322
|
interface InventoryPage {
|
|
284
323
|
cursor: number;
|
|
@@ -362,23 +401,33 @@ interface RetryableAckError extends Error {
|
|
|
362
401
|
}
|
|
363
402
|
declare function isRetryableAckError(err: unknown): err is RetryableAckError;
|
|
364
403
|
|
|
365
|
-
interface
|
|
404
|
+
interface IntentPayloadBase {
|
|
366
405
|
v: 2;
|
|
367
406
|
recipient: string;
|
|
368
|
-
coinId: string;
|
|
369
|
-
amount: string;
|
|
370
407
|
memo?: string;
|
|
371
408
|
direct: string[];
|
|
409
|
+
spentStates?: Record<string, {
|
|
410
|
+
local: string;
|
|
411
|
+
protocol: string;
|
|
412
|
+
}>;
|
|
413
|
+
}
|
|
414
|
+
interface CoinIntentPayload extends IntentPayloadBase {
|
|
415
|
+
kind: 'coin';
|
|
416
|
+
coinId: string;
|
|
417
|
+
amount: string;
|
|
372
418
|
split?: {
|
|
373
419
|
tokenId: string;
|
|
374
420
|
splitAmount: string;
|
|
375
421
|
remainderAmount: string;
|
|
376
422
|
};
|
|
377
|
-
spentStates?: Record<string, {
|
|
378
|
-
local: string;
|
|
379
|
-
protocol: string;
|
|
380
|
-
}>;
|
|
381
423
|
}
|
|
424
|
+
interface CoinlessIntentPayload extends IntentPayloadBase {
|
|
425
|
+
kind: 'coinless';
|
|
426
|
+
direct: [string];
|
|
427
|
+
split?: undefined;
|
|
428
|
+
}
|
|
429
|
+
/** `kind` is REQUIRED on both arms: a missed writer must be a compile error. */
|
|
430
|
+
type IntentPayload = CoinIntentPayload | CoinlessIntentPayload;
|
|
382
431
|
interface PlannedOp {
|
|
383
432
|
kind: 'direct' | 'split';
|
|
384
433
|
opIndex: number;
|
|
@@ -558,6 +607,9 @@ declare const STORE_KEYS: {
|
|
|
558
607
|
readonly knownSpends: "known-spends";
|
|
559
608
|
};
|
|
560
609
|
|
|
610
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
611
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
612
|
+
|
|
561
613
|
/**
|
|
562
614
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
563
615
|
*
|
|
@@ -618,6 +670,22 @@ interface SphereToken {
|
|
|
618
670
|
readonly blob: TokenBlob;
|
|
619
671
|
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
620
672
|
readonly value: SphereValue | null;
|
|
673
|
+
/**
|
|
674
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
675
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
676
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
677
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
678
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
679
|
+
* envelope never reaches this field: it throws during classification.
|
|
680
|
+
*/
|
|
681
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
682
|
+
/**
|
|
683
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
684
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
685
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
686
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
687
|
+
*/
|
|
688
|
+
readonly tokenType: string;
|
|
621
689
|
}
|
|
622
690
|
interface MintParams {
|
|
623
691
|
/** Recipient's 33-byte compressed chain pubkey; engine derives the predicate. */
|
|
@@ -1003,6 +1071,11 @@ interface RegistryReader {
|
|
|
1003
1071
|
getName(coinId: string): string;
|
|
1004
1072
|
getDecimals(coinId: string): number;
|
|
1005
1073
|
getIconUrl(coinId: string): string | null;
|
|
1074
|
+
/** Coinless token CLASS metadata, keyed by token type — a separate namespace. */
|
|
1075
|
+
getTypeMeta?(tokenType: string): {
|
|
1076
|
+
name: string;
|
|
1077
|
+
iconUrl: string | null;
|
|
1078
|
+
} | null;
|
|
1006
1079
|
}
|
|
1007
1080
|
interface PriceQuote {
|
|
1008
1081
|
readonly priceUsd: number;
|
|
@@ -1152,6 +1225,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1152
1225
|
tokens(filter?: {
|
|
1153
1226
|
coinId?: string;
|
|
1154
1227
|
}): Token[];
|
|
1228
|
+
coinless(): CoinlessToken[];
|
|
1229
|
+
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
1155
1230
|
history(page?: {
|
|
1156
1231
|
before?: string;
|
|
1157
1232
|
limit?: number;
|
|
@@ -1164,6 +1239,7 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1164
1239
|
discardPrewarm(): void;
|
|
1165
1240
|
private warmDeps;
|
|
1166
1241
|
send(request: SendRequest): Promise<TransferResult>;
|
|
1242
|
+
sendCoinless(request: SendCoinlessRequest): Promise<TransferResult>;
|
|
1167
1243
|
receive(): Promise<{
|
|
1168
1244
|
transfers: IncomingTransfer[];
|
|
1169
1245
|
}>;
|
|
@@ -1175,9 +1251,13 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1175
1251
|
private runConvergencePass;
|
|
1176
1252
|
private convergeBody;
|
|
1177
1253
|
private nowMs;
|
|
1254
|
+
private mintDeps;
|
|
1178
1255
|
/** The ONE place a send() outcome is shaped: success emits in finishSend, a
|
|
1179
1256
|
* CLEAN rejection emits `transfer:updated{status:'failed'}` here (§4). */
|
|
1180
1257
|
private sendOutcome;
|
|
1258
|
+
/** A token spend has no amount; '0' keeps the shortfall arithmetic total-free. */
|
|
1259
|
+
private sendCoinlessOutcome;
|
|
1260
|
+
private runJob;
|
|
1181
1261
|
/** Only a CLEAN failure (nothing certified, classifyError 'other') is 'failed'.
|
|
1182
1262
|
* Keep-open/partial/conflict outcomes are pending/converging — labelling them
|
|
1183
1263
|
* 'failed' invites a dApp re-send, i.e. a double-pay (#631/#676). */
|
|
@@ -1209,13 +1289,8 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1209
1289
|
private accumulate;
|
|
1210
1290
|
private finishSend;
|
|
1211
1291
|
/** 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
1292
|
private softAbort;
|
|
1216
1293
|
private mintInner;
|
|
1217
|
-
private mintUnderJournal;
|
|
1218
|
-
private finalizeMint;
|
|
1219
1294
|
/** @returns how many journal entries were RESOLVED (cleared) — heartbeat progress. */
|
|
1220
1295
|
private replayMints;
|
|
1221
1296
|
private replayMint;
|
|
@@ -1230,4 +1305,4 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1230
1305
|
declare const HEARTBEAT_SEED_MS = 5000;
|
|
1231
1306
|
declare const HEARTBEAT_CAP_MS = 120000;
|
|
1232
1307
|
|
|
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 };
|
|
1308
|
+
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 SettlingLink, type ShortfallEntry, type StoragePort, type StreamCursor, type StreamName, createScopedKV, isRetryableAckError, supportsDeterministicMint, sweepSupersededState };
|