@audren-xyz/sdk 0.0.0-stage → 1.3.0
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/LICENSE +202 -0
- package/README.md +102 -2
- package/dist/constants.d.ts +229 -0
- package/dist/constants.js +301 -0
- package/dist/crypto.d.ts +85 -0
- package/dist/crypto.js +520 -0
- package/dist/idl.d.ts +4291 -0
- package/dist/idl.js +5608 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/instructions.d.ts +398 -0
- package/dist/instructions.js +1139 -0
- package/dist/keys.d.ts +67 -0
- package/dist/keys.js +194 -0
- package/dist/layout.d.ts +153 -0
- package/dist/layout.js +535 -0
- package/dist/pda.d.ts +65 -0
- package/dist/pda.js +508 -0
- package/dist/poseidon-constants.d.ts +13 -0
- package/dist/poseidon-constants.js +1401 -0
- package/dist/poseidon.d.ts +46 -0
- package/dist/poseidon.js +214 -0
- package/dist/prover-entry.d.ts +1 -0
- package/dist/prover-entry.js +1 -0
- package/dist/prover.d.ts +100 -0
- package/dist/prover.js +515 -0
- package/dist/relayer.d.ts +336 -0
- package/dist/relayer.js +258 -0
- package/dist/scanner.d.ts +262 -0
- package/dist/scanner.js +3119 -0
- package/dist/store.d.ts +186 -0
- package/dist/store.js +1403 -0
- package/dist/swap.d.ts +105 -0
- package/dist/swap.js +156 -0
- package/dist/token2022.d.ts +29 -0
- package/dist/token2022.js +168 -0
- package/dist/tx-v1.d.ts +63 -0
- package/dist/tx-v1.js +249 -0
- package/idl/audren.anchor.json +1750 -0
- package/idl/audren.codama.json +3856 -0
- package/package.json +76 -4
- package/wasm/audren_circuits.wasm +0 -0
- package/wasm/audren_joinsplit.pk +0 -0
package/dist/layout.js
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-copy Audren account decoders matching `crates/audren-core/src/layout.rs` byte-for-byte.
|
|
3
|
+
*/
|
|
4
|
+
import { EPOCH_RING_LEN, LANE_DEPTH_4ARY, LANE_MAGIC, LANE_STATE_LEN, LN_OFF_BUMP, LN_OFF_CURRENT_ROOT, LN_OFF_LANE_ID, LN_OFF_NEXT_LEAF, LN_OFF_NF_COUNT, LN_OFF_POOL_ID, LN_OFF_RENT_BUMP, LN_OFF_VERSION, MAX_ROOT_EPOCH_INTERVAL, MEMO_CT_LEN, MEMO_MAGIC, MEMO_NOTES_PER_PAGE, MEMO_PAGE_HEADER_LEN, MEMO_PAGE_LEN, MEMO_PAGE_SCAN_SLICE_LEN, MM_OFF_BUMP, MM_OFF_CIPHERTEXTS, MM_OFF_CLOSED_SLOT, MM_OFF_COUNT, MM_OFF_CREATED_SLOT, MM_OFF_EPHEMERAL_PKS, MM_OFF_LANE_ID, MM_OFF_PAGE_SEQ, MM_OFF_POOL_ID, MM_OFF_VIEW_TAGS, NF_OFF_BUMP, NF_OFF_CLOSED_SLOT, NF_OFF_COUNT, NF_OFF_CREATED_SLOT, NF_OFF_LANE_ID, NF_OFF_PAGE_SEQ, NF_OFF_POOL_ID, NF_OFF_PREFIXES, NF_PAGE_HEADER_LEN, NF_PAGE_LEN, NF_PAGE_MAGIC, NF_PER_PAGE, NF_PREFIX_LEN, NUM_LANES, PL_OFF_ACTIVE_LANES, PL_OFF_AUTHORITY, PL_OFF_BUMP, PL_OFF_NF_RENT_FEE, PL_OFF_NOTE_RENT_FEE, PL_OFF_PAUSED, PL_OFF_PENDING_AUTHORITY, PL_OFF_POOL_ID, PL_OFF_ROOT_EPOCH_INTERVAL, PL_OFF_VAULT_AUTH_BUMP, PL_OFF_VERSION, POOL_MAGIC, POOL_STATE_LEN, PROTOCOL_VERSION, ROOTS_MAGIC, ROOT_ENTRY_LEN, ROOT_HISTORY_LEN, ROOT_RING_EPOCH, ROOT_RING_SLOT, RT_OFF_BUMP, RT_OFF_EPOCH_COUNT, RT_OFF_EPOCH_CURSOR, RT_OFF_EPOCH_INTERVAL, RT_OFF_EPOCH_RING, RT_OFF_GROUP_ROOTS, RT_OFF_LATEST_LANE_COUNTS, RT_OFF_LATEST_LANE_ROOTS, RT_OFF_LATEST_SLOT, RT_OFF_LATEST_SUPER_ROOT, RT_OFF_POOL_ID, RT_OFF_SAME_SLOT_BUMPED, RT_OFF_SLOT_COUNT, RT_OFF_SLOT_CURSOR, RT_OFF_SLOT_RING, RT_OFF_STABLE_EPOCH_ID, RT_OFF_STABLE_LANE_COUNTS, RT_OFF_STABLE_LANE_ROOTS, RT_OFF_STABLE_SLOT, RT_OFF_STABLE_SUPER_ROOT, RT_OFF_VERSION, SB_OFF_BUMP, SB_OFF_COUNT, SB_OFF_LANE_ID, SB_OFF_LEAVES, SB_OFF_PAGE_SEQ, SB_OFF_POOL_ID, SLOT_RING_LEN, SR_OFF_BUMP, SR_OFF_COUNT, SR_OFF_LANE_ID, SR_OFF_POOL_ID, SR_OFF_ROOTS, SR_OFF_ROOT_PAGE_SEQ, SUBROOTS_PER_PAGE, SUBROOT_MAGIC, SUBROOT_PAGE_LEN, SUBTREE_LEAVES, SUBTREE_MAGIC, SUBTREE_PAGE_LEN, ZERO_HASHES_4ARY, } from './constants.js';
|
|
5
|
+
import { base58Encode } from './pda.js';
|
|
6
|
+
/** Maximum note commitments per lane (`4^18 = 2^36 = 68,719,476,736`). */
|
|
7
|
+
export const MAX_LEAVES_PER_LANE = 1n << 36n;
|
|
8
|
+
const U64_MAX = 0xffffffffffffffffn;
|
|
9
|
+
function bigintToBe32(x) {
|
|
10
|
+
const out = new Uint8Array(32);
|
|
11
|
+
let v = x;
|
|
12
|
+
for (let i = 31; i >= 0; i--) {
|
|
13
|
+
out[i] = Number(v & 0xffn);
|
|
14
|
+
v >>= 8n;
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
const ZERO_LANE_ROOT_BE = bigintToBe32(ZERO_HASHES_4ARY[LANE_DEPTH_4ARY]);
|
|
19
|
+
const asciiDecoder = new TextDecoder('ascii');
|
|
20
|
+
function checkMagic(data, expected) {
|
|
21
|
+
if (!(data instanceof Uint8Array) || data.byteLength < 8)
|
|
22
|
+
return false;
|
|
23
|
+
return asciiDecoder.decode(data.subarray(0, 8)) === expected;
|
|
24
|
+
}
|
|
25
|
+
export function decodePoolState(data) {
|
|
26
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== POOL_STATE_LEN || !checkMagic(data, POOL_MAGIC)) {
|
|
27
|
+
throw new Error(`Invalid PoolState account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
28
|
+
}
|
|
29
|
+
const version = data[PL_OFF_VERSION];
|
|
30
|
+
if (version !== PROTOCOL_VERSION) {
|
|
31
|
+
throw new Error(`Invalid PoolState version=${version} (expected ${PROTOCOL_VERSION})`);
|
|
32
|
+
}
|
|
33
|
+
const pausedRaw = data[PL_OFF_PAUSED];
|
|
34
|
+
if (pausedRaw > 1) {
|
|
35
|
+
throw new Error(`Invalid PoolState paused=${pausedRaw} (expected 0 or 1)`);
|
|
36
|
+
}
|
|
37
|
+
const activeLanes = data[PL_OFF_ACTIVE_LANES];
|
|
38
|
+
if (activeLanes > NUM_LANES) {
|
|
39
|
+
throw new Error(`Invalid PoolState activeLanes=${activeLanes} (max ${NUM_LANES})`);
|
|
40
|
+
}
|
|
41
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
42
|
+
const rootEpochInterval = dv.getBigUint64(PL_OFF_ROOT_EPOCH_INTERVAL, true);
|
|
43
|
+
if (rootEpochInterval < 1n || rootEpochInterval > MAX_ROOT_EPOCH_INTERVAL) {
|
|
44
|
+
throw new Error(`Invalid PoolState rootEpochInterval=${rootEpochInterval} (expected 1..=${MAX_ROOT_EPOCH_INTERVAL})`);
|
|
45
|
+
}
|
|
46
|
+
const authorityBytes = data.slice(PL_OFF_AUTHORITY, PL_OFF_AUTHORITY + 32);
|
|
47
|
+
return {
|
|
48
|
+
version,
|
|
49
|
+
bump: data[PL_OFF_BUMP],
|
|
50
|
+
paused: pausedRaw !== 0,
|
|
51
|
+
activeLanes,
|
|
52
|
+
poolId: dv.getUint32(PL_OFF_POOL_ID, true),
|
|
53
|
+
rootEpochInterval,
|
|
54
|
+
authority: base58Encode(authorityBytes),
|
|
55
|
+
authorityBytes,
|
|
56
|
+
vaultAuthBump: data[PL_OFF_VAULT_AUTH_BUMP],
|
|
57
|
+
noteRentFee: dv.getBigUint64(PL_OFF_NOTE_RENT_FEE, true),
|
|
58
|
+
nfRentFee: dv.getBigUint64(PL_OFF_NF_RENT_FEE, true),
|
|
59
|
+
pendingAuthority: data.slice(PL_OFF_PENDING_AUTHORITY, PL_OFF_PENDING_AUTHORITY + 32),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function decodeLaneHeader(data) {
|
|
63
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== LANE_STATE_LEN || !checkMagic(data, LANE_MAGIC)) {
|
|
64
|
+
throw new Error(`Invalid LaneTreeState account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
65
|
+
}
|
|
66
|
+
const version = data[LN_OFF_VERSION];
|
|
67
|
+
if (version !== PROTOCOL_VERSION) {
|
|
68
|
+
throw new Error(`Invalid LaneTreeState version=${version} (expected ${PROTOCOL_VERSION})`);
|
|
69
|
+
}
|
|
70
|
+
const laneId = data[LN_OFF_LANE_ID];
|
|
71
|
+
if (laneId >= NUM_LANES) {
|
|
72
|
+
throw new Error(`Invalid LaneTreeState laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
73
|
+
}
|
|
74
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
75
|
+
const nextLeaf = dv.getBigUint64(LN_OFF_NEXT_LEAF, true);
|
|
76
|
+
if (nextLeaf > MAX_LEAVES_PER_LANE) {
|
|
77
|
+
throw new Error(`Invalid LaneTreeState nextLeaf=${nextLeaf} (max ${MAX_LEAVES_PER_LANE})`);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
version,
|
|
81
|
+
laneId,
|
|
82
|
+
bump: data[LN_OFF_BUMP],
|
|
83
|
+
rentBump: data[LN_OFF_RENT_BUMP],
|
|
84
|
+
poolId: dv.getUint32(LN_OFF_POOL_ID, true),
|
|
85
|
+
nextLeaf,
|
|
86
|
+
nfCount: dv.getBigUint64(LN_OFF_NF_COUNT, true),
|
|
87
|
+
currentRoot: data.slice(LN_OFF_CURRENT_ROOT, LN_OFF_CURRENT_ROOT + 32),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function isAllZero32(b) {
|
|
91
|
+
if (!(b instanceof Uint8Array) || b.byteLength !== 32)
|
|
92
|
+
return true;
|
|
93
|
+
for (let i = 0; i < 32; i++)
|
|
94
|
+
if (b[i] !== 0)
|
|
95
|
+
return false;
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
function bytesEqual32(a, b) {
|
|
99
|
+
if (!(a instanceof Uint8Array) || !(b instanceof Uint8Array))
|
|
100
|
+
return false;
|
|
101
|
+
if (a.byteLength !== 32 || b.byteLength !== 32)
|
|
102
|
+
return false;
|
|
103
|
+
for (let i = 0; i < 32; i++)
|
|
104
|
+
if (a[i] !== b[i])
|
|
105
|
+
return false;
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
export function decodeSlotRingEntry(data, idx) {
|
|
109
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== ROOT_HISTORY_LEN || !checkMagic(data, ROOTS_MAGIC)) {
|
|
110
|
+
throw new Error(`Invalid GlobalRootHistory account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
111
|
+
}
|
|
112
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= SLOT_RING_LEN) {
|
|
113
|
+
throw new RangeError(`Invalid slotRing index=${idx} (max ${SLOT_RING_LEN - 1})`);
|
|
114
|
+
}
|
|
115
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
116
|
+
const off = RT_OFF_SLOT_RING + idx * ROOT_ENTRY_LEN;
|
|
117
|
+
return {
|
|
118
|
+
superRoot: data.slice(off, off + 32),
|
|
119
|
+
slot: dv.getBigUint64(off + 32, true),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export function decodeEpochRingEntry(data, idx) {
|
|
123
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== ROOT_HISTORY_LEN || !checkMagic(data, ROOTS_MAGIC)) {
|
|
124
|
+
throw new Error(`Invalid GlobalRootHistory account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
125
|
+
}
|
|
126
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= EPOCH_RING_LEN) {
|
|
127
|
+
throw new RangeError(`Invalid epochRing index=${idx} (max ${EPOCH_RING_LEN - 1})`);
|
|
128
|
+
}
|
|
129
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
130
|
+
const off = RT_OFF_EPOCH_RING + idx * ROOT_ENTRY_LEN;
|
|
131
|
+
return {
|
|
132
|
+
superRoot: data.slice(off, off + 32),
|
|
133
|
+
slot: dv.getBigUint64(off + 32, true),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export function decodeGlobalRootHistory(data) {
|
|
137
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== ROOT_HISTORY_LEN || !checkMagic(data, ROOTS_MAGIC)) {
|
|
138
|
+
throw new Error(`Invalid GlobalRootHistory account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
139
|
+
}
|
|
140
|
+
const version = data[RT_OFF_VERSION];
|
|
141
|
+
if (version !== PROTOCOL_VERSION) {
|
|
142
|
+
throw new Error(`Invalid GlobalRootHistory version=${version} (expected ${PROTOCOL_VERSION})`);
|
|
143
|
+
}
|
|
144
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
145
|
+
const slotCursor = dv.getUint16(RT_OFF_SLOT_CURSOR, true);
|
|
146
|
+
const epochCursor = dv.getUint16(RT_OFF_EPOCH_CURSOR, true);
|
|
147
|
+
const slotCount = dv.getUint16(RT_OFF_SLOT_COUNT, true);
|
|
148
|
+
const epochCount = dv.getUint16(RT_OFF_EPOCH_COUNT, true);
|
|
149
|
+
const sameSlotBumpedRaw = data[RT_OFF_SAME_SLOT_BUMPED];
|
|
150
|
+
const epochInterval = dv.getBigUint64(RT_OFF_EPOCH_INTERVAL, true);
|
|
151
|
+
if (slotCount < 1 || slotCount > SLOT_RING_LEN) {
|
|
152
|
+
throw new Error(`Invalid GlobalRootHistory slotCount=${slotCount} (expected 1..=${SLOT_RING_LEN})`);
|
|
153
|
+
}
|
|
154
|
+
if (slotCursor >= slotCount) {
|
|
155
|
+
throw new Error(`Invalid GlobalRootHistory slotCursor=${slotCursor} >= slotCount=${slotCount}`);
|
|
156
|
+
}
|
|
157
|
+
if (epochCount < 1 || epochCount > EPOCH_RING_LEN) {
|
|
158
|
+
throw new Error(`Invalid GlobalRootHistory epochCount=${epochCount} (expected 1..=${EPOCH_RING_LEN})`);
|
|
159
|
+
}
|
|
160
|
+
if (epochCursor >= epochCount) {
|
|
161
|
+
throw new Error(`Invalid GlobalRootHistory epochCursor=${epochCursor} >= epochCount=${epochCount}`);
|
|
162
|
+
}
|
|
163
|
+
if (sameSlotBumpedRaw > 1) {
|
|
164
|
+
throw new Error(`Invalid GlobalRootHistory sameSlotBumped=${sameSlotBumpedRaw} (max 1)`);
|
|
165
|
+
}
|
|
166
|
+
if (epochInterval < 1n || epochInterval > MAX_ROOT_EPOCH_INTERVAL) {
|
|
167
|
+
throw new Error(`Invalid GlobalRootHistory epochInterval=${epochInterval} (expected 1..=${MAX_ROOT_EPOCH_INTERVAL})`);
|
|
168
|
+
}
|
|
169
|
+
const groupRoots = [];
|
|
170
|
+
for (let g = 0; g < 4; g++) {
|
|
171
|
+
groupRoots.push(data.slice(RT_OFF_GROUP_ROOTS + g * 32, RT_OFF_GROUP_ROOTS + (g + 1) * 32));
|
|
172
|
+
}
|
|
173
|
+
const latestLaneRoots = [];
|
|
174
|
+
const latestLaneCounts = [];
|
|
175
|
+
const stableLaneRoots = [];
|
|
176
|
+
const stableLaneCounts = [];
|
|
177
|
+
for (let i = 0; i < NUM_LANES; i++) {
|
|
178
|
+
latestLaneRoots.push(data.slice(RT_OFF_LATEST_LANE_ROOTS + i * 32, RT_OFF_LATEST_LANE_ROOTS + (i + 1) * 32));
|
|
179
|
+
const lc = dv.getBigUint64(RT_OFF_LATEST_LANE_COUNTS + i * 8, true);
|
|
180
|
+
if (lc > MAX_LEAVES_PER_LANE) {
|
|
181
|
+
throw new Error(`Invalid GlobalRootHistory latestLaneCounts[${i}]=${lc} (max ${MAX_LEAVES_PER_LANE})`);
|
|
182
|
+
}
|
|
183
|
+
latestLaneCounts.push(lc);
|
|
184
|
+
stableLaneRoots.push(data.slice(RT_OFF_STABLE_LANE_ROOTS + i * 32, RT_OFF_STABLE_LANE_ROOTS + (i + 1) * 32));
|
|
185
|
+
const sc = dv.getBigUint64(RT_OFF_STABLE_LANE_COUNTS + i * 8, true);
|
|
186
|
+
if (sc > MAX_LEAVES_PER_LANE) {
|
|
187
|
+
throw new Error(`Invalid GlobalRootHistory stableLaneCounts[${i}]=${sc} (max ${MAX_LEAVES_PER_LANE})`);
|
|
188
|
+
}
|
|
189
|
+
stableLaneCounts.push(sc);
|
|
190
|
+
}
|
|
191
|
+
const slotRing = [];
|
|
192
|
+
for (let s = 0; s < SLOT_RING_LEN; s++) {
|
|
193
|
+
const off = RT_OFF_SLOT_RING + s * ROOT_ENTRY_LEN;
|
|
194
|
+
slotRing.push({
|
|
195
|
+
superRoot: data.slice(off, off + 32),
|
|
196
|
+
slot: dv.getBigUint64(off + 32, true),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const epochRing = [];
|
|
200
|
+
for (let e = 0; e < EPOCH_RING_LEN; e++) {
|
|
201
|
+
const off = RT_OFF_EPOCH_RING + e * ROOT_ENTRY_LEN;
|
|
202
|
+
epochRing.push({
|
|
203
|
+
superRoot: data.slice(off, off + 32),
|
|
204
|
+
slot: dv.getBigUint64(off + 32, true),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
version: data[RT_OFF_VERSION],
|
|
209
|
+
bump: data[RT_OFF_BUMP],
|
|
210
|
+
slotCursor,
|
|
211
|
+
poolId: dv.getUint32(RT_OFF_POOL_ID, true),
|
|
212
|
+
epochCursor,
|
|
213
|
+
slotCount,
|
|
214
|
+
epochCount,
|
|
215
|
+
sameSlotBumped: sameSlotBumpedRaw !== 0,
|
|
216
|
+
latestSlot: dv.getBigUint64(RT_OFF_LATEST_SLOT, true),
|
|
217
|
+
stableEpochId: dv.getBigUint64(RT_OFF_STABLE_EPOCH_ID, true),
|
|
218
|
+
stableSlot: dv.getBigUint64(RT_OFF_STABLE_SLOT, true),
|
|
219
|
+
epochInterval,
|
|
220
|
+
groupRoots,
|
|
221
|
+
latestSuperRoot: data.slice(RT_OFF_LATEST_SUPER_ROOT, RT_OFF_LATEST_SUPER_ROOT + 32),
|
|
222
|
+
latestLaneRoots,
|
|
223
|
+
latestLaneCounts,
|
|
224
|
+
stableSuperRoot: data.slice(RT_OFF_STABLE_SUPER_ROOT, RT_OFF_STABLE_SUPER_ROOT + 32),
|
|
225
|
+
stableLaneRoots,
|
|
226
|
+
stableLaneCounts,
|
|
227
|
+
slotRing,
|
|
228
|
+
epochRing,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Select the best witness snapshot from `GlobalRootHistory` covering every `(laneId, leafIndex)`
|
|
233
|
+
* note to spend.
|
|
234
|
+
*
|
|
235
|
+
* Prefers the long-lived `stable` epoch snapshot (`ROOT_RING_EPOCH = 1`) whenever ALL notes are
|
|
236
|
+
* covered by `stableLaneCounts` (maximizing shared anonymity set & proving stability), and falls
|
|
237
|
+
* back to `latest` (`ROOT_RING_SLOT = 0`) when ANY note is newer than `stableLaneCounts` for
|
|
238
|
+
* instant 0-slot spendability.
|
|
239
|
+
*/
|
|
240
|
+
export function selectRootSnapshotForNotes(history, notes) {
|
|
241
|
+
if (!history || typeof history !== 'object' || !Array.isArray(notes)) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
for (const n of notes) {
|
|
245
|
+
if (!n ||
|
|
246
|
+
typeof n !== 'object' ||
|
|
247
|
+
!Number.isInteger(n.laneId) ||
|
|
248
|
+
n.laneId < 0 ||
|
|
249
|
+
n.laneId >= NUM_LANES ||
|
|
250
|
+
typeof n.leafIndex !== 'bigint' ||
|
|
251
|
+
n.leafIndex < 0n) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (!Number.isInteger(history.epochCount) ||
|
|
256
|
+
history.epochCount < 1 ||
|
|
257
|
+
history.epochCount > EPOCH_RING_LEN ||
|
|
258
|
+
!Number.isInteger(history.epochCursor) ||
|
|
259
|
+
history.epochCursor < 0 ||
|
|
260
|
+
history.epochCursor >= history.epochCount ||
|
|
261
|
+
!Number.isInteger(history.slotCount) ||
|
|
262
|
+
history.slotCount < 1 ||
|
|
263
|
+
history.slotCount > SLOT_RING_LEN ||
|
|
264
|
+
!Number.isInteger(history.slotCursor) ||
|
|
265
|
+
history.slotCursor < 0 ||
|
|
266
|
+
history.slotCursor >= history.slotCount ||
|
|
267
|
+
!Array.isArray(history.epochRing) ||
|
|
268
|
+
history.epochRing.length < history.epochCount ||
|
|
269
|
+
!Array.isArray(history.slotRing) ||
|
|
270
|
+
history.slotRing.length < history.slotCount) {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
if (!(history.stableSuperRoot instanceof Uint8Array) ||
|
|
274
|
+
history.stableSuperRoot.byteLength !== 32 ||
|
|
275
|
+
isAllZero32(history.stableSuperRoot) ||
|
|
276
|
+
!(history.latestSuperRoot instanceof Uint8Array) ||
|
|
277
|
+
history.latestSuperRoot.byteLength !== 32 ||
|
|
278
|
+
isAllZero32(history.latestSuperRoot) ||
|
|
279
|
+
typeof history.stableSlot !== 'bigint' ||
|
|
280
|
+
history.stableSlot < 0n ||
|
|
281
|
+
typeof history.latestSlot !== 'bigint' ||
|
|
282
|
+
history.latestSlot < 0n ||
|
|
283
|
+
history.latestSlot > U64_MAX ||
|
|
284
|
+
history.stableSlot > history.latestSlot) {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
const stableEntry = history.epochRing[history.epochCursor];
|
|
288
|
+
const latestEntry = history.slotRing[history.slotCursor];
|
|
289
|
+
if (!stableEntry ||
|
|
290
|
+
typeof stableEntry !== 'object' ||
|
|
291
|
+
!bytesEqual32(stableEntry.superRoot, history.stableSuperRoot) ||
|
|
292
|
+
typeof stableEntry.slot !== 'bigint' ||
|
|
293
|
+
stableEntry.slot !== history.stableSlot ||
|
|
294
|
+
!latestEntry ||
|
|
295
|
+
typeof latestEntry !== 'object' ||
|
|
296
|
+
!bytesEqual32(latestEntry.superRoot, history.latestSuperRoot) ||
|
|
297
|
+
typeof latestEntry.slot !== 'bigint' ||
|
|
298
|
+
latestEntry.slot !== history.latestSlot) {
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
if (!Array.isArray(history.stableLaneCounts) ||
|
|
302
|
+
history.stableLaneCounts.length !== NUM_LANES ||
|
|
303
|
+
!Array.isArray(history.latestLaneCounts) ||
|
|
304
|
+
history.latestLaneCounts.length !== NUM_LANES ||
|
|
305
|
+
!Array.isArray(history.stableLaneRoots) ||
|
|
306
|
+
history.stableLaneRoots.length !== NUM_LANES ||
|
|
307
|
+
!Array.isArray(history.latestLaneRoots) ||
|
|
308
|
+
history.latestLaneRoots.length !== NUM_LANES) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
for (let l = 0; l < NUM_LANES; l++) {
|
|
312
|
+
const sc = history.stableLaneCounts[l];
|
|
313
|
+
const lc = history.latestLaneCounts[l];
|
|
314
|
+
const sr = history.stableLaneRoots[l];
|
|
315
|
+
const lr = history.latestLaneRoots[l];
|
|
316
|
+
if (typeof sc !== 'bigint' ||
|
|
317
|
+
sc < 0n ||
|
|
318
|
+
typeof lc !== 'bigint' ||
|
|
319
|
+
lc < 0n ||
|
|
320
|
+
lc > MAX_LEAVES_PER_LANE ||
|
|
321
|
+
sc > lc ||
|
|
322
|
+
!(sr instanceof Uint8Array) ||
|
|
323
|
+
sr.byteLength !== 32 ||
|
|
324
|
+
!(lr instanceof Uint8Array) ||
|
|
325
|
+
lr.byteLength !== 32) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
if ((lc === 0n) !== bytesEqual32(lr, ZERO_LANE_ROOT_BE)) {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
if ((sc === 0n) !== bytesEqual32(sr, ZERO_LANE_ROOT_BE)) {
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
if ((sc === lc) !== bytesEqual32(sr, lr)) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (notes.every((n) => n.leafIndex < history.stableLaneCounts[n.laneId])) {
|
|
339
|
+
return {
|
|
340
|
+
ringKind: ROOT_RING_EPOCH,
|
|
341
|
+
ringIdx: history.epochCursor,
|
|
342
|
+
slot: history.stableSlot,
|
|
343
|
+
superRoot: new Uint8Array(history.stableSuperRoot),
|
|
344
|
+
laneRoots: history.stableLaneRoots.map((r) => new Uint8Array(r)),
|
|
345
|
+
laneCounts: [...history.stableLaneCounts],
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
if (notes.every((n) => n.leafIndex < history.latestLaneCounts[n.laneId])) {
|
|
349
|
+
return {
|
|
350
|
+
ringKind: ROOT_RING_SLOT,
|
|
351
|
+
ringIdx: history.slotCursor,
|
|
352
|
+
slot: history.latestSlot,
|
|
353
|
+
superRoot: new Uint8Array(history.latestSuperRoot),
|
|
354
|
+
laneRoots: history.latestLaneRoots.map((r) => new Uint8Array(r)),
|
|
355
|
+
laneCounts: [...history.latestLaneCounts],
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
export function decodeSubtreePage(data) {
|
|
361
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== SUBTREE_PAGE_LEN || !checkMagic(data, SUBTREE_MAGIC)) {
|
|
362
|
+
throw new Error(`Invalid SubtreePage account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
363
|
+
}
|
|
364
|
+
const laneId = data[SB_OFF_LANE_ID];
|
|
365
|
+
if (laneId >= NUM_LANES) {
|
|
366
|
+
throw new Error(`Invalid SubtreePage laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
367
|
+
}
|
|
368
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
369
|
+
const count = dv.getUint16(SB_OFF_COUNT, true);
|
|
370
|
+
if (count > SUBTREE_LEAVES) {
|
|
371
|
+
throw new Error(`Invalid SubtreePage count=${count} (max ${SUBTREE_LEAVES})`);
|
|
372
|
+
}
|
|
373
|
+
const leaves = [];
|
|
374
|
+
for (let i = 0; i < count; i++) {
|
|
375
|
+
leaves.push(data.slice(SB_OFF_LEAVES + i * 32, SB_OFF_LEAVES + (i + 1) * 32));
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
laneId,
|
|
379
|
+
bump: data[SB_OFF_BUMP],
|
|
380
|
+
count,
|
|
381
|
+
poolId: dv.getUint32(SB_OFF_POOL_ID, true),
|
|
382
|
+
pageSeq: dv.getBigUint64(SB_OFF_PAGE_SEQ, true),
|
|
383
|
+
leaves,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
export function decodeSubtreeRootPage(data) {
|
|
387
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== SUBROOT_PAGE_LEN || !checkMagic(data, SUBROOT_MAGIC)) {
|
|
388
|
+
throw new Error(`Invalid SubtreeRootPage account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
389
|
+
}
|
|
390
|
+
const laneId = data[SR_OFF_LANE_ID];
|
|
391
|
+
if (laneId >= NUM_LANES) {
|
|
392
|
+
throw new Error(`Invalid SubtreeRootPage laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
393
|
+
}
|
|
394
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
395
|
+
const count = dv.getUint16(SR_OFF_COUNT, true);
|
|
396
|
+
if (count > SUBROOTS_PER_PAGE) {
|
|
397
|
+
throw new Error(`Invalid SubtreeRootPage count=${count} (max ${SUBROOTS_PER_PAGE})`);
|
|
398
|
+
}
|
|
399
|
+
const roots = [];
|
|
400
|
+
for (let i = 0; i < count; i++) {
|
|
401
|
+
roots.push(data.slice(SR_OFF_ROOTS + i * 32, SR_OFF_ROOTS + (i + 1) * 32));
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
laneId,
|
|
405
|
+
bump: data[SR_OFF_BUMP],
|
|
406
|
+
count,
|
|
407
|
+
poolId: dv.getUint32(SR_OFF_POOL_ID, true),
|
|
408
|
+
rootPageSeq: dv.getBigUint64(SR_OFF_ROOT_PAGE_SEQ, true),
|
|
409
|
+
roots,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
export function decodeMemoPage(data) {
|
|
413
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== MEMO_PAGE_LEN || !checkMagic(data, MEMO_MAGIC)) {
|
|
414
|
+
throw new Error(`Invalid MemoPage account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
415
|
+
}
|
|
416
|
+
const laneId = data[MM_OFF_LANE_ID];
|
|
417
|
+
if (laneId >= NUM_LANES) {
|
|
418
|
+
throw new Error(`Invalid MemoPage laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
419
|
+
}
|
|
420
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
421
|
+
const count = dv.getUint16(MM_OFF_COUNT, true);
|
|
422
|
+
if (count > MEMO_NOTES_PER_PAGE) {
|
|
423
|
+
throw new Error(`Invalid MemoPage count=${count} (max ${MEMO_NOTES_PER_PAGE})`);
|
|
424
|
+
}
|
|
425
|
+
const entries = [];
|
|
426
|
+
for (let i = 0; i < count; i++) {
|
|
427
|
+
entries.push({
|
|
428
|
+
viewTag: data.slice(MM_OFF_VIEW_TAGS + i * 2, MM_OFF_VIEW_TAGS + (i + 1) * 2),
|
|
429
|
+
ephemeralPk: data.slice(MM_OFF_EPHEMERAL_PKS + i * 32, MM_OFF_EPHEMERAL_PKS + (i + 1) * 32),
|
|
430
|
+
ciphertext: data.slice(MM_OFF_CIPHERTEXTS + i * MEMO_CT_LEN, MM_OFF_CIPHERTEXTS + (i + 1) * MEMO_CT_LEN),
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
return {
|
|
434
|
+
laneId,
|
|
435
|
+
bump: data[MM_OFF_BUMP],
|
|
436
|
+
count,
|
|
437
|
+
poolId: dv.getUint32(MM_OFF_POOL_ID, true),
|
|
438
|
+
pageSeq: dv.getBigUint64(MM_OFF_PAGE_SEQ, true),
|
|
439
|
+
createdSlot: dv.getBigUint64(MM_OFF_CREATED_SLOT, true),
|
|
440
|
+
closedSlot: dv.getBigUint64(MM_OFF_CLOSED_SLOT, true),
|
|
441
|
+
entries,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
export function decodeMemoPageHeader(data) {
|
|
445
|
+
if (!(data instanceof Uint8Array) || data.byteLength < MEMO_PAGE_HEADER_LEN || !checkMagic(data, MEMO_MAGIC)) {
|
|
446
|
+
throw new Error(`Invalid MemoPage header (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
447
|
+
}
|
|
448
|
+
const laneId = data[MM_OFF_LANE_ID];
|
|
449
|
+
if (laneId >= NUM_LANES) {
|
|
450
|
+
throw new Error(`Invalid MemoPage laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
451
|
+
}
|
|
452
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
453
|
+
const count = dv.getUint16(MM_OFF_COUNT, true);
|
|
454
|
+
if (count > MEMO_NOTES_PER_PAGE) {
|
|
455
|
+
throw new Error(`Invalid MemoPage count=${count} (max ${MEMO_NOTES_PER_PAGE})`);
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
laneId,
|
|
459
|
+
bump: data[MM_OFF_BUMP],
|
|
460
|
+
count,
|
|
461
|
+
poolId: dv.getUint32(MM_OFF_POOL_ID, true),
|
|
462
|
+
pageSeq: dv.getBigUint64(MM_OFF_PAGE_SEQ, true),
|
|
463
|
+
createdSlot: dv.getBigUint64(MM_OFF_CREATED_SLOT, true),
|
|
464
|
+
closedSlot: dv.getBigUint64(MM_OFF_CLOSED_SLOT, true),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
export function decodeMemoPageScanSlice(data) {
|
|
468
|
+
if (!(data instanceof Uint8Array) || data.byteLength < MEMO_PAGE_SCAN_SLICE_LEN || !checkMagic(data, MEMO_MAGIC)) {
|
|
469
|
+
throw new Error(`Invalid MemoPage scan slice (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
470
|
+
}
|
|
471
|
+
const hdr = decodeMemoPageHeader(data);
|
|
472
|
+
const viewTags = [];
|
|
473
|
+
const ephemeralPks = [];
|
|
474
|
+
for (let i = 0; i < hdr.count; i++) {
|
|
475
|
+
viewTags.push(data.subarray(MM_OFF_VIEW_TAGS + i * 2, MM_OFF_VIEW_TAGS + (i + 1) * 2));
|
|
476
|
+
ephemeralPks.push(data.subarray(MM_OFF_EPHEMERAL_PKS + i * 32, MM_OFF_EPHEMERAL_PKS + (i + 1) * 32));
|
|
477
|
+
}
|
|
478
|
+
return {
|
|
479
|
+
...hdr,
|
|
480
|
+
viewTags,
|
|
481
|
+
ephemeralPks,
|
|
482
|
+
hasCiphertexts: data.byteLength === MEMO_PAGE_LEN,
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
export function decodeNullifierPageHeader(data) {
|
|
486
|
+
if (!(data instanceof Uint8Array) || data.byteLength < NF_PAGE_HEADER_LEN || !checkMagic(data, NF_PAGE_MAGIC)) {
|
|
487
|
+
throw new Error(`Invalid NullifierPage header (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
488
|
+
}
|
|
489
|
+
const laneId = data[NF_OFF_LANE_ID];
|
|
490
|
+
if (laneId >= NUM_LANES) {
|
|
491
|
+
throw new Error(`Invalid NullifierPage laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
492
|
+
}
|
|
493
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
494
|
+
const count = dv.getUint16(NF_OFF_COUNT, true);
|
|
495
|
+
if (count > NF_PER_PAGE) {
|
|
496
|
+
throw new Error(`Invalid NullifierPage count=${count} (max ${NF_PER_PAGE})`);
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
laneId,
|
|
500
|
+
bump: data[NF_OFF_BUMP],
|
|
501
|
+
count,
|
|
502
|
+
poolId: dv.getUint32(NF_OFF_POOL_ID, true),
|
|
503
|
+
pageSeq: dv.getBigUint64(NF_OFF_PAGE_SEQ, true),
|
|
504
|
+
createdSlot: dv.getBigUint64(NF_OFF_CREATED_SLOT, true),
|
|
505
|
+
closedSlot: dv.getBigUint64(NF_OFF_CLOSED_SLOT, true),
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
export function decodeNullifierPage(data) {
|
|
509
|
+
if (!(data instanceof Uint8Array) || data.byteLength !== NF_PAGE_LEN || !checkMagic(data, NF_PAGE_MAGIC)) {
|
|
510
|
+
throw new Error(`Invalid NullifierPage account (len=${data instanceof Uint8Array ? data.byteLength : String(data)})`);
|
|
511
|
+
}
|
|
512
|
+
const laneId = data[NF_OFF_LANE_ID];
|
|
513
|
+
if (laneId >= NUM_LANES) {
|
|
514
|
+
throw new Error(`Invalid NullifierPage laneId=${laneId} (max ${NUM_LANES - 1})`);
|
|
515
|
+
}
|
|
516
|
+
const dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
517
|
+
const count = dv.getUint16(NF_OFF_COUNT, true);
|
|
518
|
+
if (count > NF_PER_PAGE) {
|
|
519
|
+
throw new Error(`Invalid NullifierPage count=${count} (max ${NF_PER_PAGE})`);
|
|
520
|
+
}
|
|
521
|
+
const prefixes = [];
|
|
522
|
+
for (let i = 0; i < count; i++) {
|
|
523
|
+
prefixes.push(data.slice(NF_OFF_PREFIXES + i * NF_PREFIX_LEN, NF_OFF_PREFIXES + (i + 1) * NF_PREFIX_LEN));
|
|
524
|
+
}
|
|
525
|
+
return {
|
|
526
|
+
laneId,
|
|
527
|
+
bump: data[NF_OFF_BUMP],
|
|
528
|
+
count,
|
|
529
|
+
poolId: dv.getUint32(NF_OFF_POOL_ID, true),
|
|
530
|
+
pageSeq: dv.getBigUint64(NF_OFF_PAGE_SEQ, true),
|
|
531
|
+
createdSlot: dv.getBigUint64(NF_OFF_CREATED_SLOT, true),
|
|
532
|
+
closedSlot: dv.getBigUint64(NF_OFF_CLOSED_SLOT, true),
|
|
533
|
+
prefixes,
|
|
534
|
+
};
|
|
535
|
+
}
|
package/dist/pda.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solana Base58 codec, BIP-350 Bech32m `aud1...` stealth address codec (HRP `"aud"`,
|
|
3
|
+
* version `0x01`, 65-byte payload, 114 chars), and canonical 12 Audren v1 PDA derivations
|
|
4
|
+
* (`audren_*`) matching `crates/client/src/pda.rs` byte-for-byte.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Verify an X25519 public key is contributory (rejects all-zero and Curve25519 order-8 low-order
|
|
8
|
+
* points using the fixed RFC 7748 probe scalar `[0x09; 32]`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function isContributoryX25519Point(viewPk: Uint8Array): boolean;
|
|
11
|
+
export interface DerivedPda {
|
|
12
|
+
address: string;
|
|
13
|
+
addressBytes: Uint8Array;
|
|
14
|
+
bump: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ParsedAudrenAddress {
|
|
17
|
+
encoded: string;
|
|
18
|
+
spendPk: Uint8Array;
|
|
19
|
+
viewPk: Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
export declare function base58Encode(bytes: Uint8Array): string;
|
|
22
|
+
export declare function base58Decode(input: string, maxLen?: number): Uint8Array;
|
|
23
|
+
export declare function toPubkeyBytes(pubkey: string | Uint8Array): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Encode `(spendPk[32], viewPk[32])` into a canonical BIP-350 Bech32m `aud1...` stealth address
|
|
26
|
+
* (`hrp = "aud"`, payload `0x01 || spend_pk[32] || view_pk[32]`, 114 lowercase characters).
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatAudrenAddress(spendPk: Uint8Array, viewPk: Uint8Array): string;
|
|
29
|
+
/**
|
|
30
|
+
* Strictly decode and validate a BIP-350 Bech32m `aud1...` stealth address.
|
|
31
|
+
* Rejects leading/trailing whitespace, mixed case, wrong HRP, invalid Bech32m checksum,
|
|
32
|
+
* non-zero pad bits, wrong payload length, wrong version byte (`!== 0x01`),
|
|
33
|
+
* non-canonical `spendPk >= r`, and non-contributory / low-order X25519 `viewPk`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseAudrenAddress(encoded: string): ParsedAudrenAddress;
|
|
36
|
+
export declare function isOnEd25519Curve(bytes: Uint8Array): boolean;
|
|
37
|
+
/** Synchronous Solana `Pubkey::find_program_address`. */
|
|
38
|
+
export declare function findProgramAddressSync(seeds: readonly Uint8Array[], programId?: string | Uint8Array): DerivedPda;
|
|
39
|
+
export declare function findProgramAddress(seeds: readonly Uint8Array[], programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
40
|
+
export declare function derivePoolPdaSync(poolId?: number, programId?: string | Uint8Array): DerivedPda;
|
|
41
|
+
export declare function derivePoolPda(poolId?: number, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
42
|
+
export declare function deriveVaultAuthPdaSync(poolId?: number, programId?: string | Uint8Array): DerivedPda;
|
|
43
|
+
export declare function deriveVaultAuthPda(poolId?: number, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
44
|
+
export declare function deriveLanePdaSync(poolId: number, laneId: number, programId?: string | Uint8Array): DerivedPda;
|
|
45
|
+
export declare function deriveLanePda(poolId: number, laneId: number, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
46
|
+
export declare function deriveLaneRentVaultPdaSync(poolId: number, laneId: number, programId?: string | Uint8Array): DerivedPda;
|
|
47
|
+
export declare function deriveLaneRentVaultPda(poolId: number, laneId: number, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
48
|
+
export declare function deriveSubtreePdaSync(poolId: number, laneId: number, pageSeq: bigint, programId?: string | Uint8Array): DerivedPda;
|
|
49
|
+
export declare function deriveSubtreePda(poolId: number, laneId: number, pageSeq: bigint, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
50
|
+
export declare function deriveSubrootPdaSync(poolId: number, laneId: number, rootPageSeq: bigint, programId?: string | Uint8Array): DerivedPda;
|
|
51
|
+
export declare function deriveSubrootPda(poolId: number, laneId: number, rootPageSeq: bigint, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
52
|
+
export declare function deriveMemoPdaSync(poolId: number, laneId: number, pageSeq: bigint, programId?: string | Uint8Array): DerivedPda;
|
|
53
|
+
export declare function deriveMemoPda(poolId: number, laneId: number, pageSeq: bigint, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
54
|
+
export declare function deriveNfPagePdaSync(poolId: number, laneId: number, pageSeq: bigint, programId?: string | Uint8Array): DerivedPda;
|
|
55
|
+
export declare function deriveNfPagePda(poolId: number, laneId: number, pageSeq: bigint, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
56
|
+
export declare function deriveRootsPdaSync(poolId?: number, programId?: string | Uint8Array): DerivedPda;
|
|
57
|
+
export declare function deriveRootsPda(poolId?: number, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
58
|
+
export declare function deriveNullifierPdaSync(poolId: number, nullifier: Uint8Array, programId?: string | Uint8Array): DerivedPda;
|
|
59
|
+
export declare function deriveNullifierPda(poolId: number, nullifier: Uint8Array, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
60
|
+
export declare function deriveEscrowPdaSync(poolId?: number, shardId?: number, programId?: string | Uint8Array): DerivedPda;
|
|
61
|
+
export declare function deriveEscrowPda(poolId?: number, shardId?: number, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
62
|
+
export declare function deriveUnwrapPdaSync(poolId: number, nf0: Uint8Array, programId?: string | Uint8Array): DerivedPda;
|
|
63
|
+
export declare function deriveUnwrapPda(poolId: number, nf0: Uint8Array, programId?: string | Uint8Array): Promise<DerivedPda>;
|
|
64
|
+
export declare function deriveAssociatedTokenAddressSync(owner: string | Uint8Array, mint: string | Uint8Array, tokenProgramId?: string | Uint8Array): DerivedPda;
|
|
65
|
+
export declare function deriveAssociatedTokenAddress(owner: string | Uint8Array, mint: string | Uint8Array, tokenProgramId?: string | Uint8Array): Promise<DerivedPda>;
|