@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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
2
|
+
export { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
1
3
|
import { DataHash } from '@unicitylabs/state-transition-sdk/lib/crypto/hash/DataHash.js';
|
|
2
4
|
import { Token } from '@unicitylabs/state-transition-sdk/lib/transaction/Token.js';
|
|
3
5
|
import { IPaymentData } from '@unicitylabs/state-transition-sdk/lib/payment/IPaymentData.js';
|
|
@@ -189,6 +191,23 @@ interface MintDataTokenParams {
|
|
|
189
191
|
readonly tokenType?: Uint8Array;
|
|
190
192
|
/** Salt bytes; deterministic salt → deterministic (terms-derived) tokenId. */
|
|
191
193
|
readonly salt?: Uint8Array;
|
|
194
|
+
/** Genesis mint reason (the SDK's `justification`): tagged CBOR a registered verifier validates. */
|
|
195
|
+
readonly justification?: Uint8Array;
|
|
196
|
+
/** Verifiers for this mint's genesis reason, in place of the ones registered on the engine. */
|
|
197
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
198
|
+
}
|
|
199
|
+
/** Spend a token to a burn predicate with the reason bytes as aux data. */
|
|
200
|
+
interface BurnParams {
|
|
201
|
+
readonly token: SphereToken;
|
|
202
|
+
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
203
|
+
readonly reasonBytes: Uint8Array;
|
|
204
|
+
}
|
|
205
|
+
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
206
|
+
interface TokenPlugin {
|
|
207
|
+
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
208
|
+
readonly id: string;
|
|
209
|
+
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
210
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
192
211
|
}
|
|
193
212
|
/** Plan an NFT mint (#785); `mintDataToken` then mints the plan. */
|
|
194
213
|
interface BuildNftMintParams {
|
|
@@ -365,6 +384,8 @@ interface ITokenEngine {
|
|
|
365
384
|
readMemo(token: SphereToken): Uint8Array | null;
|
|
366
385
|
/** Raw genesis data of a token (e.g. a data-token's terms). `null` when absent. Synchronous. */
|
|
367
386
|
readTokenData(token: SphereToken): Uint8Array | null;
|
|
387
|
+
/** The genesis mint reason (`justification`) of a token; `null` when it was minted without one. Synchronous. */
|
|
388
|
+
readTokenJustification(token: SphereToken): Uint8Array | null;
|
|
368
389
|
/** Read a token's genesis payload as an NFT. NEVER throws; null = not a recognised NFT. */
|
|
369
390
|
readNft(token: SphereToken): Promise<NftReading | null>;
|
|
370
391
|
/**
|
|
@@ -386,6 +407,8 @@ interface ITokenEngine {
|
|
|
386
407
|
buildNftMint(params: BuildNftMintParams): Promise<NftMintPlan>;
|
|
387
408
|
/** Spend a token wholesale to a recipient pubkey; returns the recipient's finished token. */
|
|
388
409
|
transfer(params: TransferParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
410
|
+
/** Spend the token to `BurnPredicate(sha256(reasonBytes))` with the reason bytes as aux data. */
|
|
411
|
+
burn(params: BurnParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
389
412
|
/** Split a token into N value-conserving outputs (burn source + internally mint each output). */
|
|
390
413
|
split(params: SplitParams, options?: EngineOpOptions): Promise<SplitResult>;
|
|
391
414
|
/** Fully verify a token against the trust base. */
|
|
@@ -485,6 +508,8 @@ interface EngineConfig {
|
|
|
485
508
|
* terminate the pool.
|
|
486
509
|
*/
|
|
487
510
|
readonly verification?: VerificationWorkerConfig;
|
|
511
|
+
/** Token plugins whose mint-reason verifiers join the engine's verification context. */
|
|
512
|
+
readonly plugins?: readonly TokenPlugin[];
|
|
488
513
|
}
|
|
489
514
|
/** Factory signature for the real adapter (implemented in Track A). */
|
|
490
515
|
type CreateTokenEngine = (config: EngineConfig) => Promise<ITokenEngine>;
|
|
@@ -690,4 +715,4 @@ declare class SpherePaymentData implements IPaymentData {
|
|
|
690
715
|
*/
|
|
691
716
|
declare function decodeSpherePaymentData(bytes: Uint8Array): Promise<IPaymentData>;
|
|
692
717
|
|
|
693
|
-
export { type BuildNftMintParams, CheckpointPersistFailedError, CheckpointTrustbaseMismatchError, type CoinId, type CreateTokenEngine, type EngineConfig, type EngineIdentity, type EngineOpOptions, type EngineVerifyResult, type ITokenEngine, type MintDataTokenParams, type MintParams, NFT_DOCUMENT_MEDIA_TYPE, NFT_FORMAT_VERSION, NFT_LINK_TAG, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintPlan, type NftReading, type NftSignatureContext, type NftSignatureStatus, type ParsedNft, ProofUnconfirmedError, type SphereAsset, type SphereNetwork, SpherePaymentData, type SphereToken, type SphereValue, SplitCheckpointLostError, type SplitCheckpointStore, type SplitOutput, type SplitParams, type SplitResult, type TokenBlob, TransferConflictError, type TransferParams, type VerificationWorker, type VerificationWorkerConfig, createSphereTokenEngine, decodeSpherePaymentData, deriveDirectAddress, encodeNftContent, encodeNftSigned, isNftDocumentLink, nftSignedDigest, parseNftDocument, parseNftPayload, sphereAssetToSdk, verifyNftLinkContent, verifyNftSignature };
|
|
718
|
+
export { type BuildNftMintParams, type BurnParams, CheckpointPersistFailedError, CheckpointTrustbaseMismatchError, type CoinId, type CreateTokenEngine, type EngineConfig, type EngineIdentity, type EngineOpOptions, type EngineVerifyResult, type ITokenEngine, type MintDataTokenParams, type MintParams, NFT_DOCUMENT_MEDIA_TYPE, NFT_FORMAT_VERSION, NFT_LINK_TAG, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintPlan, type NftReading, type NftSignatureContext, type NftSignatureStatus, type ParsedNft, ProofUnconfirmedError, type SphereAsset, type SphereNetwork, SpherePaymentData, type SphereToken, type SphereValue, SplitCheckpointLostError, type SplitCheckpointStore, type SplitOutput, type SplitParams, type SplitResult, type TokenBlob, type TokenPlugin, TransferConflictError, type TransferParams, type VerificationWorker, type VerificationWorkerConfig, createSphereTokenEngine, decodeSpherePaymentData, deriveDirectAddress, encodeNftContent, encodeNftSigned, isNftDocumentLink, nftSignedDigest, parseNftDocument, parseNftPayload, sphereAssetToSdk, verifyNftLinkContent, verifyNftSignature };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
2
|
+
export { IMintJustificationVerifier } from '@unicitylabs/state-transition-sdk/lib/transaction/verification/IMintJustificationVerifier.js';
|
|
1
3
|
import { DataHash } from '@unicitylabs/state-transition-sdk/lib/crypto/hash/DataHash.js';
|
|
2
4
|
import { Token } from '@unicitylabs/state-transition-sdk/lib/transaction/Token.js';
|
|
3
5
|
import { IPaymentData } from '@unicitylabs/state-transition-sdk/lib/payment/IPaymentData.js';
|
|
@@ -189,6 +191,23 @@ interface MintDataTokenParams {
|
|
|
189
191
|
readonly tokenType?: Uint8Array;
|
|
190
192
|
/** Salt bytes; deterministic salt → deterministic (terms-derived) tokenId. */
|
|
191
193
|
readonly salt?: Uint8Array;
|
|
194
|
+
/** Genesis mint reason (the SDK's `justification`): tagged CBOR a registered verifier validates. */
|
|
195
|
+
readonly justification?: Uint8Array;
|
|
196
|
+
/** Verifiers for this mint's genesis reason, in place of the ones registered on the engine. */
|
|
197
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
198
|
+
}
|
|
199
|
+
/** Spend a token to a burn predicate with the reason bytes as aux data. */
|
|
200
|
+
interface BurnParams {
|
|
201
|
+
readonly token: SphereToken;
|
|
202
|
+
/** The recipient predicate is `BurnPredicate(sha256(reasonBytes))`; the bytes ride in the aux data. */
|
|
203
|
+
readonly reasonBytes: Uint8Array;
|
|
204
|
+
}
|
|
205
|
+
/** Mint-reason verifiers keyed by CBOR tag, registered at engine construction. */
|
|
206
|
+
interface TokenPlugin {
|
|
207
|
+
/** Stable identifier for diagnostics, e.g. `'bridge:tron-usdt'`. */
|
|
208
|
+
readonly id: string;
|
|
209
|
+
/** Mint-reason verifiers to register; a duplicate tag across plugins is INVALID_CONFIG. */
|
|
210
|
+
readonly mintJustificationVerifiers?: readonly IMintJustificationVerifier[];
|
|
192
211
|
}
|
|
193
212
|
/** Plan an NFT mint (#785); `mintDataToken` then mints the plan. */
|
|
194
213
|
interface BuildNftMintParams {
|
|
@@ -365,6 +384,8 @@ interface ITokenEngine {
|
|
|
365
384
|
readMemo(token: SphereToken): Uint8Array | null;
|
|
366
385
|
/** Raw genesis data of a token (e.g. a data-token's terms). `null` when absent. Synchronous. */
|
|
367
386
|
readTokenData(token: SphereToken): Uint8Array | null;
|
|
387
|
+
/** The genesis mint reason (`justification`) of a token; `null` when it was minted without one. Synchronous. */
|
|
388
|
+
readTokenJustification(token: SphereToken): Uint8Array | null;
|
|
368
389
|
/** Read a token's genesis payload as an NFT. NEVER throws; null = not a recognised NFT. */
|
|
369
390
|
readNft(token: SphereToken): Promise<NftReading | null>;
|
|
370
391
|
/**
|
|
@@ -386,6 +407,8 @@ interface ITokenEngine {
|
|
|
386
407
|
buildNftMint(params: BuildNftMintParams): Promise<NftMintPlan>;
|
|
387
408
|
/** Spend a token wholesale to a recipient pubkey; returns the recipient's finished token. */
|
|
388
409
|
transfer(params: TransferParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
410
|
+
/** Spend the token to `BurnPredicate(sha256(reasonBytes))` with the reason bytes as aux data. */
|
|
411
|
+
burn(params: BurnParams, options?: EngineOpOptions): Promise<SphereToken>;
|
|
389
412
|
/** Split a token into N value-conserving outputs (burn source + internally mint each output). */
|
|
390
413
|
split(params: SplitParams, options?: EngineOpOptions): Promise<SplitResult>;
|
|
391
414
|
/** Fully verify a token against the trust base. */
|
|
@@ -485,6 +508,8 @@ interface EngineConfig {
|
|
|
485
508
|
* terminate the pool.
|
|
486
509
|
*/
|
|
487
510
|
readonly verification?: VerificationWorkerConfig;
|
|
511
|
+
/** Token plugins whose mint-reason verifiers join the engine's verification context. */
|
|
512
|
+
readonly plugins?: readonly TokenPlugin[];
|
|
488
513
|
}
|
|
489
514
|
/** Factory signature for the real adapter (implemented in Track A). */
|
|
490
515
|
type CreateTokenEngine = (config: EngineConfig) => Promise<ITokenEngine>;
|
|
@@ -690,4 +715,4 @@ declare class SpherePaymentData implements IPaymentData {
|
|
|
690
715
|
*/
|
|
691
716
|
declare function decodeSpherePaymentData(bytes: Uint8Array): Promise<IPaymentData>;
|
|
692
717
|
|
|
693
|
-
export { type BuildNftMintParams, CheckpointPersistFailedError, CheckpointTrustbaseMismatchError, type CoinId, type CreateTokenEngine, type EngineConfig, type EngineIdentity, type EngineOpOptions, type EngineVerifyResult, type ITokenEngine, type MintDataTokenParams, type MintParams, NFT_DOCUMENT_MEDIA_TYPE, NFT_FORMAT_VERSION, NFT_LINK_TAG, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintPlan, type NftReading, type NftSignatureContext, type NftSignatureStatus, type ParsedNft, ProofUnconfirmedError, type SphereAsset, type SphereNetwork, SpherePaymentData, type SphereToken, type SphereValue, SplitCheckpointLostError, type SplitCheckpointStore, type SplitOutput, type SplitParams, type SplitResult, type TokenBlob, TransferConflictError, type TransferParams, type VerificationWorker, type VerificationWorkerConfig, createSphereTokenEngine, decodeSpherePaymentData, deriveDirectAddress, encodeNftContent, encodeNftSigned, isNftDocumentLink, nftSignedDigest, parseNftDocument, parseNftPayload, sphereAssetToSdk, verifyNftLinkContent, verifyNftSignature };
|
|
718
|
+
export { type BuildNftMintParams, type BurnParams, CheckpointPersistFailedError, CheckpointTrustbaseMismatchError, type CoinId, type CreateTokenEngine, type EngineConfig, type EngineIdentity, type EngineOpOptions, type EngineVerifyResult, type ITokenEngine, type MintDataTokenParams, type MintParams, NFT_DOCUMENT_MEDIA_TYPE, NFT_FORMAT_VERSION, NFT_LINK_TAG, NFT_MEDIA_TAG, NFT_METADATA_TAG, NFT_SIGNED_TAG, type NftAttribute, type NftContent, type NftLink, type NftMedia, type NftMediaRef, type NftMetadata, type NftMintPlan, type NftReading, type NftSignatureContext, type NftSignatureStatus, type ParsedNft, ProofUnconfirmedError, type SphereAsset, type SphereNetwork, SpherePaymentData, type SphereToken, type SphereValue, SplitCheckpointLostError, type SplitCheckpointStore, type SplitOutput, type SplitParams, type SplitResult, type TokenBlob, type TokenPlugin, TransferConflictError, type TransferParams, type VerificationWorker, type VerificationWorkerConfig, createSphereTokenEngine, decodeSpherePaymentData, deriveDirectAddress, encodeNftContent, encodeNftSigned, isNftDocumentLink, nftSignedDigest, parseNftDocument, parseNftPayload, sphereAssetToSdk, verifyNftLinkContent, verifyNftSignature };
|