@arcanetech/privacy-sdk-stellar 0.2.3 → 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 +310 -157
- package/dist/index.js +2505 -1817
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +53 -116
- package/dist/node.js +1506 -1622
- 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 +366 -59
- package/dist/transact/index.js +2484 -924
- package/dist/transact/index.js.map +1 -1
- package/generated/contract/README.md +4 -4
- package/generated/contract/dist/index.d.ts +270 -197
- package/generated/contract/dist/index.js +94 -52
- package/generated/contract/package.json +1 -1
- package/generated/contract/src/index.ts +239 -183
- 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 +8 -8
|
@@ -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
|
|
|
@@ -1,63 +1,9 @@
|
|
|
1
1
|
import { Buffer } from "buffer";
|
|
2
2
|
import { AssembledTransaction, Client as ContractClient, ClientOptions as ContractClientOptions, MethodOptions, Result } from "@stellar/stellar-sdk/contract";
|
|
3
|
-
import type { u32, i128, Option } from "@stellar/stellar-sdk/contract";
|
|
3
|
+
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: "CBVQTSTSIJ4UZMN5FQBFHPUIYSW3ATGSP57BZDJNKTOBNQODQTRGE4K5";
|
|
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
|
-
* Storage key for tree leaves — each leaf stored by index for O(1) write on deposit.
|
|
30
|
-
*/
|
|
31
|
-
export type TreeDataKey = {
|
|
32
|
-
tag: "Leaf";
|
|
33
|
-
values: readonly [u32];
|
|
34
|
-
} | {
|
|
35
|
-
tag: "LeafCount";
|
|
36
|
-
values: void;
|
|
37
|
-
} | {
|
|
38
|
-
tag: "LeafEphemeral";
|
|
39
|
-
values: readonly [u32];
|
|
40
|
-
} | {
|
|
41
|
-
tag: "PairwiseFrontier";
|
|
42
|
-
values: void;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Storage key for nullifiers — each nullifier hash maps to bool (consumed or not).
|
|
46
|
-
*/
|
|
47
|
-
export type NulifierDataKey = {
|
|
48
|
-
tag: "Nulifier";
|
|
49
|
-
values: readonly [Buffer];
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Ring buffer of historical Merkle roots (for proofs generated against recent states).
|
|
53
|
-
*/
|
|
54
|
-
export type RootHistoryKey = {
|
|
55
|
-
tag: "CurrentRootIndex";
|
|
56
|
-
values: void;
|
|
57
|
-
} | {
|
|
58
|
-
tag: "Root";
|
|
59
|
-
values: readonly [u32];
|
|
60
|
-
};
|
|
61
7
|
export declare const Errors: {
|
|
62
8
|
1: {
|
|
63
9
|
message: string;
|
|
@@ -108,66 +54,149 @@ export declare const Errors: {
|
|
|
108
54
|
message: string;
|
|
109
55
|
};
|
|
110
56
|
/**
|
|
111
|
-
*
|
|
57
|
+
* Reserved (H1): on-chain application audit-key allowlist removed. Do not reuse.
|
|
112
58
|
*/
|
|
113
59
|
13: {
|
|
114
60
|
message: string;
|
|
115
61
|
};
|
|
116
62
|
/**
|
|
117
|
-
*
|
|
63
|
+
* Reserved (H1): on-chain application audit-key allowlist removed. Do not reuse.
|
|
118
64
|
*/
|
|
119
65
|
14: {
|
|
120
66
|
message: string;
|
|
121
67
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
68
|
+
/**
|
|
69
|
+
* No `ZkConfig` is registered for the requested nonce.
|
|
70
|
+
*/
|
|
71
|
+
15: {
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* The `ZkConfig` for the requested nonce has been deprecated by the admin.
|
|
76
|
+
*/
|
|
77
|
+
16: {
|
|
78
|
+
message: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* `add_zk_config` was called with a `nonce` that already has a config registered.
|
|
82
|
+
*/
|
|
83
|
+
17: {
|
|
84
|
+
message: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* `add_zk_config` shape parameters are inconsistent (odd `n_outs`, insufficient
|
|
88
|
+
* `n_audit_slots`, an `audit_offset`/`output_note_offset` that doesn't match the
|
|
89
|
+
* formula-derived value, or a VK whose `ic` length doesn't match the shape).
|
|
90
|
+
*/
|
|
91
|
+
18: {
|
|
92
|
+
message: string;
|
|
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: {
|
|
132
116
|
message: string;
|
|
133
117
|
};
|
|
134
118
|
};
|
|
135
119
|
/**
|
|
136
|
-
*
|
|
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`).
|
|
137
123
|
*/
|
|
138
|
-
export interface
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
notes: Array<PlaintextNote>;
|
|
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;
|
|
151
136
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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";
|
|
159
145
|
values: void;
|
|
160
146
|
} | {
|
|
161
|
-
tag: "
|
|
162
|
-
values: readonly [
|
|
147
|
+
tag: "LeafEphemeral";
|
|
148
|
+
values: readonly [u32];
|
|
149
|
+
} | {
|
|
150
|
+
tag: "PairwiseFrontier";
|
|
151
|
+
values: void;
|
|
163
152
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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 {
|
|
185
|
+
ciphertext: Buffer;
|
|
186
|
+
ephemeral_x: Buffer;
|
|
187
|
+
ephemeral_y: Buffer;
|
|
188
|
+
tag: Buffer;
|
|
189
|
+
}
|
|
190
|
+
export interface OutputNoteEventPayload {
|
|
191
|
+
ciphertext: Buffer;
|
|
192
|
+
ephemeral_x: Buffer;
|
|
193
|
+
ephemeral_y: Buffer;
|
|
194
|
+
output_index: u32;
|
|
195
|
+
tag: Buffer;
|
|
196
|
+
}
|
|
197
|
+
export interface KytPassageRecord {
|
|
198
|
+
consumed: boolean;
|
|
199
|
+
expires_at_ledger: u32;
|
|
171
200
|
}
|
|
172
201
|
export interface PrivateAddressRecord {
|
|
173
202
|
owner: string;
|
|
@@ -175,105 +204,155 @@ export interface PrivateAddressRecord {
|
|
|
175
204
|
public_key_y: Buffer;
|
|
176
205
|
updated_at_ledger: u32;
|
|
177
206
|
}
|
|
178
|
-
export interface PendingNullifierRecord {
|
|
179
|
-
created_at_ledger: u32;
|
|
180
|
-
created_by: string;
|
|
181
|
-
encrypted_private_key: Buffer;
|
|
182
|
-
note: PlaintextNote;
|
|
183
|
-
owner: string;
|
|
184
|
-
temp_public_key_x: Buffer;
|
|
185
|
-
temp_public_key_y: Buffer;
|
|
186
|
-
}
|
|
187
|
-
export interface KytPassageRecord {
|
|
188
|
-
expires_at_ledger: u32;
|
|
189
|
-
}
|
|
190
207
|
export interface KytPassageAuthorization {
|
|
191
208
|
expiration_ledger: u32;
|
|
192
209
|
signature: Buffer;
|
|
193
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
|
+
};
|
|
194
235
|
export interface Client {
|
|
195
236
|
/**
|
|
196
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.
|
|
197
238
|
* Single entrypoint: verifies `circuits/main.circom` Groth16 proof and public signals, checks
|
|
198
239
|
* tree root and nullifiers, appends new output commitments (with ephemeral keys, not in Merkle),
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* `withdrawAddressHi` / `withdrawAddressLo`.
|
|
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`.
|
|
203
243
|
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
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.
|
|
206
250
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* `bytes[0..16]` and `bytes[16..32]` (see `circuits/main.circom`). Avoids mod-`r` loss from a single `Fr`.
|
|
251
|
+
* Asset ids: Stellar **contract** token `C...` addresses encoded as two field elements (same 32-byte
|
|
252
|
+
* split as account keys — see `cir
|
|
210
253
|
*/
|
|
211
|
-
transact: ({ from, proof_bytes, pub_signals_bytes,
|
|
254
|
+
transact: ({ from, nonce, proof_bytes, pub_signals_bytes, ciphertext_bytes, kyt_authorization }: {
|
|
212
255
|
from: string;
|
|
256
|
+
nonce: u64;
|
|
213
257
|
proof_bytes: Buffer;
|
|
214
258
|
pub_signals_bytes: Buffer;
|
|
215
|
-
|
|
259
|
+
ciphertext_bytes: Buffer;
|
|
216
260
|
kyt_authorization: Option<KytPassageAuthorization>;
|
|
217
261
|
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
218
262
|
/**
|
|
219
|
-
* Construct and simulate a
|
|
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)
|
|
220
265
|
*/
|
|
221
|
-
|
|
222
|
-
admin: string;
|
|
223
|
-
kyt_registry: string;
|
|
224
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
266
|
+
get_admin: (options?: MethodOptions) => Promise<AssembledTransaction<string>>;
|
|
225
267
|
/**
|
|
226
|
-
* Construct and simulate a
|
|
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.
|
|
227
269
|
*/
|
|
228
|
-
|
|
270
|
+
get_registry: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
|
|
229
271
|
/**
|
|
230
|
-
* Construct and simulate a
|
|
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.
|
|
231
273
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<
|
|
274
|
+
set_registry: ({ registry }: {
|
|
275
|
+
registry: string;
|
|
276
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
235
277
|
/**
|
|
236
|
-
* Construct and simulate a
|
|
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.
|
|
279
|
+
* Registers a new per-nonce ZK circuit configuration (VK + full circuit shape). Admin-only;
|
|
280
|
+
* fails if `nonce` already has a config. Validates `n_outs` is even (leaves are inserted
|
|
281
|
+
* pairwise via `PairwiseLeanIMT::insert_two`), `n_audit_slots >= n_ins + n_outs`, that
|
|
282
|
+
* `audit_offset`/`output_note_offset` match the formula-derived layout, and that the VK's
|
|
283
|
+
* `ic` length matches the resulting total public-signal count.
|
|
237
284
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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 }: {
|
|
286
|
+
nonce: u64;
|
|
287
|
+
vk_bytes: Buffer;
|
|
288
|
+
n_ins: u32;
|
|
289
|
+
n_outs: u32;
|
|
290
|
+
public_n_inputs: u32;
|
|
291
|
+
public_n_outputs: u32;
|
|
292
|
+
n_audit_slots: u32;
|
|
293
|
+
note_audit_len: u32;
|
|
294
|
+
audit_offset: u32;
|
|
295
|
+
note_output_len: u32;
|
|
296
|
+
output_note_offset: u32;
|
|
297
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
245
298
|
/**
|
|
246
|
-
* Construct and simulate a
|
|
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.
|
|
300
|
+
* Reads a registered ZK config (extending its persistent TTL), or `None` if absent.
|
|
247
301
|
*/
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<
|
|
302
|
+
get_zk_config: ({ nonce }: {
|
|
303
|
+
nonce: u64;
|
|
304
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<ZkConfig>>>;
|
|
251
305
|
/**
|
|
252
|
-
* Construct and simulate a
|
|
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.
|
|
253
309
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
310
|
+
is_known_root: ({ root }: {
|
|
311
|
+
root: Buffer;
|
|
312
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
258
313
|
/**
|
|
259
|
-
* Construct and simulate a
|
|
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.
|
|
321
|
+
*
|
|
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.
|
|
260
327
|
*/
|
|
261
|
-
|
|
328
|
+
get_commitments: (options?: MethodOptions) => Promise<AssembledTransaction<Array<Buffer>>>;
|
|
262
329
|
/**
|
|
263
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.
|
|
264
331
|
* Gets the current merkle root of the commitment tree.
|
|
265
332
|
*/
|
|
266
333
|
get_merkle_root: (options?: MethodOptions) => Promise<AssembledTransaction<Buffer>>;
|
|
334
|
+
/**
|
|
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.
|
|
336
|
+
*/
|
|
337
|
+
get_kyt_registry: (options?: MethodOptions) => Promise<AssembledTransaction<Option<string>>>;
|
|
267
338
|
/**
|
|
268
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.
|
|
269
340
|
* Gets the current depth of the merkle tree
|
|
270
341
|
*/
|
|
271
342
|
get_merkle_depth: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
|
|
272
343
|
/**
|
|
273
|
-
* Construct and simulate a
|
|
274
|
-
* Gets the number of commitments (leaves) in the merkle tree
|
|
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.
|
|
275
345
|
*/
|
|
276
|
-
|
|
346
|
+
set_kyt_registry: ({ kyt_registry }: {
|
|
347
|
+
kyt_registry: string;
|
|
348
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<null>>;
|
|
349
|
+
/**
|
|
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...`).
|
|
352
|
+
*/
|
|
353
|
+
get_token_balance: ({ token }: {
|
|
354
|
+
token: string;
|
|
355
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
277
356
|
/**
|
|
278
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.
|
|
279
358
|
* Ephemeral key (x, y) for a leaf index, if present.
|
|
@@ -282,57 +361,50 @@ export interface Client {
|
|
|
282
361
|
leaf_index: u32;
|
|
283
362
|
}, options?: MethodOptions) => Promise<AssembledTransaction<Option<EphemeralKeyCoords>>>;
|
|
284
363
|
/**
|
|
285
|
-
* Construct and simulate a
|
|
286
|
-
*
|
|
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.
|
|
287
367
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
* Gets all commitments (leaves) in the merkle tree
|
|
292
|
-
*/
|
|
293
|
-
get_commitments: (options?: MethodOptions) => Promise<AssembledTransaction<Array<Buffer>>>;
|
|
368
|
+
deprecate_zk_config: ({ nonce }: {
|
|
369
|
+
nonce: u64;
|
|
370
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
294
371
|
/**
|
|
295
|
-
* Construct and simulate a
|
|
296
|
-
* Returns true if the given nullifier hash has already been consumed (used in a withdrawal).
|
|
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.
|
|
297
373
|
*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<
|
|
374
|
+
require_kyt_passage: ({ passage_id }: {
|
|
375
|
+
passage_id: Buffer;
|
|
376
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<Result<void>>>;
|
|
301
377
|
/**
|
|
302
|
-
* Construct and simulate a
|
|
303
|
-
*
|
|
304
|
-
* All-zero bytes are never accepted.
|
|
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.
|
|
379
|
+
* Gets the number of commitments (leaves) in the merkle tree
|
|
305
380
|
*/
|
|
306
|
-
|
|
307
|
-
root: Buffer;
|
|
308
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
381
|
+
get_commitment_count: (options?: MethodOptions) => Promise<AssembledTransaction<u32>>;
|
|
309
382
|
/**
|
|
310
|
-
* Construct and simulate a
|
|
311
|
-
*
|
|
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.
|
|
384
|
+
* Filled-subtree frontier after the last pairwise insert (reload on the next deposit).
|
|
312
385
|
*/
|
|
313
|
-
|
|
314
|
-
token: string;
|
|
315
|
-
}, options?: MethodOptions) => Promise<AssembledTransaction<i128>>;
|
|
386
|
+
get_pairwise_frontier: (options?: MethodOptions) => Promise<AssembledTransaction<Array<Buffer>>>;
|
|
316
387
|
/**
|
|
317
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.
|
|
318
|
-
* `publicNInputs` / `publicNOutputs`
|
|
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.
|
|
319
392
|
*/
|
|
320
393
|
get_public_slot_config: (options?: MethodOptions) => Promise<AssembledTransaction<readonly [u32, u32]>>;
|
|
321
394
|
/**
|
|
322
|
-
* Construct and simulate a
|
|
323
|
-
*
|
|
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.
|
|
396
|
+
* Returns true if the given nullifier hash has already been consumed (used in a withdrawal).
|
|
324
397
|
*/
|
|
325
|
-
|
|
398
|
+
is_nulifier_hash_consumed: ({ hash }: {
|
|
399
|
+
hash: Buffer;
|
|
400
|
+
}, options?: MethodOptions) => Promise<AssembledTransaction<boolean>>;
|
|
326
401
|
}
|
|
327
402
|
export declare class Client extends ContractClient {
|
|
328
403
|
readonly options: ContractClientOptions;
|
|
329
404
|
static deploy<T = Client>(
|
|
330
405
|
/** Constructor/Initialization Args for the contract's `__constructor` method */
|
|
331
|
-
{ tree_depth,
|
|
406
|
+
{ tree_depth, admin }: {
|
|
332
407
|
tree_depth: u32;
|
|
333
|
-
vk_bytes: Buffer;
|
|
334
|
-
public_n_inputs: u32;
|
|
335
|
-
public_n_outputs: u32;
|
|
336
408
|
admin: string;
|
|
337
409
|
},
|
|
338
410
|
/** Options for initializing a Client as well as for calling a method, with extras specific to deploying. */
|
|
@@ -347,23 +419,24 @@ export declare class Client extends ContractClient {
|
|
|
347
419
|
constructor(options: ContractClientOptions);
|
|
348
420
|
readonly fromJSON: {
|
|
349
421
|
transact: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
350
|
-
|
|
351
|
-
get_kyt_registry: (json: string) => AssembledTransaction<Option<string>>;
|
|
352
|
-
require_kyt_passage: (json: string) => AssembledTransaction<Result<void, import("@stellar/stellar-sdk/contract").ErrorMessage>>;
|
|
353
|
-
set_app_audit_key: (json: string) => AssembledTransaction<null>;
|
|
354
|
-
get_app_audit_state: (json: string) => AssembledTransaction<Option<AppAuditState>>;
|
|
355
|
-
set_registry: (json: string) => AssembledTransaction<null>;
|
|
422
|
+
get_admin: (json: string) => AssembledTransaction<string>;
|
|
356
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>[]>;
|
|
357
429
|
get_merkle_root: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>>;
|
|
430
|
+
get_kyt_registry: (json: string) => AssembledTransaction<Option<string>>;
|
|
358
431
|
get_merkle_depth: (json: string) => AssembledTransaction<number>;
|
|
359
|
-
|
|
432
|
+
set_kyt_registry: (json: string) => AssembledTransaction<null>;
|
|
433
|
+
get_token_balance: (json: string) => AssembledTransaction<bigint>;
|
|
360
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>;
|
|
361
438
|
get_pairwise_frontier: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>[]>;
|
|
362
|
-
get_commitments: (json: string) => AssembledTransaction<Buffer<ArrayBufferLike>[]>;
|
|
363
|
-
is_nulifier_hash_consumed: (json: string) => AssembledTransaction<boolean>;
|
|
364
|
-
is_known_root: (json: string) => AssembledTransaction<boolean>;
|
|
365
|
-
get_token_balance: (json: string) => AssembledTransaction<bigint>;
|
|
366
439
|
get_public_slot_config: (json: string) => AssembledTransaction<readonly [number, number]>;
|
|
367
|
-
|
|
440
|
+
is_nulifier_hash_consumed: (json: string) => AssembledTransaction<boolean>;
|
|
368
441
|
};
|
|
369
442
|
}
|