@invisi-labs/sdk 1.1.3 → 1.1.5

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/memory.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { T as TransactionalWalletStore } from './store-1zgwa--h.cjs';
2
- export { M as MemoryAtomicRecords } from './store-1zgwa--h.cjs';
3
- import './state-DHl6j33x.cjs';
1
+ import { T as TransactionalWalletStore } from './store-Cz75STRl.cjs';
2
+ export { M as MemoryAtomicRecords } from './store-Cz75STRl.cjs';
3
+ import './state-AUnz7TG7.cjs';
4
4
  import '@invisi-labs/core';
5
5
  import '@invisi-labs/prover';
6
6
 
package/dist/memory.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { T as TransactionalWalletStore } from './store-Dlol1q1s.js';
2
- export { M as MemoryAtomicRecords } from './store-Dlol1q1s.js';
3
- import './state-DHl6j33x.js';
1
+ import { T as TransactionalWalletStore } from './store-BMN8kd0c.js';
2
+ export { M as MemoryAtomicRecords } from './store-BMN8kd0c.js';
3
+ import './state-AUnz7TG7.js';
4
4
  import '@invisi-labs/core';
5
5
  import '@invisi-labs/prover';
6
6
 
package/dist/memory.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MemoryAtomicRecords,
3
3
  MemoryWalletStore
4
- } from "./chunk-FSQYZO66.js";
4
+ } from "./chunk-BE52B32Z.js";
5
5
  import "./chunk-4HMM7ZKY.js";
