@unicitylabs/sphere-sdk 0.18.0-dev.2 → 0.18.0-dev.3
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-OAAY2JEA.js → chunk-7BZL7HE2.js} +3 -3
- package/dist/connect/chunks/{chunk-MQQ3TMHM.js → chunk-CJ4D6M6W.js} +2 -2
- package/dist/connect/chunks/{chunk-FGQ6CKKK.js → chunk-LDEOQNG2.js} +2 -2
- package/dist/connect/chunks/{chunk-FGQ6CKKK.js.map → chunk-LDEOQNG2.js.map} +1 -1
- package/dist/connect/chunks/{chunk-3CYK5SIU.js → chunk-WCKTUB4V.js} +1 -1
- package/dist/connect/chunks/chunk-WCKTUB4V.js.map +1 -0
- package/dist/connect/chunks/{chunk-JYBI36GK.js → chunk-WL6VYP7G.js} +2 -2
- package/dist/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +5 -5
- package/dist/connect/internal/host.js +3 -3
- package/dist/connect/internal/nft-wire.js +2 -2
- package/dist/core/index.cjs +831 -343
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +30 -1
- package/dist/core/index.d.ts +30 -1
- package/dist/core/index.js +831 -343
- 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/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.d.cts +1 -0
- package/dist/impl/nodejs/index.d.ts +1 -0
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/impl/shared/wallet-api/index.d.cts +1 -0
- package/dist/impl/shared/wallet-api/index.d.ts +1 -0
- package/dist/impl/wallet-api-v2/index.cjs +2 -1
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.d.cts +3 -0
- package/dist/impl/wallet-api-v2/index.d.ts +3 -0
- package/dist/impl/wallet-api-v2/index.js +2 -1
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +833 -343
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +832 -343
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +658 -259
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +65 -2
- package/dist/modules/payments-v2/index.d.ts +65 -2
- package/dist/modules/payments-v2/index.js +656 -259
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs +185 -65
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.d.cts +20 -3
- package/dist/token-engine/index.d.ts +20 -3
- package/dist/token-engine/index.js +184 -65
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/connect/chunks/chunk-3CYK5SIU.js.map +0 -1
- /package/dist/connect/chunks/{chunk-OAAY2JEA.js.map → chunk-7BZL7HE2.js.map} +0 -0
- /package/dist/connect/chunks/{chunk-MQQ3TMHM.js.map → chunk-CJ4D6M6W.js.map} +0 -0
- /package/dist/connect/chunks/{chunk-JYBI36GK.js.map → chunk-WL6VYP7G.js.map} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
2
2
|
import { Token as Token$1 } from '@unicitylabs/state-transition-sdk/lib/transaction/Token.js';
|
|
3
|
+
import { ITokenIssuanceVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/ITokenIssuanceVerifier.js';
|
|
3
4
|
|
|
4
5
|
declare const NFT_METADATA_TAG = 39052n;
|
|
5
6
|
declare const NFT_MEDIA_TAG = 39053n;
|
|
@@ -185,6 +186,22 @@ interface BurnParams {
|
|
|
185
186
|
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
186
187
|
readonly reasonBytes: Uint8Array;
|
|
187
188
|
}
|
|
189
|
+
/** The issuance rule of one token type, and the coins no other type may carry. */
|
|
190
|
+
interface TokenIssuancePolicy extends ITokenIssuanceVerifier {
|
|
191
|
+
/** A token carrying one of these coins counts only when it is of this type and verified. */
|
|
192
|
+
readonly coinIds: readonly CoinId[];
|
|
193
|
+
/** Must change whenever the proofs this policy accepts change, a fix to its verification code included, so wallets check held tokens again. */
|
|
194
|
+
readonly revision?: string;
|
|
195
|
+
}
|
|
196
|
+
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
197
|
+
interface TokenPlugin {
|
|
198
|
+
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
199
|
+
readonly id: string;
|
|
200
|
+
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
201
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
202
|
+
/** Issuance policies to register; a duplicate token type or coin across plugins is INVALID_CONFIG. */
|
|
203
|
+
readonly tokenIssuancePolicies?: readonly TokenIssuancePolicy[];
|
|
204
|
+
}
|
|
188
205
|
/** Plan an NFT mint (#785); `mintDataToken` then mints the plan. */
|
|
189
206
|
interface BuildNftMintParams {
|
|
190
207
|
/** The first owner's 33-byte compressed chain pubkey — the genesis recipient a signature binds. */
|
|
@@ -379,6 +396,8 @@ interface ITokenEngine {
|
|
|
379
396
|
* read its bytes via `readTokenData`. (Used e.g. for on-chain invoice tokens.)
|
|
380
397
|
*/
|
|
381
398
|
mintDataToken(params: MintDataTokenParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
399
|
+
/** Throws VALIDATION_ERROR when `mintDataToken` would refuse `params` before submitting, e.g. a reason tag no registered verifier handles. */
|
|
400
|
+
assertMintable(params: MintDataTokenParams): void;
|
|
382
401
|
/** Plan an NFT mint: encode (and optionally sign as this engine's identity) the payload and derive its token id. No chain op. */
|
|
383
402
|
buildNftMint(params: BuildNftMintParams): Promise<NftMintPlan>;
|
|
384
403
|
/** Spend a token wholesale to a recipient pubkey; returns the recipient's finished token. */
|
|
@@ -450,6 +469,7 @@ interface FullIdentity extends Identity {
|
|
|
450
469
|
readonly privateKey: string;
|
|
451
470
|
}
|
|
452
471
|
type TokenStatus = 'pending' | 'submitted' | 'confirmed' | 'transferring' | 'spent' | 'invalid';
|
|
472
|
+
type Unverified = 'pending' | 'refused';
|
|
453
473
|
interface Token {
|
|
454
474
|
readonly id: string;
|
|
455
475
|
readonly coinId: string;
|
|
@@ -476,6 +496,8 @@ interface Token {
|
|
|
476
496
|
* send self-heals instead of wedging on a stale source.
|
|
477
497
|
*/
|
|
478
498
|
suspectedSpent?: boolean;
|
|
499
|
+
/** Carries a coin an issuance policy claims without having passed that policy yet (`pending`) or at all (`refused`): shown, never spent. */
|
|
500
|
+
readonly unverified?: Unverified;
|
|
479
501
|
}
|
|
480
502
|
/**
|
|
481
503
|
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
@@ -538,6 +560,8 @@ interface Asset {
|
|
|
538
560
|
readonly fiatValueUsd: number | null;
|
|
539
561
|
/** Total fiat value in EUR */
|
|
540
562
|
readonly fiatValueEur: number | null;
|
|
563
|
+
/** Holds tokens of a claimed coin that have not passed its issuance policy yet (`pending`) or at all (`refused`): never spendable, never priced. */
|
|
564
|
+
readonly unverified?: Unverified;
|
|
541
565
|
}
|
|
542
566
|
type TransferStatus = 'pending' | 'submitted' | 'confirmed' | 'delivered' | 'completed' | 'failed';
|
|
543
567
|
/**
|
|
@@ -574,6 +598,8 @@ interface IncomingTransfer {
|
|
|
574
598
|
readonly tokens: Token[];
|
|
575
599
|
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
576
600
|
readonly coinless?: CoinlessToken[];
|
|
601
|
+
/** Refused arrivals of a claimed coin under another type; never counted, and never in `tokens`. */
|
|
602
|
+
readonly unverifiedTokens?: Token[];
|
|
577
603
|
readonly memo?: string;
|
|
578
604
|
readonly receivedAt: number;
|
|
579
605
|
}
|
|
@@ -634,6 +660,7 @@ interface BurnResult {
|
|
|
634
660
|
/** The burned blob, the proof of the burn: persist it, then `acknowledgeBurn(burnId)`. */
|
|
635
661
|
burnedToken?: Uint8Array;
|
|
636
662
|
error?: string;
|
|
663
|
+
errorCode?: string;
|
|
637
664
|
}
|
|
638
665
|
/** A burn not yet acknowledged: in flight (`burnedToken` null), certified, or settled. */
|
|
639
666
|
interface PendingBurn {
|
|
@@ -643,6 +670,10 @@ interface PendingBurn {
|
|
|
643
670
|
readonly burnedToken: Uint8Array | null;
|
|
644
671
|
readonly settled: boolean;
|
|
645
672
|
readonly createdAt: number;
|
|
673
|
+
readonly failure?: {
|
|
674
|
+
readonly code: string;
|
|
675
|
+
readonly message: string;
|
|
676
|
+
};
|
|
646
677
|
}
|
|
647
678
|
/** #785: `content` uses ERC-721 field names; `sign` (default true) signs as creator with this wallet's chain key. */
|
|
648
679
|
interface MintNftRequest {
|
|
@@ -730,9 +761,13 @@ interface PaymentsV2 {
|
|
|
730
761
|
prewarmSend(request: SendRequest): Promise<void>;
|
|
731
762
|
discardPrewarm(): void;
|
|
732
763
|
assets(coinId?: string): Promise<Asset[]>;
|
|
764
|
+
unverifiedAssets(coinId?: string): Promise<Asset[]>;
|
|
733
765
|
tokens(filter?: {
|
|
734
766
|
coinId?: string;
|
|
735
767
|
}): Token[];
|
|
768
|
+
unverifiedTokens(filter?: {
|
|
769
|
+
coinId?: string;
|
|
770
|
+
}): Token[];
|
|
736
771
|
coinless(): CoinlessToken[];
|
|
737
772
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
738
773
|
/** The genesis mint reason of one held token; null when it was minted without one. Same contract as tokenData. */
|
|
@@ -821,6 +856,7 @@ interface StoragePort {
|
|
|
821
856
|
tokenId: string;
|
|
822
857
|
key: string;
|
|
823
858
|
}[];
|
|
859
|
+
externalDelivery?: boolean;
|
|
824
860
|
}): Promise<ApplyDeltaResult>;
|
|
825
861
|
}
|
|
826
862
|
interface DeliveryReceipt {
|
|
@@ -1046,7 +1082,13 @@ interface BurnJournalEntry {
|
|
|
1046
1082
|
amount: string;
|
|
1047
1083
|
}[];
|
|
1048
1084
|
createdAt: number;
|
|
1085
|
+
failure?: BurnFailure;
|
|
1086
|
+
}
|
|
1087
|
+
interface BurnFailure {
|
|
1088
|
+
code: string;
|
|
1089
|
+
message: string;
|
|
1049
1090
|
}
|
|
1091
|
+
declare function isLiveBurn(entry: BurnJournalEntry): boolean;
|
|
1050
1092
|
interface ShortfallEntry {
|
|
1051
1093
|
transferId: string;
|
|
1052
1094
|
remainingAmount: string;
|
|
@@ -1080,6 +1122,7 @@ declare const STORE_KEYS: {
|
|
|
1080
1122
|
readonly epochLatch: "epoch-latch";
|
|
1081
1123
|
readonly suspectedSpent: "suspected-spent";
|
|
1082
1124
|
readonly knownSpends: "known-spends";
|
|
1125
|
+
readonly verifiedTokens: "verified-tokens";
|
|
1083
1126
|
};
|
|
1084
1127
|
|
|
1085
1128
|
interface HistoryWireAsset {
|
|
@@ -1115,6 +1158,9 @@ declare const ATTENTION_MINT_UNRESOLVED = "mint:unresolved";
|
|
|
1115
1158
|
/** Genesis payload cap, NftSigned wrapper included: wallet-api refuses an oversize blob only after the mint certified. */
|
|
1116
1159
|
declare const NFT_MAX_PAYLOAD_BYTES: number;
|
|
1117
1160
|
|
|
1161
|
+
/** Cap on `data` plus `justification`: wallet-api refuses an oversize blob only after the mint certified. */
|
|
1162
|
+
declare const CUSTOM_MINT_MAX_PAYLOAD_BYTES: number;
|
|
1163
|
+
|
|
1118
1164
|
interface IntentPayloadBase {
|
|
1119
1165
|
v: 2;
|
|
1120
1166
|
recipient: string;
|
|
@@ -1286,6 +1332,15 @@ declare class Requests implements PaymentsRequestsApi {
|
|
|
1286
1332
|
private revertPayable;
|
|
1287
1333
|
}
|
|
1288
1334
|
|
|
1335
|
+
declare class CoinClaims {
|
|
1336
|
+
private readonly issuers;
|
|
1337
|
+
private readonly policies;
|
|
1338
|
+
static fromPlugins(plugins: readonly TokenPlugin[] | undefined): CoinClaims;
|
|
1339
|
+
add(policy: TokenIssuancePolicy): void;
|
|
1340
|
+
fingerprint(): string;
|
|
1341
|
+
issuerOf(coinId: CoinId): string | null;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1289
1344
|
interface RegistryReader {
|
|
1290
1345
|
getSymbol(coinId: string): string;
|
|
1291
1346
|
getName(coinId: string): string;
|
|
@@ -1381,6 +1436,8 @@ interface PaymentsFacadeDeps {
|
|
|
1381
1436
|
kv: ScopedKV;
|
|
1382
1437
|
registry: RegistryReader;
|
|
1383
1438
|
price?: PriceReader;
|
|
1439
|
+
/** Coins that count only in verified tokens of their issuing type (TokenPlugin issuance policies). */
|
|
1440
|
+
claims?: CoinClaims;
|
|
1384
1441
|
emit: (event: string, payload: unknown) => void;
|
|
1385
1442
|
resolveRecipient: (identifier: string) => Promise<RecipientInfo | null>;
|
|
1386
1443
|
signComplete: (transferId: string) => Promise<string>;
|
|
@@ -1410,6 +1467,7 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1410
1467
|
private readonly wakeRefresh;
|
|
1411
1468
|
private readonly prewarmed;
|
|
1412
1469
|
private readonly view;
|
|
1470
|
+
private readonly verdicts;
|
|
1413
1471
|
private readonly ledger;
|
|
1414
1472
|
private readonly queue;
|
|
1415
1473
|
private readonly machine;
|
|
@@ -1435,6 +1493,7 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1435
1493
|
private readonly activeMoneyOps;
|
|
1436
1494
|
/** #737: the ledger holds exactly the sources of the still-open intents. */
|
|
1437
1495
|
private readonly pins;
|
|
1496
|
+
private readonly burnHold;
|
|
1438
1497
|
/** Per facade, so per address: an NFT reading is never served to another wallet. */
|
|
1439
1498
|
private readonly nftCache;
|
|
1440
1499
|
constructor(deps: PaymentsFacadeDeps);
|
|
@@ -1445,9 +1504,14 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1445
1504
|
* DISPOSED here, so one mid-`verify()` is cancelled — MODULE_DESTROYED, #770(4). */
|
|
1446
1505
|
setEngine(next: ITokenEngine): void;
|
|
1447
1506
|
assets(coinId?: string): Promise<Asset[]>;
|
|
1507
|
+
unverifiedAssets: (coinId?: string) => Promise<Asset[]>;
|
|
1508
|
+
private heldAssets;
|
|
1448
1509
|
tokens(filter?: {
|
|
1449
1510
|
coinId?: string;
|
|
1450
1511
|
}): Token[];
|
|
1512
|
+
unverifiedTokens: (filter?: {
|
|
1513
|
+
coinId?: string;
|
|
1514
|
+
}) => Token[];
|
|
1451
1515
|
coinless(): CoinlessToken[];
|
|
1452
1516
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
1453
1517
|
tokenJustification(tokenId: string): Promise<Uint8Array | null>;
|
|
@@ -1527,7 +1591,6 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1527
1591
|
private ownedOp;
|
|
1528
1592
|
private engine;
|
|
1529
1593
|
private newId;
|
|
1530
|
-
private seedHeldStates;
|
|
1531
1594
|
private track;
|
|
1532
1595
|
private trackTail;
|
|
1533
1596
|
}
|
|
@@ -1535,4 +1598,4 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1535
1598
|
declare const HEARTBEAT_SEED_MS = 5000;
|
|
1536
1599
|
declare const HEARTBEAT_CAP_MS = 120000;
|
|
1537
1600
|
|
|
1538
|
-
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type BurnJournalEntry, type BurnRequest, type BurnResult, type CheckpointReseeder, type ConnectionStatus, type CustomMintJournalEntry, 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 MintCustomRequest, type MintJournalEntry, type MintNftRequest, type MintResult, NFT_DOCUMENT_MEDIA_TYPE, NFT_LINK_TAG, NFT_MAX_PAYLOAD_BYTES, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintJournalEntry, type NftSignatureContext, type NftSignatureStatus, type NftView, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingBurn, 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, encodeNftContent, isNftDocumentLink, isRetryableAckError, parseNftDocument, parseNftPayload, supportsDeterministicMint, sweepSupersededState, verifyNftLinkContent };
|
|
1601
|
+
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type BurnFailure, type BurnJournalEntry, type BurnRequest, type BurnResult, CUSTOM_MINT_MAX_PAYLOAD_BYTES, type CheckpointReseeder, type ConnectionStatus, type CustomMintJournalEntry, 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 MintCustomRequest, type MintJournalEntry, type MintNftRequest, type MintResult, NFT_DOCUMENT_MEDIA_TYPE, NFT_LINK_TAG, NFT_MAX_PAYLOAD_BYTES, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintJournalEntry, type NftSignatureContext, type NftSignatureStatus, type NftView, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingBurn, 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, encodeNftContent, isLiveBurn, isNftDocumentLink, isRetryableAckError, parseNftDocument, parseNftPayload, supportsDeterministicMint, sweepSupersededState, verifyNftLinkContent };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
2
2
|
import { Token as Token$1 } from '@unicitylabs/state-transition-sdk/lib/transaction/Token.js';
|
|
3
|
+
import { ITokenIssuanceVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/ITokenIssuanceVerifier.js';
|
|
3
4
|
|
|
4
5
|
declare const NFT_METADATA_TAG = 39052n;
|
|
5
6
|
declare const NFT_MEDIA_TAG = 39053n;
|
|
@@ -185,6 +186,22 @@ interface BurnParams {
|
|
|
185
186
|
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
186
187
|
readonly reasonBytes: Uint8Array;
|
|
187
188
|
}
|
|
189
|
+
/** The issuance rule of one token type, and the coins no other type may carry. */
|
|
190
|
+
interface TokenIssuancePolicy extends ITokenIssuanceVerifier {
|
|
191
|
+
/** A token carrying one of these coins counts only when it is of this type and verified. */
|
|
192
|
+
readonly coinIds: readonly CoinId[];
|
|
193
|
+
/** Must change whenever the proofs this policy accepts change, a fix to its verification code included, so wallets check held tokens again. */
|
|
194
|
+
readonly revision?: string;
|
|
195
|
+
}
|
|
196
|
+
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
197
|
+
interface TokenPlugin {
|
|
198
|
+
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
199
|
+
readonly id: string;
|
|
200
|
+
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
201
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
202
|
+
/** Issuance policies to register; a duplicate token type or coin across plugins is INVALID_CONFIG. */
|
|
203
|
+
readonly tokenIssuancePolicies?: readonly TokenIssuancePolicy[];
|
|
204
|
+
}
|
|
188
205
|
/** Plan an NFT mint (#785); `mintDataToken` then mints the plan. */
|
|
189
206
|
interface BuildNftMintParams {
|
|
190
207
|
/** The first owner's 33-byte compressed chain pubkey — the genesis recipient a signature binds. */
|
|
@@ -379,6 +396,8 @@ interface ITokenEngine {
|
|
|
379
396
|
* read its bytes via `readTokenData`. (Used e.g. for on-chain invoice tokens.)
|
|
380
397
|
*/
|
|
381
398
|
mintDataToken(params: MintDataTokenParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
399
|
+
/** Throws VALIDATION_ERROR when `mintDataToken` would refuse `params` before submitting, e.g. a reason tag no registered verifier handles. */
|
|
400
|
+
assertMintable(params: MintDataTokenParams): void;
|
|
382
401
|
/** Plan an NFT mint: encode (and optionally sign as this engine's identity) the payload and derive its token id. No chain op. */
|
|
383
402
|
buildNftMint(params: BuildNftMintParams): Promise<NftMintPlan>;
|
|
384
403
|
/** Spend a token wholesale to a recipient pubkey; returns the recipient's finished token. */
|
|
@@ -450,6 +469,7 @@ interface FullIdentity extends Identity {
|
|
|
450
469
|
readonly privateKey: string;
|
|
451
470
|
}
|
|
452
471
|
type TokenStatus = 'pending' | 'submitted' | 'confirmed' | 'transferring' | 'spent' | 'invalid';
|
|
472
|
+
type Unverified = 'pending' | 'refused';
|
|
453
473
|
interface Token {
|
|
454
474
|
readonly id: string;
|
|
455
475
|
readonly coinId: string;
|
|
@@ -476,6 +496,8 @@ interface Token {
|
|
|
476
496
|
* send self-heals instead of wedging on a stale source.
|
|
477
497
|
*/
|
|
478
498
|
suspectedSpent?: boolean;
|
|
499
|
+
/** Carries a coin an issuance policy claims without having passed that policy yet (`pending`) or at all (`refused`): shown, never spent. */
|
|
500
|
+
readonly unverified?: Unverified;
|
|
479
501
|
}
|
|
480
502
|
/**
|
|
481
503
|
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
@@ -538,6 +560,8 @@ interface Asset {
|
|
|
538
560
|
readonly fiatValueUsd: number | null;
|
|
539
561
|
/** Total fiat value in EUR */
|
|
540
562
|
readonly fiatValueEur: number | null;
|
|
563
|
+
/** Holds tokens of a claimed coin that have not passed its issuance policy yet (`pending`) or at all (`refused`): never spendable, never priced. */
|
|
564
|
+
readonly unverified?: Unverified;
|
|
541
565
|
}
|
|
542
566
|
type TransferStatus = 'pending' | 'submitted' | 'confirmed' | 'delivered' | 'completed' | 'failed';
|
|
543
567
|
/**
|
|
@@ -574,6 +598,8 @@ interface IncomingTransfer {
|
|
|
574
598
|
readonly tokens: Token[];
|
|
575
599
|
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
576
600
|
readonly coinless?: CoinlessToken[];
|
|
601
|
+
/** Refused arrivals of a claimed coin under another type; never counted, and never in `tokens`. */
|
|
602
|
+
readonly unverifiedTokens?: Token[];
|
|
577
603
|
readonly memo?: string;
|
|
578
604
|
readonly receivedAt: number;
|
|
579
605
|
}
|
|
@@ -634,6 +660,7 @@ interface BurnResult {
|
|
|
634
660
|
/** The burned blob, the proof of the burn: persist it, then `acknowledgeBurn(burnId)`. */
|
|
635
661
|
burnedToken?: Uint8Array;
|
|
636
662
|
error?: string;
|
|
663
|
+
errorCode?: string;
|
|
637
664
|
}
|
|
638
665
|
/** A burn not yet acknowledged: in flight (`burnedToken` null), certified, or settled. */
|
|
639
666
|
interface PendingBurn {
|
|
@@ -643,6 +670,10 @@ interface PendingBurn {
|
|
|
643
670
|
readonly burnedToken: Uint8Array | null;
|
|
644
671
|
readonly settled: boolean;
|
|
645
672
|
readonly createdAt: number;
|
|
673
|
+
readonly failure?: {
|
|
674
|
+
readonly code: string;
|
|
675
|
+
readonly message: string;
|
|
676
|
+
};
|
|
646
677
|
}
|
|
647
678
|
/** #785: `content` uses ERC-721 field names; `sign` (default true) signs as creator with this wallet's chain key. */
|
|
648
679
|
interface MintNftRequest {
|
|
@@ -730,9 +761,13 @@ interface PaymentsV2 {
|
|
|
730
761
|
prewarmSend(request: SendRequest): Promise<void>;
|
|
731
762
|
discardPrewarm(): void;
|
|
732
763
|
assets(coinId?: string): Promise<Asset[]>;
|
|
764
|
+
unverifiedAssets(coinId?: string): Promise<Asset[]>;
|
|
733
765
|
tokens(filter?: {
|
|
734
766
|
coinId?: string;
|
|
735
767
|
}): Token[];
|
|
768
|
+
unverifiedTokens(filter?: {
|
|
769
|
+
coinId?: string;
|
|
770
|
+
}): Token[];
|
|
736
771
|
coinless(): CoinlessToken[];
|
|
737
772
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
738
773
|
/** The genesis mint reason of one held token; null when it was minted without one. Same contract as tokenData. */
|
|
@@ -821,6 +856,7 @@ interface StoragePort {
|
|
|
821
856
|
tokenId: string;
|
|
822
857
|
key: string;
|
|
823
858
|
}[];
|
|
859
|
+
externalDelivery?: boolean;
|
|
824
860
|
}): Promise<ApplyDeltaResult>;
|
|
825
861
|
}
|
|
826
862
|
interface DeliveryReceipt {
|
|
@@ -1046,7 +1082,13 @@ interface BurnJournalEntry {
|
|
|
1046
1082
|
amount: string;
|
|
1047
1083
|
}[];
|
|
1048
1084
|
createdAt: number;
|
|
1085
|
+
failure?: BurnFailure;
|
|
1086
|
+
}
|
|
1087
|
+
interface BurnFailure {
|
|
1088
|
+
code: string;
|
|
1089
|
+
message: string;
|
|
1049
1090
|
}
|
|
1091
|
+
declare function isLiveBurn(entry: BurnJournalEntry): boolean;
|
|
1050
1092
|
interface ShortfallEntry {
|
|
1051
1093
|
transferId: string;
|
|
1052
1094
|
remainingAmount: string;
|
|
@@ -1080,6 +1122,7 @@ declare const STORE_KEYS: {
|
|
|
1080
1122
|
readonly epochLatch: "epoch-latch";
|
|
1081
1123
|
readonly suspectedSpent: "suspected-spent";
|
|
1082
1124
|
readonly knownSpends: "known-spends";
|
|
1125
|
+
readonly verifiedTokens: "verified-tokens";
|
|
1083
1126
|
};
|
|
1084
1127
|
|
|
1085
1128
|
interface HistoryWireAsset {
|
|
@@ -1115,6 +1158,9 @@ declare const ATTENTION_MINT_UNRESOLVED = "mint:unresolved";
|
|
|
1115
1158
|
/** Genesis payload cap, NftSigned wrapper included: wallet-api refuses an oversize blob only after the mint certified. */
|
|
1116
1159
|
declare const NFT_MAX_PAYLOAD_BYTES: number;
|
|
1117
1160
|
|
|
1161
|
+
/** Cap on `data` plus `justification`: wallet-api refuses an oversize blob only after the mint certified. */
|
|
1162
|
+
declare const CUSTOM_MINT_MAX_PAYLOAD_BYTES: number;
|
|
1163
|
+
|
|
1118
1164
|
interface IntentPayloadBase {
|
|
1119
1165
|
v: 2;
|
|
1120
1166
|
recipient: string;
|
|
@@ -1286,6 +1332,15 @@ declare class Requests implements PaymentsRequestsApi {
|
|
|
1286
1332
|
private revertPayable;
|
|
1287
1333
|
}
|
|
1288
1334
|
|
|
1335
|
+
declare class CoinClaims {
|
|
1336
|
+
private readonly issuers;
|
|
1337
|
+
private readonly policies;
|
|
1338
|
+
static fromPlugins(plugins: readonly TokenPlugin[] | undefined): CoinClaims;
|
|
1339
|
+
add(policy: TokenIssuancePolicy): void;
|
|
1340
|
+
fingerprint(): string;
|
|
1341
|
+
issuerOf(coinId: CoinId): string | null;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1289
1344
|
interface RegistryReader {
|
|
1290
1345
|
getSymbol(coinId: string): string;
|
|
1291
1346
|
getName(coinId: string): string;
|
|
@@ -1381,6 +1436,8 @@ interface PaymentsFacadeDeps {
|
|
|
1381
1436
|
kv: ScopedKV;
|
|
1382
1437
|
registry: RegistryReader;
|
|
1383
1438
|
price?: PriceReader;
|
|
1439
|
+
/** Coins that count only in verified tokens of their issuing type (TokenPlugin issuance policies). */
|
|
1440
|
+
claims?: CoinClaims;
|
|
1384
1441
|
emit: (event: string, payload: unknown) => void;
|
|
1385
1442
|
resolveRecipient: (identifier: string) => Promise<RecipientInfo | null>;
|
|
1386
1443
|
signComplete: (transferId: string) => Promise<string>;
|
|
@@ -1410,6 +1467,7 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1410
1467
|
private readonly wakeRefresh;
|
|
1411
1468
|
private readonly prewarmed;
|
|
1412
1469
|
private readonly view;
|
|
1470
|
+
private readonly verdicts;
|
|
1413
1471
|
private readonly ledger;
|
|
1414
1472
|
private readonly queue;
|
|
1415
1473
|
private readonly machine;
|
|
@@ -1435,6 +1493,7 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1435
1493
|
private readonly activeMoneyOps;
|
|
1436
1494
|
/** #737: the ledger holds exactly the sources of the still-open intents. */
|
|
1437
1495
|
private readonly pins;
|
|
1496
|
+
private readonly burnHold;
|
|
1438
1497
|
/** Per facade, so per address: an NFT reading is never served to another wallet. */
|
|
1439
1498
|
private readonly nftCache;
|
|
1440
1499
|
constructor(deps: PaymentsFacadeDeps);
|
|
@@ -1445,9 +1504,14 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1445
1504
|
* DISPOSED here, so one mid-`verify()` is cancelled — MODULE_DESTROYED, #770(4). */
|
|
1446
1505
|
setEngine(next: ITokenEngine): void;
|
|
1447
1506
|
assets(coinId?: string): Promise<Asset[]>;
|
|
1507
|
+
unverifiedAssets: (coinId?: string) => Promise<Asset[]>;
|
|
1508
|
+
private heldAssets;
|
|
1448
1509
|
tokens(filter?: {
|
|
1449
1510
|
coinId?: string;
|
|
1450
1511
|
}): Token[];
|
|
1512
|
+
unverifiedTokens: (filter?: {
|
|
1513
|
+
coinId?: string;
|
|
1514
|
+
}) => Token[];
|
|
1451
1515
|
coinless(): CoinlessToken[];
|
|
1452
1516
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
1453
1517
|
tokenJustification(tokenId: string): Promise<Uint8Array | null>;
|
|
@@ -1527,7 +1591,6 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1527
1591
|
private ownedOp;
|
|
1528
1592
|
private engine;
|
|
1529
1593
|
private newId;
|
|
1530
|
-
private seedHeldStates;
|
|
1531
1594
|
private track;
|
|
1532
1595
|
private trackTail;
|
|
1533
1596
|
}
|
|
@@ -1535,4 +1598,4 @@ declare class PaymentsFacade implements PaymentsV2 {
|
|
|
1535
1598
|
declare const HEARTBEAT_SEED_MS = 5000;
|
|
1536
1599
|
declare const HEARTBEAT_CAP_MS = 120000;
|
|
1537
1600
|
|
|
1538
|
-
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type BurnJournalEntry, type BurnRequest, type BurnResult, type CheckpointReseeder, type ConnectionStatus, type CustomMintJournalEntry, 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 MintCustomRequest, type MintJournalEntry, type MintNftRequest, type MintResult, NFT_DOCUMENT_MEDIA_TYPE, NFT_LINK_TAG, NFT_MAX_PAYLOAD_BYTES, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintJournalEntry, type NftSignatureContext, type NftSignatureStatus, type NftView, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingBurn, 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, encodeNftContent, isNftDocumentLink, isRetryableAckError, parseNftDocument, parseNftPayload, supportsDeterministicMint, sweepSupersededState, verifyNftLinkContent };
|
|
1601
|
+
export { ATTENTION_MINT_UNRESOLVED, ATTENTION_RECIPIENT_NETWORK_UNVERIFIED, ATTENTION_RESEED_REJECTED, type AckOutcome, type AckRequest, type ApplyDeltaResult, type BurnFailure, type BurnJournalEntry, type BurnRequest, type BurnResult, CUSTOM_MINT_MAX_PAYLOAD_BYTES, type CheckpointReseeder, type ConnectionStatus, type CustomMintJournalEntry, 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 MintCustomRequest, type MintJournalEntry, type MintNftRequest, type MintResult, NFT_DOCUMENT_MEDIA_TYPE, NFT_LINK_TAG, NFT_MAX_PAYLOAD_BYTES, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintJournalEntry, type NftSignatureContext, type NftSignatureStatus, type NftView, type OpOutcome, type OutcomeClass, type PaymentRequestStatus, type PaymentRequestView, PaymentsFacade, type PaymentsFacadeDeps, type PaymentsRequestsApi, type PaymentsV2, type PaymentsV2Events, type PendingBurn, 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, encodeNftContent, isLiveBurn, isNftDocumentLink, isRetryableAckError, parseNftDocument, parseNftPayload, supportsDeterministicMint, sweepSupersededState, verifyNftLinkContent };
|