@arcanetech/privacy-sdk-stellar 0.3.0 → 0.4.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/README.md +6 -6
- package/dist/index.d.ts +306 -159
- package/dist/index.js +2295 -1804
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +49 -118
- package/dist/node.js +1260 -1568
- package/dist/node.js.map +1 -1
- package/dist/state/index.d.ts +7 -122
- package/dist/state/index.js +96 -490
- package/dist/state/index.js.map +1 -1
- package/dist/testing/index.d.ts +14 -32
- package/dist/transact/index.d.ts +362 -61
- package/dist/transact/index.js +2371 -940
- package/dist/transact/index.js.map +1 -1
- package/generated/contract/README.md +4 -4
- package/generated/contract/dist/index.d.ts +231 -256
- package/generated/contract/dist/index.js +71 -57
- package/generated/contract/package.json +1 -1
- package/generated/contract/src/index.ts +211 -242
- package/generated/registry/README.md +4 -4
- package/generated/registry/dist/index.d.ts +56 -123
- package/generated/registry/dist/index.js +39 -37
- package/generated/registry/package.json +1 -1
- package/generated/registry/src/index.ts +56 -132
- package/package.json +2 -2
|
@@ -6,9 +6,9 @@ This library was automatically generated by Soroban CLI using a command similar
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
soroban contract bindings ts \
|
|
9
|
-
--rpc-url
|
|
10
|
-
--network-passphrase "
|
|
11
|
-
--contract-id
|
|
9
|
+
--rpc-url INSERT_RPC_URL_HERE \
|
|
10
|
+
--network-passphrase "INSERT_NETWORK_PASSPHRASE_HERE" \
|
|
11
|
+
--contract-id INSERT_CONTRACT_ID_HERE \
|
|
12
12
|
--output-dir ./path/to/contract
|
|
13
13
|
```
|
|
14
14
|
|
|
@@ -30,7 +30,7 @@ However, we've actually encountered [frustration](https://github.com/stellar/sor
|
|
|
30
30
|
|
|
31
31
|
```json
|
|
32
32
|
"scripts": {
|
|
33
|
-
"postinstall": "soroban contract bindings ts --rpc-url
|
|
33
|
+
"postinstall": "soroban contract bindings ts --rpc-url INSERT_RPC_URL_HERE --network-passphrase \"INSERT_NETWORK_PASSPHRASE_HERE\" --id INSERT_CONTRACT_ID_HERE --name contract"
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -4,85 +4,6 @@ import type { u32, u64, i128, Option } from "@stellar/stellar-sdk/contract";
|
|
|
4
4
|
export * from "@stellar/stellar-sdk";
|
|
5
5
|
export * as contract from "@stellar/stellar-sdk/contract";
|
|
6
6
|
export * as rpc from "@stellar/stellar-sdk/rpc";
|
|
7
|
-
export declare const networks: {
|
|
8
|
-
readonly testnet: {
|
|
9
|
-
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
10
|
-
readonly contractId: "CD56SAQXVPM3MWTTNVDBDVUEQC6DPRIIYHP67C3ICH6JGMLJSWWUFUON";
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Per-application audit public key allowlist entry (runtime/config state).
|
|
15
|
-
*/
|
|
16
|
-
export interface AppAuditState {
|
|
17
|
-
audit_public_key_x: Buffer;
|
|
18
|
-
audit_public_key_y: Buffer;
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Ephemeral BabyJubJub / ECDH point (not hashed into the Merkle tree).
|
|
23
|
-
*/
|
|
24
|
-
export interface EphemeralKeyCoords {
|
|
25
|
-
x: Buffer;
|
|
26
|
-
y: Buffer;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Admin-managed, nonce-keyed ZK circuit configuration: verification key plus every dynamic
|
|
30
|
-
* shape parameter of the `Transaction(...)` circuit instantiation used to verify a `transact`
|
|
31
|
-
* call for that nonce (see `circuits/main.circom` / `libs/zk::ZkLayoutParams`).
|
|
32
|
-
*/
|
|
33
|
-
export interface ZkConfig {
|
|
34
|
-
audit_offset: u32;
|
|
35
|
-
deprecated: boolean;
|
|
36
|
-
n_audit_slots: u32;
|
|
37
|
-
n_ins: u32;
|
|
38
|
-
n_outs: u32;
|
|
39
|
-
note_audit_len: u32;
|
|
40
|
-
note_output_len: u32;
|
|
41
|
-
output_note_offset: u32;
|
|
42
|
-
public_n_inputs: u32;
|
|
43
|
-
public_n_outputs: u32;
|
|
44
|
-
vk_bytes: Buffer;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Persistent storage key for the per-nonce [`ZkConfig`] registry.
|
|
48
|
-
*/
|
|
49
|
-
export type ZkConfigKey = {
|
|
50
|
-
tag: "Config";
|
|
51
|
-
values: readonly [u64];
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Storage key for tree leaves — each leaf stored by index for O(1) write on deposit.
|
|
55
|
-
*/
|
|
56
|
-
export type TreeDataKey = {
|
|
57
|
-
tag: "Leaf";
|
|
58
|
-
values: readonly [u32];
|
|
59
|
-
} | {
|
|
60
|
-
tag: "LeafCount";
|
|
61
|
-
values: void;
|
|
62
|
-
} | {
|
|
63
|
-
tag: "LeafEphemeral";
|
|
64
|
-
values: readonly [u32];
|
|
65
|
-
} | {
|
|
66
|
-
tag: "PairwiseFrontier";
|
|
67
|
-
values: void;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Storage key for nullifiers — each nullifier hash maps to bool (consumed or not).
|
|
71
|
-
*/
|
|
72
|
-
export type NulifierDataKey = {
|
|
73
|
-
tag: "Nulifier";
|
|
74
|
-
values: readonly [Buffer];
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Ring buffer of historical Merkle roots (for proofs generated against recent states).
|
|
78
|
-
*/
|
|
79
|
-
export type RootHistoryKey = {
|
|
80
|
-
tag: "CurrentRootIndex";
|
|
81
|
-
values: void;
|
|
82
|
-
} | {
|
|
83
|
-
tag: "Root";
|
|
84
|
-
values: readonly [u32];
|
|
85
|
-
};
|
|
86
7
|
export declare const Errors: {
|
|
87
8
|
1: {
|
|
88
9
|
message: string;
|
|
@@ -133,13 +54,13 @@ export declare const Errors: {
|
|
|
133
54
|
message: string;
|
|
134
55
|
};
|
|
135
56
|
/**
|
|
136
|
-
*
|
|
57
|
+
* Reserved (H1): on-chain application audit-key allowlist removed. Do not reuse.
|
|
137
58
|
*/
|
|
138
59
|
13: {
|
|
139
60
|
message: string;
|
|
140
61
|
};
|
|
141
62
|
/**
|
|
142
|
-
*
|
|
63
|
+
* Reserved (H1): on-chain application audit-key allowlist removed. Do not reuse.
|
|
143
64
|
*/
|
|
144
65
|
14: {
|
|
145
66
|
message: string;
|
|
@@ -170,61 +91,112 @@ export declare const Errors: {
|
|
|
170
91
|
18: {
|
|
171
92
|
message: string;
|
|
172
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* `__constructor` was called with `tree_depth > MAX_TREE_DEPTH`.
|
|
96
|
+
*/
|
|
97
|
+
19: {
|
|
98
|
+
message: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Duplicate nullifier hashes appear in a single `transact` public-signal vector (C3).
|
|
102
|
+
*/
|
|
103
|
+
20: {
|
|
104
|
+
message: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Calldata escrow recipient does not match the public-signal escrow limbs.
|
|
108
|
+
*/
|
|
109
|
+
21: {
|
|
110
|
+
message: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* A sweep (non-zero public escrow recipient) requires a registry record for that account.
|
|
114
|
+
*/
|
|
115
|
+
22: {
|
|
116
|
+
message: string;
|
|
117
|
+
};
|
|
173
118
|
};
|
|
174
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Admin-managed, nonce-keyed ZK circuit configuration: verification key plus every dynamic
|
|
121
|
+
* shape parameter of the `Transaction(...)` circuit instantiation used to verify a `transact`
|
|
122
|
+
* call for that nonce (see `circuits/main.circom` / `libs/zk::ZkLayoutParams`).
|
|
123
|
+
*/
|
|
124
|
+
export interface ZkConfig {
|
|
125
|
+
audit_offset: u32;
|
|
126
|
+
deprecated: boolean;
|
|
127
|
+
n_audit_slots: u32;
|
|
128
|
+
n_ins: u32;
|
|
129
|
+
n_outs: u32;
|
|
130
|
+
note_audit_len: u32;
|
|
131
|
+
note_output_len: u32;
|
|
132
|
+
output_note_offset: u32;
|
|
133
|
+
public_n_inputs: u32;
|
|
134
|
+
public_n_outputs: u32;
|
|
135
|
+
vk_bytes: Buffer;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Storage key for tree leaves — each leaf stored by index for O(1) write on deposit.
|
|
139
|
+
*/
|
|
140
|
+
export type TreeDataKey = {
|
|
141
|
+
tag: "Leaf";
|
|
142
|
+
values: readonly [u32];
|
|
143
|
+
} | {
|
|
144
|
+
tag: "LeafCount";
|
|
145
|
+
values: void;
|
|
146
|
+
} | {
|
|
147
|
+
tag: "LeafEphemeral";
|
|
148
|
+
values: readonly [u32];
|
|
149
|
+
} | {
|
|
150
|
+
tag: "PairwiseFrontier";
|
|
151
|
+
values: void;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Persistent storage key for the per-nonce [`ZkConfig`] registry.
|
|
155
|
+
*/
|
|
156
|
+
export type ZkConfigKey = {
|
|
157
|
+
tag: "Config";
|
|
158
|
+
values: readonly [u64];
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Ring buffer of historical Merkle roots (for proofs generated against recent states).
|
|
162
|
+
*/
|
|
163
|
+
export type RootHistoryKey = {
|
|
164
|
+
tag: "CurrentRootIndex";
|
|
165
|
+
values: void;
|
|
166
|
+
} | {
|
|
167
|
+
tag: "Root";
|
|
168
|
+
values: readonly [u32];
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Storage key for nullifiers — each nullifier hash maps to bool (consumed or not).
|
|
172
|
+
*/
|
|
173
|
+
export type NulifierDataKey = {
|
|
174
|
+
tag: "Nulifier";
|
|
175
|
+
values: readonly [Buffer];
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Ephemeral BabyJubJub / ECDH point (not hashed into the Merkle tree).
|
|
179
|
+
*/
|
|
180
|
+
export interface EphemeralKeyCoords {
|
|
181
|
+
x: Buffer;
|
|
182
|
+
y: Buffer;
|
|
183
|
+
}
|
|
184
|
+
export interface AuditSlotEventPayload {
|
|
175
185
|
ciphertext: Buffer;
|
|
176
186
|
ephemeral_x: Buffer;
|
|
177
187
|
ephemeral_y: Buffer;
|
|
178
|
-
output_index: u32;
|
|
179
188
|
tag: Buffer;
|
|
180
189
|
}
|
|
181
|
-
export interface
|
|
190
|
+
export interface OutputNoteEventPayload {
|
|
182
191
|
ciphertext: Buffer;
|
|
183
192
|
ephemeral_x: Buffer;
|
|
184
193
|
ephemeral_y: Buffer;
|
|
194
|
+
output_index: u32;
|
|
185
195
|
tag: Buffer;
|
|
186
196
|
}
|
|
187
|
-
export
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
* Plaintext note fields stored in registry for onboarding claim.
|
|
194
|
-
*/
|
|
195
|
-
export interface PlaintextNote {
|
|
196
|
-
asset_hi: Buffer;
|
|
197
|
-
asset_lo: Buffer;
|
|
198
|
-
/**
|
|
199
|
-
* Must remain `None`; registry rejects payloads that expose the sender ephemeral scalar.
|
|
200
|
-
*/
|
|
201
|
-
deposited_ephemeral_scalar: Option<Buffer>;
|
|
202
|
-
nullifier: Buffer;
|
|
203
|
-
secret: Buffer;
|
|
204
|
-
value: i128;
|
|
205
|
-
}
|
|
206
|
-
export interface PendingNotePayload {
|
|
207
|
-
notes: Array<PlaintextNote>;
|
|
208
|
-
}
|
|
209
|
-
export interface PrivateAddressRegistration {
|
|
210
|
-
owner: string;
|
|
211
|
-
public_key_x: Buffer;
|
|
212
|
-
public_key_y: Buffer;
|
|
213
|
-
}
|
|
214
|
-
export type OptionalPrivateAddressRegistration = {
|
|
215
|
-
tag: "None";
|
|
216
|
-
values: void;
|
|
217
|
-
} | {
|
|
218
|
-
tag: "Some";
|
|
219
|
-
values: readonly [PrivateAddressRegistration];
|
|
220
|
-
};
|
|
221
|
-
export interface OnboardingPayload {
|
|
222
|
-
encrypted_private_key: Buffer;
|
|
223
|
-
notes: PendingNotePayload;
|
|
224
|
-
owner: string;
|
|
225
|
-
private_address_registration: OptionalPrivateAddressRegistration;
|
|
226
|
-
temp_public_key_x: Buffer;
|
|
227
|
-
temp_public_key_y: Buffer;
|
|
197
|
+
export interface KytPassageRecord {
|
|
198
|
+
consumed: boolean;
|
|
199
|
+
expires_at_ledger: u32;
|
|
228
200
|
}
|
|
229
201
|
export interface PrivateAddressRecord {
|
|
230
202
|
owner: string;
|
|
@@ -232,23 +204,76 @@ export interface PrivateAddressRecord {
|
|
|
232
204
|
public_key_y: Buffer;
|
|
233
205
|
updated_at_ledger: u32;
|
|
234
206
|
}
|
|
235
|
-
export interface PendingNullifierRecord {
|
|
236
|
-
created_at_ledger: u32;
|
|
237
|
-
created_by: string;
|
|
238
|
-
encrypted_private_key: Buffer;
|
|
239
|
-
note: PlaintextNote;
|
|
240
|
-
owner: string;
|
|
241
|
-
temp_public_key_x: Buffer;
|
|
242
|
-
temp_public_key_y: Buffer;
|
|
243
|
-
}
|
|
244
|
-
export interface KytPassageRecord {
|
|
245
|
-
expires_at_ledger: u32;
|
|
246
|
-
}
|
|
247
207
|
export interface KytPassageAuthorization {
|
|
248
208
|
expiration_ledger: u32;
|
|
249
209
|
signature: Buffer;
|
|
250
210
|
}
|
|
211
|
+
export interface PrivateAddressRegistration {
|
|
212
|
+
owner: string;
|
|
213
|
+
public_key_x: Buffer;
|
|
214
|
+
public_key_y: Buffer;
|
|
215
|
+
}
|
|
216
|
+
export declare const Groth16Error: {
|
|
217
|
+
0: {
|
|
218
|
+
message: string;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* `Proof::from_bytes` received a `proof_bytes` argument that is too short (or otherwise
|
|
222
|
+
* fails to parse as `a || b || c`) for the fixed G1/G2 encoding lengths.
|
|
223
|
+
*/
|
|
224
|
+
1: {
|
|
225
|
+
message: string;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* `PublicSignals::from_bytes` received a length prefix that does not match the remaining
|
|
229
|
+
* payload (too short, truncated Fr limbs, or a claimed length that overflows).
|
|
230
|
+
*/
|
|
231
|
+
2: {
|
|
232
|
+
message: string;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
251
235
|
export interface Client {
|
|
236
|
+
/**
|
|
237
|
+
* Construct and simulate a transact transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
238
|
+
* Single entrypoint: verifies `circuits/main.circom` Groth16 proof and public signals, checks
|
|
239
|
+
* tree root and nullifiers, appends new output commitments (with ephemeral keys, not in Merkle),
|
|
240
|
+
* then applies public token deposits / withdrawals: `publicDepositedAssets` + `publicDeposits`
|
|
241
|
+
* pull from `from`, and `publicWithdrawnAssets` + `publicWithdrawals` send to the Stellar
|
|
242
|
+
* account from `withdrawAddressHi` / `withdrawAddressLo`.
|
|
243
|
+
*
|
|
244
|
+
* The proof-bound escrow recipient reconstructed from public signals is the only
|
|
245
|
+
* authorization subject. Both limbs zero means a non-sweep: both sweep output owner
|
|
246
|
+
* coordinates must also be zero. A nonzero pair is a sweep: that account must
|
|
247
|
+
* `require_auth()` (host account credentials, so multisig and rotated signers work; a
|
|
248
|
+
* revoked key cannot), must already have a private address in the registry, and both
|
|
249
|
+
* sweep output owner coordinates must equal that registry key.
|
|
250
|
+
*
|
|
251
|
+
* Asset ids: Stellar **contract** token `C...` addresses encoded as two field elements (same 32-byte
|
|
252
|
+
* split as account keys — see `cir
|
|
253
|
+
*/
|
|
254
|
+
transact: ({ from, nonce, proof_bytes, pub_signals_bytes, ciphertext_bytes, kyt_authorization }: {
|
|
255
|
+
from: string;
|
|
256
|
+
nonce: u64;
|
|
257
|
+
proof_bytes: Buffer;
|
|
258
|
+
pub_signals_bytes: Buffer;
|
|
259
|
+
ciphertext_bytes: Buffer;
|
|
260
|
+
kyt_authorization: Option<KytPassageAuthorization>;
|
|
261
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
262
|
+
/**
|
|
263
|
+
* Construct and simulate a get_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
264
|
+
* Gets the admin address (the contract deployer)
|
|
265
|
+
*/
|
|
266
|
+
get_admin: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
|
|
267
|
+
/**
|
|
268
|
+
* Construct and simulate a get_registry transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
269
|
+
*/
|
|
270
|
+
get_registry: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
|
|
271
|
+
/**
|
|
272
|
+
* Construct and simulate a set_registry transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
273
|
+
*/
|
|
274
|
+
set_registry: ({ registry }: {
|
|
275
|
+
registry: string;
|
|
276
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
252
277
|
/**
|
|
253
278
|
* Construct and simulate a add_zk_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
254
279
|
* Registers a new per-nonce ZK circuit configuration (VK + full circuit shape). Admin-only;
|
|
@@ -257,8 +282,7 @@ export interface Client {
|
|
|
257
282
|
* `audit_offset`/`output_note_offset` match the formula-derived layout, and that the VK's
|
|
258
283
|
* `ic` length matches the resulting total public-signal count.
|
|
259
284
|
*/
|
|
260
|
-
add_zk_config: ({
|
|
261
|
-
admin: string;
|
|
285
|
+
add_zk_config: ({ nonce, vk_bytes, n_ins, n_outs, public_n_inputs, public_n_outputs, n_audit_slots, note_audit_len, audit_offset, note_output_len, output_note_offset }: {
|
|
262
286
|
nonce: u64;
|
|
263
287
|
vk_bytes: Buffer;
|
|
264
288
|
n_ins: u32;
|
|
@@ -271,15 +295,6 @@ export interface Client {
|
|
|
271
295
|
note_output_len: u32;
|
|
272
296
|
output_note_offset: u32;
|
|
273
297
|
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
274
|
-
/**
|
|
275
|
-
* Construct and simulate a deprecate_zk_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
276
|
-
* Marks a registered ZK config as deprecated; subsequent `transact` calls referencing this
|
|
277
|
-
* `nonce` fail with [`Error::ZkConfigDeprecated`]. Admin-only.
|
|
278
|
-
*/
|
|
279
|
-
deprecate_zk_config: ({ admin, nonce }: {
|
|
280
|
-
admin: string;
|
|
281
|
-
nonce: u64;
|
|
282
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
283
298
|
/**
|
|
284
299
|
* Construct and simulate a get_zk_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
285
300
|
* Reads a registered ZK config (extending its persistent TTL), or `None` if absent.
|
|
@@ -288,105 +303,94 @@ export interface Client {
|
|
|
288
303
|
nonce: u64;
|
|
289
304
|
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<ZkConfig>>>;
|
|
290
305
|
/**
|
|
291
|
-
* Construct and simulate a
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*
|
|
300
|
-
*
|
|
306
|
+
* Construct and simulate a is_known_root transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
307
|
+
* Returns true if `root` appears in the recent root history (ring buffer).
|
|
308
|
+
* All-zero bytes are never accepted.
|
|
309
|
+
*/
|
|
310
|
+
is_known_root: ({ root }: {
|
|
311
|
+
root: Buffer;
|
|
312
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
313
|
+
/**
|
|
314
|
+
* Construct and simulate a get_commitments transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
315
|
+
* Gets all commitments (leaves) in the merkle tree. Read-only view helper (not called from
|
|
316
|
+
* `transact`/`add_zk_config` or any other state-mutating entrypoint) intended for off-chain
|
|
317
|
+
* simulation/queries; its cost scales with `count`, which grows with real pool usage rather
|
|
318
|
+
* than with a single caller-controlled input, so it does not let one transaction consume a
|
|
319
|
+
* disproportionate share of a block's resources the way an admin/user-controlled shape
|
|
320
|
+
* parameter would. Acknowledged `dos-unbounded-operation` finding.
|
|
301
321
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
322
|
+
* `leaves` is a local in-memory `Vec` (`vec![&env]`), not persistent contract storage, so
|
|
323
|
+
* there is no storage-side access-control concern in the `push_back` below either;
|
|
324
|
+
* acknowledged `dos-unexpected-revert-with-storage` false positive. Both acknowledgments are
|
|
325
|
+
* function-level because neither detector respects a `#[allow]` placed on the loop/statement
|
|
326
|
+
* itself.
|
|
305
327
|
*/
|
|
306
|
-
|
|
307
|
-
from: string;
|
|
308
|
-
nonce: u64;
|
|
309
|
-
proof_bytes: Buffer;
|
|
310
|
-
pub_signals_bytes: Buffer;
|
|
311
|
-
onboarding: Option<OnboardingPayload>;
|
|
312
|
-
kyt_authorization: Option<KytPassageAuthorization>;
|
|
313
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
328
|
+
get_commitments: (options?: MethodOptions) => Promise<AssembledTransaction<Array<Buffer>>>;
|
|
314
329
|
/**
|
|
315
|
-
* Construct and simulate a
|
|
330
|
+
* Construct and simulate a get_merkle_root transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
331
|
+
* Gets the current merkle root of the commitment tree.
|
|
316
332
|
*/
|
|
317
|
-
|
|
318
|
-
admin: string;
|
|
319
|
-
kyt_registry: string;
|
|
320
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
333
|
+
get_merkle_root: (options?: MethodOptions) => Promise<AssembledTransaction<Buffer>>;
|
|
321
334
|
/**
|
|
322
335
|
* Construct and simulate a get_kyt_registry transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
323
336
|
*/
|
|
324
337
|
get_kyt_registry: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
|
|
325
338
|
/**
|
|
326
|
-
* Construct and simulate a
|
|
339
|
+
* Construct and simulate a get_merkle_depth transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
340
|
+
* Gets the current depth of the merkle tree
|
|
327
341
|
*/
|
|
328
|
-
|
|
329
|
-
passage_id: Buffer;
|
|
330
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
342
|
+
get_merkle_depth: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
|
|
331
343
|
/**
|
|
332
|
-
* Construct and simulate a
|
|
344
|
+
* Construct and simulate a set_kyt_registry transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
333
345
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
application_id: Buffer;
|
|
337
|
-
audit_public_key_x: Buffer;
|
|
338
|
-
audit_public_key_y: Buffer;
|
|
339
|
-
enabled: boolean;
|
|
346
|
+
set_kyt_registry: ({ kyt_registry }: {
|
|
347
|
+
kyt_registry: string;
|
|
340
348
|
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
341
349
|
/**
|
|
342
|
-
* Construct and simulate a
|
|
343
|
-
|
|
344
|
-
get_app_audit_state: ({ application_id }: {
|
|
345
|
-
application_id: Buffer;
|
|
346
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<AppAuditState>>>;
|
|
347
|
-
/**
|
|
348
|
-
* Construct and simulate a set_registry transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
350
|
+
* Construct and simulate a get_token_balance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
351
|
+
* Token balance held by this contract for a Stellar asset contract (`C...`).
|
|
349
352
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
353
|
+
get_token_balance: ({ token }: {
|
|
354
|
+
token: string;
|
|
355
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
354
356
|
/**
|
|
355
|
-
* Construct and simulate a
|
|
357
|
+
* Construct and simulate a get_leaf_ephemeral transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
358
|
+
* Ephemeral key (x, y) for a leaf index, if present.
|
|
356
359
|
*/
|
|
357
|
-
|
|
360
|
+
get_leaf_ephemeral: ({ leaf_index }: {
|
|
361
|
+
leaf_index: u32;
|
|
362
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<EphemeralKeyCoords>>>;
|
|
358
363
|
/**
|
|
359
|
-
* Construct and simulate a
|
|
360
|
-
*
|
|
364
|
+
* Construct and simulate a deprecate_zk_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
365
|
+
* Marks a registered ZK config as deprecated; subsequent `transact` calls referencing this
|
|
366
|
+
* `nonce` fail with [`Error::ZkConfigDeprecated`]. Admin-only.
|
|
361
367
|
*/
|
|
362
|
-
|
|
368
|
+
deprecate_zk_config: ({ nonce }: {
|
|
369
|
+
nonce: u64;
|
|
370
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
363
371
|
/**
|
|
364
|
-
* Construct and simulate a
|
|
365
|
-
* Gets the current depth of the merkle tree
|
|
372
|
+
* Construct and simulate a require_kyt_passage transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
366
373
|
*/
|
|
367
|
-
|
|
374
|
+
require_kyt_passage: ({ passage_id }: {
|
|
375
|
+
passage_id: Buffer;
|
|
376
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
368
377
|
/**
|
|
369
378
|
* Construct and simulate a get_commitment_count transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
370
379
|
* Gets the number of commitments (leaves) in the merkle tree
|
|
371
380
|
*/
|
|
372
381
|
get_commitment_count: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
|
|
373
|
-
/**
|
|
374
|
-
* Construct and simulate a get_leaf_ephemeral transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
375
|
-
* Ephemeral key (x, y) for a leaf index, if present.
|
|
376
|
-
*/
|
|
377
|
-
get_leaf_ephemeral: ({ leaf_index }: {
|
|
378
|
-
leaf_index: u32;
|
|
379
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<EphemeralKeyCoords>>>;
|
|
380
382
|
/**
|
|
381
383
|
* Construct and simulate a get_pairwise_frontier transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
382
384
|
* Filled-subtree frontier after the last pairwise insert (reload on the next deposit).
|
|
383
385
|
*/
|
|
384
386
|
get_pairwise_frontier: (options?: MethodOptions) => Promise<AssembledTransaction<Array<Buffer>>>;
|
|
385
387
|
/**
|
|
386
|
-
* Construct and simulate a
|
|
387
|
-
*
|
|
388
|
+
* Construct and simulate a get_public_slot_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
389
|
+
* `publicNInputs` / `publicNOutputs` for the nonce-`0` ("standard") ZK config.
|
|
390
|
+
* Panics with [`Error::ZkConfigNotFound`] when nonce `0` is unregistered. Prefer
|
|
391
|
+
* [`Self::get_zk_config`] for a specific nonce.
|
|
388
392
|
*/
|
|
389
|
-
|
|
393
|
+
get_public_slot_config: (options?: MethodOptions) => Promise<AssembledTransaction<readonly [u32, u32]>>;
|
|
390
394
|
/**
|
|
391
395
|
* Construct and simulate a is_nulifier_hash_consumed transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
392
396
|
* Returns true if the given nullifier hash has already been consumed (used in a withdrawal).
|
|
@@ -394,33 +398,6 @@ export interface Client {
|
|
|
394
398
|
is_nulifier_hash_consumed: ({ hash }: {
|
|
395
399
|
hash: Buffer;
|
|
396
400
|
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
397
|
-
/**
|
|
398
|
-
* Construct and simulate a is_known_root transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
399
|
-
* Returns true if `root` appears in the recent root history (ring buffer).
|
|
400
|
-
* All-zero bytes are never accepted.
|
|
401
|
-
*/
|
|
402
|
-
is_known_root: ({ root }: {
|
|
403
|
-
root: Buffer;
|
|
404
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
405
|
-
/**
|
|
406
|
-
* Construct and simulate a get_token_balance transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
407
|
-
* Token balance held by this contract for a Stellar asset contract (`C...`).
|
|
408
|
-
*/
|
|
409
|
-
get_token_balance: ({ token }: {
|
|
410
|
-
token: string;
|
|
411
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
412
|
-
/**
|
|
413
|
-
* Construct and simulate a get_public_slot_config transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
414
|
-
* `publicNInputs` / `publicNOutputs` for the nonce-`0` ("standard") ZK config, if registered.
|
|
415
|
-
* Thin backward-compatible wrapper over [`Self::get_zk_config`]; prefer reading the relevant
|
|
416
|
-
* nonce's config directly for new code, since a pool may have several registered configs.
|
|
417
|
-
*/
|
|
418
|
-
get_public_slot_config: (options?: MethodOptions) => Promise<AssembledTransaction<readonly [u32, u32]>>;
|
|
419
|
-
/**
|
|
420
|
-
* Construct and simulate a get_admin transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
421
|
-
* Gets the admin address (the contract deployer)
|
|
422
|
-
*/
|
|
423
|
-
get_admin: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
|
|
424
401
|
}
|
|
425
402
|
export declare class Client extends ContractClient {
|
|
426
403
|
readonly options: ContractClientOptions;
|
|
@@ -441,27 +418,25 @@ export declare class Client extends ContractClient {
|
|
|
441
418
|
}): Promise<AssembledTransaction<T>>;
|
|
442
419
|
constructor(options: ContractClientOptions);
|
|
443
420
|
readonly fromJSON: {
|
|
444
|
-
add_zk_config: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
445
|
-
deprecate_zk_config: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
446
|
-
get_zk_config: (json: string) => AssembledTransaction<Option<ZkConfig>>;
|
|
447
421
|
transact: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
448
|
-
|
|
449
|
-
get_kyt_registry: (json: string) => AssembledTransaction<Option<string>>;
|
|
450
|
-
require_kyt_passage: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
451
|
-
set_app_audit_key: (json: string) => AssembledTransaction<null>;
|
|
452
|
-
get_app_audit_state: (json: string) => AssembledTransaction<Option<AppAuditState>>;
|
|
453
|
-
set_registry: (json: string) => AssembledTransaction<null>;
|
|
422
|
+
get_admin: (json: string) => AssembledTransaction<string>;
|
|
454
423
|
get_registry: (json: string) => AssembledTransaction<Option<string>>;
|
|
424
|
+
set_registry: (json: string) => AssembledTransaction<null>;
|
|
425
|
+
add_zk_config: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
426
|
+
get_zk_config: (json: string) => AssembledTransaction<Option<ZkConfig>>;
|
|
427
|
+
is_known_root: (json: string) => AssembledTransaction<boolean>;
|
|
428
|
+
get_commitments: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>[]>;
|
|
455
429
|
get_merkle_root: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>>;
|
|
430
|
+
get_kyt_registry: (json: string) => AssembledTransaction<Option<string>>;
|
|
456
431
|
get_merkle_depth: (json: string) => AssembledTransaction<number>;
|
|
457
|
-
|
|
432
|
+
set_kyt_registry: (json: string) => AssembledTransaction<null>;
|
|
433
|
+
get_token_balance: (json: string) => AssembledTransaction<bigint>;
|
|
458
434
|
get_leaf_ephemeral: (json: string) => AssembledTransaction<Option<EphemeralKeyCoords>>;
|
|
435
|
+
deprecate_zk_config: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
436
|
+
require_kyt_passage: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
437
|
+
get_commitment_count: (json: string) => AssembledTransaction<number>;
|
|
459
438
|
get_pairwise_frontier: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>[]>;
|
|
460
|
-
get_commitments: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>[]>;
|
|
461
|
-
is_nulifier_hash_consumed: (json: string) => AssembledTransaction<boolean>;
|
|
462
|
-
is_known_root: (json: string) => AssembledTransaction<boolean>;
|
|
463
|
-
get_token_balance: (json: string) => AssembledTransaction<bigint>;
|
|
464
439
|
get_public_slot_config: (json: string) => AssembledTransaction<readonly [number, number]>;
|
|
465
|
-
|
|
440
|
+
is_nulifier_hash_consumed: (json: string) => AssembledTransaction<boolean>;
|
|
466
441
|
};
|
|
467
442
|
}
|