@sip-protocol/sdk 0.3.0 → 0.3.1
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/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +246 -4
- package/dist/browser.mjs +241 -5
- package/dist/chunk-YZCK337Y.mjs +12155 -0
- package/dist/index-DAgedMrt.d.ts +6927 -0
- package/dist/index-DW7AQwcU.d.mts +6927 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/proofs/worker.ts +240 -4
- package/src/zcash/bridge.ts +20 -2
- package/src/zcash/swap-service.ts +20 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, bT as BackendCapabilities, cT as BaseWalletAdapter, cr as BridgeProvider, 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, dq 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, e2 as EthereumAdapterConfig, dm as EthereumChainId, e3 as EthereumChainIdType, e0 as EthereumChainMetadata, d$ as EthereumTokenMetadata, d_ as EthereumTransactionReceipt, dZ as EthereumTransactionRequest, da as EthereumWalletAdapter, e1 as EthereumWalletName, ci as ExportedViewingKey, c0 as FindBestRouteParams, eh as HardwareAccount, e8 as HardwareConnectionStatus, ea as HardwareDeviceInfo, dn as HardwareErrorCode, ej as HardwareErrorCodeType, ef as HardwareEthereumTx, ee as HardwareSignRequest, eg as HardwareSignature, ei as HardwareTransport, eb as HardwareWalletConfig, dp as HardwareWalletError, e5 as HardwareWalletType, L as IntentBuilder, I as IntentError, ec as LedgerConfig, e6 as LedgerModel, dw as LedgerWalletAdapter, dc as MockEthereumAdapter, e4 as MockEthereumAdapterConfig, ek as MockHardwareConfig, dA as MockLedgerAdapter, b3 as MockProofProvider, d2 as MockSolanaAdapter, dP as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, dB as MockTrezorAdapter, cU as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, c1 as NEARIntentsBackend, 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, ct as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, cs as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, b$ as QuoteComparison, cg as ReceivedNote, bX as Route, b_ as RouteWithQuote, F as SIP, J as SIPConfig, S as SIPError, cD as STABLECOIN_ADDRESSES, cE as STABLECOIN_DECIMALS, cC as STABLECOIN_INFO, D as SerializedError, bU as SettlementBackend, bV as SettlementBackendFactory, bL as SettlementBackendName, bW as SettlementBackendRegistry, bN as SettlementQuote, bM as SettlementQuoteParams, bJ as SettlementRegistry, bK as SettlementRegistryError, bQ as SettlementSwapParams, bR as SettlementSwapResult, bO as SettlementSwapRoute, bP as SettlementSwapRouteStep, ch as ShieldedBalance, ce as ShieldedSendParams, cf as ShieldedSendResult, bs as SignedOracleAttestation, bY as SmartRouter, dK as SolanaAdapterConfig, dJ as SolanaCluster, dL as SolanaConnection, dE as SolanaPublicKey, dM as SolanaSendOptions, dO as SolanaSignature, dF as SolanaTransaction, dN as SolanaUnsignedTransaction, dG as SolanaVersionedTransaction, d0 as SolanaWalletAdapter, dI as SolanaWalletName, dH as SolanaWalletProvider, cQ as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, bI as SwapStatus, bS as SwapStatusResponse, as as TransactionData, e9 as TransportType, cR as Treasury, ed as TrezorConfig, e7 as TrezorModel, dy as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cV as WalletError, c3 as ZcashNativeBackend, c5 as ZcashNativeBackendConfig, cn as ZcashQuote, cm as ZcashQuoteParams, c6 as ZcashRPCClient, c7 as ZcashRPCError, c9 as ZcashShieldedService, cd as ZcashShieldedServiceConfig, co as ZcashSwapParams, cp as ZcashSwapResult, cb as ZcashSwapService, cj as ZcashSwapServiceConfig, ck as ZcashSwapSourceChain, cl as ZcashSwapSourceToken, cq as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, d9 as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, db as createEthereumAdapter, dx as createLedgerAdapter, dd as createMockEthereumAdapter, de as createMockEthereumProvider, dC as createMockLedgerAdapter, d3 as createMockSolanaAdapter, d5 as createMockSolanaConnection, d4 as createMockSolanaProvider, bG as createMockSolver, dD as createMockTrezorAdapter, bA as createNEARIntentsAdapter, c2 as createNEARIntentsBackend, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, cu as createShieldedPayment, bZ as createSmartRouter, d1 as createSolanaAdapter, dz as createTrezorAdapter, c_ as createWalletFactory, c8 as createZcashClient, c4 as createZcashNativeBackend, ca as createZcashShieldedService, cc as createZcashSwapService, a5 as decodeStealthMetaAddress, cv 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, dg as detectEthereumWallets, d7 as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cX as featureNotSupportedError, cO as formatStablecoinAmount, di 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, dv as getAvailableTransports, g as getBrowserInfo, bh as getChainNumericId, cL as getChainsForStablecoin, a8 as getCurveForChain, dl as getDefaultRpcEndpoint, dr as getDerivationPath, A as getErrorMessage, df as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, cB as getPaymentSummary, cy as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, d6 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, dj as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, cx as isPaymentExpired, c$ as isPrivateWalletAdapter, x as isSIPError, cH as isStablecoin, cK as isStablecoinOnChain, 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, dk 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, cz as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, d8 as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, du as supportsWebBluetooth, dt as supportsWebHID, ds as supportsWebUSB, s as supportsWebWorkers, dh as toHex, cM as toStablecoinUnits, T as trackIntent, cw 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-
|
|
1
|
+
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, bT as BackendCapabilities, cT as BaseWalletAdapter, cr as BridgeProvider, 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, dq 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, e2 as EthereumAdapterConfig, dm as EthereumChainId, e3 as EthereumChainIdType, e0 as EthereumChainMetadata, d$ as EthereumTokenMetadata, d_ as EthereumTransactionReceipt, dZ as EthereumTransactionRequest, da as EthereumWalletAdapter, e1 as EthereumWalletName, ci as ExportedViewingKey, c0 as FindBestRouteParams, eh as HardwareAccount, e8 as HardwareConnectionStatus, ea as HardwareDeviceInfo, dn as HardwareErrorCode, ej as HardwareErrorCodeType, ef as HardwareEthereumTx, ee as HardwareSignRequest, eg as HardwareSignature, ei as HardwareTransport, eb as HardwareWalletConfig, dp as HardwareWalletError, e5 as HardwareWalletType, L as IntentBuilder, I as IntentError, ec as LedgerConfig, e6 as LedgerModel, dw as LedgerWalletAdapter, dc as MockEthereumAdapter, e4 as MockEthereumAdapterConfig, ek as MockHardwareConfig, dA as MockLedgerAdapter, b3 as MockProofProvider, d2 as MockSolanaAdapter, dP as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, dB as MockTrezorAdapter, cU as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, c1 as NEARIntentsBackend, 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, ct as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, cs as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, b$ as QuoteComparison, cg as ReceivedNote, bX as Route, b_ as RouteWithQuote, F as SIP, J as SIPConfig, S as SIPError, cD as STABLECOIN_ADDRESSES, cE as STABLECOIN_DECIMALS, cC as STABLECOIN_INFO, D as SerializedError, bU as SettlementBackend, bV as SettlementBackendFactory, bL as SettlementBackendName, bW as SettlementBackendRegistry, bN as SettlementQuote, bM as SettlementQuoteParams, bJ as SettlementRegistry, bK as SettlementRegistryError, bQ as SettlementSwapParams, bR as SettlementSwapResult, bO as SettlementSwapRoute, bP as SettlementSwapRouteStep, ch as ShieldedBalance, ce as ShieldedSendParams, cf as ShieldedSendResult, bs as SignedOracleAttestation, bY as SmartRouter, dK as SolanaAdapterConfig, dJ as SolanaCluster, dL as SolanaConnection, dE as SolanaPublicKey, dM as SolanaSendOptions, dO as SolanaSignature, dF as SolanaTransaction, dN as SolanaUnsignedTransaction, dG as SolanaVersionedTransaction, d0 as SolanaWalletAdapter, dI as SolanaWalletName, dH as SolanaWalletProvider, cQ as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, bI as SwapStatus, bS as SwapStatusResponse, as as TransactionData, e9 as TransportType, cR as Treasury, ed as TrezorConfig, e7 as TrezorModel, dy as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cV as WalletError, c3 as ZcashNativeBackend, c5 as ZcashNativeBackendConfig, cn as ZcashQuote, cm as ZcashQuoteParams, c6 as ZcashRPCClient, c7 as ZcashRPCError, c9 as ZcashShieldedService, cd as ZcashShieldedServiceConfig, co as ZcashSwapParams, cp as ZcashSwapResult, cb as ZcashSwapService, cj as ZcashSwapServiceConfig, ck as ZcashSwapSourceChain, cl as ZcashSwapSourceToken, cq as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, d9 as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, db as createEthereumAdapter, dx as createLedgerAdapter, dd as createMockEthereumAdapter, de as createMockEthereumProvider, dC as createMockLedgerAdapter, d3 as createMockSolanaAdapter, d5 as createMockSolanaConnection, d4 as createMockSolanaProvider, bG as createMockSolver, dD as createMockTrezorAdapter, bA as createNEARIntentsAdapter, c2 as createNEARIntentsBackend, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, cu as createShieldedPayment, bZ as createSmartRouter, d1 as createSolanaAdapter, dz as createTrezorAdapter, c_ as createWalletFactory, c8 as createZcashClient, c4 as createZcashNativeBackend, ca as createZcashShieldedService, cc as createZcashSwapService, a5 as decodeStealthMetaAddress, cv 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, dg as detectEthereumWallets, d7 as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cX as featureNotSupportedError, cO as formatStablecoinAmount, di 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, dv as getAvailableTransports, g as getBrowserInfo, bh as getChainNumericId, cL as getChainsForStablecoin, a8 as getCurveForChain, dl as getDefaultRpcEndpoint, dr as getDerivationPath, A as getErrorMessage, df as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, cB as getPaymentSummary, cy as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, d6 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, dj as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, cx as isPaymentExpired, c$ as isPrivateWalletAdapter, x as isSIPError, cH as isStablecoin, cK as isStablecoinOnChain, 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, dk 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, cz as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, d8 as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, du as supportsWebBluetooth, dt as supportsWebHID, ds as supportsWebUSB, s as supportsWebWorkers, dh as toHex, cM as toStablecoinUnits, T as trackIntent, cw 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-DW7AQwcU.mjs';
|
|
2
2
|
export { a as FulfillmentProofParams, F as FundingProofParams, N as NoirProviderConfig, O as OracleAttestation, d as ProofFramework, b as ProofGenerationError, c as ProofProvider, P as ProofResult, V as ValidityProofParams } from './noir-BTyLXLlZ.mjs';
|
|
3
3
|
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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, bT as BackendCapabilities, cT as BaseWalletAdapter, cr as BridgeProvider, 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, dq 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, e2 as EthereumAdapterConfig, dm as EthereumChainId, e3 as EthereumChainIdType, e0 as EthereumChainMetadata, d$ as EthereumTokenMetadata, d_ as EthereumTransactionReceipt, dZ as EthereumTransactionRequest, da as EthereumWalletAdapter, e1 as EthereumWalletName, ci as ExportedViewingKey, c0 as FindBestRouteParams, eh as HardwareAccount, e8 as HardwareConnectionStatus, ea as HardwareDeviceInfo, dn as HardwareErrorCode, ej as HardwareErrorCodeType, ef as HardwareEthereumTx, ee as HardwareSignRequest, eg as HardwareSignature, ei as HardwareTransport, eb as HardwareWalletConfig, dp as HardwareWalletError, e5 as HardwareWalletType, L as IntentBuilder, I as IntentError, ec as LedgerConfig, e6 as LedgerModel, dw as LedgerWalletAdapter, dc as MockEthereumAdapter, e4 as MockEthereumAdapterConfig, ek as MockHardwareConfig, dA as MockLedgerAdapter, b3 as MockProofProvider, d2 as MockSolanaAdapter, dP as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, dB as MockTrezorAdapter, cU as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, c1 as NEARIntentsBackend, 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, ct as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, cs as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, b$ as QuoteComparison, cg as ReceivedNote, bX as Route, b_ as RouteWithQuote, F as SIP, J as SIPConfig, S as SIPError, cD as STABLECOIN_ADDRESSES, cE as STABLECOIN_DECIMALS, cC as STABLECOIN_INFO, D as SerializedError, bU as SettlementBackend, bV as SettlementBackendFactory, bL as SettlementBackendName, bW as SettlementBackendRegistry, bN as SettlementQuote, bM as SettlementQuoteParams, bJ as SettlementRegistry, bK as SettlementRegistryError, bQ as SettlementSwapParams, bR as SettlementSwapResult, bO as SettlementSwapRoute, bP as SettlementSwapRouteStep, ch as ShieldedBalance, ce as ShieldedSendParams, cf as ShieldedSendResult, bs as SignedOracleAttestation, bY as SmartRouter, dK as SolanaAdapterConfig, dJ as SolanaCluster, dL as SolanaConnection, dE as SolanaPublicKey, dM as SolanaSendOptions, dO as SolanaSignature, dF as SolanaTransaction, dN as SolanaUnsignedTransaction, dG as SolanaVersionedTransaction, d0 as SolanaWalletAdapter, dI as SolanaWalletName, dH as SolanaWalletProvider, cQ as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, bI as SwapStatus, bS as SwapStatusResponse, as as TransactionData, e9 as TransportType, cR as Treasury, ed as TrezorConfig, e7 as TrezorModel, dy as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cV as WalletError, c3 as ZcashNativeBackend, c5 as ZcashNativeBackendConfig, cn as ZcashQuote, cm as ZcashQuoteParams, c6 as ZcashRPCClient, c7 as ZcashRPCError, c9 as ZcashShieldedService, cd as ZcashShieldedServiceConfig, co as ZcashSwapParams, cp as ZcashSwapResult, cb as ZcashSwapService, cj as ZcashSwapServiceConfig, ck as ZcashSwapSourceChain, cl as ZcashSwapSourceToken, cq as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, d9 as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, db as createEthereumAdapter, dx as createLedgerAdapter, dd as createMockEthereumAdapter, de as createMockEthereumProvider, dC as createMockLedgerAdapter, d3 as createMockSolanaAdapter, d5 as createMockSolanaConnection, d4 as createMockSolanaProvider, bG as createMockSolver, dD as createMockTrezorAdapter, bA as createNEARIntentsAdapter, c2 as createNEARIntentsBackend, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, cu as createShieldedPayment, bZ as createSmartRouter, d1 as createSolanaAdapter, dz as createTrezorAdapter, c_ as createWalletFactory, c8 as createZcashClient, c4 as createZcashNativeBackend, ca as createZcashShieldedService, cc as createZcashSwapService, a5 as decodeStealthMetaAddress, cv 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, dg as detectEthereumWallets, d7 as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cX as featureNotSupportedError, cO as formatStablecoinAmount, di 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, dv as getAvailableTransports, g as getBrowserInfo, bh as getChainNumericId, cL as getChainsForStablecoin, a8 as getCurveForChain, dl as getDefaultRpcEndpoint, dr as getDerivationPath, A as getErrorMessage, df as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, cB as getPaymentSummary, cy as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, d6 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, dj as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, cx as isPaymentExpired, c$ as isPrivateWalletAdapter, x as isSIPError, cH as isStablecoin, cK as isStablecoinOnChain, 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, dk 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, cz as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, d8 as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, du as supportsWebBluetooth, dt as supportsWebHID, ds as supportsWebUSB, s as supportsWebWorkers, dh as toHex, cM as toStablecoinUnits, T as trackIntent, cw 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-
|
|
1
|
+
export { bj as ATTESTATION_VERSION, bv as AttestationRequest, bw as AttestationResult, bT as BackendCapabilities, cT as BaseWalletAdapter, cr as BridgeProvider, 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, dq 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, e2 as EthereumAdapterConfig, dm as EthereumChainId, e3 as EthereumChainIdType, e0 as EthereumChainMetadata, d$ as EthereumTokenMetadata, d_ as EthereumTransactionReceipt, dZ as EthereumTransactionRequest, da as EthereumWalletAdapter, e1 as EthereumWalletName, ci as ExportedViewingKey, c0 as FindBestRouteParams, eh as HardwareAccount, e8 as HardwareConnectionStatus, ea as HardwareDeviceInfo, dn as HardwareErrorCode, ej as HardwareErrorCodeType, ef as HardwareEthereumTx, ee as HardwareSignRequest, eg as HardwareSignature, ei as HardwareTransport, eb as HardwareWalletConfig, dp as HardwareWalletError, e5 as HardwareWalletType, L as IntentBuilder, I as IntentError, ec as LedgerConfig, e6 as LedgerModel, dw as LedgerWalletAdapter, dc as MockEthereumAdapter, e4 as MockEthereumAdapterConfig, ek as MockHardwareConfig, dA as MockLedgerAdapter, b3 as MockProofProvider, d2 as MockSolanaAdapter, dP as MockSolanaAdapterConfig, bF as MockSolver, bH as MockSolverConfig, dB as MockTrezorAdapter, cU as MockWalletAdapter, bz as NEARIntentsAdapter, bE as NEARIntentsAdapterConfig, c1 as NEARIntentsBackend, 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, ct as PaymentBuilder, aL as PedersenCommitment, bC as PreparedSwap, cs as PriceFeed, ar as PrivacyConfig, K as ProductionQuote, u as ProofError, v as ProofNotImplementedError, P as ProofProgressCallback, b$ as QuoteComparison, cg as ReceivedNote, bX as Route, b_ as RouteWithQuote, F as SIP, J as SIPConfig, S as SIPError, cD as STABLECOIN_ADDRESSES, cE as STABLECOIN_DECIMALS, cC as STABLECOIN_INFO, D as SerializedError, bU as SettlementBackend, bV as SettlementBackendFactory, bL as SettlementBackendName, bW as SettlementBackendRegistry, bN as SettlementQuote, bM as SettlementQuoteParams, bJ as SettlementRegistry, bK as SettlementRegistryError, bQ as SettlementSwapParams, bR as SettlementSwapResult, bO as SettlementSwapRoute, bP as SettlementSwapRouteStep, ch as ShieldedBalance, ce as ShieldedSendParams, cf as ShieldedSendResult, bs as SignedOracleAttestation, bY as SmartRouter, dK as SolanaAdapterConfig, dJ as SolanaCluster, dL as SolanaConnection, dE as SolanaPublicKey, dM as SolanaSendOptions, dO as SolanaSignature, dF as SolanaTransaction, dN as SolanaUnsignedTransaction, dG as SolanaVersionedTransaction, d0 as SolanaWalletAdapter, dI as SolanaWalletName, dH as SolanaWalletProvider, cQ as StablecoinInfo, ak as StealthCurve, bB as SwapRequest, bD as SwapResult, bI as SwapStatus, bS as SwapStatusResponse, as as TransactionData, e9 as TransportType, cR as Treasury, ed as TrezorConfig, e7 as TrezorModel, dy as TrezorWalletAdapter, V as ValidationError, bx as VerificationResult, W as WalletAdapter, cV as WalletError, c3 as ZcashNativeBackend, c5 as ZcashNativeBackendConfig, cn as ZcashQuote, cm as ZcashQuoteParams, c6 as ZcashRPCClient, c7 as ZcashRPCError, c9 as ZcashShieldedService, cd as ZcashShieldedServiceConfig, co as ZcashSwapParams, cp as ZcashSwapResult, cb as ZcashSwapService, cj as ZcashSwapServiceConfig, ck as ZcashSwapSourceChain, cl as ZcashSwapSourceToken, cq as ZcashSwapStatus, aH as addBlindings, aF as addCommitments, b9 as addOracle, Q as attachProofs, d9 as base58ToHex, b as browserBytesToHex, h as browserHexToBytes, ac as checkEd25519StealthAddress, a3 as checkStealthAddress, aC as commit, aE as commitZero, bg as computeAttestationHash, at as createCommitment, db as createEthereumAdapter, dx as createLedgerAdapter, dd as createMockEthereumAdapter, de as createMockEthereumProvider, dC as createMockLedgerAdapter, d3 as createMockSolanaAdapter, d5 as createMockSolanaConnection, d4 as createMockSolanaProvider, bG as createMockSolver, dD as createMockTrezorAdapter, bA as createNEARIntentsAdapter, c2 as createNEARIntentsBackend, b8 as createOracleRegistry, H as createProductionSIP, G as createSIP, O as createShieldedIntent, cu as createShieldedPayment, bZ as createSmartRouter, d1 as createSolanaAdapter, dz as createTrezorAdapter, c_ as createWalletFactory, c8 as createZcashClient, c4 as createZcashNativeBackend, ca as createZcashShieldedService, cc as createZcashSwapService, a5 as decodeStealthMetaAddress, cv 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, dg as detectEthereumWallets, d7 as detectSolanaWallets, ag as ed25519PublicKeyToNearAddress, ad as ed25519PublicKeyToSolanaAddress, a4 as encodeStealthMetaAddress, ao as encryptForViewing, cX as featureNotSupportedError, cO as formatStablecoinAmount, di 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, dv as getAvailableTransports, g as getBrowserInfo, bh as getChainNumericId, cL as getChainsForStablecoin, a8 as getCurveForChain, dl as getDefaultRpcEndpoint, dr as getDerivationPath, A as getErrorMessage, df as getEthereumProvider, aJ as getGenerators, _ as getIntentSummary, cB as getPaymentSummary, cy as getPaymentTimeRemaining, al as getPrivacyConfig, aq as getPrivacyDescription, d6 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, dj as hexToNumber, i as isBrowser, a7 as isEd25519Chain, U as isExpired, aS as isNonNegativeAmount, cx as isPaymentExpired, c$ as isPrivateWalletAdapter, x as isSIPError, cH as isStablecoin, cK as isStablecoinOnChain, 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, dk 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, cz as serializePayment, b6 as signAttestationMessage, ae as solanaAddressToEd25519PublicKey, d8 as solanaPublicKeyToHex, aI as subtractBlindings, aG as subtractCommitments, a as supportsSharedArrayBuffer, du as supportsWebBluetooth, dt as supportsWebHID, ds as supportsWebUSB, s as supportsWebWorkers, dh as toHex, cM as toStablecoinUnits, T as trackIntent, cw 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-DAgedMrt.js';
|
|
2
2
|
export { a as FulfillmentProofParams, F as FundingProofParams, N as NoirProviderConfig, O as OracleAttestation, d as ProofFramework, b as ProofGenerationError, c as ProofProvider, P as ProofResult, V as ValidityProofParams } from './noir-BTyLXLlZ.js';
|
|
3
3
|
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';
|
package/dist/index.js
CHANGED
|
@@ -5961,6 +5961,12 @@ var ZcashSwapService = class {
|
|
|
5961
5961
|
quotes = /* @__PURE__ */ new Map();
|
|
5962
5962
|
swaps = /* @__PURE__ */ new Map();
|
|
5963
5963
|
constructor(config) {
|
|
5964
|
+
if (config.mode === "production" && !config.bridgeProvider) {
|
|
5965
|
+
throw new IntentError(
|
|
5966
|
+
"Bridge provider required for production mode",
|
|
5967
|
+
"SIP_5004" /* INTENT_INVALID_STATE */
|
|
5968
|
+
);
|
|
5969
|
+
}
|
|
5964
5970
|
this.config = {
|
|
5965
5971
|
mode: config.mode,
|
|
5966
5972
|
defaultSlippage: config.defaultSlippage ?? 100,
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sip-protocol/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Core SDK for Shielded Intents Protocol - Privacy layer for cross-chain transactions",
|
|
5
5
|
"author": "SIP Protocol <hello@sip-protocol.org>",
|
|
6
6
|
"homepage": "https://sip-protocol.org",
|
package/src/proofs/worker.ts
CHANGED
|
@@ -181,6 +181,211 @@ export function createWorkerBlobURL(): string {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
// Generate validity proof
|
|
185
|
+
async function generateValidityProof(id, params) {
|
|
186
|
+
if (!isReady) {
|
|
187
|
+
sendError(id, new Error('Worker not initialized'));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
try {
|
|
192
|
+
sendProgress(id, 'witness', 20, 'Preparing validity witness...');
|
|
193
|
+
|
|
194
|
+
// Import noble crypto for hashing
|
|
195
|
+
const { sha256 } = await import('@noble/hashes/sha256');
|
|
196
|
+
|
|
197
|
+
// Convert inputs to field elements
|
|
198
|
+
const intentHashField = hexToField(params.intentHash);
|
|
199
|
+
const senderAddressField = hexToField(params.senderAddress);
|
|
200
|
+
const senderBlindingField = bytesToField(params.senderBlinding);
|
|
201
|
+
const senderSecretField = bytesToField(params.senderSecret);
|
|
202
|
+
const nonceField = bytesToField(params.nonce);
|
|
203
|
+
|
|
204
|
+
// Compute sender commitment
|
|
205
|
+
const addressBytes = hexToBytes(senderAddressField);
|
|
206
|
+
const blindingBytes = hexToBytes(senderBlindingField.padStart(64, '0'));
|
|
207
|
+
const commitmentPreimage = new Uint8Array([...addressBytes, ...blindingBytes]);
|
|
208
|
+
const commitmentHash = sha256(commitmentPreimage);
|
|
209
|
+
const commitmentX = bytesToHex(commitmentHash.slice(0, 16)).padStart(64, '0');
|
|
210
|
+
const commitmentY = bytesToHex(commitmentHash.slice(16, 32)).padStart(64, '0');
|
|
211
|
+
|
|
212
|
+
// Compute nullifier
|
|
213
|
+
const secretBytes = hexToBytes(senderSecretField.padStart(64, '0'));
|
|
214
|
+
const intentBytes = hexToBytes(intentHashField);
|
|
215
|
+
const nonceBytes = hexToBytes(nonceField.padStart(64, '0'));
|
|
216
|
+
const nullifierPreimage = new Uint8Array([...secretBytes, ...intentBytes, ...nonceBytes]);
|
|
217
|
+
const nullifierHash = sha256(nullifierPreimage);
|
|
218
|
+
const nullifier = bytesToHex(nullifierHash);
|
|
219
|
+
|
|
220
|
+
const signature = Array.from(params.authorizationSignature);
|
|
221
|
+
const messageHash = fieldToBytes32(intentHashField);
|
|
222
|
+
|
|
223
|
+
// Get public key coordinates
|
|
224
|
+
let pubKeyX, pubKeyY;
|
|
225
|
+
if (params.senderPublicKey) {
|
|
226
|
+
pubKeyX = Array.from(params.senderPublicKey.x);
|
|
227
|
+
pubKeyY = Array.from(params.senderPublicKey.y);
|
|
228
|
+
} else {
|
|
229
|
+
// Derive from secret
|
|
230
|
+
const { secp256k1 } = await import('@noble/curves/secp256k1');
|
|
231
|
+
const uncompressedPubKey = secp256k1.getPublicKey(params.senderSecret, false);
|
|
232
|
+
pubKeyX = Array.from(uncompressedPubKey.slice(1, 33));
|
|
233
|
+
pubKeyY = Array.from(uncompressedPubKey.slice(33, 65));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const witnessInputs = {
|
|
237
|
+
intent_hash: intentHashField,
|
|
238
|
+
sender_commitment_x: commitmentX,
|
|
239
|
+
sender_commitment_y: commitmentY,
|
|
240
|
+
nullifier: nullifier,
|
|
241
|
+
timestamp: params.timestamp.toString(),
|
|
242
|
+
expiry: params.expiry.toString(),
|
|
243
|
+
sender_address: senderAddressField,
|
|
244
|
+
sender_blinding: senderBlindingField,
|
|
245
|
+
sender_secret: senderSecretField,
|
|
246
|
+
pub_key_x: pubKeyX,
|
|
247
|
+
pub_key_y: pubKeyY,
|
|
248
|
+
signature: signature,
|
|
249
|
+
message_hash: messageHash,
|
|
250
|
+
nonce: nonceField,
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
sendProgress(id, 'witness', 40, 'Executing validity circuit...');
|
|
254
|
+
const { witness } = await validityNoir.execute(witnessInputs);
|
|
255
|
+
|
|
256
|
+
sendProgress(id, 'proving', 60, 'Generating validity proof...');
|
|
257
|
+
const proofData = await validityBackend.generateProof(witness);
|
|
258
|
+
|
|
259
|
+
sendProgress(id, 'complete', 100, 'Validity proof generated');
|
|
260
|
+
|
|
261
|
+
const publicInputs = [
|
|
262
|
+
'0x' + intentHashField,
|
|
263
|
+
'0x' + commitmentX,
|
|
264
|
+
'0x' + commitmentY,
|
|
265
|
+
'0x' + nullifier,
|
|
266
|
+
'0x' + params.timestamp.toString(16).padStart(16, '0'),
|
|
267
|
+
'0x' + params.expiry.toString(16).padStart(16, '0'),
|
|
268
|
+
];
|
|
269
|
+
|
|
270
|
+
const proof = {
|
|
271
|
+
type: 'validity',
|
|
272
|
+
proof: '0x' + bytesToHex(proofData.proof),
|
|
273
|
+
publicInputs,
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
sendSuccess(id, { proof, publicInputs });
|
|
277
|
+
} catch (error) {
|
|
278
|
+
sendError(id, error);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Generate fulfillment proof
|
|
283
|
+
async function generateFulfillmentProof(id, params) {
|
|
284
|
+
if (!isReady) {
|
|
285
|
+
sendError(id, new Error('Worker not initialized'));
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
try {
|
|
290
|
+
sendProgress(id, 'witness', 20, 'Preparing fulfillment witness...');
|
|
291
|
+
|
|
292
|
+
// Import noble crypto for hashing
|
|
293
|
+
const { sha256 } = await import('@noble/hashes/sha256');
|
|
294
|
+
|
|
295
|
+
const intentHashField = hexToField(params.intentHash);
|
|
296
|
+
const recipientStealthField = hexToField(params.recipientStealth);
|
|
297
|
+
|
|
298
|
+
// Compute output commitment
|
|
299
|
+
const amountBytes = bigintToBytes(params.outputAmount, 8);
|
|
300
|
+
const blindingBytes = params.outputBlinding.slice(0, 32);
|
|
301
|
+
const outputPreimage = new Uint8Array([...amountBytes, ...blindingBytes]);
|
|
302
|
+
const outputHash = sha256(outputPreimage);
|
|
303
|
+
const commitmentX = bytesToHex(outputHash.slice(0, 16)).padStart(64, '0');
|
|
304
|
+
const commitmentY = bytesToHex(outputHash.slice(16, 32)).padStart(64, '0');
|
|
305
|
+
|
|
306
|
+
const solverSecretField = bytesToField(params.solverSecret);
|
|
307
|
+
|
|
308
|
+
// Compute solver ID
|
|
309
|
+
const solverSecretBytes = hexToBytes(solverSecretField.padStart(64, '0'));
|
|
310
|
+
const solverIdHash = sha256(solverSecretBytes);
|
|
311
|
+
const solverId = bytesToHex(solverIdHash);
|
|
312
|
+
|
|
313
|
+
const outputBlindingField = bytesToField(params.outputBlinding);
|
|
314
|
+
|
|
315
|
+
const attestation = params.oracleAttestation;
|
|
316
|
+
const attestationRecipientField = hexToField(attestation.recipient);
|
|
317
|
+
const attestationTxHashField = hexToField(attestation.txHash);
|
|
318
|
+
const oracleSignature = Array.from(attestation.signature);
|
|
319
|
+
|
|
320
|
+
// Compute oracle message hash
|
|
321
|
+
const recipientBytes = hexToBytes(attestationRecipientField);
|
|
322
|
+
const attestationAmountBytes = bigintToBytes(attestation.amount, 8);
|
|
323
|
+
const txHashBytes = hexToBytes(attestationTxHashField);
|
|
324
|
+
const blockBytes = bigintToBytes(attestation.blockNumber, 8);
|
|
325
|
+
const oraclePreimage = new Uint8Array([
|
|
326
|
+
...recipientBytes,
|
|
327
|
+
...attestationAmountBytes,
|
|
328
|
+
...txHashBytes,
|
|
329
|
+
...blockBytes,
|
|
330
|
+
]);
|
|
331
|
+
const oracleMessageHash = Array.from(sha256(oraclePreimage));
|
|
332
|
+
|
|
333
|
+
const oraclePubKeyX = config.oraclePublicKey?.x ?? new Array(32).fill(0);
|
|
334
|
+
const oraclePubKeyY = config.oraclePublicKey?.y ?? new Array(32).fill(0);
|
|
335
|
+
|
|
336
|
+
const witnessInputs = {
|
|
337
|
+
intent_hash: intentHashField,
|
|
338
|
+
output_commitment_x: commitmentX,
|
|
339
|
+
output_commitment_y: commitmentY,
|
|
340
|
+
recipient_stealth: recipientStealthField,
|
|
341
|
+
min_output_amount: params.minOutputAmount.toString(),
|
|
342
|
+
solver_id: solverId,
|
|
343
|
+
fulfillment_time: params.fulfillmentTime.toString(),
|
|
344
|
+
expiry: params.expiry.toString(),
|
|
345
|
+
output_amount: params.outputAmount.toString(),
|
|
346
|
+
output_blinding: outputBlindingField,
|
|
347
|
+
solver_secret: solverSecretField,
|
|
348
|
+
attestation_recipient: attestationRecipientField,
|
|
349
|
+
attestation_amount: attestation.amount.toString(),
|
|
350
|
+
attestation_tx_hash: attestationTxHashField,
|
|
351
|
+
attestation_block: attestation.blockNumber.toString(),
|
|
352
|
+
oracle_signature: oracleSignature,
|
|
353
|
+
oracle_message_hash: oracleMessageHash,
|
|
354
|
+
oracle_pub_key_x: oraclePubKeyX,
|
|
355
|
+
oracle_pub_key_y: oraclePubKeyY,
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
sendProgress(id, 'witness', 40, 'Executing fulfillment circuit...');
|
|
359
|
+
const { witness } = await fulfillmentNoir.execute(witnessInputs);
|
|
360
|
+
|
|
361
|
+
sendProgress(id, 'proving', 60, 'Generating fulfillment proof...');
|
|
362
|
+
const proofData = await fulfillmentBackend.generateProof(witness);
|
|
363
|
+
|
|
364
|
+
sendProgress(id, 'complete', 100, 'Fulfillment proof generated');
|
|
365
|
+
|
|
366
|
+
const publicInputs = [
|
|
367
|
+
'0x' + intentHashField,
|
|
368
|
+
'0x' + commitmentX,
|
|
369
|
+
'0x' + commitmentY,
|
|
370
|
+
'0x' + recipientStealthField,
|
|
371
|
+
'0x' + params.minOutputAmount.toString(16).padStart(16, '0'),
|
|
372
|
+
'0x' + solverId,
|
|
373
|
+
'0x' + params.fulfillmentTime.toString(16).padStart(16, '0'),
|
|
374
|
+
'0x' + params.expiry.toString(16).padStart(16, '0'),
|
|
375
|
+
];
|
|
376
|
+
|
|
377
|
+
const proof = {
|
|
378
|
+
type: 'fulfillment',
|
|
379
|
+
proof: '0x' + bytesToHex(proofData.proof),
|
|
380
|
+
publicInputs,
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
sendSuccess(id, { proof, publicInputs });
|
|
384
|
+
} catch (error) {
|
|
385
|
+
sendError(id, error);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
184
389
|
// Helper functions
|
|
185
390
|
function bytesToField(bytes) {
|
|
186
391
|
let result = 0n;
|
|
@@ -208,6 +413,39 @@ export function createWorkerBlobURL(): string {
|
|
|
208
413
|
return Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
209
414
|
}
|
|
210
415
|
|
|
416
|
+
function hexToBytes(hex) {
|
|
417
|
+
const h = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
418
|
+
const bytes = new Uint8Array(h.length / 2);
|
|
419
|
+
for (let i = 0; i < h.length; i += 2) {
|
|
420
|
+
bytes[i / 2] = parseInt(h.slice(i, i + 2), 16);
|
|
421
|
+
}
|
|
422
|
+
return bytes;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function hexToField(hex) {
|
|
426
|
+
const h = hex.startsWith('0x') ? hex.slice(2) : hex;
|
|
427
|
+
return h.padStart(64, '0');
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function fieldToBytes32(field) {
|
|
431
|
+
const hex = field.padStart(64, '0');
|
|
432
|
+
const bytes = [];
|
|
433
|
+
for (let i = 0; i < 32; i++) {
|
|
434
|
+
bytes.push(parseInt(hex.slice(i * 2, i * 2 + 2), 16));
|
|
435
|
+
}
|
|
436
|
+
return bytes;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function bigintToBytes(value, length) {
|
|
440
|
+
const bytes = new Uint8Array(length);
|
|
441
|
+
let v = value;
|
|
442
|
+
for (let i = length - 1; i >= 0; i--) {
|
|
443
|
+
bytes[i] = Number(v & 0xffn);
|
|
444
|
+
v = v >> 8n;
|
|
445
|
+
}
|
|
446
|
+
return bytes;
|
|
447
|
+
}
|
|
448
|
+
|
|
211
449
|
// Message handler
|
|
212
450
|
self.onmessage = async function(event) {
|
|
213
451
|
const { id, type, params, config: initConfig } = event.data;
|
|
@@ -220,12 +458,10 @@ export function createWorkerBlobURL(): string {
|
|
|
220
458
|
await generateFundingProof(id, params);
|
|
221
459
|
break;
|
|
222
460
|
case 'generateValidityProof':
|
|
223
|
-
|
|
224
|
-
sendError(id, new Error('Validity proof not yet implemented in worker'));
|
|
461
|
+
await generateValidityProof(id, params);
|
|
225
462
|
break;
|
|
226
463
|
case 'generateFulfillmentProof':
|
|
227
|
-
|
|
228
|
-
sendError(id, new Error('Fulfillment proof not yet implemented in worker'));
|
|
464
|
+
await generateFulfillmentProof(id, params);
|
|
229
465
|
break;
|
|
230
466
|
case 'destroy':
|
|
231
467
|
// Cleanup
|
package/src/zcash/bridge.ts
CHANGED
|
@@ -126,7 +126,7 @@ export interface ZcashBridgeConfig {
|
|
|
126
126
|
zcashService?: ZcashShieldedService
|
|
127
127
|
/** Operating mode */
|
|
128
128
|
mode: 'demo' | 'production'
|
|
129
|
-
/** External bridge provider for production */
|
|
129
|
+
/** External bridge provider (required for production mode) */
|
|
130
130
|
bridgeProvider?: BridgeProvider
|
|
131
131
|
/** Price feed for conversions */
|
|
132
132
|
priceFeed?: PriceFeed
|
|
@@ -150,7 +150,15 @@ const TOKEN_DECIMALS: Record<string, number> = {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
|
-
* Mock prices for demo mode
|
|
153
|
+
* Mock prices for demo mode calculations.
|
|
154
|
+
*
|
|
155
|
+
* ⚠️ DEMO VALUES ONLY - Not for production use!
|
|
156
|
+
*
|
|
157
|
+
* These prices are approximate values for testing and demonstration.
|
|
158
|
+
* They do not reflect real market conditions.
|
|
159
|
+
*
|
|
160
|
+
* @lastUpdated 2024-12-03
|
|
161
|
+
* @note Update quarterly or when prices diverge significantly from market
|
|
154
162
|
*/
|
|
155
163
|
const MOCK_PRICES: Record<string, number> = {
|
|
156
164
|
ETH: 2500,
|
|
@@ -189,6 +197,8 @@ const ROUTE_CONFIG: Record<string, { minUsd: number; maxUsd: number; feeBps: num
|
|
|
189
197
|
*
|
|
190
198
|
* Bridges tokens from Ethereum, Solana, and other chains to Zcash,
|
|
191
199
|
* with optional shielding to z-addresses.
|
|
200
|
+
*
|
|
201
|
+
* @throws {IntentError} If production mode is configured without a bridge provider
|
|
192
202
|
*/
|
|
193
203
|
export class ZcashBridge {
|
|
194
204
|
private readonly config: Required<Omit<ZcashBridgeConfig, 'zcashService' | 'bridgeProvider' | 'priceFeed'>>
|
|
@@ -198,6 +208,14 @@ export class ZcashBridge {
|
|
|
198
208
|
private readonly bridgeRequests: Map<string, BridgeResult> = new Map()
|
|
199
209
|
|
|
200
210
|
constructor(config: ZcashBridgeConfig) {
|
|
211
|
+
// Fail-fast validation for production mode
|
|
212
|
+
if (config.mode === 'production' && !config.bridgeProvider) {
|
|
213
|
+
throw new IntentError(
|
|
214
|
+
'Bridge provider required for production mode',
|
|
215
|
+
ErrorCode.INTENT_INVALID_STATE,
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
201
219
|
this.config = {
|
|
202
220
|
mode: config.mode,
|
|
203
221
|
defaultSlippage: config.defaultSlippage ?? 100,
|
|
@@ -55,7 +55,7 @@ export interface ZcashSwapServiceConfig {
|
|
|
55
55
|
zcashService?: ZcashShieldedService
|
|
56
56
|
/** Operating mode */
|
|
57
57
|
mode: 'demo' | 'production'
|
|
58
|
-
/** Bridge provider (for production) */
|
|
58
|
+
/** Bridge provider (required for production mode) */
|
|
59
59
|
bridgeProvider?: BridgeProvider
|
|
60
60
|
/** Price feed for quotes */
|
|
61
61
|
priceFeed?: PriceFeed
|
|
@@ -245,7 +245,15 @@ export type ZcashSwapStatus =
|
|
|
245
245
|
// ─── Mock Price Data ───────────────────────────────────────────────────────────
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
|
-
* Mock prices for demo mode
|
|
248
|
+
* Mock prices for demo mode calculations.
|
|
249
|
+
*
|
|
250
|
+
* ⚠️ DEMO VALUES ONLY - Not for production use!
|
|
251
|
+
*
|
|
252
|
+
* These prices are approximate values for testing and demonstration.
|
|
253
|
+
* They do not reflect real market conditions.
|
|
254
|
+
*
|
|
255
|
+
* @lastUpdated 2024-12-03
|
|
256
|
+
* @note Update quarterly or when prices diverge significantly from market
|
|
249
257
|
*/
|
|
250
258
|
const MOCK_PRICES: Record<string, number> = {
|
|
251
259
|
ETH: 2500,
|
|
@@ -276,6 +284,8 @@ const TOKEN_DECIMALS: Record<string, number> = {
|
|
|
276
284
|
* Zcash Swap Service
|
|
277
285
|
*
|
|
278
286
|
* Enables cross-chain swaps from ETH/SOL/NEAR to Zcash's shielded pool.
|
|
287
|
+
*
|
|
288
|
+
* @throws {IntentError} If production mode is configured without a bridge provider
|
|
279
289
|
*/
|
|
280
290
|
export class ZcashSwapService {
|
|
281
291
|
private readonly config: Required<Omit<ZcashSwapServiceConfig, 'zcashService' | 'bridgeProvider' | 'priceFeed'>>
|
|
@@ -286,6 +296,14 @@ export class ZcashSwapService {
|
|
|
286
296
|
private readonly swaps: Map<string, ZcashSwapResult> = new Map()
|
|
287
297
|
|
|
288
298
|
constructor(config: ZcashSwapServiceConfig) {
|
|
299
|
+
// Fail-fast validation for production mode
|
|
300
|
+
if (config.mode === 'production' && !config.bridgeProvider) {
|
|
301
|
+
throw new IntentError(
|
|
302
|
+
'Bridge provider required for production mode',
|
|
303
|
+
ErrorCode.INTENT_INVALID_STATE,
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
289
307
|
this.config = {
|
|
290
308
|
mode: config.mode,
|
|
291
309
|
defaultSlippage: config.defaultSlippage ?? 100, // 1%
|