@invisi-labs/sdk 1.2.0 → 1.2.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/index.cjs CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkNKYHYIRPcjs = require('./chunk-NKYHYIRP.cjs');
8
+ var _chunkDHQEB6JRcjs = require('./chunk-DHQEB6JR.cjs');
9
9
  require('./chunk-BBSRP4MH.cjs');
10
10
  require('./chunk-HCB7RQ3S.cjs');
11
11
 
@@ -125,8 +125,8 @@ var DisclosureVerifier = class {
125
125
  "invalid disclosure receipt block"
126
126
  );
127
127
  const { context } = this.#protocol;
128
- const logs = _chunkNKYHYIRPcjs.readProtocolLogs.call(void 0, receipt, context.protocolAddress);
129
- const candidates = _chunkNKYHYIRPcjs.extractDeliveryCandidates.call(void 0, logs, context, receipt.block.number).filter(
128
+ const logs = _chunkDHQEB6JRcjs.readProtocolLogs.call(void 0, receipt, context.protocolAddress);
129
+ const candidates = _chunkDHQEB6JRcjs.extractDeliveryCandidates.call(void 0, logs, context, receipt.block.number).filter(
130
130
  (candidate2) => candidate2.treeId === selected.treeId && candidate2.leafIndex === selected.leafIndex && candidate2.role === selected.role && candidate2.tokenAddress.toLowerCase() === context.tokenAddress.toLowerCase()
131
131
  );
132
132
  check(
@@ -635,5 +635,10 @@ var PaymentNote = class _PaymentNote {
635
635
 
636
636
 
637
637
 
638
- exports.AddressRegistry = _chunkNKYHYIRPcjs.AddressRegistry; exports.BroadcasterClient = _chunk3KTQQZOWcjs.BroadcasterClient; exports.BroadcasterRegistry = BroadcasterRegistry; exports.BroadcasterRpcError = _chunk3KTQQZOWcjs.BroadcasterRpcError; exports.DeliveryDecryptionError = _primitives.DeliveryDecryptionError; exports.Detector = _primitives.Detector; exports.Disclosure = _primitives.Disclosure; exports.DisclosureVerifier = DisclosureVerifier; exports.Invisi = _chunkNKYHYIRPcjs.Invisi; exports.InvisiError = _chunk4SDP53YQcjs.InvisiError; exports.MAX_MEMO_BYTES = _primitives.MAX_MEMO_BYTES; exports.MAX_UPDATE_BLOCKS = _rpc.MAX_UPDATE_BLOCKS; exports.MissingCapabilityError = _primitives.MissingCapabilityError; exports.NoteOutput = _chunk4SDP53YQcjs.NoteOutput; exports.NullifierCapability = _primitives.NullifierCapability; exports.PaymentNote = PaymentNote; exports.PreparedTransaction = _chunkNKYHYIRPcjs.PreparedTransaction; exports.Protocol = Protocol; exports.ProtocolRpcClient = ProtocolRpcClient; exports.ProtocolRpcError = _rpc.ProtocolRpcError; exports.RegistrationOperation = _rpc.RegistrationOperation; exports.SpendablePaymentNote = SpendablePaymentNote; exports.TransactionOutput = _chunkOCZLJKIAcjs.TransactionOutput; exports.VerifiedPaymentNote = VerifiedPaymentNote; exports.ViewingCapability = _primitives.ViewingCapability; exports.Wallet = _primitives.Wallet; exports.authenticatedDecryptor = _primitives.authenticatedDecryptor; exports.broadcasterQuoteDomain = _chunk3KTQQZOWcjs.broadcasterQuoteDomain; exports.broadcasterQuoteTypes = _chunk3KTQQZOWcjs.broadcasterQuoteTypes; exports.broadcasterRequestHash = _chunk3KTQQZOWcjs.broadcasterRequestHash; exports.broadcasterTransactInterface = _chunk3KTQQZOWcjs.broadcasterTransactInterface; exports.computeCreditNullifier = _primitives.computeCreditNullifier; exports.creditPeriods = _primitives.creditPeriods; exports.creditV1 = _primitives.creditV1; exports.decodeBroadcasterIntent = _chunk3KTQQZOWcjs.decodeBroadcasterIntent; exports.decodeDeliveryHeader = _primitives.decodeDeliveryHeader; exports.decodeMemoText = _primitives.decodeMemoText; exports.decodePaymentNote = _chunk4SDP53YQcjs.decodePaymentNote; exports.decodePaymentRequest = _chunk4SDP53YQcjs.decodePaymentRequest; exports.decryptCandidates = _chunkNKYHYIRPcjs.decryptCandidates; exports.encodeMemo = _primitives.encodeMemo; exports.encodePaymentNote = _chunk4SDP53YQcjs.encodePaymentNote; exports.encodePaymentRequest = _chunk4SDP53YQcjs.encodePaymentRequest; exports.fundsV1 = _primitives.fundsV1; exports.getDocumentedGasReference = _protocol.getDocumentedGasReference; exports.readProtocolLogs = _chunkNKYHYIRPcjs.readProtocolLogs; exports.verifyBroadcasterQuote = _chunk3KTQQZOWcjs.verifyBroadcasterQuote;
638
+
639
+
640
+
641
+
642
+
643
+ exports.AddressRegistry = _chunkDHQEB6JRcjs.AddressRegistry; exports.BroadcasterClient = _chunk3KTQQZOWcjs.BroadcasterClient; exports.BroadcasterRegistry = BroadcasterRegistry; exports.BroadcasterRpcError = _chunk3KTQQZOWcjs.BroadcasterRpcError; exports.DeliveryAuthenticationError = _primitives.DeliveryAuthenticationError; exports.DeliveryDecryptionError = _primitives.DeliveryDecryptionError; exports.Detector = _primitives.Detector; exports.Disclosure = _primitives.Disclosure; exports.DisclosureVerifier = DisclosureVerifier; exports.Invisi = _chunkDHQEB6JRcjs.Invisi; exports.InvisiError = _chunk4SDP53YQcjs.InvisiError; exports.MAX_MEMO_BYTES = _primitives.MAX_MEMO_BYTES; exports.MAX_UPDATE_BLOCKS = _rpc.MAX_UPDATE_BLOCKS; exports.MissingCapabilityError = _primitives.MissingCapabilityError; exports.NoteOutput = _chunk4SDP53YQcjs.NoteOutput; exports.NullifierCapability = _primitives.NullifierCapability; exports.PaymentNote = PaymentNote; exports.PreparedTransaction = _chunkDHQEB6JRcjs.PreparedTransaction; exports.Protocol = Protocol; exports.ProtocolRpcClient = ProtocolRpcClient; exports.ProtocolRpcError = _rpc.ProtocolRpcError; exports.RegistrationOperation = _rpc.RegistrationOperation; exports.SpendablePaymentNote = SpendablePaymentNote; exports.TransactionOutput = _chunkOCZLJKIAcjs.TransactionOutput; exports.VerifiedPaymentNote = VerifiedPaymentNote; exports.ViewingCapability = _primitives.ViewingCapability; exports.Wallet = _primitives.Wallet; exports.authenticatedDecryptor = _primitives.authenticatedDecryptor; exports.broadcasterQuoteDomain = _chunk3KTQQZOWcjs.broadcasterQuoteDomain; exports.broadcasterQuoteTypes = _chunk3KTQQZOWcjs.broadcasterQuoteTypes; exports.broadcasterRequestHash = _chunk3KTQQZOWcjs.broadcasterRequestHash; exports.broadcasterTransactInterface = _chunk3KTQQZOWcjs.broadcasterTransactInterface; exports.computeCreditNullifier = _primitives.computeCreditNullifier; exports.creditPeriods = _primitives.creditPeriods; exports.creditV1 = _primitives.creditV1; exports.decodeBroadcasterIntent = _chunk3KTQQZOWcjs.decodeBroadcasterIntent; exports.decodeDeliveryHeader = _primitives.decodeDeliveryHeader; exports.decodeMemoText = _primitives.decodeMemoText; exports.decodePaymentNote = _chunk4SDP53YQcjs.decodePaymentNote; exports.decodePaymentRequest = _chunk4SDP53YQcjs.decodePaymentRequest; exports.decryptCandidates = _chunkDHQEB6JRcjs.decryptCandidates; exports.encodeMemo = _primitives.encodeMemo; exports.encodePaymentNote = _chunk4SDP53YQcjs.encodePaymentNote; exports.encodePaymentRequest = _chunk4SDP53YQcjs.encodePaymentRequest; exports.fundsV1 = _primitives.fundsV1; exports.getDocumentedGasReference = _protocol.getDocumentedGasReference; exports.readProtocolLogs = _chunkDHQEB6JRcjs.readProtocolLogs; exports.verifyBroadcasterQuote = _chunk3KTQQZOWcjs.verifyBroadcasterQuote;
639
644
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/wx/Workspace/invisi-lab/invisi-sdk-ts/packages/sdk/dist/index.cjs","../src/index.ts","../src/disclosure/DisclosureVerifier.ts","../src/protocol/connections.ts","../src/protocol/Protocol.ts","../src/protocol/BroadcasterRegistry.ts","../src/protocol/ProtocolRpcClient.ts","../src/payment-note/PaymentNote.ts","../src/payment-note/verification.ts"],"names":["candidate","getAddress"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,qsFAAC","file":"/Users/wx/Workspace/invisi-lab/invisi-sdk-ts/packages/sdk/dist/index.cjs","sourcesContent":[null,"export {\n Detector,\n Disclosure,\n MAX_MEMO_BYTES,\n MissingCapabilityError,\n NullifierCapability,\n ViewingCapability,\n Wallet,\n computeCreditNullifier,\n creditPeriods,\n creditV1,\n decodeDeliveryHeader,\n decodeMemoText,\n encodeMemo,\n fundsV1,\n} from \"@invisi-labs/primitives\";\nexport type {\n Address,\n CreditDataV1,\n CreditDeliveryState,\n CreditState,\n CreditOpening,\n CreditPolicy,\n DisclosureExport,\n DisclosureOutput,\n DisclosureResult,\n FundsDataV1,\n Hex,\n Memo,\n Note,\n ReceivingKeys,\n} from \"@invisi-labs/primitives\";\nexport { RegistrationOperation } from \"@invisi-labs/rpc\";\nexport type {\n AddressRegistryOptions,\n ProtocolOptions,\n RegistryReader,\n TokenProtocol,\n TokenProtocolOptions,\n} from \"@invisi-labs/rpc\";\nexport type {\n CanonicalBlock,\n CanonicalReceipt,\n ChainReader,\n FactoryReader,\n Membership,\n ProtocolDataProvider,\n ProtocolDataStatus,\n ProtocolUpdateRange,\n RegistryContext,\n TransactionCall,\n TransactionContext,\n} from \"@invisi-labs/protocol\";\nexport type {\n AggregateMember,\n AggregatorCapability,\n ProofBundle,\n ProofStatement,\n Prover,\n ProverOptions,\n} from \"@invisi-labs/prover\";\nexport { Invisi } from \"./client/Invisi\";\nexport type { InvisiOptions, RegistrationPreparationOptions } from \"./client/Invisi\";\nexport { DisclosureVerifier } from \"./disclosure/DisclosureVerifier\";\nexport type {\n DisclosureEvidence,\n DisclosureReader,\n DisclosureReference,\n DisclosureVerifierOptions,\n VerifiedDisclosure,\n} from \"./disclosure/DisclosureVerifier\";\nexport { InvisiError } from \"./errors\";\nexport type { InvisiErrorCode, InvisiErrorDetails } from \"./errors\";\nexport { NoteOutput } from \"./notes/NoteOutput\";\nexport type { NoteOutputContext, PaymentRequest, NoteOutputRecipient } from \"./notes/NoteOutput\";\nexport { Protocol } from \"./protocol/Protocol\";\nexport type {\n RevokeCreditPreparation,\n CreateCreditPreparation,\n DrawCreditPreparation,\n FundingAuthorizationVerifier,\n FundingSigner,\n FundingSource,\n FundingTypedData,\n OperationAggregateMember,\n ShieldPreparation,\n UpdateCreditPreparation,\n TransactionExecution,\n TransactionProveOptions,\n TransferPreparation,\n} from \"./transactions/operation-types\";\n\nexport { MAX_UPDATE_BLOCKS, ProtocolRpcError } from \"@invisi-labs/rpc\";\nexport type {\n ProtocolDeployment,\n ProtocolRpcChain,\n ProtocolRpcClientOptions,\n ProtocolRpcConnectionOptions,\n ProtocolRpcReader,\n RegisteredReceivingAddress,\n} from \"@invisi-labs/rpc\";\nexport { AddressRegistry } from \"./protocol/AddressRegistry\";\nexport { BroadcasterRegistry } from \"./protocol/BroadcasterRegistry\";\nexport type {\n BroadcasterRegistration,\n BroadcasterRegistryOptions,\n RegisteredBroadcaster,\n} from \"./protocol/BroadcasterRegistry\";\nexport { ProtocolRpcClient } from \"./protocol/ProtocolRpcClient\";\n\nexport { PreparedTransaction } from \"./transactions/execution/PreparedTransaction\";\nexport type {\n CreditInput,\n ExplicitRevokeCreditPreparation,\n ExplicitCreateCreditPreparation,\n ExplicitDrawCreditPreparation,\n ExplicitShieldPreparation,\n ExplicitUpdateCreditPreparation,\n ExplicitTransferPreparation,\n NoteInput,\n TransactionIdentity,\n} from \"./transactions/explicit-types\";\n\nexport { getDocumentedGasReference } from \"@invisi-labs/protocol\";\nexport type { DocumentedGasReference, DocumentedGasShape } from \"@invisi-labs/protocol\";\n\nexport type { SigningRequest } from \"@invisi-labs/primitives\";\n\n// Stateless recovery for applications that supply canonical receipts without a wallet store.\nexport { decryptCandidates } from \"./discovery/discovery\";\nexport type { DeliveryEventLog, DiscoveredCredit, DiscoveredNote } from \"./discovery/discovery\";\nexport { readProtocolLogs } from \"./discovery/receipt-logs\";\n\nexport type {\n ProtocolCreditTransition,\n ProtocolNoteOutput,\n IndexedCreditState,\n ProtocolTransactionNoteUpdates,\n ProtocolTransactionCreditUpdates,\n} from \"@invisi-labs/rpc\";\n\nexport * from \"./broadcaster/index\";\n\nexport type {\n BroadcasterFeeSource,\n BroadcasterQuoteOptions,\n} from \"./broadcaster/broadcaster-preparation\";\n\nexport { encodePaymentRequest, decodePaymentRequest } from \"./payment-request/codec\";\nexport type { NoteOutputExecutionOptions } from \"./payment-request/types\";\n\nexport { PaymentNote, VerifiedPaymentNote, SpendablePaymentNote } from \"./payment-note/PaymentNote\";\nexport { encodePaymentNote, decodePaymentNote } from \"./payment-note/codec\";\nexport type { PaymentNoteData } from \"./payment-note/types\";\nexport type {\n PaymentNoteVerificationOptions,\n PaymentNoteVerificationSettings,\n} from \"./payment-note/verification\";\nexport { TransactionOutput } from \"./notes/TransactionOutput\";\n\nexport type { PreparedProvenanceCapability } from \"./broadcaster/provenance-preparation\";\n\nexport { authenticatedDecryptor, DeliveryDecryptionError } from \"@invisi-labs/primitives\";\nexport type { DeliveryDecryptor } from \"@invisi-labs/primitives\";\n","import type { Hex } from \"@invisi-labs/protocol/contracts\";\nimport type { Provider } from \"ethers\";\nimport { readProtocolLogs } from \"../discovery/receipt-logs\";\nimport { EthersChainReader } from \"../integrations/ethers\";\n\nimport { Disclosure, type DisclosureOutput, type DisclosureResult } from \"@invisi-labs/primitives\";\nimport { TokenProtocol } from \"@invisi-labs/rpc\";\nimport { type CanonicalBlock, type ChainReader } from \"@invisi-labs/protocol\";\nimport { extractDeliveryCandidates } from \"../discovery/discovery\";\n\nexport interface DisclosureReference {\n transactionHash: Hex;\n treeId: bigint;\n leafIndex: number;\n role: \"funds\" | \"owner\" | \"spender\";\n}\n\nexport type DisclosureReader = Pick<\n ChainReader,\n \"getChainId\" | \"getCode\" | \"getReceipt\" | \"getBlock\" | \"getLatestBlockNumber\"\n>;\n\nexport interface DisclosureVerifierOptions {\n protocol: TokenProtocol;\n reader: DisclosureReader;\n /** Minimum confirmations including the inclusion block; defaults to one. */\n confirmations?: number;\n}\n\nexport interface DisclosureEvidence {\n reference: Readonly<DisclosureReference>;\n block: Readonly<CanonicalBlock>;\n confirmations: bigint;\n output: Readonly<DisclosureOutput>;\n}\n\nexport interface VerifiedDisclosure {\n result: DisclosureResult;\n block: Readonly<CanonicalBlock>;\n confirmations: bigint;\n output: Readonly<DisclosureReference & { commitment: Hex }>;\n}\n\nfunction check(value: unknown, message: string): asserts value {\n if (!value) throw new Error(message);\n}\n\nfunction reference(value: DisclosureReference): DisclosureReference {\n check(/^0x[0-9a-fA-F]{64}$/.test(value.transactionHash), \"invalid disclosure transaction hash\");\n check(\n typeof value.treeId === \"bigint\" && value.treeId > 0n && value.treeId < 1n << 64n,\n \"invalid disclosure tree ID\"\n );\n check(\n Number.isSafeInteger(value.leafIndex) && value.leafIndex >= 0 && value.leafIndex < 65536,\n \"invalid disclosure leaf index\"\n );\n check([\"funds\", \"owner\", \"spender\"].includes(value.role), \"invalid disclosure reference role\");\n return {\n transactionHash: value.transactionHash.toLowerCase() as Hex,\n treeId: value.treeId,\n leafIndex: value.leafIndex,\n role: value.role,\n };\n}\n\n/** Read-only verification against a trusted RPC and authenticated protocol deployment.\n * Results establish output content/inclusion at a block, not payer identity, spent state or wallet completeness.\n */\nexport class DisclosureVerifier {\n readonly #protocol: TokenProtocol;\n readonly #reader: DisclosureReader;\n readonly #confirmations: bigint;\n\n constructor(\n options:\n | DisclosureVerifierOptions\n | (Omit<DisclosureVerifierOptions, \"reader\"> & { provider: Provider })\n ) {\n const confirmations = options.confirmations ?? 1;\n check(\n Number.isSafeInteger(confirmations) && confirmations >= 1,\n \"invalid disclosure confirmations\"\n );\n this.#protocol = options.protocol;\n this.#reader =\n \"provider\" in options ? new EthersChainReader(options.provider) : options.reader;\n this.#confirmations = BigInt(confirmations);\n Object.freeze(this);\n }\n\n private async barrier(block: Readonly<CanonicalBlock>): Promise<bigint> {\n await this.#protocol.validateDeployment(this.#reader);\n const canonical = await this.#reader.getBlock(block.number);\n check(\n canonical.number === block.number &&\n canonical.hash.toLowerCase() === block.hash.toLowerCase(),\n \"disclosure canonical block changed; reorg verification required\"\n );\n const head = await this.#reader.getLatestBlockNumber();\n check(\n head >= block.number && head - block.number + 1n >= this.#confirmations,\n \"insufficient disclosure confirmations\"\n );\n check(\n (await this.#reader.getChainId()) === this.#protocol.context.chainId,\n \"disclosure chain changed during verification\"\n );\n return head - block.number + 1n;\n }\n\n /** Resolve the exact inserted output and its delivery from a successful canonical receipt. */\n async readOutput(value: DisclosureReference): Promise<DisclosureEvidence> {\n const selected = reference(value);\n await this.#protocol.validateDeployment(this.#reader);\n const received = await this.#reader.getReceipt(selected.transactionHash);\n check(received, \"disclosure transaction receipt is unavailable\");\n const receipt = structuredClone(received);\n check(receipt.status === \"success\", \"disclosure requires a successful transaction receipt\");\n check(\n receipt.transactionHash.toLowerCase() === selected.transactionHash,\n \"disclosure receipt transaction mismatch\"\n );\n check(\n typeof receipt.block.number === \"bigint\" &&\n receipt.block.number >= 0n &&\n /^0x[0-9a-fA-F]{64}$/.test(receipt.block.hash),\n \"invalid disclosure receipt block\"\n );\n const { context } = this.#protocol;\n const logs = readProtocolLogs(receipt, context.protocolAddress);\n const candidates = extractDeliveryCandidates(logs, context, receipt.block.number).filter(\n (candidate) =>\n candidate.treeId === selected.treeId &&\n candidate.leafIndex === selected.leafIndex &&\n candidate.role === selected.role &&\n candidate.tokenAddress.toLowerCase() === context.tokenAddress.toLowerCase()\n );\n check(\n candidates.length === 1,\n \"disclosure output has no unique canonical insertion and delivery\"\n );\n const candidate = candidates[0]!;\n const confirmations = await this.barrier(receipt.block);\n return Object.freeze({\n reference: Object.freeze(selected),\n block: Object.freeze({ ...receipt.block }),\n confirmations,\n output: Object.freeze({\n chainId: context.chainId,\n protocolAddress: BigInt(context.protocolAddress),\n tokenAddress: BigInt(context.tokenAddress),\n outputCommitment: candidate.commitment,\n role: selected.role,\n ciphertext: candidate.delivery.ciphertext,\n }),\n });\n }\n\n async verify(disclosure: Disclosure, value: DisclosureReference): Promise<VerifiedDisclosure> {\n const evidence = await this.readOutput(value);\n const result = await disclosure.verify(evidence.output);\n const confirmations = await this.barrier(evidence.block);\n return Object.freeze({\n result: Object.freeze(result),\n block: evidence.block,\n confirmations,\n output: Object.freeze({\n ...evidence.reference,\n commitment: evidence.output.outputCommitment,\n }),\n });\n }\n\n toJSON() {\n return { disclosureVerifier: true, confirmations: this.#confirmations.toString() };\n }\n\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n","import type { Protocol } from \"@invisi-labs/rpc\";\nimport type { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport type { Provider } from \"ethers\";\n\n/** Public network connections only; never holds wallet keys or a signer. */\nconst connections = new WeakMap<\n Protocol,\n { provider: Provider; protocolRpc: Pick<ProtocolRpcClient, \"withReader\"> }\n>();\nexport function rememberProtocolConnection(\n protocol: Protocol,\n provider: Provider,\n protocolRpc: Pick<ProtocolRpcClient, \"withReader\">\n): void {\n connections.set(protocol, { provider, protocolRpc });\n}\nexport function protocolConnection(protocol: Protocol) {\n return connections.get(protocol);\n}\n","import { rememberProtocolConnection } from \"./connections\";\nimport { Protocol as BaseProtocol } from \"@invisi-labs/rpc\";\nimport type { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport { getAddress, type Provider } from \"ethers\";\nimport { BroadcasterClient } from \"../broadcaster/index\";\n\nconst sources = new WeakMap<Protocol, Pick<ProtocolRpcClient, \"getBroadcasters\">>();\n\n/** Deployment operations and transaction-compatible broadcaster discovery. */\nexport class Protocol extends BaseProtocol {\n static override async fromRpc(\n rpc: Pick<ProtocolRpcClient, \"getDeployment\"> &\n Partial<Pick<ProtocolRpcClient, \"getBroadcasters\" | \"withReader\">>,\n provider: Provider,\n options: { signal?: AbortSignal } = {}\n ): Promise<Protocol> {\n const verified = await BaseProtocol.fromRpc(rpc, provider, options);\n const protocol = new Protocol({ deployment: verified.deployment });\n if (rpc.getBroadcasters)\n sources.set(protocol, rpc as Pick<ProtocolRpcClient, \"getBroadcasters\">);\n if (rpc.withReader)\n rememberProtocolConnection(\n protocol,\n provider,\n rpc as Pick<ProtocolRpcClient, \"withReader\">\n );\n return protocol;\n }\n\n /** Discover token support without disclosing a transaction or requesting a price. */\n async getBroadcasters(options: {\n tokenAddress: string;\n signal?: AbortSignal;\n }): Promise<BroadcasterClient[]> {\n options.signal?.throwIfAborted();\n const token = getAddress(options.tokenAddress);\n if (BigInt(token) === 0n) throw Error(\"Invalid Broadcaster token address\");\n if (!this.deployment.broadcasterRegistry)\n throw new Error(\"broadcaster registry is not configured\");\n const rpc = sources.get(this);\n if (!rpc) throw new Error(\"broadcaster discovery requires Protocol.fromRpc\");\n const clients: BroadcasterClient[] = [];\n let after: `0x${string}` | undefined;\n let block: Awaited<ReturnType<ProtocolRpcClient[\"getBroadcasters\"]>>[\"block\"] | undefined;\n const seen = new Set<string>();\n do {\n options.signal?.throwIfAborted();\n const page = await rpc.getBroadcasters({\n enabled: true,\n limit: 100,\n ...(options.signal ? { signal: options.signal } : {}),\n ...(after ? { after } : {}),\n ...(block ? { block } : {}),\n });\n block ??= page.block;\n const compatible = await Promise.all(\n page.broadcasters.map(async (entry) => {\n if (!entry.enabled) return undefined;\n try {\n const client = new BroadcasterClient({\n endpoint: entry.endpoint,\n quoteSigner: entry.quoteSigner,\n feeRecipient: entry.feeRecipient,\n });\n if (\n !(await client.supportsToken(\n token,\n {\n chainId: this.context.chainId,\n protocol: this.context.protocolAddress,\n },\n options\n ))\n )\n return undefined;\n return client;\n } catch {\n options.signal?.throwIfAborted();\n return undefined;\n }\n })\n );\n options.signal?.throwIfAborted();\n clients.push(\n ...compatible.filter((client): client is BroadcasterClient => client !== undefined)\n );\n after = page.next;\n if (after && seen.has(after)) throw new Error(\"repeated broadcaster pagination cursor\");\n if (after) seen.add(after);\n } while (after);\n return clients;\n }\n}\n","import type { TransactionCall } from \"@invisi-labs/protocol\";\nimport { broadcasterRegistryAbi, type Address, type Hex } from \"@invisi-labs/protocol/contracts\";\nimport { getAddress, Interface, keccak256, type Provider } from \"ethers\";\n\nexport interface BroadcasterRegistration {\n endpoint: string;\n metadataURI?: string;\n quoteSigner: Address;\n feeRecipient: Address;\n}\n\nexport interface RegisteredBroadcaster extends Required<BroadcasterRegistration> {\n operator: Address;\n enabled: boolean;\n}\n\nexport interface BroadcasterRegistryOptions {\n provider: Provider;\n address: Address;\n chainId: bigint;\n fromBlock: number;\n runtimeCodeHash: string;\n /** Maximum blocks per getLogs request. Defaults to 2,000. */\n blockRange?: number;\n}\n\nconst abi = new Interface(broadcasterRegistryAbi);\n\nfunction address(value: string): Address {\n const normalized = getAddress(value) as Address;\n if (BigInt(normalized) === 0n) throw new Error(\"zero broadcaster address\");\n return normalized;\n}\n\n/** Optional on-chain discovery. Registry entries do not authorize spending or endorse operators. */\nexport class BroadcasterRegistry {\n readonly address: Address;\n readonly #options: Readonly<BroadcasterRegistryOptions>;\n\n constructor(options: BroadcasterRegistryOptions) {\n this.address = address(options.address);\n const blockRange = options.blockRange ?? 2_000;\n if (\n options.chainId <= 0n ||\n !Number.isSafeInteger(options.fromBlock) ||\n options.fromBlock < 0 ||\n !Number.isSafeInteger(blockRange) ||\n blockRange < 1 ||\n blockRange > 100_000 ||\n !/^0x[0-9a-fA-F]{64}$/.test(options.runtimeCodeHash)\n )\n throw new Error(\"invalid broadcaster registry configuration\");\n this.#options = Object.freeze({ ...options, blockRange });\n }\n\n prepareRegistration(registration: BroadcasterRegistration): TransactionCall {\n const { endpoint, metadataURI = \"\" } = registration;\n if (\n !endpoint.startsWith(\"https://\") ||\n endpoint.length <= 8 ||\n endpoint.length > 2048 ||\n /[^\\x21-\\x7e]/.test(endpoint)\n )\n throw new Error(\"broadcaster endpoint must be a printable HTTPS URI\");\n // Parse locally for a useful error; the registry additionally enforces its byte limits.\n const url = new URL(endpoint);\n if (!url.hostname || url.username || url.password) {\n throw new Error(\"broadcaster HTTPS endpoint must not include credentials\");\n }\n if (metadataURI.length > 2048 || /[^\\x21-\\x7e]/.test(metadataURI)) {\n throw new Error(\"invalid broadcaster metadata URI\");\n }\n return this.call(\"setBroadcaster\", [\n endpoint,\n metadataURI,\n address(registration.quoteSigner),\n address(registration.feeRecipient),\n ]);\n }\n\n prepareAvailability(enabled: boolean): TransactionCall {\n return this.call(\"setEnabled\", [enabled]);\n }\n\n private call(name: string, args: readonly unknown[]): TransactionCall {\n return { to: this.address, data: abi.encodeFunctionData(name, args) as Hex, value: 0n };\n }\n\n private async validate(): Promise<void> {\n const { provider, chainId, runtimeCodeHash } = this.#options;\n if ((await provider.getNetwork()).chainId !== chainId) {\n throw new Error(\"broadcaster registry chain mismatch\");\n }\n if (\n keccak256(await provider.getCode(this.address)).toLowerCase() !==\n runtimeCodeHash.toLowerCase()\n ) {\n throw new Error(\"broadcaster registry runtime code mismatch\");\n }\n }\n\n async get(operator: Address): Promise<RegisteredBroadcaster> {\n await this.validate();\n return this.read(address(operator));\n }\n\n private async read(operator: Address): Promise<RegisteredBroadcaster> {\n const result = await this.#options.provider.call(this.call(\"broadcasterOf\", [operator]));\n const [entry] = abi.decodeFunctionResult(\"broadcasterOf\", result);\n return {\n operator,\n endpoint: entry.endpoint,\n metadataURI: entry.metadataURI,\n quoteSigner: address(entry.quoteSigner),\n feeRecipient: address(entry.feeRecipient),\n enabled: entry.enabled,\n };\n }\n\n /** Discover event operators, then read their latest entry; disabled services remain explicit. */\n async discover(\n options: { toBlock?: number; signal?: AbortSignal } = {}\n ): Promise<RegisteredBroadcaster[]> {\n const { provider, fromBlock, blockRange } = this.#options;\n options.signal?.throwIfAborted();\n await this.validate();\n const toBlock = options.toBlock ?? (await provider.getBlockNumber());\n if (!Number.isSafeInteger(toBlock) || toBlock < fromBlock) {\n throw new Error(\"invalid broadcaster discovery block range\");\n }\n const operators = new Set<Address>();\n for (let start = fromBlock; start <= toBlock;) {\n options.signal?.throwIfAborted();\n const end = Math.min(start + blockRange! - 1, toBlock);\n const logs = await provider.getLogs({\n address: this.address,\n topics: [abi.getEvent(\"BroadcasterSet\")!.topicHash],\n fromBlock: start,\n toBlock: end,\n });\n for (const log of logs) {\n if (getAddress(log.address) !== this.address)\n throw new Error(\"registry event address mismatch\");\n const event = abi.parseLog(log);\n if (!event || event.name !== \"BroadcasterSet\")\n throw new Error(\"invalid registry event\");\n operators.add(address(event.args.operator));\n }\n start = end + 1;\n }\n const entries: RegisteredBroadcaster[] = [];\n for (const operator of operators) {\n options.signal?.throwIfAborted();\n entries.push(await this.read(operator));\n }\n return entries;\n }\n}\n","import { ProtocolRpcClient as RpcClient } from \"@invisi-labs/rpc\";\nimport type { Provider } from \"ethers\";\nimport { EthersChainReader } from \"../integrations/ethers\";\n\n/** Protocol RPC transport with ethers provider integration for independent chain checks. */\nexport class ProtocolRpcClient extends RpcClient {\n withProvider(provider: Provider): RpcClient {\n return this.withReader(new EthersChainReader(provider));\n }\n}\n","import { computeNoteIdentity, computeNoteCommitment, Wallet } from \"@invisi-labs/primitives\";\nimport type { Protocol } from \"@invisi-labs/rpc\";\nimport type { Membership, CanonicalBlock } from \"@invisi-labs/protocol\";\nimport type { NoteInput } from \"../transactions/explicit-types\";\nimport { decodePaymentNote, encodePaymentNote } from \"./codec\";\nimport type { PaymentNoteData } from \"./types\";\nimport {\n verifyPaymentNote,\n verificationOptions,\n type PaymentNoteVerificationSettings,\n type PaymentNoteVerificationOptions,\n} from \"./verification\";\n\nconst verification = Symbol(\"PaymentNote verification\");\nexport class VerifiedPaymentNote {\n readonly #membership: Membership;\n readonly #checkedAt: CanonicalBlock;\n constructor(token: symbol, membership: Membership, checkedAt: CanonicalBlock) {\n if (token !== verification) throw new Error(\"Payment note verification required\");\n this.#membership = structuredClone(membership);\n this.#checkedAt = structuredClone(checkedAt);\n }\n get membership(): Membership {\n return structuredClone(this.#membership);\n }\n get checkedAt(): CanonicalBlock {\n return structuredClone(this.#checkedAt);\n }\n}\nexport class SpendablePaymentNote extends VerifiedPaymentNote {\n readonly #input: NoteInput;\n readonly #spendabilityCheckedAt: CanonicalBlock;\n constructor(\n token: symbol,\n input: NoteInput,\n membership: Membership,\n checkedAt: CanonicalBlock,\n spendabilityCheckedAt: CanonicalBlock\n ) {\n super(token, membership, checkedAt);\n this.#input = structuredClone(input);\n this.#spendabilityCheckedAt = structuredClone(spendabilityCheckedAt);\n Object.freeze(this);\n }\n get spendabilityCheckedAt(): CanonicalBlock {\n return structuredClone(this.#spendabilityCheckedAt);\n }\n toInput(): NoteInput {\n return structuredClone(this.#input);\n }\n}\n/** A validated Note opening, independent of an indexed wallet store. */\nexport class PaymentNote implements PaymentNoteData {\n readonly chainId: bigint;\n readonly protocolAddress: PaymentNoteData[\"protocolAddress\"];\n readonly tokenAddress: PaymentNoteData[\"tokenAddress\"];\n readonly amount: bigint;\n readonly ownerAddress: PaymentNoteData[\"ownerAddress\"];\n readonly nonce: bigint;\n readonly commitment: PaymentNoteData[\"commitment\"];\n readonly ipn: string;\n private constructor(data: PaymentNoteData, ipn: string) {\n this.chainId = data.chainId;\n this.protocolAddress = data.protocolAddress;\n this.tokenAddress = data.tokenAddress;\n this.amount = data.amount;\n this.ownerAddress = data.ownerAddress;\n this.nonce = data.nonce;\n this.commitment = data.commitment;\n this.ipn = ipn;\n Object.freeze(this);\n }\n static async from(ipn: string): Promise<PaymentNote> {\n const data = decodePaymentNote(ipn);\n const identity = await computeNoteIdentity(BigInt(data.ownerAddress), data.nonce);\n const commitment = await computeNoteCommitment(\n data.chainId,\n BigInt(data.protocolAddress),\n identity,\n BigInt(data.tokenAddress),\n data.amount\n );\n if (commitment !== data.commitment) throw new Error(\"Payment note commitment mismatch\");\n return new PaymentNote(data, encodePaymentNote(data));\n }\n async verify(\n protocol: Protocol,\n options: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings = {}\n ): Promise<VerifiedPaymentNote> {\n const result = await verifyPaymentNote(\n this.data(),\n protocol,\n verificationOptions(protocol, options)\n );\n const verified = new VerifiedPaymentNote(verification, result.membership, result.checkedAt);\n Object.freeze(verified);\n return verified;\n }\n async verifySpendable(\n protocol: Protocol,\n wallet: Wallet,\n options: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings = {}\n ): Promise<SpendablePaymentNote> {\n if (!(wallet instanceof Wallet)) throw new Error(\"A public Wallet is required\");\n const result = await verifyPaymentNote(\n this.data(),\n protocol,\n verificationOptions(protocol, options),\n wallet\n );\n return new SpendablePaymentNote(\n verification,\n result.input,\n result.membership,\n result.checkedAt,\n result.spendabilityCheckedAt!\n );\n }\n private data(): PaymentNoteData {\n const { chainId, protocolAddress, tokenAddress, amount, ownerAddress, nonce, commitment } =\n this;\n return { chainId, protocolAddress, tokenAddress, amount, ownerAddress, nonce, commitment };\n }\n}\n","import { protocolConnection } from \"../protocol/connections\";\nimport {\n poseidonHash,\n TREE_DEPTH,\n type Wallet,\n type Note,\n computeNoteNullifier,\n} from \"@invisi-labs/primitives\";\nimport type { CanonicalBlock, ChainReader, Membership } from \"@invisi-labs/protocol\";\nimport type { Protocol } from \"@invisi-labs/rpc\";\nimport type { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport { getAddress, type Provider } from \"ethers\";\nimport { EthersChainReader } from \"../integrations/ethers\";\nimport type { NoteInput } from \"../transactions/explicit-types\";\nimport type { PaymentNoteData } from \"./types\";\n\n/** Supply connections for manually constructed Protocols; fromRpc connections are reused. */\nexport type PaymentNoteVerificationOptions = {\n protocolRpc: Pick<ProtocolRpcClient, \"withReader\">;\n confirmations?: number;\n} & ({ provider: Provider; chainReader?: never } | { chainReader: ChainReader; provider?: never });\n\nexport type PaymentNoteVerificationSettings = { confirmations?: number };\nexport function verificationOptions(\n protocol: Protocol,\n options: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings = {}\n): PaymentNoteVerificationOptions {\n const connected = protocolConnection(protocol);\n const resolved = { ...connected, ...options };\n if (\n !(\"protocolRpc\" in resolved) ||\n !resolved.protocolRpc ||\n (!(\"chainReader\" in resolved) && !(\"provider\" in resolved))\n )\n throw new Error(\n \"Payment note verification requires Protocol.fromRpc or explicit chain and Protocol RPC connections\"\n );\n return resolved as PaymentNoteVerificationOptions;\n}\n\nfunction sameBlock(a: CanonicalBlock, b: CanonicalBlock): boolean {\n return (\n a.number === b.number &&\n a.hash === b.hash &&\n a.parentHash === b.parentHash &&\n a.timestamp === b.timestamp\n );\n}\nexport function asNote(data: PaymentNoteData): Note {\n return {\n chainId: data.chainId,\n protocolAddress: BigInt(data.protocolAddress),\n tokenAddress: BigInt(data.tokenAddress),\n amount: data.amount,\n ownerAddress: data.ownerAddress,\n nonce: data.nonce,\n };\n}\nexport async function verifyPaymentNote(\n data: PaymentNoteData,\n protocol: Protocol,\n options: PaymentNoteVerificationOptions,\n wallet?: Wallet\n): Promise<{\n input: NoteInput;\n membership: Membership;\n checkedAt: CanonicalBlock;\n spendabilityCheckedAt?: CanonicalBlock;\n}> {\n if (\n data.chainId !== protocol.context.chainId ||\n getAddress(data.protocolAddress) !== getAddress(protocol.context.protocolAddress)\n )\n throw new Error(\"Payment note protocol context mismatch\");\n const confirmations = options.confirmations ?? 1;\n if (!Number.isSafeInteger(confirmations) || confirmations < 1)\n throw new RangeError(\"confirmations must be positive\");\n const reader = options.chainReader ?? new EthersChainReader(options.provider!);\n await protocol.validateDeployment(reader);\n if (wallet && getAddress(wallet.ownerAddress) !== getAddress(data.ownerAddress))\n throw new Error(\"Payment note owner mismatch\");\n const latest = await reader.getLatestBlockNumber();\n const number = latest - BigInt(confirmations - 1);\n if (number < protocol.deployment.protocol.fromBlock)\n throw new Error(\"Insufficient confirmed blocks\");\n const rpc = options.protocolRpc.withReader(reader);\n const status = await rpc.getStatus(protocol.context);\n if (!status.indexedHead) throw new Error(\"Protocol RPC has no indexed blocks\");\n const indexedNumber = status.indexedHead.number < number ? status.indexedHead.number : number;\n if (indexedNumber < protocol.deployment.protocol.fromBlock)\n throw new Error(\"Protocol RPC has not reached the deployment\");\n const checkedAt = await reader.getBlock(indexedNumber);\n if (checkedAt.number !== indexedNumber)\n throw new Error(\"Payment note confirmation block mismatch\");\n const result = await rpc.getNote(protocol.context, data.commitment, checkedAt);\n if (!result) throw new Error(\"Payment note is not indexed at the requested confirmed block\");\n const { output, membership } = result;\n if (\n output.commitment !== data.commitment ||\n getAddress(output.tokenAddress) !== getAddress(data.tokenAddress) ||\n membership.leaf !== data.commitment ||\n membership.treeId !== output.treeId ||\n membership.leafIndex !== output.leafIndex ||\n membership.block.number > checkedAt.number ||\n output.block.number > checkedAt.number ||\n membership.path.length !== TREE_DEPTH ||\n !Number.isSafeInteger(output.leafIndex) ||\n output.leafIndex < 0 ||\n output.leafIndex >= 2 ** TREE_DEPTH\n )\n throw new Error(\"Payment note membership metadata mismatch\");\n let root = BigInt(data.commitment);\n for (let level = 0; level < membership.path.length; level++) {\n const sibling = membership.path[level]!;\n root = BigInt(\n await poseidonHash((output.leafIndex >> level) & 1 ? [sibling, root] : [root, sibling])\n );\n }\n if (\n root !== BigInt(membership.root) ||\n !(await reader.isKnownRoot(protocol.context, membership.treeId, membership.root, checkedAt))\n )\n throw new Error(\"Payment note membership root is not accepted on chain\");\n if (\n !sameBlock(output.block, await reader.getBlock(output.block.number)) ||\n !sameBlock(membership.block, await reader.getBlock(membership.block.number))\n )\n throw new Error(\"Payment note block is no longer canonical\");\n let spendabilityCheckedAt: CanonicalBlock | undefined;\n if (wallet) {\n // Spendability concerns current state, not just the confirmed historical anchor.\n const current = await reader.getBlock(await reader.getLatestBlockNumber());\n const nullifier = await computeNoteNullifier(\n data.chainId,\n BigInt(data.protocolAddress),\n data.nonce,\n data.commitment\n );\n const spent = await reader.isSpent(protocol.context, [nullifier], current);\n if (spent.length !== 1 || spent[0] !== false)\n throw new Error(\"Payment note is already spent\");\n if (\n !(await reader.isKnownRoot(\n protocol.context,\n membership.treeId,\n membership.root,\n current\n ))\n )\n throw new Error(\"Payment note membership root is no longer spendable\");\n if (!sameBlock(current, await reader.getBlock(current.number)))\n throw new Error(\"Spendability block reorganized\");\n spendabilityCheckedAt = current;\n }\n if (!sameBlock(checkedAt, await reader.getBlock(checkedAt.number)))\n throw new Error(\"Payment note verification block reorganized\");\n return {\n input: {\n note: asNote(data),\n commitment: data.commitment,\n treeId: output.treeId,\n leafIndex: output.leafIndex,\n },\n membership,\n checkedAt,\n ...(spendabilityCheckedAt ? { spendabilityCheckedAt } : {}),\n };\n}\n"]}
1
+ {"version":3,"sources":["/Users/wx/Workspace/invisi-lab/invisi-sdk-ts/packages/sdk/dist/index.cjs","../src/index.ts","../src/disclosure/DisclosureVerifier.ts","../src/protocol/connections.ts","../src/protocol/Protocol.ts","../src/protocol/BroadcasterRegistry.ts","../src/protocol/ProtocolRpcClient.ts","../src/payment-note/PaymentNote.ts","../src/payment-note/verification.ts"],"names":["candidate","getAddress"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACpCA;AACI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,qDACG;AAiBP,uCAAsC;ADsBtC;AACA;AEZA,SAAS,KAAA,CAAM,KAAA,EAAgB,OAAA,EAAgC;AAC3D,EAAA,GAAA,CAAI,CAAC,KAAA,EAAO,MAAM,IAAI,KAAA,CAAM,OAAO,CAAA;AACvC;AAEA,SAAS,SAAA,CAAU,KAAA,EAAiD;AAChE,EAAA,KAAA,CAAM,qBAAA,CAAsB,IAAA,CAAK,KAAA,CAAM,eAAe,CAAA,EAAG,qCAAqC,CAAA;AAC9F,EAAA,KAAA;AAAA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AM,iBAAA;AAAA,MACjB,IAAA,CAAK,IAAA,CAAK,CAAA;AAAA,MACV,QAAA;AAAA,MACA,mBAAA,CAAoB,QAAA,EAAU,OAAO,CAAA;AAAA,MACrC;AAAA,IACJ,CAAA;AACA,IAAA,OAAO,IAAI,oBAAA;AAAA,MACP,YAAA;AAAA,MACA,MAAA,CAAO,KAAA;AAAA,MACP,MAAA,CAAO,UAAA;AAAA,MACP,MAAA,CAAO,SAAA;AAAA,MACP,MAAA,CAAO;AAAA,IACX,CAAA;AAAA,EACJ;AAAA,EACQ,IAAA,CAAA,EAAwB;AAC5B,IAAA,MAAM,EAAE,OAAA,EAAS,eAAA,EAAiB,YAAA,EAAc,MAAA,EAAQ,YAAA,EAAc,KAAA,EAAO,WAAW,EAAA,EACpF,IAAA;AACJ,IAAA,OAAO,EAAE,OAAA,EAAS,eAAA,EAAiB,YAAA,EAAc,MAAA,EAAQ,YAAA,EAAc,KAAA,EAAO,WAAW,CAAA;AAAA,EAC7F;AACJ,CAAA;AP+cA;AACA;ACzaA;AACI;AACA;AACA;AAAA;AD4aJ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,oxFAAC","file":"/Users/wx/Workspace/invisi-lab/invisi-sdk-ts/packages/sdk/dist/index.cjs","sourcesContent":[null,"export {\n Detector,\n Disclosure,\n MAX_MEMO_BYTES,\n MissingCapabilityError,\n NullifierCapability,\n ViewingCapability,\n Wallet,\n computeCreditNullifier,\n creditPeriods,\n creditV1,\n decodeDeliveryHeader,\n decodeMemoText,\n encodeMemo,\n fundsV1,\n} from \"@invisi-labs/primitives\";\nexport type {\n Address,\n CreditDataV1,\n CreditDeliveryState,\n CreditState,\n CreditOpening,\n CreditPolicy,\n DisclosureExport,\n DisclosureOutput,\n DisclosureResult,\n FundsDataV1,\n Hex,\n Memo,\n Note,\n ReceivingKeys,\n} from \"@invisi-labs/primitives\";\nexport { RegistrationOperation } from \"@invisi-labs/rpc\";\nexport type {\n AddressRegistryOptions,\n ProtocolOptions,\n RegistryReader,\n TokenProtocol,\n TokenProtocolOptions,\n} from \"@invisi-labs/rpc\";\nexport type {\n CanonicalBlock,\n CanonicalReceipt,\n ChainReader,\n FactoryReader,\n Membership,\n ProtocolDataProvider,\n ProtocolDataStatus,\n ProtocolUpdateRange,\n RegistryContext,\n TransactionCall,\n TransactionContext,\n} from \"@invisi-labs/protocol\";\nexport type {\n AggregateMember,\n AggregatorCapability,\n ProofBundle,\n ProofStatement,\n Prover,\n ProverOptions,\n} from \"@invisi-labs/prover\";\nexport { Invisi } from \"./client/Invisi\";\nexport type { InvisiOptions, RegistrationPreparationOptions } from \"./client/Invisi\";\nexport { DisclosureVerifier } from \"./disclosure/DisclosureVerifier\";\nexport type {\n DisclosureEvidence,\n DisclosureReader,\n DisclosureReference,\n DisclosureVerifierOptions,\n VerifiedDisclosure,\n} from \"./disclosure/DisclosureVerifier\";\nexport { InvisiError } from \"./errors\";\nexport type { InvisiErrorCode, InvisiErrorDetails } from \"./errors\";\nexport { NoteOutput } from \"./notes/NoteOutput\";\nexport type { NoteOutputContext, PaymentRequest, NoteOutputRecipient } from \"./notes/NoteOutput\";\nexport { Protocol } from \"./protocol/Protocol\";\nexport type {\n RevokeCreditPreparation,\n CreateCreditPreparation,\n DrawCreditPreparation,\n FundingAuthorizationVerifier,\n FundingSigner,\n FundingSource,\n FundingTypedData,\n OperationAggregateMember,\n ShieldPreparation,\n UpdateCreditPreparation,\n TransactionExecution,\n TransactionProveOptions,\n TransferPreparation,\n} from \"./transactions/operation-types\";\n\nexport { MAX_UPDATE_BLOCKS, ProtocolRpcError } from \"@invisi-labs/rpc\";\nexport type {\n ProtocolDeployment,\n ProtocolRpcChain,\n ProtocolRpcClientOptions,\n ProtocolRpcConnectionOptions,\n ProtocolRpcReader,\n RegisteredReceivingAddress,\n} from \"@invisi-labs/rpc\";\nexport { AddressRegistry } from \"./protocol/AddressRegistry\";\nexport { BroadcasterRegistry } from \"./protocol/BroadcasterRegistry\";\nexport type {\n BroadcasterRegistration,\n BroadcasterRegistryOptions,\n RegisteredBroadcaster,\n} from \"./protocol/BroadcasterRegistry\";\nexport { ProtocolRpcClient } from \"./protocol/ProtocolRpcClient\";\n\nexport { PreparedTransaction } from \"./transactions/execution/PreparedTransaction\";\nexport type {\n CreditInput,\n ExplicitRevokeCreditPreparation,\n ExplicitCreateCreditPreparation,\n ExplicitDrawCreditPreparation,\n ExplicitShieldPreparation,\n ExplicitUpdateCreditPreparation,\n ExplicitTransferPreparation,\n NoteInput,\n TransactionIdentity,\n} from \"./transactions/explicit-types\";\n\nexport { getDocumentedGasReference } from \"@invisi-labs/protocol\";\nexport type { DocumentedGasReference, DocumentedGasShape } from \"@invisi-labs/protocol\";\n\nexport type { SigningRequest } from \"@invisi-labs/primitives\";\n\n// Stateless recovery for applications that supply canonical receipts without a wallet store.\nexport { decryptCandidates } from \"./discovery/discovery\";\nexport type { DeliveryEventLog, DiscoveredCredit, DiscoveredNote } from \"./discovery/discovery\";\nexport { readProtocolLogs } from \"./discovery/receipt-logs\";\n\nexport type {\n ProtocolCreditTransition,\n ProtocolNoteOutput,\n IndexedCreditState,\n ProtocolTransactionNoteUpdates,\n ProtocolTransactionCreditUpdates,\n} from \"@invisi-labs/rpc\";\n\nexport * from \"./broadcaster/index\";\n\nexport type {\n BroadcasterFeeSource,\n BroadcasterQuoteOptions,\n} from \"./broadcaster/broadcaster-preparation\";\n\nexport { encodePaymentRequest, decodePaymentRequest } from \"./payment-request/codec\";\nexport type { NoteOutputExecutionOptions } from \"./payment-request/types\";\n\nexport { PaymentNote, VerifiedPaymentNote, SpendablePaymentNote } from \"./payment-note/PaymentNote\";\nexport { encodePaymentNote, decodePaymentNote } from \"./payment-note/codec\";\nexport type { PaymentNoteData } from \"./payment-note/types\";\nexport type {\n PaymentNoteVerificationOptions,\n PaymentNoteVerificationSettings,\n} from \"./payment-note/verification\";\nexport { TransactionOutput } from \"./notes/TransactionOutput\";\n\nexport type { PreparedProvenanceCapability } from \"./broadcaster/provenance-preparation\";\n\nexport {\n authenticatedDecryptor,\n DeliveryDecryptionError,\n DeliveryAuthenticationError,\n} from \"@invisi-labs/primitives\";\nexport type {\n DeliveryDecryptor,\n DeliveryDecryptionResult,\n DeliveryDetectionCandidate,\n DeliveryDetectionBatch,\n} from \"@invisi-labs/primitives\";\n","import type { Hex } from \"@invisi-labs/protocol/contracts\";\nimport type { Provider } from \"ethers\";\nimport { readProtocolLogs } from \"../discovery/receipt-logs\";\nimport { EthersChainReader } from \"../integrations/ethers\";\n\nimport { Disclosure, type DisclosureOutput, type DisclosureResult } from \"@invisi-labs/primitives\";\nimport { TokenProtocol } from \"@invisi-labs/rpc\";\nimport { type CanonicalBlock, type ChainReader } from \"@invisi-labs/protocol\";\nimport { extractDeliveryCandidates } from \"../discovery/discovery\";\n\nexport interface DisclosureReference {\n transactionHash: Hex;\n treeId: bigint;\n leafIndex: number;\n role: \"funds\" | \"owner\" | \"spender\";\n}\n\nexport type DisclosureReader = Pick<\n ChainReader,\n \"getChainId\" | \"getCode\" | \"getReceipt\" | \"getBlock\" | \"getLatestBlockNumber\"\n>;\n\nexport interface DisclosureVerifierOptions {\n protocol: TokenProtocol;\n reader: DisclosureReader;\n /** Minimum confirmations including the inclusion block; defaults to one. */\n confirmations?: number;\n}\n\nexport interface DisclosureEvidence {\n reference: Readonly<DisclosureReference>;\n block: Readonly<CanonicalBlock>;\n confirmations: bigint;\n output: Readonly<DisclosureOutput>;\n}\n\nexport interface VerifiedDisclosure {\n result: DisclosureResult;\n block: Readonly<CanonicalBlock>;\n confirmations: bigint;\n output: Readonly<DisclosureReference & { commitment: Hex }>;\n}\n\nfunction check(value: unknown, message: string): asserts value {\n if (!value) throw new Error(message);\n}\n\nfunction reference(value: DisclosureReference): DisclosureReference {\n check(/^0x[0-9a-fA-F]{64}$/.test(value.transactionHash), \"invalid disclosure transaction hash\");\n check(\n typeof value.treeId === \"bigint\" && value.treeId > 0n && value.treeId < 1n << 64n,\n \"invalid disclosure tree ID\"\n );\n check(\n Number.isSafeInteger(value.leafIndex) && value.leafIndex >= 0 && value.leafIndex < 65536,\n \"invalid disclosure leaf index\"\n );\n check([\"funds\", \"owner\", \"spender\"].includes(value.role), \"invalid disclosure reference role\");\n return {\n transactionHash: value.transactionHash.toLowerCase() as Hex,\n treeId: value.treeId,\n leafIndex: value.leafIndex,\n role: value.role,\n };\n}\n\n/** Read-only verification against a trusted RPC and authenticated protocol deployment.\n * Results establish output content/inclusion at a block, not payer identity, spent state or wallet completeness.\n */\nexport class DisclosureVerifier {\n readonly #protocol: TokenProtocol;\n readonly #reader: DisclosureReader;\n readonly #confirmations: bigint;\n\n constructor(\n options:\n | DisclosureVerifierOptions\n | (Omit<DisclosureVerifierOptions, \"reader\"> & { provider: Provider })\n ) {\n const confirmations = options.confirmations ?? 1;\n check(\n Number.isSafeInteger(confirmations) && confirmations >= 1,\n \"invalid disclosure confirmations\"\n );\n this.#protocol = options.protocol;\n this.#reader =\n \"provider\" in options ? new EthersChainReader(options.provider) : options.reader;\n this.#confirmations = BigInt(confirmations);\n Object.freeze(this);\n }\n\n private async barrier(block: Readonly<CanonicalBlock>): Promise<bigint> {\n await this.#protocol.validateDeployment(this.#reader);\n const canonical = await this.#reader.getBlock(block.number);\n check(\n canonical.number === block.number &&\n canonical.hash.toLowerCase() === block.hash.toLowerCase(),\n \"disclosure canonical block changed; reorg verification required\"\n );\n const head = await this.#reader.getLatestBlockNumber();\n check(\n head >= block.number && head - block.number + 1n >= this.#confirmations,\n \"insufficient disclosure confirmations\"\n );\n check(\n (await this.#reader.getChainId()) === this.#protocol.context.chainId,\n \"disclosure chain changed during verification\"\n );\n return head - block.number + 1n;\n }\n\n /** Resolve the exact inserted output and its delivery from a successful canonical receipt. */\n async readOutput(value: DisclosureReference): Promise<DisclosureEvidence> {\n const selected = reference(value);\n await this.#protocol.validateDeployment(this.#reader);\n const received = await this.#reader.getReceipt(selected.transactionHash);\n check(received, \"disclosure transaction receipt is unavailable\");\n const receipt = structuredClone(received);\n check(receipt.status === \"success\", \"disclosure requires a successful transaction receipt\");\n check(\n receipt.transactionHash.toLowerCase() === selected.transactionHash,\n \"disclosure receipt transaction mismatch\"\n );\n check(\n typeof receipt.block.number === \"bigint\" &&\n receipt.block.number >= 0n &&\n /^0x[0-9a-fA-F]{64}$/.test(receipt.block.hash),\n \"invalid disclosure receipt block\"\n );\n const { context } = this.#protocol;\n const logs = readProtocolLogs(receipt, context.protocolAddress);\n const candidates = extractDeliveryCandidates(logs, context, receipt.block.number).filter(\n (candidate) =>\n candidate.treeId === selected.treeId &&\n candidate.leafIndex === selected.leafIndex &&\n candidate.role === selected.role &&\n candidate.tokenAddress.toLowerCase() === context.tokenAddress.toLowerCase()\n );\n check(\n candidates.length === 1,\n \"disclosure output has no unique canonical insertion and delivery\"\n );\n const candidate = candidates[0]!;\n const confirmations = await this.barrier(receipt.block);\n return Object.freeze({\n reference: Object.freeze(selected),\n block: Object.freeze({ ...receipt.block }),\n confirmations,\n output: Object.freeze({\n chainId: context.chainId,\n protocolAddress: BigInt(context.protocolAddress),\n tokenAddress: BigInt(context.tokenAddress),\n outputCommitment: candidate.commitment,\n role: selected.role,\n ciphertext: candidate.delivery.ciphertext,\n }),\n });\n }\n\n async verify(disclosure: Disclosure, value: DisclosureReference): Promise<VerifiedDisclosure> {\n const evidence = await this.readOutput(value);\n const result = await disclosure.verify(evidence.output);\n const confirmations = await this.barrier(evidence.block);\n return Object.freeze({\n result: Object.freeze(result),\n block: evidence.block,\n confirmations,\n output: Object.freeze({\n ...evidence.reference,\n commitment: evidence.output.outputCommitment,\n }),\n });\n }\n\n toJSON() {\n return { disclosureVerifier: true, confirmations: this.#confirmations.toString() };\n }\n\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return this.toJSON();\n }\n}\n","import type { Protocol } from \"@invisi-labs/rpc\";\nimport type { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport type { Provider } from \"ethers\";\n\n/** Public network connections only; never holds wallet keys or a signer. */\nconst connections = new WeakMap<\n Protocol,\n { provider: Provider; protocolRpc: Pick<ProtocolRpcClient, \"withReader\"> }\n>();\nexport function rememberProtocolConnection(\n protocol: Protocol,\n provider: Provider,\n protocolRpc: Pick<ProtocolRpcClient, \"withReader\">\n): void {\n connections.set(protocol, { provider, protocolRpc });\n}\nexport function protocolConnection(protocol: Protocol) {\n return connections.get(protocol);\n}\n","import { rememberProtocolConnection } from \"./connections\";\nimport { Protocol as BaseProtocol } from \"@invisi-labs/rpc\";\nimport type { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport { getAddress, type Provider } from \"ethers\";\nimport { BroadcasterClient } from \"../broadcaster/index\";\n\nconst sources = new WeakMap<Protocol, Pick<ProtocolRpcClient, \"getBroadcasters\">>();\n\n/** Deployment operations and transaction-compatible broadcaster discovery. */\nexport class Protocol extends BaseProtocol {\n static override async fromRpc(\n rpc: Pick<ProtocolRpcClient, \"getDeployment\"> &\n Partial<Pick<ProtocolRpcClient, \"getBroadcasters\" | \"withReader\">>,\n provider: Provider,\n options: { signal?: AbortSignal } = {}\n ): Promise<Protocol> {\n const verified = await BaseProtocol.fromRpc(rpc, provider, options);\n const protocol = new Protocol({ deployment: verified.deployment });\n if (rpc.getBroadcasters)\n sources.set(protocol, rpc as Pick<ProtocolRpcClient, \"getBroadcasters\">);\n if (rpc.withReader)\n rememberProtocolConnection(\n protocol,\n provider,\n rpc as Pick<ProtocolRpcClient, \"withReader\">\n );\n return protocol;\n }\n\n /** Discover token support without disclosing a transaction or requesting a price. */\n async getBroadcasters(options: {\n tokenAddress: string;\n signal?: AbortSignal;\n }): Promise<BroadcasterClient[]> {\n options.signal?.throwIfAborted();\n const token = getAddress(options.tokenAddress);\n if (BigInt(token) === 0n) throw Error(\"Invalid Broadcaster token address\");\n if (!this.deployment.broadcasterRegistry)\n throw new Error(\"broadcaster registry is not configured\");\n const rpc = sources.get(this);\n if (!rpc) throw new Error(\"broadcaster discovery requires Protocol.fromRpc\");\n const clients: BroadcasterClient[] = [];\n let after: `0x${string}` | undefined;\n let block: Awaited<ReturnType<ProtocolRpcClient[\"getBroadcasters\"]>>[\"block\"] | undefined;\n const seen = new Set<string>();\n do {\n options.signal?.throwIfAborted();\n const page = await rpc.getBroadcasters({\n enabled: true,\n limit: 100,\n ...(options.signal ? { signal: options.signal } : {}),\n ...(after ? { after } : {}),\n ...(block ? { block } : {}),\n });\n block ??= page.block;\n const compatible = await Promise.all(\n page.broadcasters.map(async (entry) => {\n if (!entry.enabled) return undefined;\n try {\n const client = new BroadcasterClient({\n endpoint: entry.endpoint,\n quoteSigner: entry.quoteSigner,\n feeRecipient: entry.feeRecipient,\n });\n if (\n !(await client.supportsToken(\n token,\n {\n chainId: this.context.chainId,\n protocol: this.context.protocolAddress,\n },\n options\n ))\n )\n return undefined;\n return client;\n } catch {\n options.signal?.throwIfAborted();\n return undefined;\n }\n })\n );\n options.signal?.throwIfAborted();\n clients.push(\n ...compatible.filter((client): client is BroadcasterClient => client !== undefined)\n );\n after = page.next;\n if (after && seen.has(after)) throw new Error(\"repeated broadcaster pagination cursor\");\n if (after) seen.add(after);\n } while (after);\n return clients;\n }\n}\n","import type { TransactionCall } from \"@invisi-labs/protocol\";\nimport { broadcasterRegistryAbi, type Address, type Hex } from \"@invisi-labs/protocol/contracts\";\nimport { getAddress, Interface, keccak256, type Provider } from \"ethers\";\n\nexport interface BroadcasterRegistration {\n endpoint: string;\n metadataURI?: string;\n quoteSigner: Address;\n feeRecipient: Address;\n}\n\nexport interface RegisteredBroadcaster extends Required<BroadcasterRegistration> {\n operator: Address;\n enabled: boolean;\n}\n\nexport interface BroadcasterRegistryOptions {\n provider: Provider;\n address: Address;\n chainId: bigint;\n fromBlock: number;\n runtimeCodeHash: string;\n /** Maximum blocks per getLogs request. Defaults to 2,000. */\n blockRange?: number;\n}\n\nconst abi = new Interface(broadcasterRegistryAbi);\n\nfunction address(value: string): Address {\n const normalized = getAddress(value) as Address;\n if (BigInt(normalized) === 0n) throw new Error(\"zero broadcaster address\");\n return normalized;\n}\n\n/** Optional on-chain discovery. Registry entries do not authorize spending or endorse operators. */\nexport class BroadcasterRegistry {\n readonly address: Address;\n readonly #options: Readonly<BroadcasterRegistryOptions>;\n\n constructor(options: BroadcasterRegistryOptions) {\n this.address = address(options.address);\n const blockRange = options.blockRange ?? 2_000;\n if (\n options.chainId <= 0n ||\n !Number.isSafeInteger(options.fromBlock) ||\n options.fromBlock < 0 ||\n !Number.isSafeInteger(blockRange) ||\n blockRange < 1 ||\n blockRange > 100_000 ||\n !/^0x[0-9a-fA-F]{64}$/.test(options.runtimeCodeHash)\n )\n throw new Error(\"invalid broadcaster registry configuration\");\n this.#options = Object.freeze({ ...options, blockRange });\n }\n\n prepareRegistration(registration: BroadcasterRegistration): TransactionCall {\n const { endpoint, metadataURI = \"\" } = registration;\n if (\n !endpoint.startsWith(\"https://\") ||\n endpoint.length <= 8 ||\n endpoint.length > 2048 ||\n /[^\\x21-\\x7e]/.test(endpoint)\n )\n throw new Error(\"broadcaster endpoint must be a printable HTTPS URI\");\n // Parse locally for a useful error; the registry additionally enforces its byte limits.\n const url = new URL(endpoint);\n if (!url.hostname || url.username || url.password) {\n throw new Error(\"broadcaster HTTPS endpoint must not include credentials\");\n }\n if (metadataURI.length > 2048 || /[^\\x21-\\x7e]/.test(metadataURI)) {\n throw new Error(\"invalid broadcaster metadata URI\");\n }\n return this.call(\"setBroadcaster\", [\n endpoint,\n metadataURI,\n address(registration.quoteSigner),\n address(registration.feeRecipient),\n ]);\n }\n\n prepareAvailability(enabled: boolean): TransactionCall {\n return this.call(\"setEnabled\", [enabled]);\n }\n\n private call(name: string, args: readonly unknown[]): TransactionCall {\n return { to: this.address, data: abi.encodeFunctionData(name, args) as Hex, value: 0n };\n }\n\n private async validate(): Promise<void> {\n const { provider, chainId, runtimeCodeHash } = this.#options;\n if ((await provider.getNetwork()).chainId !== chainId) {\n throw new Error(\"broadcaster registry chain mismatch\");\n }\n if (\n keccak256(await provider.getCode(this.address)).toLowerCase() !==\n runtimeCodeHash.toLowerCase()\n ) {\n throw new Error(\"broadcaster registry runtime code mismatch\");\n }\n }\n\n async get(operator: Address): Promise<RegisteredBroadcaster> {\n await this.validate();\n return this.read(address(operator));\n }\n\n private async read(operator: Address): Promise<RegisteredBroadcaster> {\n const result = await this.#options.provider.call(this.call(\"broadcasterOf\", [operator]));\n const [entry] = abi.decodeFunctionResult(\"broadcasterOf\", result);\n return {\n operator,\n endpoint: entry.endpoint,\n metadataURI: entry.metadataURI,\n quoteSigner: address(entry.quoteSigner),\n feeRecipient: address(entry.feeRecipient),\n enabled: entry.enabled,\n };\n }\n\n /** Discover event operators, then read their latest entry; disabled services remain explicit. */\n async discover(\n options: { toBlock?: number; signal?: AbortSignal } = {}\n ): Promise<RegisteredBroadcaster[]> {\n const { provider, fromBlock, blockRange } = this.#options;\n options.signal?.throwIfAborted();\n await this.validate();\n const toBlock = options.toBlock ?? (await provider.getBlockNumber());\n if (!Number.isSafeInteger(toBlock) || toBlock < fromBlock) {\n throw new Error(\"invalid broadcaster discovery block range\");\n }\n const operators = new Set<Address>();\n for (let start = fromBlock; start <= toBlock;) {\n options.signal?.throwIfAborted();\n const end = Math.min(start + blockRange! - 1, toBlock);\n const logs = await provider.getLogs({\n address: this.address,\n topics: [abi.getEvent(\"BroadcasterSet\")!.topicHash],\n fromBlock: start,\n toBlock: end,\n });\n for (const log of logs) {\n if (getAddress(log.address) !== this.address)\n throw new Error(\"registry event address mismatch\");\n const event = abi.parseLog(log);\n if (!event || event.name !== \"BroadcasterSet\")\n throw new Error(\"invalid registry event\");\n operators.add(address(event.args.operator));\n }\n start = end + 1;\n }\n const entries: RegisteredBroadcaster[] = [];\n for (const operator of operators) {\n options.signal?.throwIfAborted();\n entries.push(await this.read(operator));\n }\n return entries;\n }\n}\n","import { ProtocolRpcClient as RpcClient } from \"@invisi-labs/rpc\";\nimport type { Provider } from \"ethers\";\nimport { EthersChainReader } from \"../integrations/ethers\";\n\n/** Protocol RPC transport with ethers provider integration for independent chain checks. */\nexport class ProtocolRpcClient extends RpcClient {\n withProvider(provider: Provider): RpcClient {\n return this.withReader(new EthersChainReader(provider));\n }\n}\n","import { computeNoteIdentity, computeNoteCommitment, Wallet } from \"@invisi-labs/primitives\";\nimport type { Protocol } from \"@invisi-labs/rpc\";\nimport type { Membership, CanonicalBlock } from \"@invisi-labs/protocol\";\nimport type { NoteInput } from \"../transactions/explicit-types\";\nimport { decodePaymentNote, encodePaymentNote } from \"./codec\";\nimport type { PaymentNoteData } from \"./types\";\nimport {\n verifyPaymentNote,\n verificationOptions,\n type PaymentNoteVerificationSettings,\n type PaymentNoteVerificationOptions,\n} from \"./verification\";\n\nconst verification = Symbol(\"PaymentNote verification\");\nexport class VerifiedPaymentNote {\n readonly #membership: Membership;\n readonly #checkedAt: CanonicalBlock;\n constructor(token: symbol, membership: Membership, checkedAt: CanonicalBlock) {\n if (token !== verification) throw new Error(\"Payment note verification required\");\n this.#membership = structuredClone(membership);\n this.#checkedAt = structuredClone(checkedAt);\n }\n get membership(): Membership {\n return structuredClone(this.#membership);\n }\n get checkedAt(): CanonicalBlock {\n return structuredClone(this.#checkedAt);\n }\n}\nexport class SpendablePaymentNote extends VerifiedPaymentNote {\n readonly #input: NoteInput;\n readonly #spendabilityCheckedAt: CanonicalBlock;\n constructor(\n token: symbol,\n input: NoteInput,\n membership: Membership,\n checkedAt: CanonicalBlock,\n spendabilityCheckedAt: CanonicalBlock\n ) {\n super(token, membership, checkedAt);\n this.#input = structuredClone(input);\n this.#spendabilityCheckedAt = structuredClone(spendabilityCheckedAt);\n Object.freeze(this);\n }\n get spendabilityCheckedAt(): CanonicalBlock {\n return structuredClone(this.#spendabilityCheckedAt);\n }\n toInput(): NoteInput {\n return structuredClone(this.#input);\n }\n}\n/** A validated Note opening, independent of an indexed wallet store. */\nexport class PaymentNote implements PaymentNoteData {\n readonly chainId: bigint;\n readonly protocolAddress: PaymentNoteData[\"protocolAddress\"];\n readonly tokenAddress: PaymentNoteData[\"tokenAddress\"];\n readonly amount: bigint;\n readonly ownerAddress: PaymentNoteData[\"ownerAddress\"];\n readonly nonce: bigint;\n readonly commitment: PaymentNoteData[\"commitment\"];\n readonly ipn: string;\n private constructor(data: PaymentNoteData, ipn: string) {\n this.chainId = data.chainId;\n this.protocolAddress = data.protocolAddress;\n this.tokenAddress = data.tokenAddress;\n this.amount = data.amount;\n this.ownerAddress = data.ownerAddress;\n this.nonce = data.nonce;\n this.commitment = data.commitment;\n this.ipn = ipn;\n Object.freeze(this);\n }\n static async from(ipn: string): Promise<PaymentNote> {\n const data = decodePaymentNote(ipn);\n const identity = await computeNoteIdentity(BigInt(data.ownerAddress), data.nonce);\n const commitment = await computeNoteCommitment(\n data.chainId,\n BigInt(data.protocolAddress),\n identity,\n BigInt(data.tokenAddress),\n data.amount\n );\n if (commitment !== data.commitment) throw new Error(\"Payment note commitment mismatch\");\n return new PaymentNote(data, encodePaymentNote(data));\n }\n async verify(\n protocol: Protocol,\n options: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings = {}\n ): Promise<VerifiedPaymentNote> {\n const result = await verifyPaymentNote(\n this.data(),\n protocol,\n verificationOptions(protocol, options)\n );\n const verified = new VerifiedPaymentNote(verification, result.membership, result.checkedAt);\n Object.freeze(verified);\n return verified;\n }\n async verifySpendable(\n protocol: Protocol,\n wallet: Wallet,\n options: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings = {}\n ): Promise<SpendablePaymentNote> {\n if (!(wallet instanceof Wallet)) throw new Error(\"A public Wallet is required\");\n const result = await verifyPaymentNote(\n this.data(),\n protocol,\n verificationOptions(protocol, options),\n wallet\n );\n return new SpendablePaymentNote(\n verification,\n result.input,\n result.membership,\n result.checkedAt,\n result.spendabilityCheckedAt!\n );\n }\n private data(): PaymentNoteData {\n const { chainId, protocolAddress, tokenAddress, amount, ownerAddress, nonce, commitment } =\n this;\n return { chainId, protocolAddress, tokenAddress, amount, ownerAddress, nonce, commitment };\n }\n}\n","import { protocolConnection } from \"../protocol/connections\";\nimport {\n poseidonHash,\n TREE_DEPTH,\n type Wallet,\n type Note,\n computeNoteNullifier,\n} from \"@invisi-labs/primitives\";\nimport type { CanonicalBlock, ChainReader, Membership } from \"@invisi-labs/protocol\";\nimport type { Protocol } from \"@invisi-labs/rpc\";\nimport type { ProtocolRpcClient } from \"@invisi-labs/rpc\";\nimport { getAddress, type Provider } from \"ethers\";\nimport { EthersChainReader } from \"../integrations/ethers\";\nimport type { NoteInput } from \"../transactions/explicit-types\";\nimport type { PaymentNoteData } from \"./types\";\n\n/** Supply connections for manually constructed Protocols; fromRpc connections are reused. */\nexport type PaymentNoteVerificationOptions = {\n protocolRpc: Pick<ProtocolRpcClient, \"withReader\">;\n confirmations?: number;\n} & ({ provider: Provider; chainReader?: never } | { chainReader: ChainReader; provider?: never });\n\nexport type PaymentNoteVerificationSettings = { confirmations?: number };\nexport function verificationOptions(\n protocol: Protocol,\n options: PaymentNoteVerificationOptions | PaymentNoteVerificationSettings = {}\n): PaymentNoteVerificationOptions {\n const connected = protocolConnection(protocol);\n const resolved = { ...connected, ...options };\n if (\n !(\"protocolRpc\" in resolved) ||\n !resolved.protocolRpc ||\n (!(\"chainReader\" in resolved) && !(\"provider\" in resolved))\n )\n throw new Error(\n \"Payment note verification requires Protocol.fromRpc or explicit chain and Protocol RPC connections\"\n );\n return resolved as PaymentNoteVerificationOptions;\n}\n\nfunction sameBlock(a: CanonicalBlock, b: CanonicalBlock): boolean {\n return (\n a.number === b.number &&\n a.hash === b.hash &&\n a.parentHash === b.parentHash &&\n a.timestamp === b.timestamp\n );\n}\nexport function asNote(data: PaymentNoteData): Note {\n return {\n chainId: data.chainId,\n protocolAddress: BigInt(data.protocolAddress),\n tokenAddress: BigInt(data.tokenAddress),\n amount: data.amount,\n ownerAddress: data.ownerAddress,\n nonce: data.nonce,\n };\n}\nexport async function verifyPaymentNote(\n data: PaymentNoteData,\n protocol: Protocol,\n options: PaymentNoteVerificationOptions,\n wallet?: Wallet\n): Promise<{\n input: NoteInput;\n membership: Membership;\n checkedAt: CanonicalBlock;\n spendabilityCheckedAt?: CanonicalBlock;\n}> {\n if (\n data.chainId !== protocol.context.chainId ||\n getAddress(data.protocolAddress) !== getAddress(protocol.context.protocolAddress)\n )\n throw new Error(\"Payment note protocol context mismatch\");\n const confirmations = options.confirmations ?? 1;\n if (!Number.isSafeInteger(confirmations) || confirmations < 1)\n throw new RangeError(\"confirmations must be positive\");\n const reader = options.chainReader ?? new EthersChainReader(options.provider!);\n await protocol.validateDeployment(reader);\n if (wallet && getAddress(wallet.ownerAddress) !== getAddress(data.ownerAddress))\n throw new Error(\"Payment note owner mismatch\");\n const latest = await reader.getLatestBlockNumber();\n const number = latest - BigInt(confirmations - 1);\n if (number < protocol.deployment.protocol.fromBlock)\n throw new Error(\"Insufficient confirmed blocks\");\n const rpc = options.protocolRpc.withReader(reader);\n const status = await rpc.getStatus(protocol.context);\n if (!status.indexedHead) throw new Error(\"Protocol RPC has no indexed blocks\");\n const indexedNumber = status.indexedHead.number < number ? status.indexedHead.number : number;\n if (indexedNumber < protocol.deployment.protocol.fromBlock)\n throw new Error(\"Protocol RPC has not reached the deployment\");\n const checkedAt = await reader.getBlock(indexedNumber);\n if (checkedAt.number !== indexedNumber)\n throw new Error(\"Payment note confirmation block mismatch\");\n const result = await rpc.getNote(protocol.context, data.commitment, checkedAt);\n if (!result) throw new Error(\"Payment note is not indexed at the requested confirmed block\");\n const { output, membership } = result;\n if (\n output.commitment !== data.commitment ||\n getAddress(output.tokenAddress) !== getAddress(data.tokenAddress) ||\n membership.leaf !== data.commitment ||\n membership.treeId !== output.treeId ||\n membership.leafIndex !== output.leafIndex ||\n membership.block.number > checkedAt.number ||\n output.block.number > checkedAt.number ||\n membership.path.length !== TREE_DEPTH ||\n !Number.isSafeInteger(output.leafIndex) ||\n output.leafIndex < 0 ||\n output.leafIndex >= 2 ** TREE_DEPTH\n )\n throw new Error(\"Payment note membership metadata mismatch\");\n let root = BigInt(data.commitment);\n for (let level = 0; level < membership.path.length; level++) {\n const sibling = membership.path[level]!;\n root = BigInt(\n await poseidonHash((output.leafIndex >> level) & 1 ? [sibling, root] : [root, sibling])\n );\n }\n if (\n root !== BigInt(membership.root) ||\n !(await reader.isKnownRoot(protocol.context, membership.treeId, membership.root, checkedAt))\n )\n throw new Error(\"Payment note membership root is not accepted on chain\");\n if (\n !sameBlock(output.block, await reader.getBlock(output.block.number)) ||\n !sameBlock(membership.block, await reader.getBlock(membership.block.number))\n )\n throw new Error(\"Payment note block is no longer canonical\");\n let spendabilityCheckedAt: CanonicalBlock | undefined;\n if (wallet) {\n // Spendability concerns current state, not just the confirmed historical anchor.\n const current = await reader.getBlock(await reader.getLatestBlockNumber());\n const nullifier = await computeNoteNullifier(\n data.chainId,\n BigInt(data.protocolAddress),\n data.nonce,\n data.commitment\n );\n const spent = await reader.isSpent(protocol.context, [nullifier], current);\n if (spent.length !== 1 || spent[0] !== false)\n throw new Error(\"Payment note is already spent\");\n if (\n !(await reader.isKnownRoot(\n protocol.context,\n membership.treeId,\n membership.root,\n current\n ))\n )\n throw new Error(\"Payment note membership root is no longer spendable\");\n if (!sameBlock(current, await reader.getBlock(current.number)))\n throw new Error(\"Spendability block reorganized\");\n spendabilityCheckedAt = current;\n }\n if (!sameBlock(checkedAt, await reader.getBlock(checkedAt.number)))\n throw new Error(\"Payment note verification block reorganized\");\n return {\n input: {\n note: asNote(data),\n commitment: data.commitment,\n treeId: output.treeId,\n leafIndex: output.leafIndex,\n },\n membership,\n checkedAt,\n ...(spendabilityCheckedAt ? { spendabilityCheckedAt } : {}),\n };\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { DisclosureOutput, Disclosure, DisclosureResult, Wallet } from '@invisi-labs/primitives';
2
- export { Address, CreditDataV1, CreditDeliveryState, CreditOpening, CreditPolicy, CreditState, DeliveryDecryptionError, DeliveryDecryptor, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, FundsDataV1, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, SigningRequest, ViewingCapability, Wallet, authenticatedDecryptor, computeCreditNullifier, creditPeriods, creditV1, decodeDeliveryHeader, decodeMemoText, encodeMemo, fundsV1 } from '@invisi-labs/primitives';
2
+ export { Address, CreditDataV1, CreditDeliveryState, CreditOpening, CreditPolicy, CreditState, DeliveryAuthenticationError, DeliveryDecryptionError, DeliveryDecryptionResult, DeliveryDecryptor, DeliveryDetectionBatch, DeliveryDetectionCandidate, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, FundsDataV1, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, SigningRequest, ViewingCapability, Wallet, authenticatedDecryptor, computeCreditNullifier, creditPeriods, creditV1, decodeDeliveryHeader, decodeMemoText, encodeMemo, fundsV1 } from '@invisi-labs/primitives';
3
3
  import * as _invisi_labs_rpc from '@invisi-labs/rpc';
4
4
  import { TokenProtocol, Protocol as Protocol$1, ProtocolRpcClient as ProtocolRpcClient$1, AddressRegistry as AddressRegistry$1, RegistrationPreparation } from '@invisi-labs/rpc';
5
5
  export { AddressRegistryOptions, IndexedCreditState, MAX_UPDATE_BLOCKS, ProtocolCreditTransition, ProtocolDeployment, ProtocolNoteOutput, ProtocolOptions, ProtocolRpcChain, ProtocolRpcClientOptions, ProtocolRpcConnectionOptions, ProtocolRpcError, ProtocolRpcReader, ProtocolTransactionCreditUpdates, ProtocolTransactionNoteUpdates, RegisteredReceivingAddress, RegistrationOperation, RegistryReader, TokenProtocol, TokenProtocolOptions } from '@invisi-labs/rpc';
6
6
  import { CanonicalBlock, ChainReader, TransactionCall, Membership } from '@invisi-labs/protocol';
7
7
  export { CanonicalBlock, CanonicalReceipt, ChainReader, DocumentedGasReference, DocumentedGasShape, FactoryReader, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolUpdateRange, RegistryContext, TransactionCall, TransactionContext, getDocumentedGasReference } from '@invisi-labs/protocol';
8
8
  export { AggregateMember, AggregatorCapability, ProofBundle, ProofStatement, Prover, ProverOptions } from '@invisi-labs/prover';
9
- export { D as DeliveryEventLog, a as DiscoveredCredit, b as DiscoveredNote, I as Invisi, c as InvisiError, d as InvisiErrorCode, e as InvisiErrorDetails, f as InvisiOptions, P as PreparedTransaction, R as RegistrationPreparationOptions, g as decryptCandidates, r as readProtocolLogs } from './receipt-logs-DWG4In8N.cjs';
9
+ export { D as DeliveryEventLog, a as DiscoveredCredit, b as DiscoveredNote, I as Invisi, c as InvisiError, d as InvisiErrorCode, e as InvisiErrorDetails, f as InvisiOptions, P as PreparedTransaction, R as RegistrationPreparationOptions, g as decryptCandidates, r as readProtocolLogs } from './receipt-logs-DQRJK0l8.cjs';
10
10
  import { Hex, Address } from '@invisi-labs/protocol/contracts';
11
11
  import { Provider } from 'ethers';
12
12
  import { i as BroadcasterClient, j as PaymentRequest } from './operation-bridge-CoECSxfi.cjs';
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { DisclosureOutput, Disclosure, DisclosureResult, Wallet } from '@invisi-labs/primitives';
2
- export { Address, CreditDataV1, CreditDeliveryState, CreditOpening, CreditPolicy, CreditState, DeliveryDecryptionError, DeliveryDecryptor, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, FundsDataV1, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, SigningRequest, ViewingCapability, Wallet, authenticatedDecryptor, computeCreditNullifier, creditPeriods, creditV1, decodeDeliveryHeader, decodeMemoText, encodeMemo, fundsV1 } from '@invisi-labs/primitives';
2
+ export { Address, CreditDataV1, CreditDeliveryState, CreditOpening, CreditPolicy, CreditState, DeliveryAuthenticationError, DeliveryDecryptionError, DeliveryDecryptionResult, DeliveryDecryptor, DeliveryDetectionBatch, DeliveryDetectionCandidate, Detector, Disclosure, DisclosureExport, DisclosureOutput, DisclosureResult, FundsDataV1, Hex, MAX_MEMO_BYTES, Memo, MissingCapabilityError, Note, NullifierCapability, ReceivingKeys, SigningRequest, ViewingCapability, Wallet, authenticatedDecryptor, computeCreditNullifier, creditPeriods, creditV1, decodeDeliveryHeader, decodeMemoText, encodeMemo, fundsV1 } from '@invisi-labs/primitives';
3
3
  import * as _invisi_labs_rpc from '@invisi-labs/rpc';
4
4
  import { TokenProtocol, Protocol as Protocol$1, ProtocolRpcClient as ProtocolRpcClient$1, AddressRegistry as AddressRegistry$1, RegistrationPreparation } from '@invisi-labs/rpc';
5
5
  export { AddressRegistryOptions, IndexedCreditState, MAX_UPDATE_BLOCKS, ProtocolCreditTransition, ProtocolDeployment, ProtocolNoteOutput, ProtocolOptions, ProtocolRpcChain, ProtocolRpcClientOptions, ProtocolRpcConnectionOptions, ProtocolRpcError, ProtocolRpcReader, ProtocolTransactionCreditUpdates, ProtocolTransactionNoteUpdates, RegisteredReceivingAddress, RegistrationOperation, RegistryReader, TokenProtocol, TokenProtocolOptions } from '@invisi-labs/rpc';
6
6
  import { CanonicalBlock, ChainReader, TransactionCall, Membership } from '@invisi-labs/protocol';
7
7
  export { CanonicalBlock, CanonicalReceipt, ChainReader, DocumentedGasReference, DocumentedGasShape, FactoryReader, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolUpdateRange, RegistryContext, TransactionCall, TransactionContext, getDocumentedGasReference } from '@invisi-labs/protocol';
8
8
  export { AggregateMember, AggregatorCapability, ProofBundle, ProofStatement, Prover, ProverOptions } from '@invisi-labs/prover';
9
- export { D as DeliveryEventLog, a as DiscoveredCredit, b as DiscoveredNote, I as Invisi, c as InvisiError, d as InvisiErrorCode, e as InvisiErrorDetails, f as InvisiOptions, P as PreparedTransaction, R as RegistrationPreparationOptions, g as decryptCandidates, r as readProtocolLogs } from './receipt-logs-8Msm_HZS.js';
9
+ export { D as DeliveryEventLog, a as DiscoveredCredit, b as DiscoveredNote, I as Invisi, c as InvisiError, d as InvisiErrorCode, e as InvisiErrorDetails, f as InvisiOptions, P as PreparedTransaction, R as RegistrationPreparationOptions, g as decryptCandidates, r as readProtocolLogs } from './receipt-logs-fMR6Bwql.js';
10
10
  import { Hex, Address } from '@invisi-labs/protocol/contracts';
11
11
  import { Provider } from 'ethers';
12
12
  import { i as BroadcasterClient, j as PaymentRequest } from './operation-bridge-CoECSxfi.js';
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  decryptCandidates,
6
6
  extractDeliveryCandidates,
7
7
  readProtocolLogs
8
- } from "./chunk-4H4FARQK.js";
8
+ } from "./chunk-FKF67XE6.js";
9
9
  import "./chunk-HLH5JZD4.js";
10
10
  import "./chunk-THMD5QO2.js";
11
11
  import {
@@ -586,12 +586,17 @@ var PaymentNote = class _PaymentNote {
586
586
  };
587
587
 
588
588
  // src/index.ts
589
- import { authenticatedDecryptor, DeliveryDecryptionError } from "@invisi-labs/primitives";
589
+ import {
590
+ authenticatedDecryptor,
591
+ DeliveryDecryptionError,
592
+ DeliveryAuthenticationError
593
+ } from "@invisi-labs/primitives";
590
594
  export {
591
595
  AddressRegistry,
592
596
  BroadcasterClient,
593
597
  BroadcasterRegistry,
594
598
  BroadcasterRpcError,
599
+ DeliveryAuthenticationError,
595
600
  DeliveryDecryptionError,
596
601
  Detector,
597
602
  Disclosure,