@sip-protocol/sdk 0.2.9 → 0.2.10
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/LICENSE +21 -0
- package/dist/browser.d.mts +100 -2
- package/dist/browser.d.ts +100 -2
- package/dist/browser.js +774 -114
- package/dist/browser.mjs +498 -16
- package/dist/{chunk-KXN6IWL5.mjs → chunk-AV37IZST.mjs} +284 -0
- package/dist/{chunk-VITVG25F.mjs → chunk-XLEPIR2P.mjs} +2 -100
- package/dist/index-BFOKTz2z.d.ts +6062 -0
- package/dist/index-CAhjA4kh.d.mts +6062 -0
- package/dist/index.d.mts +2 -5897
- package/dist/index.d.ts +2 -5897
- package/dist/index.mjs +1 -1
- package/dist/{noir-BHQtFvRk.d.mts → noir-BTyLXLlZ.d.mts} +1 -1
- package/dist/{noir-BHQtFvRk.d.ts → noir-BTyLXLlZ.d.ts} +1 -1
- package/dist/proofs/noir.d.mts +1 -1
- package/dist/proofs/noir.d.ts +1 -1
- package/dist/proofs/noir.js +11 -112
- package/dist/proofs/noir.mjs +10 -13
- package/package.json +16 -16
- package/src/browser.ts +23 -0
- package/src/proofs/browser-utils.ts +389 -0
- package/src/proofs/browser.ts +246 -19
- package/src/proofs/circuits/funding_proof.json +1 -1
- package/src/proofs/noir.ts +14 -14
- package/src/proofs/worker.ts +426 -0
- package/dist/chunk-4VJHI66K.mjs +0 -12120
- package/dist/chunk-5BAS4D44.mjs +0 -10283
- package/dist/chunk-6WOV2YNG.mjs +0 -10179
- package/dist/chunk-DU7LQDD2.mjs +0 -10148
- package/dist/chunk-MR7HRCRS.mjs +0 -10165
- package/dist/chunk-NDGUWOOZ.mjs +0 -10157
- package/dist/chunk-O4Y2ZUDL.mjs +0 -12721
- package/dist/chunk-UPTISVCY.mjs +0 -10304
- package/dist/chunk-VXSHK7US.mjs +0 -10158
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RECTOR Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/browser.d.mts
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
export { ATTESTATION_VERSION, AttestationRequest, AttestationResult, BaseWalletAdapter, BridgeProvider, B as BrowserNoirProvider, BrowserNoirProviderConfig, CHAIN_NUMERIC_IDS, CommitmentPoint, ComplianceManager, CreateIntentOptions, CreatePaymentOptions, CryptoError, DEFAULT_THRESHOLD, DEFAULT_TOTAL_ORACLES, DerivationPath, EIP1193ConnectInfo, EIP1193Event, EIP1193Provider, EIP1193ProviderRpcError, EIP1193RequestArguments, EIP712Domain, EIP712TypeDefinition, EIP712TypedData, EIP712Types, EncryptionNotImplementedError, ErrorCode, EthereumAdapterConfig, EthereumChainId, EthereumChainIdType, EthereumChainMetadata, EthereumTokenMetadata, EthereumTransactionReceipt, EthereumTransactionRequest, EthereumWalletAdapter, EthereumWalletName, ExportedViewingKey, HardwareAccount, HardwareConnectionStatus, HardwareDeviceInfo, HardwareErrorCode, HardwareErrorCodeType, HardwareEthereumTx, HardwareSignRequest, HardwareSignature, HardwareTransport, HardwareWalletConfig, HardwareWalletError, HardwareWalletType, IntentBuilder, IntentError, LedgerConfig, LedgerModel, LedgerWalletAdapter, MockEthereumAdapter, MockEthereumAdapterConfig, MockHardwareConfig, MockLedgerAdapter, MockProofProvider, MockSolanaAdapter, MockSolanaAdapterConfig, MockSolver, MockSolverConfig, MockTrezorAdapter, MockWalletAdapter, NEARIntentsAdapter, NEARIntentsAdapterConfig, NetworkError, ORACLE_DOMAIN, OneClickClient, OracleAttestationMessage, OracleId, OracleInfo, OracleRegistry, OracleRegistryConfig, OracleSignature, OracleStatus, PaymentBuilder, PedersenCommitment, PreparedSwap, PriceFeed, PrivacyConfig, ProductionQuote, ProofError, ProofNotImplementedError, ProofProgressCallback, ReceivedNote, SIP, SIPConfig, SIPError, STABLECOIN_ADDRESSES, STABLECOIN_DECIMALS, STABLECOIN_INFO, SerializedError, ShieldedBalance, ShieldedSendParams, ShieldedSendResult, SignedOracleAttestation, SolanaAdapterConfig, SolanaCluster, SolanaConnection, SolanaPublicKey, SolanaSendOptions, SolanaSignature, SolanaTransaction, SolanaUnsignedTransaction, SolanaVersionedTransaction, SolanaWalletAdapter, SolanaWalletName, SolanaWalletProvider, StablecoinInfo, StealthCurve, SwapRequest, SwapResult, TransactionData, TransportType, Treasury, TrezorConfig, TrezorModel, TrezorWalletAdapter, ValidationError, VerificationResult, WalletAdapter, WalletError, ZcashQuote, ZcashQuoteParams, ZcashRPCClient, ZcashRPCError, ZcashShieldedService, ZcashShieldedServiceConfig, ZcashSwapParams, ZcashSwapResult, ZcashSwapService, ZcashSwapServiceConfig, ZcashSwapSourceChain, ZcashSwapSourceToken, ZcashSwapStatus, addBlindings, addCommitments, addOracle, attachProofs, base58ToHex, browserBytesToHex, browserHexToBytes, checkEd25519StealthAddress, checkStealthAddress, commit, commitZero, computeAttestationHash, createCommitment, createEthereumAdapter, createLedgerAdapter, createMockEthereumAdapter, createMockEthereumProvider, createMockLedgerAdapter, createMockSolanaAdapter, createMockSolanaConnection, createMockSolanaProvider, createMockSolver, createMockTrezorAdapter, createNEARIntentsAdapter, createOracleRegistry, createProductionSIP, createSIP, createShieldedIntent, createShieldedPayment, createSolanaAdapter, createTrezorAdapter, createWalletFactory, createZcashClient, createZcashShieldedService, createZcashSwapService, decodeStealthMetaAddress, decryptMemo, decryptWithViewing, deriveEd25519StealthPrivateKey, deriveOracleId, deriveStealthPrivateKey, deriveViewingKey, deserializeAttestationMessage, deserializeIntent, deserializePayment, detectEthereumWallets, detectSolanaWallets, ed25519PublicKeyToNearAddress, ed25519PublicKeyToSolanaAddress, encodeStealthMetaAddress, encryptForViewing, featureNotSupportedError, formatStablecoinAmount, fromHex, fromStablecoinUnits, generateBlinding, generateEd25519StealthAddress, generateEd25519StealthMetaAddress, generateIntentId, generateRandomBytes, generateStealthAddress, generateStealthMetaAddress, generateViewingKey, getActiveOracles, getAvailableTransports, getBrowserInfo, getChainNumericId, getChainsForStablecoin, getCurveForChain, getDefaultRpcEndpoint, getDerivationPath, getErrorMessage, getEthereumProvider, getGenerators, getIntentSummary, getPaymentSummary, getPaymentTimeRemaining, getPrivacyConfig, getPrivacyDescription, getSolanaProvider, getStablecoin, getStablecoinInfo, getStablecoinsForChain, getSupportedStablecoins, getTimeRemaining, hasEnoughOracles, hasErrorCode, hasRequiredProofs, hash, hexToNumber, isBrowser, isEd25519Chain, isExpired, isNonNegativeAmount, isPaymentExpired, isPrivateWalletAdapter, isSIPError, isStablecoin, isStablecoinOnChain, isValidAmount, isValidChainId, isValidCompressedPublicKey, isValidEd25519PublicKey, isValidHex, isValidHexLength, isValidNearAccountId, isValidNearImplicitAddress, isValidPrivacyLevel, isValidPrivateKey, isValidScalar, isValidSlippage, isValidSolanaAddress, isValidStealthMetaAddress, nearAddressToEd25519PublicKey, normalizeAddress, notConnectedError, publicKeyToEthAddress, registerWallet, removeOracle, secureWipe, secureWipeAll, serializeAttestationMessage, serializeIntent, serializePayment, signAttestationMessage, solanaAddressToEd25519PublicKey, solanaPublicKeyToHex, subtractBlindings, subtractCommitments, supportsSharedArrayBuffer, supportsWebBluetooth, supportsWebHID, supportsWebUSB, supportsWebWorkers, toHex, toStablecoinUnits, trackIntent, trackPayment, updateOracleStatus, validateAsset, validateCreateIntentParams, validateIntentInput, validateIntentOutput, validateScalar, validateViewingKey, verifyAttestation, verifyCommitment, verifyOpening, verifyOracleSignature, walletRegistry, withSecureBuffer, withSecureBufferSync, wrapError } from './index.mjs';
|
|
2
|
-
|
|
1
|
+
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, ct as BaseWalletAdapter, c1 as BridgeProvider, B as BrowserNoirProvider, t as BrowserNoirProviderConfig, bm as CHAIN_NUMERIC_IDS, aM as CommitmentPoint, cs as ComplianceManager, $ as CreateIntentOptions, cp as CreatePaymentOptions, C as CryptoError, bk as DEFAULT_THRESHOLD, bl as DEFAULT_TOTAL_ORACLES, c$ as DerivationPath, dt as EIP1193ConnectInfo, ds as EIP1193Event, dq as EIP1193Provider, du as EIP1193ProviderRpcError, dr as EIP1193RequestArguments, dv as EIP712Domain, dw as EIP712TypeDefinition, dy as EIP712TypedData, dx as EIP712Types, w as EncryptionNotImplementedError, E as ErrorCode, dE as EthereumAdapterConfig, cY as EthereumChainId, dF as EthereumChainIdType, dC as EthereumChainMetadata, dB as EthereumTokenMetadata, dA as EthereumTransactionReceipt, dz as EthereumTransactionRequest, cM as EthereumWalletAdapter, dD as EthereumWalletName, bU as ExportedViewingKey, dT as HardwareAccount, dK as HardwareConnectionStatus, dM as HardwareDeviceInfo, cZ as HardwareErrorCode, dV as HardwareErrorCodeType, dR as HardwareEthereumTx, dQ as HardwareSignRequest, dS as HardwareSignature, dU as HardwareTransport, dN as HardwareWalletConfig, c_ as HardwareWalletError, dH as HardwareWalletType, L as IntentBuilder, I as IntentError, dO as LedgerConfig, dI as LedgerModel, d5 as LedgerWalletAdapter, p as MobileBrowser, q as MobileDeviceInfo, M as MobilePlatform, r as MobileWASMCompatibility, cO as MockEthereumAdapter, dG as MockEthereumAdapterConfig, dW as MockHardwareConfig, d9 as MockLedgerAdapter, b3 as MockProofProvider, cE as MockSolanaAdapter, dp as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, da as MockTrezorAdapter, cu as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, N as NetworkError, bi as ORACLE_DOMAIN, by as OneClickClient, bq as OracleAttestationMessage, bn as OracleId, bp as OracleInfo, bt as OracleRegistry, bu as OracleRegistryConfig, br as OracleSignature, bo as OracleStatus, c3 as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, c2 as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, bS as ReceivedNote, F as SIP, J as SIPConfig, S as SIPError, cd as STABLECOIN_ADDRESSES, ce as STABLECOIN_DECIMALS, cc as STABLECOIN_INFO, D as SerializedError, bT as ShieldedBalance, bQ as ShieldedSendParams, bR as ShieldedSendResult, bs as SignedOracleAttestation, dj as SolanaAdapterConfig, di as SolanaCluster, dk as SolanaConnection, dd as SolanaPublicKey, dl as SolanaSendOptions, dn as SolanaSignature, de as SolanaTransaction, dm as SolanaUnsignedTransaction, df as SolanaVersionedTransaction, cC as SolanaWalletAdapter, dh as SolanaWalletName, dg as SolanaWalletProvider, cq as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, as as TransactionData, dL as TransportType, cr as Treasury, dP as TrezorConfig, dJ as TrezorModel, d7 as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cv as WalletError, bZ as ZcashQuote, bY as ZcashQuoteParams, bI as ZcashRPCClient, bJ as ZcashRPCError, bL as ZcashShieldedService, bP as ZcashShieldedServiceConfig, b_ as ZcashSwapParams, b$ as ZcashSwapResult, bN as ZcashSwapService, bV as ZcashSwapServiceConfig, bW as ZcashSwapSourceChain, bX as ZcashSwapSourceToken, c0 as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, cL as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, f as checkMobileWASMCompatibility, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, cN as createEthereumAdapter, d6 as createLedgerAdapter, cP as createMockEthereumAdapter, cQ as createMockEthereumProvider, db as createMockLedgerAdapter, cF as createMockSolanaAdapter, cH as createMockSolanaConnection, cG as createMockSolanaProvider, bG as createMockSolver, dc as createMockTrezorAdapter, bA as createNEARIntentsAdapter, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, c4 as createShieldedPayment, cD as createSolanaAdapter, d8 as createTrezorAdapter, cA as createWalletFactory, bK as createZcashClient, bM as createZcashShieldedService, bO as createZcashSwapService, a5 as decodeStealthMetaAddress, c5 as decryptMemo, ap as decryptWithViewing, ab as deriveEd25519StealthPrivateKey, b7 as deriveOracleId, a2 as deriveStealthPrivateKey, an as deriveViewingKey, bf as deserializeAttestationMessage, Z as deserializeIntent, ca as deserializePayment, cS as detectEthereumWallets, c as detectMobileBrowser, d as detectMobilePlatform, cJ as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cx as featureNotSupportedError, co as formatStablecoinAmount, cU as fromHex, cn as fromStablecoinUnits, aK as generateBlinding, aa as generateEd25519StealthAddress, a9 as generateEd25519StealthMetaAddress, av as generateIntentId, ax as generateRandomBytes, a1 as generateStealthAddress, a0 as generateStealthMetaAddress, am as generateViewingKey, bc as getActiveOracles, d4 as getAvailableTransports, g as getBrowserInfo, j as getBrowserVersion, bh as getChainNumericId, cl as getChainsForStablecoin, a8 as getCurveForChain, cX as getDefaultRpcEndpoint, d0 as getDerivationPath, A as getErrorMessage, cR as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, e as getMobileDeviceInfo, k as getOSVersion, cb as getPaymentSummary, c8 as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, cI as getSolanaProvider, cf as getStablecoin, ci as getStablecoinInfo, cg as getStablecoinsForChain, cj as getSupportedStablecoins, X as getTimeRemaining, bd as hasEnoughOracles, y as hasErrorCode, R as hasRequiredProofs, aw as hash, cV as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, c7 as isPaymentExpired, cB as isPrivateWalletAdapter, x as isSIPError, ch as isStablecoin, ck as isStablecoinOnChain, l as isTablet, aR as isValidAmount, aN as isValidChainId, aV as isValidCompressedPublicKey, aW as isValidEd25519PublicKey, aP as isValidHex, aQ as isValidHexLength, aj as isValidNearAccountId, ai as isValidNearImplicitAddress, aO as isValidPrivacyLevel, aX as isValidPrivateKey, aY as isValidScalar, aT as isValidSlippage, af as isValidSolanaAddress, aU as isValidStealthMetaAddress, ah as nearAddressToEd25519PublicKey, cW as normalizeAddress, cw as notConnectedError, a6 as publicKeyToEthAddress, cz as registerWallet, ba as removeOracle, ay as secureWipe, az as secureWipeAll, be as serializeAttestationMessage, Y as serializeIntent, c9 as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, cK as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, m as supportsTouch, o as supportsWASMBulkMemory, n as supportsWASMSimd, d3 as supportsWebBluetooth, d2 as supportsWebHID, d1 as supportsWebUSB, s as supportsWebWorkers, cT as toHex, cm as toStablecoinUnits, T as trackIntent, c6 as trackPayment, bb as updateOracleStatus, a_ as validateAsset, aZ as validateCreateIntentParams, a$ as validateIntentInput, b0 as validateIntentOutput, b2 as validateScalar, b1 as validateViewingKey, b4 as verifyAttestation, au as verifyCommitment, aD as verifyOpening, b5 as verifyOracleSignature, cy as walletRegistry, aA as withSecureBuffer, aB as withSecureBufferSync, z as wrapError } from './index-CAhjA4kh.mjs';
|
|
2
|
+
import { F as FundingProofParams, V as ValidityProofParams, a as FulfillmentProofParams, P as ProofResult } from './noir-BTyLXLlZ.mjs';
|
|
3
|
+
export { N as NoirProviderConfig, O as OracleAttestation, d as ProofFramework, b as ProofGenerationError, c as ProofProvider } from './noir-BTyLXLlZ.mjs';
|
|
3
4
|
export { Asset, AuditLogEntry, AuditScope, AuditorRegistration, AuditorViewingKey, BatchPaymentRecipient, BatchPaymentRequest, ChainId, Commitment, ComplianceConfig, ComplianceReport, ComplianceRole, CreateBatchProposalParams, CreateComplianceConfigParams, CreateIntentParams, CreatePaymentParams, CreatePaymentProposalParams, CreateTreasuryParams, DefuseAssetId, DisclosedTransaction, DisclosureRequest, FulfillmentCommitment, FulfillmentProof, FulfillmentRequest, FulfillmentResult, FulfillmentStatus, GenerateReportParams, Hash, HexString, WalletAdapter as IWalletAdapter, IntentStatus, NATIVE_TOKENS, OneClickConfig, OneClickDepositMode, OneClickErrorCode, OneClickQuoteRequest, OneClickQuoteResponse, OneClickStatusResponse, OneClickSwapStatus, OneClickSwapType, PaymentPurpose, PaymentReceipt, PaymentStatus, PaymentStatusType, PrivacyLevel, PrivateWalletAdapter, ProposalSignature, ProposalStatus, ProposalStatusType, ProposalType, Quote, RegisterAuditorParams, ReportData, ReportFormat, ReportStatus, ReportStatusType, ReportType, SIPSolver, SIP_VERSION, ShieldedIntent, ShieldedPayment, Signature, SignedTransaction, Solver, SolverCapabilities, SolverEvent, SolverEventListener, SolverQuote, SolverVisibleIntent, StablecoinSymbol, StealthAddress, StealthAddressRecovery, StealthMetaAddress, SwapRoute, SwapRouteStep, TrackedIntent, TrackedPayment, TransactionReceipt, TreasuryBalance, TreasuryConfig, TreasuryMember, TreasuryProposal, TreasuryRole, TreasuryTransaction, UnsignedTransaction, ViewingKey, WalletAccountChangedEvent, WalletAdapterFactory, WalletChainChangedEvent, WalletConnectEvent, WalletConnectionState, WalletDisconnectEvent, WalletErrorCode, WalletErrorEvent, WalletEvent, WalletEventHandler, WalletEventType, WalletInfo, WalletRegistryEntry, WalletShieldedSendParams, WalletShieldedSendResult, ZKProof, ZcashAccountAddress, ZcashAccountBalance, ZcashAddressInfo, ZcashAddressType, ZcashBlock, ZcashBlockHeader, ZcashBlockchainInfo, ZcashConfig, ZcashErrorCode, ZcashNetwork, ZcashNetworkInfo, ZcashNewAccount, ZcashOperation, ZcashOperationError, ZcashOperationStatus, ZcashOperationTxResult, ZcashPool, ZcashPoolBalance, ZcashPrivacyPolicy, ZcashReceiverType, ZcashSendRecipient, ZcashShieldedSendParams, ZcashUnspentNote, isPrivate, supportsViewingKey } from '@sip-protocol/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Proof Generation Web Worker
|
|
8
|
+
*
|
|
9
|
+
* Runs proof generation off the main thread to keep UI responsive.
|
|
10
|
+
* Communicates via postMessage with the main thread.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/sip-protocol/sip-protocol/issues/140
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type WorkerMessageType = 'init' | 'generateFundingProof' | 'generateValidityProof' | 'generateFulfillmentProof' | 'destroy';
|
|
16
|
+
interface WorkerRequest {
|
|
17
|
+
id: string;
|
|
18
|
+
type: WorkerMessageType;
|
|
19
|
+
params?: FundingProofParams | ValidityProofParams | FulfillmentProofParams;
|
|
20
|
+
config?: {
|
|
21
|
+
verbose?: boolean;
|
|
22
|
+
oraclePublicKey?: {
|
|
23
|
+
x: number[];
|
|
24
|
+
y: number[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface WorkerResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'success' | 'error' | 'progress';
|
|
31
|
+
result?: ProofResult;
|
|
32
|
+
error?: string;
|
|
33
|
+
progress?: {
|
|
34
|
+
stage: string;
|
|
35
|
+
percent: number;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create inline worker code as a blob URL
|
|
41
|
+
* This approach works with most bundlers without special configuration
|
|
42
|
+
*/
|
|
43
|
+
declare function createWorkerBlobURL(): string;
|
|
44
|
+
/**
|
|
45
|
+
* ProofWorker class for managing Web Worker proof generation
|
|
46
|
+
*
|
|
47
|
+
* Provides a clean API for generating proofs in a Web Worker,
|
|
48
|
+
* with progress callbacks and automatic fallback to main thread.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const worker = new ProofWorker()
|
|
53
|
+
* await worker.initialize()
|
|
54
|
+
*
|
|
55
|
+
* const result = await worker.generateProof('funding', params, (progress) => {
|
|
56
|
+
* console.log(`${progress.stage}: ${progress.percent}%`)
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare class ProofWorker {
|
|
61
|
+
private worker;
|
|
62
|
+
private pendingRequests;
|
|
63
|
+
private _isReady;
|
|
64
|
+
private requestCounter;
|
|
65
|
+
/**
|
|
66
|
+
* Check if Web Workers are supported
|
|
67
|
+
*/
|
|
68
|
+
static isSupported(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Check if worker is initialized and ready
|
|
71
|
+
*/
|
|
72
|
+
get isReady(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the worker
|
|
75
|
+
*/
|
|
76
|
+
initialize(config?: {
|
|
77
|
+
verbose?: boolean;
|
|
78
|
+
oraclePublicKey?: {
|
|
79
|
+
x: number[];
|
|
80
|
+
y: number[];
|
|
81
|
+
};
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Generate a proof using the worker
|
|
85
|
+
*/
|
|
86
|
+
generateProof(type: 'funding' | 'validity' | 'fulfillment', params: FundingProofParams | ValidityProofParams | FulfillmentProofParams, onProgress?: (progress: NonNullable<WorkerResponse['progress']>) => void): Promise<ProofResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Destroy the worker and free resources
|
|
89
|
+
*/
|
|
90
|
+
destroy(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Send a request to the worker
|
|
93
|
+
*/
|
|
94
|
+
private sendRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Handle messages from the worker
|
|
97
|
+
*/
|
|
98
|
+
private handleWorkerMessage;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { FulfillmentProofParams, FundingProofParams, ProofResult, ProofWorker, ValidityProofParams, type WorkerMessageType, type WorkerRequest, type WorkerResponse, createWorkerBlobURL };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,3 +1,101 @@
|
|
|
1
|
-
export { ATTESTATION_VERSION, AttestationRequest, AttestationResult, BaseWalletAdapter, BridgeProvider, B as BrowserNoirProvider, BrowserNoirProviderConfig, CHAIN_NUMERIC_IDS, CommitmentPoint, ComplianceManager, CreateIntentOptions, CreatePaymentOptions, CryptoError, DEFAULT_THRESHOLD, DEFAULT_TOTAL_ORACLES, DerivationPath, EIP1193ConnectInfo, EIP1193Event, EIP1193Provider, EIP1193ProviderRpcError, EIP1193RequestArguments, EIP712Domain, EIP712TypeDefinition, EIP712TypedData, EIP712Types, EncryptionNotImplementedError, ErrorCode, EthereumAdapterConfig, EthereumChainId, EthereumChainIdType, EthereumChainMetadata, EthereumTokenMetadata, EthereumTransactionReceipt, EthereumTransactionRequest, EthereumWalletAdapter, EthereumWalletName, ExportedViewingKey, HardwareAccount, HardwareConnectionStatus, HardwareDeviceInfo, HardwareErrorCode, HardwareErrorCodeType, HardwareEthereumTx, HardwareSignRequest, HardwareSignature, HardwareTransport, HardwareWalletConfig, HardwareWalletError, HardwareWalletType, IntentBuilder, IntentError, LedgerConfig, LedgerModel, LedgerWalletAdapter, MockEthereumAdapter, MockEthereumAdapterConfig, MockHardwareConfig, MockLedgerAdapter, MockProofProvider, MockSolanaAdapter, MockSolanaAdapterConfig, MockSolver, MockSolverConfig, MockTrezorAdapter, MockWalletAdapter, NEARIntentsAdapter, NEARIntentsAdapterConfig, NetworkError, ORACLE_DOMAIN, OneClickClient, OracleAttestationMessage, OracleId, OracleInfo, OracleRegistry, OracleRegistryConfig, OracleSignature, OracleStatus, PaymentBuilder, PedersenCommitment, PreparedSwap, PriceFeed, PrivacyConfig, ProductionQuote, ProofError, ProofNotImplementedError, ProofProgressCallback, ReceivedNote, SIP, SIPConfig, SIPError, STABLECOIN_ADDRESSES, STABLECOIN_DECIMALS, STABLECOIN_INFO, SerializedError, ShieldedBalance, ShieldedSendParams, ShieldedSendResult, SignedOracleAttestation, SolanaAdapterConfig, SolanaCluster, SolanaConnection, SolanaPublicKey, SolanaSendOptions, SolanaSignature, SolanaTransaction, SolanaUnsignedTransaction, SolanaVersionedTransaction, SolanaWalletAdapter, SolanaWalletName, SolanaWalletProvider, StablecoinInfo, StealthCurve, SwapRequest, SwapResult, TransactionData, TransportType, Treasury, TrezorConfig, TrezorModel, TrezorWalletAdapter, ValidationError, VerificationResult, WalletAdapter, WalletError, ZcashQuote, ZcashQuoteParams, ZcashRPCClient, ZcashRPCError, ZcashShieldedService, ZcashShieldedServiceConfig, ZcashSwapParams, ZcashSwapResult, ZcashSwapService, ZcashSwapServiceConfig, ZcashSwapSourceChain, ZcashSwapSourceToken, ZcashSwapStatus, addBlindings, addCommitments, addOracle, attachProofs, base58ToHex, browserBytesToHex, browserHexToBytes, checkEd25519StealthAddress, checkStealthAddress, commit, commitZero, computeAttestationHash, createCommitment, createEthereumAdapter, createLedgerAdapter, createMockEthereumAdapter, createMockEthereumProvider, createMockLedgerAdapter, createMockSolanaAdapter, createMockSolanaConnection, createMockSolanaProvider, createMockSolver, createMockTrezorAdapter, createNEARIntentsAdapter, createOracleRegistry, createProductionSIP, createSIP, createShieldedIntent, createShieldedPayment, createSolanaAdapter, createTrezorAdapter, createWalletFactory, createZcashClient, createZcashShieldedService, createZcashSwapService, decodeStealthMetaAddress, decryptMemo, decryptWithViewing, deriveEd25519StealthPrivateKey, deriveOracleId, deriveStealthPrivateKey, deriveViewingKey, deserializeAttestationMessage, deserializeIntent, deserializePayment, detectEthereumWallets, detectSolanaWallets, ed25519PublicKeyToNearAddress, ed25519PublicKeyToSolanaAddress, encodeStealthMetaAddress, encryptForViewing, featureNotSupportedError, formatStablecoinAmount, fromHex, fromStablecoinUnits, generateBlinding, generateEd25519StealthAddress, generateEd25519StealthMetaAddress, generateIntentId, generateRandomBytes, generateStealthAddress, generateStealthMetaAddress, generateViewingKey, getActiveOracles, getAvailableTransports, getBrowserInfo, getChainNumericId, getChainsForStablecoin, getCurveForChain, getDefaultRpcEndpoint, getDerivationPath, getErrorMessage, getEthereumProvider, getGenerators, getIntentSummary, getPaymentSummary, getPaymentTimeRemaining, getPrivacyConfig, getPrivacyDescription, getSolanaProvider, getStablecoin, getStablecoinInfo, getStablecoinsForChain, getSupportedStablecoins, getTimeRemaining, hasEnoughOracles, hasErrorCode, hasRequiredProofs, hash, hexToNumber, isBrowser, isEd25519Chain, isExpired, isNonNegativeAmount, isPaymentExpired, isPrivateWalletAdapter, isSIPError, isStablecoin, isStablecoinOnChain, isValidAmount, isValidChainId, isValidCompressedPublicKey, isValidEd25519PublicKey, isValidHex, isValidHexLength, isValidNearAccountId, isValidNearImplicitAddress, isValidPrivacyLevel, isValidPrivateKey, isValidScalar, isValidSlippage, isValidSolanaAddress, isValidStealthMetaAddress, nearAddressToEd25519PublicKey, normalizeAddress, notConnectedError, publicKeyToEthAddress, registerWallet, removeOracle, secureWipe, secureWipeAll, serializeAttestationMessage, serializeIntent, serializePayment, signAttestationMessage, solanaAddressToEd25519PublicKey, solanaPublicKeyToHex, subtractBlindings, subtractCommitments, supportsSharedArrayBuffer, supportsWebBluetooth, supportsWebHID, supportsWebUSB, supportsWebWorkers, toHex, toStablecoinUnits, trackIntent, trackPayment, updateOracleStatus, validateAsset, validateCreateIntentParams, validateIntentInput, validateIntentOutput, validateScalar, validateViewingKey, verifyAttestation, verifyCommitment, verifyOpening, verifyOracleSignature, walletRegistry, withSecureBuffer, withSecureBufferSync, wrapError } from './index.js';
|
|
2
|
-
|
|
1
|
+
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, ct as BaseWalletAdapter, c1 as BridgeProvider, B as BrowserNoirProvider, t as BrowserNoirProviderConfig, bm as CHAIN_NUMERIC_IDS, aM as CommitmentPoint, cs as ComplianceManager, $ as CreateIntentOptions, cp as CreatePaymentOptions, C as CryptoError, bk as DEFAULT_THRESHOLD, bl as DEFAULT_TOTAL_ORACLES, c$ as DerivationPath, dt as EIP1193ConnectInfo, ds as EIP1193Event, dq as EIP1193Provider, du as EIP1193ProviderRpcError, dr as EIP1193RequestArguments, dv as EIP712Domain, dw as EIP712TypeDefinition, dy as EIP712TypedData, dx as EIP712Types, w as EncryptionNotImplementedError, E as ErrorCode, dE as EthereumAdapterConfig, cY as EthereumChainId, dF as EthereumChainIdType, dC as EthereumChainMetadata, dB as EthereumTokenMetadata, dA as EthereumTransactionReceipt, dz as EthereumTransactionRequest, cM as EthereumWalletAdapter, dD as EthereumWalletName, bU as ExportedViewingKey, dT as HardwareAccount, dK as HardwareConnectionStatus, dM as HardwareDeviceInfo, cZ as HardwareErrorCode, dV as HardwareErrorCodeType, dR as HardwareEthereumTx, dQ as HardwareSignRequest, dS as HardwareSignature, dU as HardwareTransport, dN as HardwareWalletConfig, c_ as HardwareWalletError, dH as HardwareWalletType, L as IntentBuilder, I as IntentError, dO as LedgerConfig, dI as LedgerModel, d5 as LedgerWalletAdapter, p as MobileBrowser, q as MobileDeviceInfo, M as MobilePlatform, r as MobileWASMCompatibility, cO as MockEthereumAdapter, dG as MockEthereumAdapterConfig, dW as MockHardwareConfig, d9 as MockLedgerAdapter, b3 as MockProofProvider, cE as MockSolanaAdapter, dp as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, da as MockTrezorAdapter, cu as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, N as NetworkError, bi as ORACLE_DOMAIN, by as OneClickClient, bq as OracleAttestationMessage, bn as OracleId, bp as OracleInfo, bt as OracleRegistry, bu as OracleRegistryConfig, br as OracleSignature, bo as OracleStatus, c3 as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, c2 as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, bS as ReceivedNote, F as SIP, J as SIPConfig, S as SIPError, cd as STABLECOIN_ADDRESSES, ce as STABLECOIN_DECIMALS, cc as STABLECOIN_INFO, D as SerializedError, bT as ShieldedBalance, bQ as ShieldedSendParams, bR as ShieldedSendResult, bs as SignedOracleAttestation, dj as SolanaAdapterConfig, di as SolanaCluster, dk as SolanaConnection, dd as SolanaPublicKey, dl as SolanaSendOptions, dn as SolanaSignature, de as SolanaTransaction, dm as SolanaUnsignedTransaction, df as SolanaVersionedTransaction, cC as SolanaWalletAdapter, dh as SolanaWalletName, dg as SolanaWalletProvider, cq as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, as as TransactionData, dL as TransportType, cr as Treasury, dP as TrezorConfig, dJ as TrezorModel, d7 as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cv as WalletError, bZ as ZcashQuote, bY as ZcashQuoteParams, bI as ZcashRPCClient, bJ as ZcashRPCError, bL as ZcashShieldedService, bP as ZcashShieldedServiceConfig, b_ as ZcashSwapParams, b$ as ZcashSwapResult, bN as ZcashSwapService, bV as ZcashSwapServiceConfig, bW as ZcashSwapSourceChain, bX as ZcashSwapSourceToken, c0 as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, cL as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, f as checkMobileWASMCompatibility, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, cN as createEthereumAdapter, d6 as createLedgerAdapter, cP as createMockEthereumAdapter, cQ as createMockEthereumProvider, db as createMockLedgerAdapter, cF as createMockSolanaAdapter, cH as createMockSolanaConnection, cG as createMockSolanaProvider, bG as createMockSolver, dc as createMockTrezorAdapter, bA as createNEARIntentsAdapter, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, c4 as createShieldedPayment, cD as createSolanaAdapter, d8 as createTrezorAdapter, cA as createWalletFactory, bK as createZcashClient, bM as createZcashShieldedService, bO as createZcashSwapService, a5 as decodeStealthMetaAddress, c5 as decryptMemo, ap as decryptWithViewing, ab as deriveEd25519StealthPrivateKey, b7 as deriveOracleId, a2 as deriveStealthPrivateKey, an as deriveViewingKey, bf as deserializeAttestationMessage, Z as deserializeIntent, ca as deserializePayment, cS as detectEthereumWallets, c as detectMobileBrowser, d as detectMobilePlatform, cJ as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cx as featureNotSupportedError, co as formatStablecoinAmount, cU as fromHex, cn as fromStablecoinUnits, aK as generateBlinding, aa as generateEd25519StealthAddress, a9 as generateEd25519StealthMetaAddress, av as generateIntentId, ax as generateRandomBytes, a1 as generateStealthAddress, a0 as generateStealthMetaAddress, am as generateViewingKey, bc as getActiveOracles, d4 as getAvailableTransports, g as getBrowserInfo, j as getBrowserVersion, bh as getChainNumericId, cl as getChainsForStablecoin, a8 as getCurveForChain, cX as getDefaultRpcEndpoint, d0 as getDerivationPath, A as getErrorMessage, cR as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, e as getMobileDeviceInfo, k as getOSVersion, cb as getPaymentSummary, c8 as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, cI as getSolanaProvider, cf as getStablecoin, ci as getStablecoinInfo, cg as getStablecoinsForChain, cj as getSupportedStablecoins, X as getTimeRemaining, bd as hasEnoughOracles, y as hasErrorCode, R as hasRequiredProofs, aw as hash, cV as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, c7 as isPaymentExpired, cB as isPrivateWalletAdapter, x as isSIPError, ch as isStablecoin, ck as isStablecoinOnChain, l as isTablet, aR as isValidAmount, aN as isValidChainId, aV as isValidCompressedPublicKey, aW as isValidEd25519PublicKey, aP as isValidHex, aQ as isValidHexLength, aj as isValidNearAccountId, ai as isValidNearImplicitAddress, aO as isValidPrivacyLevel, aX as isValidPrivateKey, aY as isValidScalar, aT as isValidSlippage, af as isValidSolanaAddress, aU as isValidStealthMetaAddress, ah as nearAddressToEd25519PublicKey, cW as normalizeAddress, cw as notConnectedError, a6 as publicKeyToEthAddress, cz as registerWallet, ba as removeOracle, ay as secureWipe, az as secureWipeAll, be as serializeAttestationMessage, Y as serializeIntent, c9 as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, cK as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, m as supportsTouch, o as supportsWASMBulkMemory, n as supportsWASMSimd, d3 as supportsWebBluetooth, d2 as supportsWebHID, d1 as supportsWebUSB, s as supportsWebWorkers, cT as toHex, cm as toStablecoinUnits, T as trackIntent, c6 as trackPayment, bb as updateOracleStatus, a_ as validateAsset, aZ as validateCreateIntentParams, a$ as validateIntentInput, b0 as validateIntentOutput, b2 as validateScalar, b1 as validateViewingKey, b4 as verifyAttestation, au as verifyCommitment, aD as verifyOpening, b5 as verifyOracleSignature, cy as walletRegistry, aA as withSecureBuffer, aB as withSecureBufferSync, z as wrapError } from './index-BFOKTz2z.js';
|
|
2
|
+
import { F as FundingProofParams, V as ValidityProofParams, a as FulfillmentProofParams, P as ProofResult } from './noir-BTyLXLlZ.js';
|
|
3
|
+
export { N as NoirProviderConfig, O as OracleAttestation, d as ProofFramework, b as ProofGenerationError, c as ProofProvider } from './noir-BTyLXLlZ.js';
|
|
3
4
|
export { Asset, AuditLogEntry, AuditScope, AuditorRegistration, AuditorViewingKey, BatchPaymentRecipient, BatchPaymentRequest, ChainId, Commitment, ComplianceConfig, ComplianceReport, ComplianceRole, CreateBatchProposalParams, CreateComplianceConfigParams, CreateIntentParams, CreatePaymentParams, CreatePaymentProposalParams, CreateTreasuryParams, DefuseAssetId, DisclosedTransaction, DisclosureRequest, FulfillmentCommitment, FulfillmentProof, FulfillmentRequest, FulfillmentResult, FulfillmentStatus, GenerateReportParams, Hash, HexString, WalletAdapter as IWalletAdapter, IntentStatus, NATIVE_TOKENS, OneClickConfig, OneClickDepositMode, OneClickErrorCode, OneClickQuoteRequest, OneClickQuoteResponse, OneClickStatusResponse, OneClickSwapStatus, OneClickSwapType, PaymentPurpose, PaymentReceipt, PaymentStatus, PaymentStatusType, PrivacyLevel, PrivateWalletAdapter, ProposalSignature, ProposalStatus, ProposalStatusType, ProposalType, Quote, RegisterAuditorParams, ReportData, ReportFormat, ReportStatus, ReportStatusType, ReportType, SIPSolver, SIP_VERSION, ShieldedIntent, ShieldedPayment, Signature, SignedTransaction, Solver, SolverCapabilities, SolverEvent, SolverEventListener, SolverQuote, SolverVisibleIntent, StablecoinSymbol, StealthAddress, StealthAddressRecovery, StealthMetaAddress, SwapRoute, SwapRouteStep, TrackedIntent, TrackedPayment, TransactionReceipt, TreasuryBalance, TreasuryConfig, TreasuryMember, TreasuryProposal, TreasuryRole, TreasuryTransaction, UnsignedTransaction, ViewingKey, WalletAccountChangedEvent, WalletAdapterFactory, WalletChainChangedEvent, WalletConnectEvent, WalletConnectionState, WalletDisconnectEvent, WalletErrorCode, WalletErrorEvent, WalletEvent, WalletEventHandler, WalletEventType, WalletInfo, WalletRegistryEntry, WalletShieldedSendParams, WalletShieldedSendResult, ZKProof, ZcashAccountAddress, ZcashAccountBalance, ZcashAddressInfo, ZcashAddressType, ZcashBlock, ZcashBlockHeader, ZcashBlockchainInfo, ZcashConfig, ZcashErrorCode, ZcashNetwork, ZcashNetworkInfo, ZcashNewAccount, ZcashOperation, ZcashOperationError, ZcashOperationStatus, ZcashOperationTxResult, ZcashPool, ZcashPoolBalance, ZcashPrivacyPolicy, ZcashReceiverType, ZcashSendRecipient, ZcashShieldedSendParams, ZcashUnspentNote, isPrivate, supportsViewingKey } from '@sip-protocol/types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Proof Generation Web Worker
|
|
8
|
+
*
|
|
9
|
+
* Runs proof generation off the main thread to keep UI responsive.
|
|
10
|
+
* Communicates via postMessage with the main thread.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/sip-protocol/sip-protocol/issues/140
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type WorkerMessageType = 'init' | 'generateFundingProof' | 'generateValidityProof' | 'generateFulfillmentProof' | 'destroy';
|
|
16
|
+
interface WorkerRequest {
|
|
17
|
+
id: string;
|
|
18
|
+
type: WorkerMessageType;
|
|
19
|
+
params?: FundingProofParams | ValidityProofParams | FulfillmentProofParams;
|
|
20
|
+
config?: {
|
|
21
|
+
verbose?: boolean;
|
|
22
|
+
oraclePublicKey?: {
|
|
23
|
+
x: number[];
|
|
24
|
+
y: number[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface WorkerResponse {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'success' | 'error' | 'progress';
|
|
31
|
+
result?: ProofResult;
|
|
32
|
+
error?: string;
|
|
33
|
+
progress?: {
|
|
34
|
+
stage: string;
|
|
35
|
+
percent: number;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create inline worker code as a blob URL
|
|
41
|
+
* This approach works with most bundlers without special configuration
|
|
42
|
+
*/
|
|
43
|
+
declare function createWorkerBlobURL(): string;
|
|
44
|
+
/**
|
|
45
|
+
* ProofWorker class for managing Web Worker proof generation
|
|
46
|
+
*
|
|
47
|
+
* Provides a clean API for generating proofs in a Web Worker,
|
|
48
|
+
* with progress callbacks and automatic fallback to main thread.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const worker = new ProofWorker()
|
|
53
|
+
* await worker.initialize()
|
|
54
|
+
*
|
|
55
|
+
* const result = await worker.generateProof('funding', params, (progress) => {
|
|
56
|
+
* console.log(`${progress.stage}: ${progress.percent}%`)
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare class ProofWorker {
|
|
61
|
+
private worker;
|
|
62
|
+
private pendingRequests;
|
|
63
|
+
private _isReady;
|
|
64
|
+
private requestCounter;
|
|
65
|
+
/**
|
|
66
|
+
* Check if Web Workers are supported
|
|
67
|
+
*/
|
|
68
|
+
static isSupported(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Check if worker is initialized and ready
|
|
71
|
+
*/
|
|
72
|
+
get isReady(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Initialize the worker
|
|
75
|
+
*/
|
|
76
|
+
initialize(config?: {
|
|
77
|
+
verbose?: boolean;
|
|
78
|
+
oraclePublicKey?: {
|
|
79
|
+
x: number[];
|
|
80
|
+
y: number[];
|
|
81
|
+
};
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Generate a proof using the worker
|
|
85
|
+
*/
|
|
86
|
+
generateProof(type: 'funding' | 'validity' | 'fulfillment', params: FundingProofParams | ValidityProofParams | FulfillmentProofParams, onProgress?: (progress: NonNullable<WorkerResponse['progress']>) => void): Promise<ProofResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Destroy the worker and free resources
|
|
89
|
+
*/
|
|
90
|
+
destroy(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Send a request to the worker
|
|
93
|
+
*/
|
|
94
|
+
private sendRequest;
|
|
95
|
+
/**
|
|
96
|
+
* Handle messages from the worker
|
|
97
|
+
*/
|
|
98
|
+
private handleWorkerMessage;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { FulfillmentProofParams, FundingProofParams, ProofResult, ProofWorker, ValidityProofParams, type WorkerMessageType, type WorkerRequest, type WorkerResponse, createWorkerBlobURL };
|