@unicitylabs/sphere-sdk 0.17.6 → 0.18.0-dev.2
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/chunks/{chunk-T4DZCXWS.js → chunk-FGQ6CKKK.js} +2 -2
- package/dist/connect/chunks/{chunk-T4DZCXWS.js.map → chunk-FGQ6CKKK.js.map} +1 -1
- package/dist/connect/chunks/{chunk-BRYRG2TL.js → chunk-JYBI36GK.js} +2 -2
- package/dist/connect/chunks/{chunk-MA32MTCD.js → chunk-OAAY2JEA.js} +2 -2
- package/dist/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +3 -3
- package/dist/connect/internal/host.js +2 -2
- package/dist/core/index.cjs +304 -47
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +392 -320
- package/dist/core/index.d.ts +392 -320
- package/dist/core/index.js +304 -47
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +2 -2
- 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 +30 -30
- package/dist/impl/wallet-api-v2/index.d.ts +30 -30
- 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 +304 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +279 -154
- package/dist/index.d.ts +279 -154
- package/dist/index.js +304 -47
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +249 -28
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +252 -166
- package/dist/modules/payments-v2/index.d.ts +252 -166
- package/dist/modules/payments-v2/index.js +249 -28
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs +455 -427
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.d.cts +26 -1
- package/dist/token-engine/index.d.ts +26 -1
- package/dist/token-engine/index.js +455 -427
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +1 -1
- /package/dist/connect/chunks/{chunk-BRYRG2TL.js.map → chunk-JYBI36GK.js.map} +0 -0
- /package/dist/connect/chunks/{chunk-MA32MTCD.js.map → chunk-OAAY2JEA.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
2
|
+
import { Token as Token$1 } from '@unicitylabs/state-transition-sdk/lib/transaction/Token.js';
|
|
1
3
|
export { BindingInfo, ConnectionEventListener, IdentityBindingParams, NostrClient, NostrClientOptions, NostrKeyManager, areSameNametag, decryptNametag, encryptNametag, hashAddressForTag, hashNametag, isPhoneNumber, normalizeNametag } from '@unicitylabs/nostr-js-sdk';
|
|
2
4
|
|
|
3
5
|
/**
|
|
@@ -155,6 +157,9 @@ declare function isNftDocumentLink(content: NftContent): boolean;
|
|
|
155
157
|
/** Does `bytes` match the link's sha256? Pure, sync. */
|
|
156
158
|
declare function verifyNftLinkContent(link: NftLink, bytes: Uint8Array): boolean;
|
|
157
159
|
|
|
160
|
+
/** `none_*` = coinless; `bare_collection` = a dialect this SDK cannot read. */
|
|
161
|
+
type ValueEnvelope = 'sphere' | 'bare_collection' | 'none_tag' | 'none_other' | 'none_absent';
|
|
162
|
+
|
|
158
163
|
/**
|
|
159
164
|
* token-engine/types.ts — the FROZEN, sphere-domain contract surface.
|
|
160
165
|
*
|
|
@@ -170,6 +175,76 @@ declare function verifyNftLinkContent(link: NftLink, bytes: Uint8Array): boolean
|
|
|
170
175
|
* Track B codes callers against it (using FakeTokenEngine until A lands).
|
|
171
176
|
*/
|
|
172
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Coin identifier. Canonical form is the lowercase hex of the v2 AssetId;
|
|
180
|
+
* human symbols (e.g. "UCT") are resolved to hex via the registry before use.
|
|
181
|
+
*/
|
|
182
|
+
type CoinId = string;
|
|
183
|
+
/** One fungible position inside a token. */
|
|
184
|
+
interface SphereAsset {
|
|
185
|
+
readonly coinId: CoinId;
|
|
186
|
+
readonly amount: bigint;
|
|
187
|
+
}
|
|
188
|
+
/** The decoded, app-defined value carried by a token (v2 Token itself is value-less). */
|
|
189
|
+
interface SphereValue {
|
|
190
|
+
readonly assets: readonly SphereAsset[];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Storage-and-display token. Format version + network let storage migrate
|
|
194
|
+
* independently of the SDK's own CBOR. The decoded value is re-derivable from
|
|
195
|
+
* `token`, so it is NOT stored — only cached at runtime on SphereToken.value.
|
|
196
|
+
*/
|
|
197
|
+
interface TokenBlob {
|
|
198
|
+
/**
|
|
199
|
+
* Genesis-stable token id — 64-char lowercase hex of the v2 `TokenId.bytes`
|
|
200
|
+
* (same across every state of the token). Stored on the blob so dedup / listing
|
|
201
|
+
* / tombstone keys need no engine call. `createTokenStateKey = ${tokenId}_${hash}`.
|
|
202
|
+
*/
|
|
203
|
+
readonly tokenId: string;
|
|
204
|
+
/** CBOR bytes of the v2 Token (`Token.toCBOR()`). */
|
|
205
|
+
readonly token: Uint8Array;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A wallet token. `sdkToken` is the OPAQUE engine handle (see file header) —
|
|
209
|
+
* present for the engine to operate on, never to be touched by callers.
|
|
210
|
+
*/
|
|
211
|
+
interface SphereToken {
|
|
212
|
+
/** Opaque v2 SDK handle. Do not call methods on this outside token-engine/. */
|
|
213
|
+
readonly sdkToken: Token$1;
|
|
214
|
+
/** Serializable form for storage/transport. */
|
|
215
|
+
readonly blob: TokenBlob;
|
|
216
|
+
/** Decoded value (cached); null when the token carries no sphere payment data. */
|
|
217
|
+
readonly value: SphereValue | null;
|
|
218
|
+
/**
|
|
219
|
+
* Which value envelope the genesis payload carried (#778). Distinguishes the
|
|
220
|
+
* reasons `value` is null, which the old boolean predicate collapsed:
|
|
221
|
+
* `'none_*'` means the token genuinely names no coin — a COINLESS token — while
|
|
222
|
+
* `'bare_collection'` means it carries coins in the bridged dialect this SDK
|
|
223
|
+
* does not decode, so a zero here is "cannot read", not "has none". A corrupt
|
|
224
|
+
* envelope never reaches this field: it throws during classification.
|
|
225
|
+
*/
|
|
226
|
+
readonly valueEnvelope: ValueEnvelope;
|
|
227
|
+
/**
|
|
228
|
+
* Genesis `TokenType`, lowercase hex. The token's CLASS, never its instance —
|
|
229
|
+
* `blob.tokenId` is the instance key (wallet-api#147). Only as meaningful as its
|
|
230
|
+
* minter made it: `mint()` and split outputs derive one per operation, so for
|
|
231
|
+
* value tokens it is per-mint noise. Never a spend gate.
|
|
232
|
+
*/
|
|
233
|
+
readonly tokenType: string;
|
|
234
|
+
}
|
|
235
|
+
/** Spend a token to a burn predicate with the reason bytes as aux data. */
|
|
236
|
+
interface BurnParams {
|
|
237
|
+
readonly token: SphereToken;
|
|
238
|
+
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
239
|
+
readonly reasonBytes: Uint8Array;
|
|
240
|
+
}
|
|
241
|
+
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
242
|
+
interface TokenPlugin {
|
|
243
|
+
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
244
|
+
readonly id: string;
|
|
245
|
+
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
246
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
247
|
+
}
|
|
173
248
|
/** A token's genesis payload read as an NFT (#785). Display-only. */
|
|
174
249
|
interface NftReading {
|
|
175
250
|
readonly content: NftContent;
|
|
@@ -179,6 +254,159 @@ interface NftReading {
|
|
|
179
254
|
readonly signature: NftSignatureStatus;
|
|
180
255
|
}
|
|
181
256
|
|
|
257
|
+
/**
|
|
258
|
+
* token-engine/engine.ts — the FROZEN public port (ITokenEngine) + its config.
|
|
259
|
+
*
|
|
260
|
+
* This is the contract both migration tracks build against. It is sphere-domain
|
|
261
|
+
* only (see types.ts). The granular, SDK-typed steps (buildMint, submit,
|
|
262
|
+
* awaitProof, certify, …) are an INTERNAL concern of the real adapter and are
|
|
263
|
+
* intentionally NOT part of this public interface.
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Engine construction config. Sphere-domain inputs only: the factory maps
|
|
268
|
+
* `network` → SDK NetworkId, builds the aggregator client from `aggregatorUrl`,
|
|
269
|
+
* the signing service from `privateKey`, and loads the trust base internally.
|
|
270
|
+
*
|
|
271
|
+
* NOTE: trust-base sourcing + proof-policy defaults are finalized in Phase 0.8;
|
|
272
|
+
* this shape may gain fields there without affecting the ITokenEngine contract.
|
|
273
|
+
*/
|
|
274
|
+
/**
|
|
275
|
+
* The web-`Worker` subset the verification pool drives (in Node wrap a `worker_threads.Worker`).
|
|
276
|
+
* A browser `Worker` has these members, but under `strictFunctionTypes` its `ErrorEvent` /
|
|
277
|
+
* `MessageEvent` handler types are not assignable here (TS2322), so it needs a cast or a thin
|
|
278
|
+
* wrapper. Payloads stay `unknown` so no base-SDK wire type reaches this port.
|
|
279
|
+
*/
|
|
280
|
+
interface VerificationWorker {
|
|
281
|
+
onerror: ((event: {
|
|
282
|
+
message: string;
|
|
283
|
+
}) => void) | null;
|
|
284
|
+
onmessage: ((event: {
|
|
285
|
+
data: unknown;
|
|
286
|
+
}) => void) | null;
|
|
287
|
+
postMessage(message: unknown): void;
|
|
288
|
+
terminate(): void;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Opt-in PARALLEL token verification (state-transition-sdk 2.0.2+): per-transfer
|
|
292
|
+
* work fans out to a worker pool instead of walking the calling thread. You
|
|
293
|
+
* author and bundle the entry script, and its predicate verifier MUST match the
|
|
294
|
+
* engine's or the verdict silently diverges — docs/VERIFICATION-WORKERS.md.
|
|
295
|
+
*/
|
|
296
|
+
interface VerificationWorkerConfig {
|
|
297
|
+
/** Spawn ONE worker running that entry script. Called lazily, up to `poolSize` times. */
|
|
298
|
+
readonly createWorker: () => VerificationWorker;
|
|
299
|
+
/** Maximum workers in the pool (default 4). Workers are reused across verify() calls. */
|
|
300
|
+
readonly poolSize?: number;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* SDK Error Types
|
|
305
|
+
*
|
|
306
|
+
* Structured error codes for programmatic error handling in UI.
|
|
307
|
+
* UI can switch on error.code to show appropriate user-facing messages.
|
|
308
|
+
*
|
|
309
|
+
* Errors thrown by provider code (the `./impl/*` bundles) are a different `SphereError` class
|
|
310
|
+
* copy, so `instanceof SphereError` / `isSphereError()` is false for them: read `code` structurally.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```ts
|
|
314
|
+
* import { PartialSendConflictError, isPossiblyCommittedSendOutcome } from '@unicitylabs/sphere-sdk';
|
|
315
|
+
*
|
|
316
|
+
* try {
|
|
317
|
+
* await sphere.payments.send({ recipient: '@alice', amount: '1000000', coinId });
|
|
318
|
+
* } catch (err) {
|
|
319
|
+
* if (err instanceof PartialSendConflictError) {
|
|
320
|
+
* // Part of the amount already left the wallet and is final. Only err.remainingAmount is still owed:
|
|
321
|
+
* // if you pay it, do it as a NEW send of exactly that amount, never the original amount.
|
|
322
|
+
* showToast(`Partly sent: ${err.remainingAmount} base units were not sent`);
|
|
323
|
+
* } else if (isPossiblyCommittedSendOutcome(err)) {
|
|
324
|
+
* // The money may already have left the wallet: never call send() again for this payment.
|
|
325
|
+
* showToast('Sent, waiting for confirmation');
|
|
326
|
+
* } else {
|
|
327
|
+
* switch ((err as { code?: unknown } | null)?.code) {
|
|
328
|
+
* case 'SEND_INSUFFICIENT_BALANCE': showToast('Not enough funds'); break;
|
|
329
|
+
* case 'INVALID_RECIPIENT': showToast('Recipient not found'); break;
|
|
330
|
+
* case 'TRANSPORT_ERROR': showToast('Network connection issue'); break;
|
|
331
|
+
* default: showToast(err instanceof Error ? err.message : String(err));
|
|
332
|
+
* }
|
|
333
|
+
* }
|
|
334
|
+
* }
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'TRANSFER_CONFLICT' | 'CERTIFICATION_UNCONFIRMED' | 'CHECKPOINT_PERSIST_FAILED' | 'SPLIT_CHECKPOINT_LOST' | 'CHECKPOINT_TRUSTBASE_MISMATCH' | 'STORAGE_ERROR' | 'SEND_SYNC_PENDING' | 'SEND_PARTIALLY_COMPLETED' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'INVALID_AMOUNT' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE' | 'PAYMENTS_NOT_COMPOSED' | 'SIGNING_ERROR' | 'SEND_QUEUE_TIMEOUT' | 'SEND_INSUFFICIENT_BALANCE' | 'SEND_RESERVATION_CANCELLED' | 'SEND_QUEUE_FULL' | 'MODULE_DESTROYED' | 'REENTRANT_GATE' | 'INVOICE_NO_TARGETS' | 'INVOICE_INVALID_ADDRESS' | 'INVOICE_NO_ASSETS' | 'INVOICE_INVALID_ASSET' | 'INVOICE_INVALID_AMOUNT' | 'INVOICE_INVALID_COIN' | 'INVOICE_INVALID_NFT' | 'INVOICE_PAST_DUE_DATE' | 'INVOICE_DUPLICATE_ADDRESS' | 'INVOICE_DUPLICATE_COIN' | 'INVOICE_DUPLICATE_NFT' | 'INVOICE_MINT_FAILED' | 'INVOICE_INVALID_PROOF' | 'INVOICE_WRONG_TOKEN_TYPE' | 'INVOICE_INVALID_DATA' | 'INVOICE_ALREADY_EXISTS' | 'INVOICE_NOT_FOUND' | 'INVOICE_NOT_TARGET' | 'INVOICE_ALREADY_CLOSED' | 'INVOICE_ALREADY_CANCELLED' | 'INVOICE_ORACLE_REQUIRED' | 'INVOICE_TERMINATED' | 'INVOICE_INVALID_TARGET' | 'INVOICE_INVALID_ASSET_INDEX' | 'INVOICE_RETURN_EXCEEDS_BALANCE' | 'INVOICE_INVALID_DELIVERY_METHOD' | 'INVOICE_INVALID_REFUND_ADDRESS' | 'INVOICE_INVALID_CONTACT' | 'INVOICE_INVALID_ID' | 'INVOICE_TOO_MANY_TARGETS' | 'INVOICE_TOO_MANY_ASSETS' | 'INVOICE_MEMO_TOO_LONG' | 'INVOICE_TERMS_TOO_LARGE' | 'INVOICE_NOT_TERMINATED' | 'INVOICE_NOT_CANCELLED' | 'INVOICE_STORAGE_FAILED' | 'RATE_LIMITED' | 'COMMUNICATIONS_UNAVAILABLE' | 'SWAP_INVALID_DEAL' | 'SWAP_INVALID_MANIFEST' | 'SWAP_NOT_FOUND' | 'SWAP_WRONG_STATE' | 'SWAP_RESOLVE_FAILED' | 'SWAP_DM_SEND_FAILED' | 'SWAP_ESCROW_REJECTED' | 'SWAP_DEPOSIT_FAILED' | 'SWAP_PAYOUT_VERIFICATION_FAILED' | 'SWAP_ALREADY_EXISTS' | 'SWAP_ALREADY_COMPLETED' | 'SWAP_ALREADY_CANCELLED' | 'SWAP_TIMEOUT' | 'SWAP_LIMIT_EXCEEDED' | 'SWAP_ALREADY_INITIALIZED' | 'SWAP_MODULE_DESTROYED' | 'SWAP_NOT_INITIALIZED';
|
|
338
|
+
declare class SphereError extends Error {
|
|
339
|
+
readonly code: SphereErrorCode;
|
|
340
|
+
readonly cause?: unknown;
|
|
341
|
+
/**
|
|
342
|
+
* #441 deferred-paid linkage: the transferId of the possibly-committed send,
|
|
343
|
+
* stamped by `sendOnce` before the error leaves so a payment-request consumer
|
|
344
|
+
* can durably journal request→transfer and resolve 'paid' only when that
|
|
345
|
+
* transfer actually completes (never optimistically). Present ONLY on
|
|
346
|
+
* possibly-committed outcomes ({@link isPossiblyCommittedSendOutcome}).
|
|
347
|
+
*/
|
|
348
|
+
transferId?: string;
|
|
349
|
+
constructor(message: string, code: SphereErrorCode, cause?: unknown);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* #677: a send that PARTIALLY completed before losing a source to a concurrent
|
|
353
|
+
* transfer. At least one earlier leg certified on-chain and was journaled for
|
|
354
|
+
* delivery (its {@link committedTokenIds}) — that value has irreversibly left
|
|
355
|
+
* the wallet — but a LATER leg raised `TransferConflictError` (a lost race), and
|
|
356
|
+
* `send()` could NOT COMPLETE the {@link remainingAmount} from the remaining live
|
|
357
|
+
* sources. This is the fallback after the internal remainder re-plan gave up —
|
|
358
|
+
* either insufficient funds OR a transient/transport error during the re-plan
|
|
359
|
+
* (the underlying reason is on `cause`), not necessarily an "out of funds" state.
|
|
360
|
+
*
|
|
361
|
+
* Distinct from `TransferConflictError` on purpose: a bare conflict makes the
|
|
362
|
+
* caller re-send the FULL amount, paying the already-delivered leg a second
|
|
363
|
+
* time. Catching THIS type (or `code === 'SEND_PARTIALLY_COMPLETED'`) tells the
|
|
364
|
+
* caller/UI: the delivered legs are final, the conflicted intent stays OPEN
|
|
365
|
+
* (resume converges its certified legs), and only the REMAINDER
|
|
366
|
+
* ({@link remainingAmount}) may be re-planned — under a NEW transferId, never
|
|
367
|
+
* re-sending the whole amount.
|
|
368
|
+
*
|
|
369
|
+
* NOT a subclass of `TransferConflictError` by design: existing conflict
|
|
370
|
+
* handlers that re-send in full must NOT treat this as an ordinary conflict.
|
|
371
|
+
*/
|
|
372
|
+
declare class PartialSendConflictError extends SphereError {
|
|
373
|
+
/**
|
|
374
|
+
* The FIRST partial attempt's transferId — its intent stays open for resume,
|
|
375
|
+
* and it is the §6 handoff anchor. NOTE: `send()` may re-plan the remainder across
|
|
376
|
+
* SEVERAL internal attempts before giving up, so {@link committedTokenIds} can
|
|
377
|
+
* span MULTIPLE transferIds — they do NOT all map to this single id.
|
|
378
|
+
*/
|
|
379
|
+
readonly transferId: string;
|
|
380
|
+
/**
|
|
381
|
+
* Source token ids whose spend already certified on-chain (and whose finished
|
|
382
|
+
* output blob is journaled for delivery). Their value has already been
|
|
383
|
+
* delivered; NEVER re-send these. May accumulate across several internal
|
|
384
|
+
* remainder-re-plan attempts (so not all are journaled under {@link transferId}).
|
|
385
|
+
*/
|
|
386
|
+
readonly committedTokenIds: readonly string[];
|
|
387
|
+
/**
|
|
388
|
+
* The still-undelivered portion (base units, decimal string) — `send()` could
|
|
389
|
+
* not COMPLETE it from the remaining live sources (insufficient funds or a
|
|
390
|
+
* transient error; see `cause`). Re-plan ONLY this amount, under a new
|
|
391
|
+
* transferId; the delivered legs converge via the recipient's §6 claim.
|
|
392
|
+
*/
|
|
393
|
+
readonly remainingAmount: string;
|
|
394
|
+
constructor(message: string, transferId: string, committedTokenIds: readonly string[], remainingAmount: string, cause?: unknown);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* #441: true when a send failed with an outcome where the payment has (or may
|
|
398
|
+
* have) irreversibly left the wallet — a post-commit sync-pending / keep-open
|
|
399
|
+
* certification state, or a `PartialSendConflictError`. Such a send completes (or
|
|
400
|
+
* has already partially completed) via resume/claim and MUST NOT be re-sent, so
|
|
401
|
+
* a persisted "paid" state must stay non-payable. A `false` result is a clean
|
|
402
|
+
* pre-commit failure — nothing left the wallet, safe to re-pay.
|
|
403
|
+
*/
|
|
404
|
+
declare function isPossiblyCommittedSendOutcome(err: unknown): boolean;
|
|
405
|
+
/**
|
|
406
|
+
* Type guard to check if an error is a SphereError
|
|
407
|
+
*/
|
|
408
|
+
declare function isSphereError(err: unknown): err is SphereError;
|
|
409
|
+
|
|
182
410
|
interface SendRequest {
|
|
183
411
|
recipient: string;
|
|
184
412
|
amount: string;
|
|
@@ -195,6 +423,40 @@ interface MintResult {
|
|
|
195
423
|
tokenId?: string;
|
|
196
424
|
error?: string;
|
|
197
425
|
}
|
|
426
|
+
/** Custom-genesis mint (a TokenPlugin's token), always to this wallet; `assets` = what the payload declares. */
|
|
427
|
+
interface MintCustomRequest {
|
|
428
|
+
readonly tokenType: Uint8Array;
|
|
429
|
+
readonly salt: Uint8Array;
|
|
430
|
+
readonly data: Uint8Array;
|
|
431
|
+
readonly justification?: Uint8Array;
|
|
432
|
+
readonly assets: readonly {
|
|
433
|
+
coinId: string;
|
|
434
|
+
amount: bigint;
|
|
435
|
+
}[];
|
|
436
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
437
|
+
}
|
|
438
|
+
/** Burn a held token to `BurnPredicate(sha256(reasonBytes))` with the bytes as aux data. */
|
|
439
|
+
interface BurnRequest {
|
|
440
|
+
readonly tokenId: string;
|
|
441
|
+
readonly reasonBytes: Uint8Array;
|
|
442
|
+
}
|
|
443
|
+
interface BurnResult {
|
|
444
|
+
success: boolean;
|
|
445
|
+
burnId: string;
|
|
446
|
+
tokenId: string;
|
|
447
|
+
/** The burned blob, the proof of the burn: persist it, then `acknowledgeBurn(burnId)`. */
|
|
448
|
+
burnedToken?: Uint8Array;
|
|
449
|
+
error?: string;
|
|
450
|
+
}
|
|
451
|
+
/** A burn not yet acknowledged: in flight (`burnedToken` null), certified, or settled. */
|
|
452
|
+
interface PendingBurn {
|
|
453
|
+
readonly burnId: string;
|
|
454
|
+
readonly tokenId: string;
|
|
455
|
+
readonly reasonBytes: Uint8Array;
|
|
456
|
+
readonly burnedToken: Uint8Array | null;
|
|
457
|
+
readonly settled: boolean;
|
|
458
|
+
readonly createdAt: number;
|
|
459
|
+
}
|
|
198
460
|
/** #785: `content` uses ERC-721 field names; `sign` (default true) signs as creator with this wallet's chain key. */
|
|
199
461
|
interface MintNftRequest {
|
|
200
462
|
readonly content: NftContent;
|
|
@@ -286,6 +548,8 @@ interface PaymentsV2 {
|
|
|
286
548
|
}): Token[];
|
|
287
549
|
coinless(): CoinlessToken[];
|
|
288
550
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
551
|
+
/** The genesis mint reason of one held token; null when it was minted without one. Same contract as tokenData. */
|
|
552
|
+
tokenJustification(tokenId: string): Promise<Uint8Array | null>;
|
|
289
553
|
/** One held token read as an NFT; null = its payload is not a recognised NFT. `creator` is only CLAIMED unless `signature` is 'valid'. Throws VALIDATION_ERROR when not held, STORAGE_ERROR when its blob is missing (same contract as tokenData). */
|
|
290
554
|
nft(tokenId: string): Promise<NftView | null>;
|
|
291
555
|
/** Batch read for list views. Ids not held, blobs missing or undecodable, and non-NFT payloads are simply absent from the map. Throws only on a transport failure. */
|
|
@@ -300,6 +564,10 @@ interface PaymentsV2 {
|
|
|
300
564
|
sendCoinless(req: SendWholeTokenRequest): Promise<TransferResult>;
|
|
301
565
|
mint(coinId: string, amount: bigint): Promise<MintResult>;
|
|
302
566
|
mintNft(request: MintNftRequest): Promise<MintResult>;
|
|
567
|
+
mintCustom(request: MintCustomRequest): Promise<MintResult>;
|
|
568
|
+
burn(request: BurnRequest): Promise<BurnResult>;
|
|
569
|
+
pendingBurns(): Promise<PendingBurn[]>;
|
|
570
|
+
acknowledgeBurn(burnId: string): Promise<void>;
|
|
303
571
|
receive(): Promise<{
|
|
304
572
|
transfers: IncomingTransfer[];
|
|
305
573
|
}>;
|
|
@@ -309,113 +577,6 @@ interface PaymentsV2 {
|
|
|
309
577
|
readonly requests: PaymentsRequestsApi;
|
|
310
578
|
}
|
|
311
579
|
|
|
312
|
-
/**
|
|
313
|
-
* SDK Error Types
|
|
314
|
-
*
|
|
315
|
-
* Structured error codes for programmatic error handling in UI.
|
|
316
|
-
* UI can switch on error.code to show appropriate user-facing messages.
|
|
317
|
-
*
|
|
318
|
-
* Errors thrown by provider code (the `./impl/*` bundles) are a different `SphereError` class
|
|
319
|
-
* copy, so `instanceof SphereError` / `isSphereError()` is false for them: read `code` structurally.
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* ```ts
|
|
323
|
-
* import { PartialSendConflictError, isPossiblyCommittedSendOutcome } from '@unicitylabs/sphere-sdk';
|
|
324
|
-
*
|
|
325
|
-
* try {
|
|
326
|
-
* await sphere.payments.send({ recipient: '@alice', amount: '1000000', coinId });
|
|
327
|
-
* } catch (err) {
|
|
328
|
-
* if (err instanceof PartialSendConflictError) {
|
|
329
|
-
* // Part of the amount already left the wallet and is final. Only err.remainingAmount is still owed:
|
|
330
|
-
* // if you pay it, do it as a NEW send of exactly that amount, never the original amount.
|
|
331
|
-
* showToast(`Partly sent: ${err.remainingAmount} base units were not sent`);
|
|
332
|
-
* } else if (isPossiblyCommittedSendOutcome(err)) {
|
|
333
|
-
* // The money may already have left the wallet: never call send() again for this payment.
|
|
334
|
-
* showToast('Sent, waiting for confirmation');
|
|
335
|
-
* } else {
|
|
336
|
-
* switch ((err as { code?: unknown } | null)?.code) {
|
|
337
|
-
* case 'SEND_INSUFFICIENT_BALANCE': showToast('Not enough funds'); break;
|
|
338
|
-
* case 'INVALID_RECIPIENT': showToast('Recipient not found'); break;
|
|
339
|
-
* case 'TRANSPORT_ERROR': showToast('Network connection issue'); break;
|
|
340
|
-
* default: showToast(err instanceof Error ? err.message : String(err));
|
|
341
|
-
* }
|
|
342
|
-
* }
|
|
343
|
-
* }
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
type SphereErrorCode = 'NOT_INITIALIZED' | 'ALREADY_INITIALIZED' | 'INVALID_CONFIG' | 'INVALID_IDENTITY' | 'INSUFFICIENT_BALANCE' | 'INVALID_RECIPIENT' | 'TRANSFER_FAILED' | 'TRANSFER_CONFLICT' | 'CERTIFICATION_UNCONFIRMED' | 'CHECKPOINT_PERSIST_FAILED' | 'SPLIT_CHECKPOINT_LOST' | 'CHECKPOINT_TRUSTBASE_MISMATCH' | 'STORAGE_ERROR' | 'SEND_SYNC_PENDING' | 'SEND_PARTIALLY_COMPLETED' | 'TRANSPORT_ERROR' | 'AGGREGATOR_ERROR' | 'VALIDATION_ERROR' | 'INVALID_AMOUNT' | 'NETWORK_ERROR' | 'TIMEOUT' | 'DECRYPTION_ERROR' | 'MODULE_NOT_AVAILABLE' | 'PAYMENTS_NOT_COMPOSED' | 'SIGNING_ERROR' | 'SEND_QUEUE_TIMEOUT' | 'SEND_INSUFFICIENT_BALANCE' | 'SEND_RESERVATION_CANCELLED' | 'SEND_QUEUE_FULL' | 'MODULE_DESTROYED' | 'REENTRANT_GATE' | 'INVOICE_NO_TARGETS' | 'INVOICE_INVALID_ADDRESS' | 'INVOICE_NO_ASSETS' | 'INVOICE_INVALID_ASSET' | 'INVOICE_INVALID_AMOUNT' | 'INVOICE_INVALID_COIN' | 'INVOICE_INVALID_NFT' | 'INVOICE_PAST_DUE_DATE' | 'INVOICE_DUPLICATE_ADDRESS' | 'INVOICE_DUPLICATE_COIN' | 'INVOICE_DUPLICATE_NFT' | 'INVOICE_MINT_FAILED' | 'INVOICE_INVALID_PROOF' | 'INVOICE_WRONG_TOKEN_TYPE' | 'INVOICE_INVALID_DATA' | 'INVOICE_ALREADY_EXISTS' | 'INVOICE_NOT_FOUND' | 'INVOICE_NOT_TARGET' | 'INVOICE_ALREADY_CLOSED' | 'INVOICE_ALREADY_CANCELLED' | 'INVOICE_ORACLE_REQUIRED' | 'INVOICE_TERMINATED' | 'INVOICE_INVALID_TARGET' | 'INVOICE_INVALID_ASSET_INDEX' | 'INVOICE_RETURN_EXCEEDS_BALANCE' | 'INVOICE_INVALID_DELIVERY_METHOD' | 'INVOICE_INVALID_REFUND_ADDRESS' | 'INVOICE_INVALID_CONTACT' | 'INVOICE_INVALID_ID' | 'INVOICE_TOO_MANY_TARGETS' | 'INVOICE_TOO_MANY_ASSETS' | 'INVOICE_MEMO_TOO_LONG' | 'INVOICE_TERMS_TOO_LARGE' | 'INVOICE_NOT_TERMINATED' | 'INVOICE_NOT_CANCELLED' | 'INVOICE_STORAGE_FAILED' | 'RATE_LIMITED' | 'COMMUNICATIONS_UNAVAILABLE' | 'SWAP_INVALID_DEAL' | 'SWAP_INVALID_MANIFEST' | 'SWAP_NOT_FOUND' | 'SWAP_WRONG_STATE' | 'SWAP_RESOLVE_FAILED' | 'SWAP_DM_SEND_FAILED' | 'SWAP_ESCROW_REJECTED' | 'SWAP_DEPOSIT_FAILED' | 'SWAP_PAYOUT_VERIFICATION_FAILED' | 'SWAP_ALREADY_EXISTS' | 'SWAP_ALREADY_COMPLETED' | 'SWAP_ALREADY_CANCELLED' | 'SWAP_TIMEOUT' | 'SWAP_LIMIT_EXCEEDED' | 'SWAP_ALREADY_INITIALIZED' | 'SWAP_MODULE_DESTROYED' | 'SWAP_NOT_INITIALIZED';
|
|
347
|
-
declare class SphereError extends Error {
|
|
348
|
-
readonly code: SphereErrorCode;
|
|
349
|
-
readonly cause?: unknown;
|
|
350
|
-
/**
|
|
351
|
-
* #441 deferred-paid linkage: the transferId of the possibly-committed send,
|
|
352
|
-
* stamped by `sendOnce` before the error leaves so a payment-request consumer
|
|
353
|
-
* can durably journal request→transfer and resolve 'paid' only when that
|
|
354
|
-
* transfer actually completes (never optimistically). Present ONLY on
|
|
355
|
-
* possibly-committed outcomes ({@link isPossiblyCommittedSendOutcome}).
|
|
356
|
-
*/
|
|
357
|
-
transferId?: string;
|
|
358
|
-
constructor(message: string, code: SphereErrorCode, cause?: unknown);
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* #677: a send that PARTIALLY completed before losing a source to a concurrent
|
|
362
|
-
* transfer. At least one earlier leg certified on-chain and was journaled for
|
|
363
|
-
* delivery (its {@link committedTokenIds}) — that value has irreversibly left
|
|
364
|
-
* the wallet — but a LATER leg raised `TransferConflictError` (a lost race), and
|
|
365
|
-
* `send()` could NOT COMPLETE the {@link remainingAmount} from the remaining live
|
|
366
|
-
* sources. This is the fallback after the internal remainder re-plan gave up —
|
|
367
|
-
* either insufficient funds OR a transient/transport error during the re-plan
|
|
368
|
-
* (the underlying reason is on `cause`), not necessarily an "out of funds" state.
|
|
369
|
-
*
|
|
370
|
-
* Distinct from `TransferConflictError` on purpose: a bare conflict makes the
|
|
371
|
-
* caller re-send the FULL amount, paying the already-delivered leg a second
|
|
372
|
-
* time. Catching THIS type (or `code === 'SEND_PARTIALLY_COMPLETED'`) tells the
|
|
373
|
-
* caller/UI: the delivered legs are final, the conflicted intent stays OPEN
|
|
374
|
-
* (resume converges its certified legs), and only the REMAINDER
|
|
375
|
-
* ({@link remainingAmount}) may be re-planned — under a NEW transferId, never
|
|
376
|
-
* re-sending the whole amount.
|
|
377
|
-
*
|
|
378
|
-
* NOT a subclass of `TransferConflictError` by design: existing conflict
|
|
379
|
-
* handlers that re-send in full must NOT treat this as an ordinary conflict.
|
|
380
|
-
*/
|
|
381
|
-
declare class PartialSendConflictError extends SphereError {
|
|
382
|
-
/**
|
|
383
|
-
* The FIRST partial attempt's transferId — its intent stays open for resume,
|
|
384
|
-
* and it is the §6 handoff anchor. NOTE: `send()` may re-plan the remainder across
|
|
385
|
-
* SEVERAL internal attempts before giving up, so {@link committedTokenIds} can
|
|
386
|
-
* span MULTIPLE transferIds — they do NOT all map to this single id.
|
|
387
|
-
*/
|
|
388
|
-
readonly transferId: string;
|
|
389
|
-
/**
|
|
390
|
-
* Source token ids whose spend already certified on-chain (and whose finished
|
|
391
|
-
* output blob is journaled for delivery). Their value has already been
|
|
392
|
-
* delivered; NEVER re-send these. May accumulate across several internal
|
|
393
|
-
* remainder-re-plan attempts (so not all are journaled under {@link transferId}).
|
|
394
|
-
*/
|
|
395
|
-
readonly committedTokenIds: readonly string[];
|
|
396
|
-
/**
|
|
397
|
-
* The still-undelivered portion (base units, decimal string) — `send()` could
|
|
398
|
-
* not COMPLETE it from the remaining live sources (insufficient funds or a
|
|
399
|
-
* transient error; see `cause`). Re-plan ONLY this amount, under a new
|
|
400
|
-
* transferId; the delivered legs converge via the recipient's §6 claim.
|
|
401
|
-
*/
|
|
402
|
-
readonly remainingAmount: string;
|
|
403
|
-
constructor(message: string, transferId: string, committedTokenIds: readonly string[], remainingAmount: string, cause?: unknown);
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* #441: true when a send failed with an outcome where the payment has (or may
|
|
407
|
-
* have) irreversibly left the wallet — a post-commit sync-pending / keep-open
|
|
408
|
-
* certification state, or a `PartialSendConflictError`. Such a send completes (or
|
|
409
|
-
* has already partially completed) via resume/claim and MUST NOT be re-sent, so
|
|
410
|
-
* a persisted "paid" state must stay non-payable. A `false` result is a clean
|
|
411
|
-
* pre-commit failure — nothing left the wallet, safe to re-pay.
|
|
412
|
-
*/
|
|
413
|
-
declare function isPossiblyCommittedSendOutcome(err: unknown): boolean;
|
|
414
|
-
/**
|
|
415
|
-
* Type guard to check if an error is a SphereError
|
|
416
|
-
*/
|
|
417
|
-
declare function isSphereError(err: unknown): err is SphereError;
|
|
418
|
-
|
|
419
580
|
interface MasterKey {
|
|
420
581
|
privateKey: string;
|
|
421
582
|
chainCode: string;
|
|
@@ -2399,52 +2560,6 @@ interface DiscoverAddressesResult {
|
|
|
2399
2560
|
aborted: boolean;
|
|
2400
2561
|
}
|
|
2401
2562
|
|
|
2402
|
-
/**
|
|
2403
|
-
* token-engine/engine.ts — the FROZEN public port (ITokenEngine) + its config.
|
|
2404
|
-
*
|
|
2405
|
-
* This is the contract both migration tracks build against. It is sphere-domain
|
|
2406
|
-
* only (see types.ts). The granular, SDK-typed steps (buildMint, submit,
|
|
2407
|
-
* awaitProof, certify, …) are an INTERNAL concern of the real adapter and are
|
|
2408
|
-
* intentionally NOT part of this public interface.
|
|
2409
|
-
*/
|
|
2410
|
-
|
|
2411
|
-
/**
|
|
2412
|
-
* Engine construction config. Sphere-domain inputs only: the factory maps
|
|
2413
|
-
* `network` → SDK NetworkId, builds the aggregator client from `aggregatorUrl`,
|
|
2414
|
-
* the signing service from `privateKey`, and loads the trust base internally.
|
|
2415
|
-
*
|
|
2416
|
-
* NOTE: trust-base sourcing + proof-policy defaults are finalized in Phase 0.8;
|
|
2417
|
-
* this shape may gain fields there without affecting the ITokenEngine contract.
|
|
2418
|
-
*/
|
|
2419
|
-
/**
|
|
2420
|
-
* The web-`Worker` subset the verification pool drives (in Node wrap a `worker_threads.Worker`).
|
|
2421
|
-
* A browser `Worker` has these members, but under `strictFunctionTypes` its `ErrorEvent` /
|
|
2422
|
-
* `MessageEvent` handler types are not assignable here (TS2322), so it needs a cast or a thin
|
|
2423
|
-
* wrapper. Payloads stay `unknown` so no base-SDK wire type reaches this port.
|
|
2424
|
-
*/
|
|
2425
|
-
interface VerificationWorker {
|
|
2426
|
-
onerror: ((event: {
|
|
2427
|
-
message: string;
|
|
2428
|
-
}) => void) | null;
|
|
2429
|
-
onmessage: ((event: {
|
|
2430
|
-
data: unknown;
|
|
2431
|
-
}) => void) | null;
|
|
2432
|
-
postMessage(message: unknown): void;
|
|
2433
|
-
terminate(): void;
|
|
2434
|
-
}
|
|
2435
|
-
/**
|
|
2436
|
-
* Opt-in PARALLEL token verification (state-transition-sdk 2.0.2+): per-transfer
|
|
2437
|
-
* work fans out to a worker pool instead of walking the calling thread. You
|
|
2438
|
-
* author and bundle the entry script, and its predicate verifier MUST match the
|
|
2439
|
-
* engine's or the verdict silently diverges — docs/VERIFICATION-WORKERS.md.
|
|
2440
|
-
*/
|
|
2441
|
-
interface VerificationWorkerConfig {
|
|
2442
|
-
/** Spawn ONE worker running that entry script. Called lazily, up to `poolSize` times. */
|
|
2443
|
-
readonly createWorker: () => VerificationWorker;
|
|
2444
|
-
/** Maximum workers in the pool (default 4). Workers are reused across verify() calls. */
|
|
2445
|
-
readonly poolSize?: number;
|
|
2446
|
-
}
|
|
2447
|
-
|
|
2448
2563
|
interface ScopedKV {
|
|
2449
2564
|
get<T>(key: string): Promise<T | null>;
|
|
2450
2565
|
set<T>(key: string, value: T): Promise<void>;
|
|
@@ -3035,6 +3150,8 @@ interface SphereCreateOptions extends SphereWalletApiOptions {
|
|
|
3035
3150
|
* {@link SphereInitOptions.verification}. Omit for the sequential verifier.
|
|
3036
3151
|
*/
|
|
3037
3152
|
verification?: VerificationWorkerConfig;
|
|
3153
|
+
/** Token plugins: mint-reason verifiers registered into every engine this Sphere builds. */
|
|
3154
|
+
plugins?: readonly TokenPlugin[];
|
|
3038
3155
|
}
|
|
3039
3156
|
/** Options for loading existing wallet */
|
|
3040
3157
|
interface SphereLoadOptions extends SphereWalletApiOptions {
|
|
@@ -3078,6 +3195,8 @@ interface SphereLoadOptions extends SphereWalletApiOptions {
|
|
|
3078
3195
|
* {@link SphereInitOptions.verification}. Omit for the sequential verifier.
|
|
3079
3196
|
*/
|
|
3080
3197
|
verification?: VerificationWorkerConfig;
|
|
3198
|
+
/** Token plugins: mint-reason verifiers registered into every engine this Sphere builds. */
|
|
3199
|
+
plugins?: readonly TokenPlugin[];
|
|
3081
3200
|
}
|
|
3082
3201
|
/** Options for importing a wallet */
|
|
3083
3202
|
interface SphereImportOptions extends SphereWalletApiOptions {
|
|
@@ -3151,6 +3270,8 @@ interface SphereImportOptions extends SphereWalletApiOptions {
|
|
|
3151
3270
|
* registration) still rejects, and the erased wallet is not restored: keep a backup of it.
|
|
3152
3271
|
*/
|
|
3153
3272
|
overwrite?: boolean;
|
|
3273
|
+
/** Token plugins: mint-reason verifiers registered into every engine this Sphere builds. */
|
|
3274
|
+
plugins?: readonly TokenPlugin[];
|
|
3154
3275
|
}
|
|
3155
3276
|
/** Options for unified init (auto-create or load) */
|
|
3156
3277
|
interface SphereInitOptions extends SphereWalletApiOptions {
|
|
@@ -3220,6 +3341,8 @@ interface SphereInitOptions extends SphereWalletApiOptions {
|
|
|
3220
3341
|
* {@link VerificationWorkerConfig}); `sphere.destroy()` terminates the pool.
|
|
3221
3342
|
*/
|
|
3222
3343
|
verification?: VerificationWorkerConfig;
|
|
3344
|
+
/** Token plugins: mint-reason verifiers registered into every engine this Sphere builds. */
|
|
3345
|
+
plugins?: readonly TokenPlugin[];
|
|
3223
3346
|
}
|
|
3224
3347
|
/** Result of init operation */
|
|
3225
3348
|
interface SphereInitResult {
|
|
@@ -3307,6 +3430,8 @@ declare class Sphere {
|
|
|
3307
3430
|
* the rebuild after an api-key change share one pool configuration.
|
|
3308
3431
|
*/
|
|
3309
3432
|
private _verification;
|
|
3433
|
+
/** Token plugins (SphereInitOptions.plugins), applied to every engine like _verification. */
|
|
3434
|
+
private _plugins;
|
|
3310
3435
|
/** This Sphere's OWN token registry. Disposed by destroy(); never the process global. */
|
|
3311
3436
|
private _registry;
|
|
3312
3437
|
private eventHandlers;
|
|
@@ -5022,4 +5147,4 @@ declare function normalizeAddress(address: string): string;
|
|
|
5022
5147
|
*/
|
|
5023
5148
|
declare function addressesMatch(a: string, b: string): boolean;
|
|
5024
5149
|
|
|
5025
|
-
export { AUTH_CHALLENGE_PREFIX, type AddressInfo, type AddressType, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type Asset, type BaseProvider, type BroadcastHandler, type BroadcastMessage, COIN_TYPES, ChallengeTemplateError, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, type CoinlessToken, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_DERIVATION_PATH, DEFAULT_GROUP_RELAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, FIELD_ENCRYPTION_HKDF_INFO, FIELD_ENVELOPE_MAX_BYTES, FIELD_ENVELOPE_NONCE_BYTES, FIELD_ENVELOPE_PREFIX, type FullIdentity, type GetConversationPageOptions, GroupChatModule, type GroupChatModuleConfig, type GroupChatModuleDependencies, type GroupData, type GroupMemberData, type GroupMessageData, GroupRole, GroupVisibility, type HealthCheckFn, type HistoryRecord, type Identity, type IdentityConfig, type IncomingBroadcast, type IncomingMessage, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type IntentStatus, type IntentType, LIMITS, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LogHandler, type LogLevel, type LoggerConfig, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintNftRequest, NETWORKS, NFT_DOCUMENT_MEDIA_TYPE, NFT_LINK_TAG, NFT_MAX_PAYLOAD_BYTES, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, NIP29_KINDS, NOSTR_EVENT_KINDS, NO_PAYMENTS, type NetworkHealthResult, type NetworkType, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftSignatureContext, type NftSignatureStatus, type NftView, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type ParsedAddress, PartialSendConflictError, type PeerInfo, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type RegistryNetwork, SIGN_MESSAGE_PREFIX, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type StorageProvider, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPrice, TokenRegistry, type TokenStatus, type TokenTransferDetail, type TrackedAddress, type TrackedAddressEntry, type HistoryRecord as TransactionHistoryEntry, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type WalletApiOption, type WalletApiTransportConfig, type WalletInfo, type WalletJSON, type WalletJSONExportOptions, type WalletSource, addressesMatch, assertFieldEnvelopeShape, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, coinIdsMatch, createCommunicationsModule, createGroupChatModule, createKeyPair, createMarketModule, createPriceProvider, createSphere, decrypt, decryptField, decryptFieldBytes, decryptJson, decryptMnemonic, decryptSimple, decryptTextFormatKey, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveFieldEncryptionKey, deriveKeyAtPath, doubleSha256, encodeNftContent, encrypt, encryptField, encryptFieldBytes, encryptMnemonic, encryptSimple, extractFromText, findPattern, formatAmount, generateAddressFromMasterKey, generateMasterKey, generateMnemonic, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getPublicKey, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenName, getTokenSymbol, hash160, hashSignMessage, hexToBytes, identityFromMnemonicSync, initSphere, isKnownToken, isNftDocumentLink, isPossiblyCommittedSendOutcome, isSphereError, isTextWalletEncrypted, isValidAddress, isValidDirectAddress, isValidNametag, isValidPrivateKey, isWalletTextFormat, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeCoinId, parseAddress, parseAndDecryptWalletText, parseNftDocument, parseNftPayload, parseTokenAmount, parseWalletText, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, safeParseTokenAmount, sha256, signMessage, sleep, sphereExists, toHumanReadable, validateMnemonic, verifyChallengeTemplate, verifyNftLinkContent, verifySignedMessage };
|
|
5150
|
+
export { AUTH_CHALLENGE_PREFIX, type AddressInfo, type AddressType, type AggregatorEvent, type AggregatorEventCallback, type AggregatorEventType, type AggregatorProvider, type Asset, type BaseProvider, type BroadcastHandler, type BroadcastMessage, type BurnParams, COIN_TYPES, ChallengeTemplateError, type CheckNetworkHealthOptions, CoinGeckoPriceProvider, type CoinlessToken, CommunicationsModule, type CommunicationsModuleConfig, type CommunicationsModuleDependencies, type ComposingIndicator, type ConversationPage, type CreateGroupOptions, DEFAULT_AGGREGATOR_TIMEOUT, DEFAULT_DERIVATION_PATH, DEFAULT_GROUP_RELAYS, DEFAULT_MARKET_API_URL, DEFAULT_NOSTR_RELAYS, type DecryptionProgressCallback, type DerivationMode, type DirectMessage, type DiscoverAddressProgress, type DiscoverAddressesOptions, type DiscoverAddressesResult, type DiscoveredAddress, type EncryptedData, FIELD_ENCRYPTION_HKDF_INFO, FIELD_ENVELOPE_MAX_BYTES, FIELD_ENVELOPE_NONCE_BYTES, FIELD_ENVELOPE_PREFIX, type FullIdentity, type GetConversationPageOptions, GroupChatModule, type GroupChatModuleConfig, type GroupChatModuleDependencies, type GroupData, type GroupMemberData, type GroupMessageData, GroupRole, GroupVisibility, type HealthCheckFn, type HistoryRecord, type Identity, type IdentityConfig, type IncomingBroadcast, type IncomingMessage, type IncomingTransfer, type InitProgress, type InitProgressCallback, type InitProgressStep, type IntentStatus, type IntentType, LIMITS, type LegacyFileParseResult, type LegacyFileParsedData, type LegacyFileType, type LogHandler, type LogLevel, type LoggerConfig, type MarketIntent, MarketModule, type MarketModuleConfig, type MarketModuleDependencies, type MessageHandler, type MintNftRequest, NETWORKS, NFT_DOCUMENT_MEDIA_TYPE, NFT_LINK_TAG, NFT_MAX_PAYLOAD_BYTES, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, NIP29_KINDS, NOSTR_EVENT_KINDS, NO_PAYMENTS, type NetworkHealthResult, type NetworkType, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftSignatureContext, type NftSignatureStatus, type NftView, type OracleEvent, type OracleEventCallback, type OracleEventType, type OracleProvider, type ParsedAddress, PartialSendConflictError, type PeerInfo, type PostIntentRequest, type PostIntentResult, type PricePlatform, type PriceProvider, type PriceProviderConfig, type ProviderMetadata, type ProviderRole, type ProviderStatus, type ProviderStatusInfo, type RegistryNetwork, SIGN_MESSAGE_PREFIX, STORAGE_KEYS_ADDRESS, STORAGE_KEYS_GLOBAL, STORAGE_PREFIX, type SearchFilters, type SearchIntentResult, type SearchOptions, type SearchResult, type ServiceHealthResult, Sphere, type SphereCreateOptions, SphereError, type SphereErrorCode, type SphereEventHandler, type SphereEventMap, type SphereEventType, type SphereImportOptions, type SphereInitOptions, type SphereInitResult, type SphereLoadOptions, type SphereStatus, type StorageProvider, TEST_NOSTR_RELAYS, TIMEOUTS, type Token, type TokenDefinition, type TokenIcon, type TokenPlugin, type TokenPrice, TokenRegistry, type TokenStatus, type TokenTransferDetail, type TrackedAddress, type TrackedAddressEntry, type HistoryRecord as TransactionHistoryEntry, type TransferRequest, type TransferResult, type TransferStatus, type TransportEvent, type TransportEventCallback, type TransportEventType, type TransportProvider, type WalletApiOption, type WalletApiTransportConfig, type WalletInfo, type WalletJSON, type WalletJSONExportOptions, type WalletSource, addressesMatch, assertFieldEnvelopeShape, base58Decode, base58Encode, bytesToHex, checkNetworkHealth, coinIdsMatch, createCommunicationsModule, createGroupChatModule, createKeyPair, createMarketModule, createPriceProvider, createSphere, decrypt, decryptField, decryptFieldBytes, decryptJson, decryptMnemonic, decryptSimple, decryptTextFormatKey, decryptWithSalt, deriveAddressInfo, deriveChildKey, deriveFieldEncryptionKey, deriveKeyAtPath, doubleSha256, encodeNftContent, encrypt, encryptField, encryptFieldBytes, encryptMnemonic, encryptSimple, extractFromText, findPattern, formatAmount, generateAddressFromMasterKey, generateMasterKey, generateMnemonic, getAddressId, getAddressStorageKey, getCoinIdByName, getCoinIdBySymbol, getPublicKey, getTokenDecimals, getTokenDefinition, getTokenIconUrl, getTokenName, getTokenSymbol, hash160, hashSignMessage, hexToBytes, identityFromMnemonicSync, initSphere, isKnownToken, isNftDocumentLink, isPossiblyCommittedSendOutcome, isSphereError, isTextWalletEncrypted, isValidAddress, isValidDirectAddress, isValidNametag, isValidPrivateKey, isWalletTextFormat, loadSphere, logger, mnemonicToSeedSync, normalizeAddress, normalizeCoinId, parseAddress, parseAndDecryptWalletText, parseNftDocument, parseNftPayload, parseTokenAmount, parseWalletText, randomBytes, randomHex, randomUUID, recoverPubkeyFromSignature, ripemd160, safeParseTokenAmount, sha256, signMessage, sleep, sphereExists, toHumanReadable, validateMnemonic, verifyChallengeTemplate, verifyNftLinkContent, verifySignedMessage };
|