@invisi-labs/protocol 1.1.5 → 1.1.6

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.d.cts CHANGED
@@ -3,7 +3,7 @@ import { Hex, Address, ReceivingKeyLookup, PublicWallet, CreditDeliveryState, Au
3
3
  import { ContractRunner, Provider } from 'ethers';
4
4
  import { DeploymentContext, CanonicalBlock, ProtocolDeployment, ProtocolRpcClient } from '@invisi-labs/rpc';
5
5
  export { CanonicalBlock, DeploymentContext, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolUpdateRange, ProtocolUpdates } from '@invisi-labs/rpc';
6
- import { F as FundingParams, D as Delivery, I as InputSource, C as CreateCreditParams, a as CancelCreditParams, b as CreditDrawParams, T as TopUpCreditParams, c as TransactRequest, S as ShieldParams, d as ShieldOutput, e as CrossTreeTransactParams } from './types-BCTQjKzw.cjs';
6
+ import { F as FundingParams, D as Delivery, I as InputSource, C as CreateCreditParams, a as CancelCreditParams, b as CreditDrawParams, T as TopUpCreditParams, c as TransactRequest, S as ShieldParams, d as ShieldOutput, e as CrossTreeTransactParams } from './types-BmUlasOg.cjs';
7
7
  import { ProofTarget, CircuitName, ProofStatement, ProvingRequest } from '@invisi-labs/prover';
8
8
 
9
9
  interface RegistryContext {
@@ -18,7 +18,7 @@ interface RegistryReceivingKeys {
18
18
  }
19
19
  interface AddressRegistration {
20
20
  /** Nonzero EVM owner: 20 bytes or canonical zero-padded bytes32. */
21
- walletIdentity: Hex;
21
+ ownerAddress: Hex;
22
22
  keys: RegistryReceivingKeys;
23
23
  /** The current registry nonce expected for this operation. */
24
24
  nonce: bigint;
@@ -108,6 +108,7 @@ declare const pad: (v: readonly bigint[], n: number) => bigint[];
108
108
  /** Receipt/transport validation must not reject unrelated future wallet codecs. */
109
109
  declare function normalizeOpaqueDelivery(value: Delivery, options?: {
110
110
  empty?: boolean;
111
+ allowEmpty?: boolean;
111
112
  }): Delivery;
112
113
  declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
113
114
  declare function normalizeFunding(input?: FundingInput): FundingParams;
@@ -180,7 +181,7 @@ interface FactoryReader {
180
181
  interface RegistryReader extends Pick<ChainReader, "getChainId" | "getCode" | "getBlock" | "getLatestBlockNumber" | "getTransaction" | "getReceipt"> {
181
182
  /** Validate arbitrary ERC-1271 bytes for a contract owner; transport errors propagate. */
182
183
  isValidRegistrationSignature?(owner: Address, digest: Hex, signature: Hex): Promise<boolean>;
183
- getRegistryNonce(context: RegistryContext, walletIdentity: Hex, block: CanonicalBlock): Promise<bigint>;
184
+ getRegistryNonce(context: RegistryContext, ownerAddress: Hex, block: CanonicalBlock): Promise<bigint>;
184
185
  }
185
186
  interface RegistrationPreparation {
186
187
  wallet: PublicWallet;
@@ -197,7 +198,7 @@ declare class RegistrationOperation {
197
198
  get id(): string;
198
199
  preview(): {
199
200
  update: boolean;
200
- walletIdentity: Hex;
201
+ ownerAddress: Hex;
201
202
  keys: RegistryReceivingKeys;
202
203
  nonce: bigint;
203
204
  deadline: bigint;
@@ -293,7 +294,7 @@ declare class AddressRegistry {
293
294
  buildCall(registration: AddressRegistration, signature: `0x${string}`, options?: RegistrationOptions): RegistrationCalldata;
294
295
  }
295
296
 
296
- declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline"];
297
+ declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline", "feeRecipient", "feeAmount"];
297
298
  /** Public checks cannot establish ownership or conservation: those are enforced by the proof. */
298
299
  declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
299
300
  sources: {
@@ -310,6 +311,8 @@ declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCre
310
311
  deadline: bigint;
311
312
  deliveries: Delivery[];
312
313
  funding: FundingParams;
314
+ feeRecipient: `0x${string}`;
315
+ feeAmount: bigint;
313
316
  chainId: bigint;
314
317
  protocolAddress: Hex;
315
318
  tokenAddress: Hex;
@@ -436,6 +439,8 @@ declare function validateCancelCreditRequest(c: TransactionContext, p: CancelCre
436
439
  owner: `0x${string}`;
437
440
  amount: bigint;
438
441
  deadline: bigint;
442
+ feeRecipient: `0x${string}`;
443
+ feeAmount: bigint;
439
444
  chainId: bigint;
440
445
  protocolAddress: Hex;
441
446
  tokenAddress: Hex;
@@ -459,6 +464,8 @@ declare function validateTopUpCreditRequest(c: TransactionContext, p: TopUpCredi
459
464
  deadline: bigint;
460
465
  deliveries: Delivery[];
461
466
  funding: FundingParams;
467
+ feeRecipient: `0x${string}`;
468
+ feeAmount: bigint;
462
469
  chainId: bigint;
463
470
  protocolAddress: Hex;
464
471
  tokenAddress: Hex;
@@ -615,7 +622,7 @@ type TransactCapacity = (typeof TRANSACT_CAPACITIES)[number];
615
622
  declare function selectTransactCapacity(inputs: number, outputs: number): TransactCapacity;
616
623
  type TransactRequestParams = CrossTreeTransactParams;
617
624
  declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], funding?: FundingInput): {
618
- capacity: 112 | 14 | 56 | 168;
625
+ capacity: 14 | 56 | 112 | 168;
619
626
  sources: {
620
627
  treeId: bigint;
621
628
  merkleRoot: `0x${string}`;
@@ -632,6 +639,8 @@ declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequ
632
639
  deliveriesHash: `0x${string}`;
633
640
  withdrawalAddress: `0x${string}`;
634
641
  withdrawalAmount: bigint;
642
+ feeRecipient: `0x${string}`;
643
+ feeAmount: bigint;
635
644
  deadline: bigint;
636
645
  depositAmount: bigint;
637
646
  depositPayer: `0x${string}`;
@@ -710,7 +719,7 @@ interface BuildTransactCalldataParams {
710
719
  }
711
720
  declare function buildTransactCalldata(p: BuildTransactCalldataParams): {
712
721
  data: `0x${string}`;
713
- capacity: 112 | 14 | 56 | 168;
722
+ capacity: 14 | 56 | 112 | 168;
714
723
  approveAmount: bigint;
715
724
  };
716
725
  interface BuildTransactAggregateCalldataParams {
@@ -780,7 +789,7 @@ type AggregateMemberInput = Pick<TransactRequest, "params" | "deliveries"> & {
780
789
  };
781
790
  /** Atomic aggregate funding binds the member statement rather than the aggregate proof bytes. */
782
791
  declare function aggregateMemberRequestHash(c: TransactionContext, r: AggregateMemberInput): Hex;
783
- /** Router adapter business words (56 per member), not the aggregate circuit statement. */
792
+ /** Router adapter business words (58 per member), not the aggregate circuit statement. */
784
793
  declare function aggregatePublicInputs(c: TransactionContext, requests: readonly AggregateMemberInput[]): `0x${string}`[];
785
794
  declare function encodeAggregateFundingTypedData(c: TransactionContext, r: AggregateMemberInput): {
786
795
  domain: {
@@ -830,7 +839,7 @@ declare class TokenProtocol {
830
839
  }): Promise<void>;
831
840
  transact(request: Omit<BuildTransactCalldataParams, "context">): {
832
841
  data: `0x${string}`;
833
- capacity: 112 | 14 | 56 | 168;
842
+ capacity: 14 | 56 | 112 | 168;
834
843
  approveAmount: bigint;
835
844
  to: `0x${string}`;
836
845
  value: bigint;
@@ -900,7 +909,7 @@ declare class Protocol {
900
909
  }
901
910
 
902
911
  interface VerifyNoteCommitmentParams {
903
- walletIdentity: `0x${string}`;
912
+ ownerAddress: `0x${string}`;
904
913
  tokenAddress: `0x${string}`;
905
914
  amount: bigint;
906
915
  nonce: `0x${string}`;
@@ -943,7 +952,11 @@ interface CreditMembership {
943
952
  }
944
953
  interface TransactWitnessParams extends Omit<BuildTransactCalldataParams, "proof" | "context"> {
945
954
  inputs: readonly NoteMembership[];
946
- outputs: readonly Note[];
955
+ outputs: readonly (Note | {
956
+ identity: Hex;
957
+ amount: bigint;
958
+ note?: Note;
959
+ })[];
947
960
  authorization?: AuthorizedStatement;
948
961
  target?: ProofTarget;
949
962
  }
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Hex, Address, ReceivingKeyLookup, PublicWallet, CreditDeliveryState, Au
3
3
  import { ContractRunner, Provider } from 'ethers';
4
4
  import { DeploymentContext, CanonicalBlock, ProtocolDeployment, ProtocolRpcClient } from '@invisi-labs/rpc';
5
5
  export { CanonicalBlock, DeploymentContext, Membership, ProtocolDataProvider, ProtocolDataStatus, ProtocolUpdateRange, ProtocolUpdates } from '@invisi-labs/rpc';
6
- import { F as FundingParams, D as Delivery, I as InputSource, C as CreateCreditParams, a as CancelCreditParams, b as CreditDrawParams, T as TopUpCreditParams, c as TransactRequest, S as ShieldParams, d as ShieldOutput, e as CrossTreeTransactParams } from './types-BCTQjKzw.js';
6
+ import { F as FundingParams, D as Delivery, I as InputSource, C as CreateCreditParams, a as CancelCreditParams, b as CreditDrawParams, T as TopUpCreditParams, c as TransactRequest, S as ShieldParams, d as ShieldOutput, e as CrossTreeTransactParams } from './types-BmUlasOg.js';
7
7
  import { ProofTarget, CircuitName, ProofStatement, ProvingRequest } from '@invisi-labs/prover';
8
8
 
9
9
  interface RegistryContext {
@@ -18,7 +18,7 @@ interface RegistryReceivingKeys {
18
18
  }
19
19
  interface AddressRegistration {
20
20
  /** Nonzero EVM owner: 20 bytes or canonical zero-padded bytes32. */
21
- walletIdentity: Hex;
21
+ ownerAddress: Hex;
22
22
  keys: RegistryReceivingKeys;
23
23
  /** The current registry nonce expected for this operation. */
24
24
  nonce: bigint;
@@ -108,6 +108,7 @@ declare const pad: (v: readonly bigint[], n: number) => bigint[];
108
108
  /** Receipt/transport validation must not reject unrelated future wallet codecs. */
109
109
  declare function normalizeOpaqueDelivery(value: Delivery, options?: {
110
110
  empty?: boolean;
111
+ allowEmpty?: boolean;
111
112
  }): Delivery;
112
113
  declare const deliveriesHash: (v: readonly Delivery[]) => Hex;
113
114
  declare function normalizeFunding(input?: FundingInput): FundingParams;
@@ -180,7 +181,7 @@ interface FactoryReader {
180
181
  interface RegistryReader extends Pick<ChainReader, "getChainId" | "getCode" | "getBlock" | "getLatestBlockNumber" | "getTransaction" | "getReceipt"> {
181
182
  /** Validate arbitrary ERC-1271 bytes for a contract owner; transport errors propagate. */
182
183
  isValidRegistrationSignature?(owner: Address, digest: Hex, signature: Hex): Promise<boolean>;
183
- getRegistryNonce(context: RegistryContext, walletIdentity: Hex, block: CanonicalBlock): Promise<bigint>;
184
+ getRegistryNonce(context: RegistryContext, ownerAddress: Hex, block: CanonicalBlock): Promise<bigint>;
184
185
  }
185
186
  interface RegistrationPreparation {
186
187
  wallet: PublicWallet;
@@ -197,7 +198,7 @@ declare class RegistrationOperation {
197
198
  get id(): string;
198
199
  preview(): {
199
200
  update: boolean;
200
- walletIdentity: Hex;
201
+ ownerAddress: Hex;
201
202
  keys: RegistryReceivingKeys;
202
203
  nonce: bigint;
203
204
  deadline: bigint;
@@ -293,7 +294,7 @@ declare class AddressRegistry {
293
294
  buildCall(registration: AddressRegistration, signature: `0x${string}`, options?: RegistrationOptions): RegistrationCalldata;
294
295
  }
295
296
 
296
- declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline"];
297
+ declare const CREATE_CREDIT_FIELDS: readonly ["token", "sources", "nullifiers", "creditCommitment", "changeCommitment", "owner", "expiry", "deadline", "feeRecipient", "feeAmount"];
297
298
  /** Public checks cannot establish ownership or conservation: those are enforced by the proof. */
298
299
  declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCreditParams, cs: readonly Delivery[], funding?: FundingInput): {
299
300
  sources: {
@@ -310,6 +311,8 @@ declare function validateCreateCreditRequest(c: TransactionContext, p: CreateCre
310
311
  deadline: bigint;
311
312
  deliveries: Delivery[];
312
313
  funding: FundingParams;
314
+ feeRecipient: `0x${string}`;
315
+ feeAmount: bigint;
313
316
  chainId: bigint;
314
317
  protocolAddress: Hex;
315
318
  tokenAddress: Hex;
@@ -436,6 +439,8 @@ declare function validateCancelCreditRequest(c: TransactionContext, p: CancelCre
436
439
  owner: `0x${string}`;
437
440
  amount: bigint;
438
441
  deadline: bigint;
442
+ feeRecipient: `0x${string}`;
443
+ feeAmount: bigint;
439
444
  chainId: bigint;
440
445
  protocolAddress: Hex;
441
446
  tokenAddress: Hex;
@@ -459,6 +464,8 @@ declare function validateTopUpCreditRequest(c: TransactionContext, p: TopUpCredi
459
464
  deadline: bigint;
460
465
  deliveries: Delivery[];
461
466
  funding: FundingParams;
467
+ feeRecipient: `0x${string}`;
468
+ feeAmount: bigint;
462
469
  chainId: bigint;
463
470
  protocolAddress: Hex;
464
471
  tokenAddress: Hex;
@@ -615,7 +622,7 @@ type TransactCapacity = (typeof TRANSACT_CAPACITIES)[number];
615
622
  declare function selectTransactCapacity(inputs: number, outputs: number): TransactCapacity;
616
623
  type TransactRequestParams = CrossTreeTransactParams;
617
624
  declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequestParams, cs: readonly Delivery[], funding?: FundingInput): {
618
- capacity: 112 | 14 | 56 | 168;
625
+ capacity: 14 | 56 | 112 | 168;
619
626
  sources: {
620
627
  treeId: bigint;
621
628
  merkleRoot: `0x${string}`;
@@ -632,6 +639,8 @@ declare function normalizeTransactRequest(c: TransactionContext, p: TransactRequ
632
639
  deliveriesHash: `0x${string}`;
633
640
  withdrawalAddress: `0x${string}`;
634
641
  withdrawalAmount: bigint;
642
+ feeRecipient: `0x${string}`;
643
+ feeAmount: bigint;
635
644
  deadline: bigint;
636
645
  depositAmount: bigint;
637
646
  depositPayer: `0x${string}`;
@@ -710,7 +719,7 @@ interface BuildTransactCalldataParams {
710
719
  }
711
720
  declare function buildTransactCalldata(p: BuildTransactCalldataParams): {
712
721
  data: `0x${string}`;
713
- capacity: 112 | 14 | 56 | 168;
722
+ capacity: 14 | 56 | 112 | 168;
714
723
  approveAmount: bigint;
715
724
  };
716
725
  interface BuildTransactAggregateCalldataParams {
@@ -780,7 +789,7 @@ type AggregateMemberInput = Pick<TransactRequest, "params" | "deliveries"> & {
780
789
  };
781
790
  /** Atomic aggregate funding binds the member statement rather than the aggregate proof bytes. */
782
791
  declare function aggregateMemberRequestHash(c: TransactionContext, r: AggregateMemberInput): Hex;
783
- /** Router adapter business words (56 per member), not the aggregate circuit statement. */
792
+ /** Router adapter business words (58 per member), not the aggregate circuit statement. */
784
793
  declare function aggregatePublicInputs(c: TransactionContext, requests: readonly AggregateMemberInput[]): `0x${string}`[];
785
794
  declare function encodeAggregateFundingTypedData(c: TransactionContext, r: AggregateMemberInput): {
786
795
  domain: {
@@ -830,7 +839,7 @@ declare class TokenProtocol {
830
839
  }): Promise<void>;
831
840
  transact(request: Omit<BuildTransactCalldataParams, "context">): {
832
841
  data: `0x${string}`;
833
- capacity: 112 | 14 | 56 | 168;
842
+ capacity: 14 | 56 | 112 | 168;
834
843
  approveAmount: bigint;
835
844
  to: `0x${string}`;
836
845
  value: bigint;
@@ -900,7 +909,7 @@ declare class Protocol {
900
909
  }
901
910
 
902
911
  interface VerifyNoteCommitmentParams {
903
- walletIdentity: `0x${string}`;
912
+ ownerAddress: `0x${string}`;
904
913
  tokenAddress: `0x${string}`;
905
914
  amount: bigint;
906
915
  nonce: `0x${string}`;
@@ -943,7 +952,11 @@ interface CreditMembership {
943
952
  }
944
953
  interface TransactWitnessParams extends Omit<BuildTransactCalldataParams, "proof" | "context"> {
945
954
  inputs: readonly NoteMembership[];
946
- outputs: readonly Note[];
955
+ outputs: readonly (Note | {
956
+ identity: Hex;
957
+ amount: bigint;
958
+ note?: Note;
959
+ })[];
947
960
  authorization?: AuthorizedStatement;
948
961
  target?: ProofTarget;
949
962
  }