@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
package/dist/core/index.d.cts
CHANGED
|
@@ -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
|
import { NostrClient, NostrKeyManager } from '@unicitylabs/nostr-js-sdk';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -230,12 +231,21 @@ interface BurnParams {
|
|
|
230
231
|
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
231
232
|
readonly reasonBytes: Uint8Array;
|
|
232
233
|
}
|
|
234
|
+
/** The issuance rule of one token type, and the coins no other type may carry. */
|
|
235
|
+
interface TokenIssuancePolicy extends ITokenIssuanceVerifier {
|
|
236
|
+
/** A token carrying one of these coins counts only when it is of this type and verified. */
|
|
237
|
+
readonly coinIds: readonly CoinId[];
|
|
238
|
+
/** Must change whenever the proofs this policy accepts change, a fix to its verification code included, so wallets check held tokens again. */
|
|
239
|
+
readonly revision?: string;
|
|
240
|
+
}
|
|
233
241
|
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
234
242
|
interface TokenPlugin {
|
|
235
243
|
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
236
244
|
readonly id: string;
|
|
237
245
|
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
238
246
|
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
247
|
+
/** Issuance policies to register; a duplicate token type or coin across plugins is INVALID_CONFIG. */
|
|
248
|
+
readonly tokenIssuancePolicies?: readonly TokenIssuancePolicy[];
|
|
239
249
|
}
|
|
240
250
|
/** Plan an NFT mint (#785); `mintDataToken` then mints the plan. */
|
|
241
251
|
interface BuildNftMintParams {
|
|
@@ -431,6 +441,8 @@ interface ITokenEngine {
|
|
|
431
441
|
* read its bytes via `readTokenData`. (Used e.g. for on-chain invoice tokens.)
|
|
432
442
|
*/
|
|
433
443
|
mintDataToken(params: MintDataTokenParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
444
|
+
/** Throws VALIDATION_ERROR when `mintDataToken` would refuse `params` before submitting, e.g. a reason tag no registered verifier handles. */
|
|
445
|
+
assertMintable(params: MintDataTokenParams): void;
|
|
434
446
|
/** Plan an NFT mint: encode (and optionally sign as this engine's identity) the payload and derive its token id. No chain op. */
|
|
435
447
|
buildNftMint(params: BuildNftMintParams): Promise<NftMintPlan>;
|
|
436
448
|
/** Spend a token wholesale to a recipient pubkey; returns the recipient's finished token. */
|
|
@@ -543,7 +555,7 @@ interface VerificationWorkerConfig {
|
|
|
543
555
|
* }
|
|
544
556
|
* ```
|
|
545
557
|
*/
|
|
546
|
-
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';
|
|
558
|
+
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' | 'MINT_REASON_UNVERIFIABLE' | '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';
|
|
547
559
|
declare class SphereError extends Error {
|
|
548
560
|
readonly code: SphereErrorCode;
|
|
549
561
|
readonly cause?: unknown;
|
|
@@ -656,6 +668,7 @@ interface BurnResult {
|
|
|
656
668
|
/** The burned blob, the proof of the burn: persist it, then `acknowledgeBurn(burnId)`. */
|
|
657
669
|
burnedToken?: Uint8Array;
|
|
658
670
|
error?: string;
|
|
671
|
+
errorCode?: string;
|
|
659
672
|
}
|
|
660
673
|
/** A burn not yet acknowledged: in flight (`burnedToken` null), certified, or settled. */
|
|
661
674
|
interface PendingBurn {
|
|
@@ -665,6 +678,10 @@ interface PendingBurn {
|
|
|
665
678
|
readonly burnedToken: Uint8Array | null;
|
|
666
679
|
readonly settled: boolean;
|
|
667
680
|
readonly createdAt: number;
|
|
681
|
+
readonly failure?: {
|
|
682
|
+
readonly code: string;
|
|
683
|
+
readonly message: string;
|
|
684
|
+
};
|
|
668
685
|
}
|
|
669
686
|
/** #785: `content` uses ERC-721 field names; `sign` (default true) signs as creator with this wallet's chain key. */
|
|
670
687
|
interface MintNftRequest {
|
|
@@ -752,9 +769,13 @@ interface PaymentsV2 {
|
|
|
752
769
|
prewarmSend(request: SendRequest): Promise<void>;
|
|
753
770
|
discardPrewarm(): void;
|
|
754
771
|
assets(coinId?: string): Promise<Asset[]>;
|
|
772
|
+
unverifiedAssets(coinId?: string): Promise<Asset[]>;
|
|
755
773
|
tokens(filter?: {
|
|
756
774
|
coinId?: string;
|
|
757
775
|
}): Token[];
|
|
776
|
+
unverifiedTokens(filter?: {
|
|
777
|
+
coinId?: string;
|
|
778
|
+
}): Token[];
|
|
758
779
|
coinless(): CoinlessToken[];
|
|
759
780
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
760
781
|
/** The genesis mint reason of one held token; null when it was minted without one. Same contract as tokenData. */
|
|
@@ -999,6 +1020,7 @@ interface FullIdentity extends Identity {
|
|
|
999
1020
|
readonly privateKey: string;
|
|
1000
1021
|
}
|
|
1001
1022
|
type TokenStatus = 'pending' | 'submitted' | 'confirmed' | 'transferring' | 'spent' | 'invalid';
|
|
1023
|
+
type Unverified = 'pending' | 'refused';
|
|
1002
1024
|
interface Token {
|
|
1003
1025
|
readonly id: string;
|
|
1004
1026
|
readonly coinId: string;
|
|
@@ -1025,6 +1047,8 @@ interface Token {
|
|
|
1025
1047
|
* send self-heals instead of wedging on a stale source.
|
|
1026
1048
|
*/
|
|
1027
1049
|
suspectedSpent?: boolean;
|
|
1050
|
+
/** Carries a coin an issuance policy claims without having passed that policy yet (`pending`) or at all (`refused`): shown, never spent. */
|
|
1051
|
+
readonly unverified?: Unverified;
|
|
1028
1052
|
}
|
|
1029
1053
|
/**
|
|
1030
1054
|
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
@@ -1087,6 +1111,8 @@ interface Asset {
|
|
|
1087
1111
|
readonly fiatValueUsd: number | null;
|
|
1088
1112
|
/** Total fiat value in EUR */
|
|
1089
1113
|
readonly fiatValueEur: number | null;
|
|
1114
|
+
/** Holds tokens of a claimed coin that have not passed its issuance policy yet (`pending`) or at all (`refused`): never spendable, never priced. */
|
|
1115
|
+
readonly unverified?: Unverified;
|
|
1090
1116
|
}
|
|
1091
1117
|
type TransferStatus = 'pending' | 'submitted' | 'confirmed' | 'delivered' | 'completed' | 'failed';
|
|
1092
1118
|
/**
|
|
@@ -1123,6 +1149,8 @@ interface IncomingTransfer {
|
|
|
1123
1149
|
readonly tokens: Token[];
|
|
1124
1150
|
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
1125
1151
|
readonly coinless?: CoinlessToken[];
|
|
1152
|
+
/** Refused arrivals of a claimed coin under another type; never counted, and never in `tokens`. */
|
|
1153
|
+
readonly unverifiedTokens?: Token[];
|
|
1126
1154
|
readonly memo?: string;
|
|
1127
1155
|
readonly receivedAt: number;
|
|
1128
1156
|
}
|
|
@@ -3149,6 +3177,7 @@ declare class WalletApiV2Client {
|
|
|
3149
3177
|
tokenId: string;
|
|
3150
3178
|
key: string;
|
|
3151
3179
|
}[];
|
|
3180
|
+
externalDelivery?: boolean;
|
|
3152
3181
|
}): Promise<ApplyDeltaWire>;
|
|
3153
3182
|
fetchBlob(getUrl: string): Promise<Uint8Array>;
|
|
3154
3183
|
/**
|
package/dist/core/index.d.ts
CHANGED
|
@@ -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
|
import { NostrClient, NostrKeyManager } from '@unicitylabs/nostr-js-sdk';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -230,12 +231,21 @@ interface BurnParams {
|
|
|
230
231
|
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
231
232
|
readonly reasonBytes: Uint8Array;
|
|
232
233
|
}
|
|
234
|
+
/** The issuance rule of one token type, and the coins no other type may carry. */
|
|
235
|
+
interface TokenIssuancePolicy extends ITokenIssuanceVerifier {
|
|
236
|
+
/** A token carrying one of these coins counts only when it is of this type and verified. */
|
|
237
|
+
readonly coinIds: readonly CoinId[];
|
|
238
|
+
/** Must change whenever the proofs this policy accepts change, a fix to its verification code included, so wallets check held tokens again. */
|
|
239
|
+
readonly revision?: string;
|
|
240
|
+
}
|
|
233
241
|
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
234
242
|
interface TokenPlugin {
|
|
235
243
|
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
236
244
|
readonly id: string;
|
|
237
245
|
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
238
246
|
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
247
|
+
/** Issuance policies to register; a duplicate token type or coin across plugins is INVALID_CONFIG. */
|
|
248
|
+
readonly tokenIssuancePolicies?: readonly TokenIssuancePolicy[];
|
|
239
249
|
}
|
|
240
250
|
/** Plan an NFT mint (#785); `mintDataToken` then mints the plan. */
|
|
241
251
|
interface BuildNftMintParams {
|
|
@@ -431,6 +441,8 @@ interface ITokenEngine {
|
|
|
431
441
|
* read its bytes via `readTokenData`. (Used e.g. for on-chain invoice tokens.)
|
|
432
442
|
*/
|
|
433
443
|
mintDataToken(params: MintDataTokenParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
444
|
+
/** Throws VALIDATION_ERROR when `mintDataToken` would refuse `params` before submitting, e.g. a reason tag no registered verifier handles. */
|
|
445
|
+
assertMintable(params: MintDataTokenParams): void;
|
|
434
446
|
/** Plan an NFT mint: encode (and optionally sign as this engine's identity) the payload and derive its token id. No chain op. */
|
|
435
447
|
buildNftMint(params: BuildNftMintParams): Promise<NftMintPlan>;
|
|
436
448
|
/** Spend a token wholesale to a recipient pubkey; returns the recipient's finished token. */
|
|
@@ -543,7 +555,7 @@ interface VerificationWorkerConfig {
|
|
|
543
555
|
* }
|
|
544
556
|
* ```
|
|
545
557
|
*/
|
|
546
|
-
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';
|
|
558
|
+
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' | 'MINT_REASON_UNVERIFIABLE' | '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';
|
|
547
559
|
declare class SphereError extends Error {
|
|
548
560
|
readonly code: SphereErrorCode;
|
|
549
561
|
readonly cause?: unknown;
|
|
@@ -656,6 +668,7 @@ interface BurnResult {
|
|
|
656
668
|
/** The burned blob, the proof of the burn: persist it, then `acknowledgeBurn(burnId)`. */
|
|
657
669
|
burnedToken?: Uint8Array;
|
|
658
670
|
error?: string;
|
|
671
|
+
errorCode?: string;
|
|
659
672
|
}
|
|
660
673
|
/** A burn not yet acknowledged: in flight (`burnedToken` null), certified, or settled. */
|
|
661
674
|
interface PendingBurn {
|
|
@@ -665,6 +678,10 @@ interface PendingBurn {
|
|
|
665
678
|
readonly burnedToken: Uint8Array | null;
|
|
666
679
|
readonly settled: boolean;
|
|
667
680
|
readonly createdAt: number;
|
|
681
|
+
readonly failure?: {
|
|
682
|
+
readonly code: string;
|
|
683
|
+
readonly message: string;
|
|
684
|
+
};
|
|
668
685
|
}
|
|
669
686
|
/** #785: `content` uses ERC-721 field names; `sign` (default true) signs as creator with this wallet's chain key. */
|
|
670
687
|
interface MintNftRequest {
|
|
@@ -752,9 +769,13 @@ interface PaymentsV2 {
|
|
|
752
769
|
prewarmSend(request: SendRequest): Promise<void>;
|
|
753
770
|
discardPrewarm(): void;
|
|
754
771
|
assets(coinId?: string): Promise<Asset[]>;
|
|
772
|
+
unverifiedAssets(coinId?: string): Promise<Asset[]>;
|
|
755
773
|
tokens(filter?: {
|
|
756
774
|
coinId?: string;
|
|
757
775
|
}): Token[];
|
|
776
|
+
unverifiedTokens(filter?: {
|
|
777
|
+
coinId?: string;
|
|
778
|
+
}): Token[];
|
|
758
779
|
coinless(): CoinlessToken[];
|
|
759
780
|
tokenData(tokenId: string): Promise<Uint8Array | null>;
|
|
760
781
|
/** The genesis mint reason of one held token; null when it was minted without one. Same contract as tokenData. */
|
|
@@ -999,6 +1020,7 @@ interface FullIdentity extends Identity {
|
|
|
999
1020
|
readonly privateKey: string;
|
|
1000
1021
|
}
|
|
1001
1022
|
type TokenStatus = 'pending' | 'submitted' | 'confirmed' | 'transferring' | 'spent' | 'invalid';
|
|
1023
|
+
type Unverified = 'pending' | 'refused';
|
|
1002
1024
|
interface Token {
|
|
1003
1025
|
readonly id: string;
|
|
1004
1026
|
readonly coinId: string;
|
|
@@ -1025,6 +1047,8 @@ interface Token {
|
|
|
1025
1047
|
* send self-heals instead of wedging on a stale source.
|
|
1026
1048
|
*/
|
|
1027
1049
|
suspectedSpent?: boolean;
|
|
1050
|
+
/** Carries a coin an issuance policy claims without having passed that policy yet (`pending`) or at all (`refused`): shown, never spent. */
|
|
1051
|
+
readonly unverified?: Unverified;
|
|
1028
1052
|
}
|
|
1029
1053
|
/**
|
|
1030
1054
|
* A holding that names no coin (wallet-api#140) — an NFT. Deliberately NOT a
|
|
@@ -1087,6 +1111,8 @@ interface Asset {
|
|
|
1087
1111
|
readonly fiatValueUsd: number | null;
|
|
1088
1112
|
/** Total fiat value in EUR */
|
|
1089
1113
|
readonly fiatValueEur: number | null;
|
|
1114
|
+
/** Holds tokens of a claimed coin that have not passed its issuance policy yet (`pending`) or at all (`refused`): never spendable, never priced. */
|
|
1115
|
+
readonly unverified?: Unverified;
|
|
1090
1116
|
}
|
|
1091
1117
|
type TransferStatus = 'pending' | 'submitted' | 'confirmed' | 'delivered' | 'completed' | 'failed';
|
|
1092
1118
|
/**
|
|
@@ -1123,6 +1149,8 @@ interface IncomingTransfer {
|
|
|
1123
1149
|
readonly tokens: Token[];
|
|
1124
1150
|
/** Arrivals that name no coin (#777). Disjoint from `tokens`, never a zero Token. */
|
|
1125
1151
|
readonly coinless?: CoinlessToken[];
|
|
1152
|
+
/** Refused arrivals of a claimed coin under another type; never counted, and never in `tokens`. */
|
|
1153
|
+
readonly unverifiedTokens?: Token[];
|
|
1126
1154
|
readonly memo?: string;
|
|
1127
1155
|
readonly receivedAt: number;
|
|
1128
1156
|
}
|
|
@@ -3149,6 +3177,7 @@ declare class WalletApiV2Client {
|
|
|
3149
3177
|
tokenId: string;
|
|
3150
3178
|
key: string;
|
|
3151
3179
|
}[];
|
|
3180
|
+
externalDelivery?: boolean;
|
|
3152
3181
|
}): Promise<ApplyDeltaWire>;
|
|
3153
3182
|
fetchBlob(getUrl: string): Promise<Uint8Array>;
|
|
3154
3183
|
/**
|