6
6
  export {
7
7
  MemoryAtomicRecords,
@@ -1,13 +1,94 @@
1
- import { Note, CreditDeliveryState, ViewingCapability, Wallet, WalletAuthorizationProvider, ReceivingKeyLookup, Hex as Hex$1 } from '@invisi-labs/core';
2
- import { S as StoredNote, W as WalletScope, b as WalletStore } from './state-DHl6j33x.js';
1
+ import { c as StoredNote, W as WalletScope, b as WalletStore } from './state-AUnz7TG7.js';
3
2
  import { TransactionContext, CanonicalBlock, NoteMembership, FundingInput, TransactRequestParams, CreditMembership, Protocol, ChainReader, ProtocolDataProvider, TokenProtocol } from '@invisi-labs/protocol';
4
3
  import * as _invisi_labs_prover from '@invisi-labs/prover';
5
- import { Prover, ProofTarget, AggregateMember } from '@invisi-labs/prover';
4
+ import { Prover, ProverOptions, AggregateMember } from '@invisi-labs/prover';
5
+ import { Hex, Note, CreditDeliveryState, ViewingCapability, Wallet, PublicWallet, WalletAuthorizationProvider, ReceivingKeyLookup } from '@invisi-labs/core';
6
6
  import { Signer } from 'ethers';
7
- import { Address, Hex, Delivery, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, CancelCreditParams, TopUpCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
7
+ import { Address, Hex as Hex$1, Delivery, ShieldParams, ShieldOutput, CreateCreditParams, CreditDrawParams, CancelCreditParams, TopUpCreditParams, TransactRequest } from '@invisi-labs/protocol/contracts';
8
+
9
+ interface GasBenchmarkShape {
10
+ kind: OperationPlan["kind"];
11
+ target: string;
12
+ capacity: number;
13
+ noteInputs: number;
14
+ noteOutputs: number;
15
+ sourceTrees: number;
16
+ creditInputs: number;
17
+ creditOutputs: number;
18
+ creditRemainders: number;
19
+ funding: "none" | "caller" | "signature";
20
+ permit: boolean;
21
+ deliveryBytes: number;
22
+ }
23
+ interface GasBenchmarkDeployment {
24
+ chainId: string;
25
+ protocolAddress: Hex;
26
+ runtimeCodeHash: Hex | null;
27
+ tokenAddress: Hex;
28
+ }
29
+ interface GasBenchmarkCircuit {
30
+ circuitName: string;
31
+ target: string;
32
+ artifactSha256: string;
33
+ vkSha256: string;
34
+ }
35
+ interface GasBenchmarkSample {
36
+ gasUsed: string;
37
+ transactionHash: Hex;
38
+ blockNumber: string;
39
+ blockHash: Hex;
40
+ calldataBytes: number;
41
+ }
42
+ interface GasBenchmarkProfile {
43
+ formatVersion: 1;
44
+ id: string;
45
+ deployment: GasBenchmarkDeployment;
46
+ source: {
47
+ protocolCommit: string;
48
+ fingerprints?: {
49
+ protocolSourceSha256: string;
50
+ dirtyDiffSha256: string;
51
+ compiledArtifactsSha256: string;
52
+ creditManifestSha256: string;
53
+ userManifestSha256: string;
54
+ sdkSourceSha256: string;
55
+ };
56
+ toolchain?: {
57
+ solidity: string;
58
+ barretenberg: string;
59
+ noir: string;
60
+ evmVersion: string;
61
+ optimizerRuns: number;
62
+ anvil: string;
63
+ };
64
+ blockGasLimit?: string;
65
+ runtimeContracts?: Record<string, {
66
+ address: Hex;
67
+ runtimeCodeHash: Hex;
68
+ }>;
69
+ measuredAt: string;
70
+ chain: string;
71
+ hardfork: string;
72
+ token: string;
73
+ verifier: "real";
74
+ assumptions: string[];
75
+ };
76
+ measurements: Array<{
77
+ id: string;
78
+ shape: GasBenchmarkShape;
79
+ circuit: GasBenchmarkCircuit | null;
80
+ samples: GasBenchmarkSample[];
81
+ }>;
82
+ }
83
+ /** Parse a trusted, JSON-compatible benchmark catalog. No network access or publisher authentication. */
84
+ declare function defineGasBenchmarks(input: unknown): GasBenchmarkProfile[];
85
+ /** Pre-proof reference only; ethers must estimate the final transaction independently. */
86
+ interface GasReference {
87
+ gasUnits: bigint;
88
+ }
8
89
 
9
90
  interface CoinSelector {
10
- select(candidates: readonly StoredNote[], requiredAmount: bigint): readonly Hex[] | Promise<readonly Hex[]>;
91
+ select(candidates: readonly StoredNote[], requiredAmount: bigint): readonly Hex$1[] | Promise<readonly Hex$1[]>;
11
92
  }
12
93
  interface FundingTypedData {
13
94
  domain: Record<string, unknown>;
@@ -20,12 +101,12 @@ interface FundingTypedData {
20
101
  }
21
102
  interface FundingSigner {
22
103
  readonly address: Address;
23
- signTypedData(data: FundingTypedData): Promise<Hex>;
104
+ signTypedData(data: FundingTypedData): Promise<Hex$1>;
24
105
  }
25
106
  interface FundingAuthorizationVerifier {
26
107
  verifyTypedData(data: FundingTypedData & {
27
108
  address: Address;
28
- signature: Hex;
109
+ signature: Hex$1;
29
110
  }): Promise<boolean>;
30
111
  }
31
112
  interface FundingSource {
@@ -37,29 +118,29 @@ interface FundingSource {
37
118
  permit?: NonNullable<FundingInput["permit"]>;
38
119
  }
39
120
  interface PaymentOutput {
40
- memo?: string | Uint8Array;
121
+ /** Version-specific application data. Omission uses built-in v1 with no data. */
122
+ payload?: Uint8Array;
41
123
  to: string;
42
124
  amount: bigint;
43
125
  }
126
+ /** Public submission mode; backend proof targets are selected internally. */
127
+ type TransactionExecution = "single" | "aggregate";
128
+ interface TransactionProveOptions extends ProverOptions {
129
+ /** Defaults to single. Aggregate produces a member for a separate aggregate submission. */
130
+ execution?: TransactionExecution;
131
+ }
44
132
  interface TransferPreparation {
45
133
  tokenAddress: Address;
134
+ /** Explicit subset for managed inventory; detached calls already supply inputs. */
135
+ commitments?: readonly Hex$1[];
136
+ /** Public ERC20 payout. Empty private outputs are allowed when a payout is present. */
137
+ withdrawal?: {
138
+ to: Address;
139
+ amount: bigint;
140
+ };
46
141
  outputs: readonly PaymentOutput[];
47
142
  funding?: FundingSource;
48
143
  deadline?: bigint;
49
- target?: ProofTarget;
50
- }
51
- interface WithdrawalPreparation {
52
- tokenAddress: Address;
53
- to: Address;
54
- amount: bigint;
55
- deadline?: bigint;
56
- target?: ProofTarget;
57
- }
58
- interface SweepPreparation {
59
- tokenAddress: Address;
60
- commitments?: readonly Hex[];
61
- deadline?: bigint;
62
- target?: ProofTarget;
63
144
  }
64
145
  interface ShieldPreparation {
65
146
  tokenAddress: Address;
@@ -69,17 +150,18 @@ interface ShieldPreparation {
69
150
  }
70
151
  interface PreparedOutput {
71
152
  note: Note;
72
- commitment: Hex;
73
- identity: Hex;
153
+ commitment: Hex$1;
154
+ identity: Hex$1;
74
155
  delivery: Delivery;
75
156
  address: string;
76
157
  change: boolean;
77
158
  }
78
159
  interface CreateCreditPreparation {
160
+ /** Version-specific application data. Omission uses built-in v1 with no data. */
161
+ payload?: Uint8Array;
79
162
  singleLimit?: bigint;
80
163
  dailyLimit?: bigint;
81
164
  monthlyLimit?: bigint;
82
- memo?: string | Uint8Array;
83
165
  tokenAddress: Address;
84
166
  spender: string;
85
167
  amount: bigint;
@@ -90,20 +172,21 @@ interface CreateCreditPreparation {
90
172
  interface DrawCreditPreparation {
91
173
  tokenAddress: Address;
92
174
  credits: readonly {
93
- credit: Hex;
175
+ credit: Hex$1;
94
176
  amount: bigint;
95
- memo?: string | Uint8Array;
177
+ payload?: Uint8Array;
96
178
  }[];
97
179
  deadline?: bigint;
98
180
  }
99
181
  interface TopUpCreditPreparation {
182
+ /** Version-specific application data. Omission uses built-in v1 with no data. */
183
+ payload?: Uint8Array;
100
184
  /** Omission inherits the previous limit; zero disables it without clearing usage. */
101
185
  singleLimit?: bigint;
102
186
  dailyLimit?: bigint;
103
187
  monthlyLimit?: bigint;
104
- memo?: string | Uint8Array;
105
188
  tokenAddress: Address;
106
- credit: Hex;
189
+ credit: Hex$1;
107
190
  additionalAmount: bigint;
108
191
  expiry?: bigint;
109
192
  funding?: FundingSource;
@@ -111,16 +194,16 @@ interface TopUpCreditPreparation {
111
194
  }
112
195
  interface CancelCreditPreparation {
113
196
  tokenAddress: Address;
114
- credit: Hex;
197
+ credit: Hex$1;
115
198
  deadline?: bigint;
116
199
  }
117
200
  interface PreparedCreditOutput {
118
201
  state: CreditDeliveryState;
119
- commitment: Hex;
202
+ commitment: Hex$1;
120
203
  deliveries: [Delivery, Delivery];
121
204
  }
122
205
  interface PreparedCreditInput extends CreditMembership {
123
- commitment: Hex;
206
+ commitment: Hex$1;
124
207
  role: "owner" | "spender";
125
208
  }
126
209
  interface CreditPlan {
@@ -136,14 +219,14 @@ interface CreditPlan {
136
219
  interface OperationPlan {
137
220
  version: 1;
138
221
  id: string;
139
- kind: "transfer" | "withdraw" | "sweep" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
222
+ kind: "transfer" | "shield" | "create-credit" | "draw-credit" | "top-up-credit" | "cancel-credit";
140
223
  context: TransactionContext;
141
224
  scope: WalletScope;
142
225
  preparedAt: CanonicalBlock;
143
226
  deadline: bigint;
144
227
  outputs: PreparedOutput[];
145
228
  inputs: Array<NoteMembership & {
146
- commitment: Hex;
229
+ commitment: Hex$1;
147
230
  }>;
148
231
  funding: FundingInput;
149
232
  fundingMode: "none" | "signature" | "caller";
@@ -154,12 +237,14 @@ interface OperationPlan {
154
237
  credit?: CreditPlan;
155
238
  statement?: _invisi_labs_prover.ProofStatement;
156
239
  }
157
- interface WalletSessionOptions {
240
+ type WalletSessionOptions = WalletSessionInfrastructure;
241
+ /** Shared runtime fields; public options separately enforce the custom registry requirement. */
242
+ interface WalletSessionInfrastructure {
158
243
  gasBenchmarks?: readonly GasBenchmarkProfile[];
159
244
  /** Optional ethers gas/funding signer; distinct from the Invisi wallet authority. */
160
245
  signer?: Signer;
161
246
  viewing?: Pick<ViewingCapability, "walletIdentity" | "decryptNote" | "decryptCredit">;
162
- wallet: Wallet;
247
+ wallet: Wallet | PublicWallet;
163
248
  protocol: Protocol;
164
249
  namespace?: string;
165
250
  store?: WalletStore;
@@ -187,85 +272,4 @@ interface OperationAggregateMember extends AggregateMember {
187
272
  request: TransactRequest;
188
273
  }
189
274
 
190
- interface GasBenchmarkShape {
191
- kind: OperationPlan["kind"];
192
- target: string;
193
- capacity: number;
194
- noteInputs: number;
195
- noteOutputs: number;
196
- sourceTrees: number;
197
- creditInputs: number;
198
- creditOutputs: number;
199
- creditRemainders: number;
200
- funding: "none" | "caller" | "signature";
201
- permit: boolean;
202
- deliveryBytes: number;
203
- }
204
- interface GasBenchmarkDeployment {
205
- chainId: string;
206
- protocolAddress: Hex$1;
207
- runtimeCodeHash: Hex$1 | null;
208
- tokenAddress: Hex$1;
209
- }
210
- interface GasBenchmarkCircuit {
211
- circuitName: string;
212
- target: string;
213
- artifactSha256: string;
214
- vkSha256: string;
215
- }
216
- interface GasBenchmarkSample {
217
- gasUsed: string;
218
- transactionHash: Hex$1;
219
- blockNumber: string;
220
- blockHash: Hex$1;
221
- calldataBytes: number;
222
- }
223
- interface GasBenchmarkProfile {
224
- formatVersion: 1;
225
- id: string;
226
- deployment: GasBenchmarkDeployment;
227
- source: {
228
- protocolCommit: string;
229
- fingerprints?: {
230
- protocolSourceSha256: string;
231
- dirtyDiffSha256: string;
232
- compiledArtifactsSha256: string;
233
- creditManifestSha256: string;
234
- userManifestSha256: string;
235
- sdkSourceSha256: string;
236
- };
237
- toolchain?: {
238
- solidity: string;
239
- barretenberg: string;
240
- noir: string;
241
- evmVersion: string;
242
- optimizerRuns: number;
243
- anvil: string;
244
- };
245
- blockGasLimit?: string;
246
- runtimeContracts?: Record<string, {
247
- address: Hex$1;
248
- runtimeCodeHash: Hex$1;
249
- }>;
250
- measuredAt: string;
251
- chain: string;
252
- hardfork: string;
253
- token: string;
254
- verifier: "real";
255
- assumptions: string[];
256
- };
257
- measurements: Array<{
258
- id: string;
259
- shape: GasBenchmarkShape;
260
- circuit: GasBenchmarkCircuit | null;
261
- samples: GasBenchmarkSample[];
262
- }>;
263
- }
264
- /** Parse a trusted, JSON-compatible benchmark catalog. No network access or publisher authentication. */
265
- declare function defineGasBenchmarks(input: unknown): GasBenchmarkProfile[];
266
- /** Pre-proof reference only; ethers must estimate the final transaction independently. */
267
- interface GasReference {
268
- gasUnits: bigint;
269
- }
270
-
271
- export { type CancelCreditPreparation as C, type DrawCreditPreparation as D, type FundingSigner as F, type GasReference as G, type OperationRuntime as O, type ShieldPreparation as S, type TopUpCreditPreparation as T, type WithdrawalPreparation as W, type OperationPlan as a, type OperationAggregateMember as b, type CreateCreditPreparation as c, type SweepPreparation as d, type TransferPreparation as e, type WalletSessionOptions as f, type CoinSelector as g, type FundingAuthorizationVerifier as h, type FundingSource as i, type FundingTypedData as j, type GasBenchmarkCircuit as k, type GasBenchmarkDeployment as l, type GasBenchmarkProfile as m, type GasBenchmarkSample as n, type GasBenchmarkShape as o, defineGasBenchmarks as p };
275
+ export { type CancelCreditPreparation as C, type DrawCreditPreparation as D, type FundingAuthorizationVerifier as F, type GasReference as G, type OperationRuntime as O, type PaymentOutput as P, type ShieldPreparation as S, type TransactionProveOptions as T, type WalletSessionOptions as W, type OperationPlan as a, type OperationAggregateMember as b, type CreateCreditPreparation as c, type TopUpCreditPreparation as d, type TransferPreparation as e, type WalletSessionInfrastructure as f, type CoinSelector as g, type FundingSigner as h, type FundingSource as i, type FundingTypedData as j, type GasBenchmarkCircuit as k, type GasBenchmarkDeployment as l, type GasBenchmarkProfile as m, type GasBenchmarkSample as n, type GasBenchmarkShape as o, type TransactionExecution as p, defineGasBenchmarks as q };