@blockula/sdk 0.3.0 → 1.0.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/dist/tx.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export type KeyRole = {
2
2
  type: "owner";
3
3
  }
4
- /** Transfers only, at most `limit` drops (amount + fee) per `period_blocks`, until block `expires_at`. */
4
+ /** Transfers only, at most `limit` drops (amount + charged fee) per `period_blocks`, until block `expires_at`. */
5
5
  | {
6
6
  type: "session";
7
7
  limit: string;
@@ -15,11 +15,20 @@ export type Action = {
15
15
  } | {
16
16
  type: "register_name";
17
17
  name: string;
18
- } | {
18
+ }
19
+ /**
20
+ * Authorize a key on this account (owner keys only). The added key consents: `public_key` is its
21
+ * hex ML-DSA-65 public key (`key_id` is its BLAKE3) and `pop` its signature over
22
+ * `keyPopMessage(chain_id, genesis_hash, account, key_id)` with context `KEY_POP_CONTEXT`. Build
23
+ * it from a `KeyGrant` (`Wallet.keyGrant`, `addOwnerKey`, `addSessionKey`).
24
+ */
25
+ | {
19
26
  type: "add_key";
20
27
  key_id: string;
21
28
  label: string;
22
29
  role: KeyRole;
30
+ public_key: string;
31
+ pop: string;
23
32
  } | {
24
33
  type: "remove_key";
25
34
  key_id: string;
@@ -83,13 +92,430 @@ export type Action = {
83
92
  type: "register_familiar";
84
93
  key_id: string;
85
94
  label: string;
95
+ }
96
+ /** Season 0 admins: put a repo in the contribution pool (weight 1–100; 0 removes it). */
97
+ | {
98
+ type: "set_repo";
99
+ repo: string;
100
+ weight: number;
101
+ }
102
+ /** Season 0 admins: bootstrap Soul, in milli-Soul (≤ 100 Soul per grant). */
103
+ | {
104
+ type: "grant_soul";
105
+ to: string;
106
+ amount: number;
107
+ reason: string;
108
+ }
109
+ /** Stake 10 FANG on a newcomer `account` being a real, distinct person (needs 10 Soul). */
110
+ | {
111
+ type: "vouch";
112
+ account: string;
113
+ }
114
+ /** The voucher withdraws (after the lock), or the newcomer declines (any time). */
115
+ | {
116
+ type: "unvouch";
117
+ account: string;
118
+ } | {
119
+ type: "flag_sybil";
120
+ account: string;
121
+ reason: string;
122
+ }
123
+ /** Claim a merged PR by your linked GitHub handle. Registered Familiars may sign this. */
124
+ | {
125
+ type: "submit_claim";
126
+ repo: string;
127
+ pr: number;
128
+ familiar_key?: string;
129
+ }
130
+ /** Validators only (nodes do this automatically). */
131
+ | {
132
+ type: "attest_claim";
133
+ claim_id: number;
134
+ ok: boolean;
135
+ merge_sha: string;
136
+ note: string;
137
+ } | {
138
+ type: "reject_claim";
139
+ claim_id: number;
140
+ reason: string;
141
+ } | {
142
+ type: "join_jury";
143
+ bond: string;
144
+ } | {
145
+ type: "leave_jury";
146
+ }
147
+ /**
148
+ * A juror's sealed judgment: `seanceCommitment(...)`, and `seancePairsDigest(...)` of the pairs
149
+ * (and their claims' PRs) the juror compared: other pairs on chain refuse it (audit gap-7-6).
150
+ */
151
+ | {
152
+ type: "commit_votes";
153
+ seance_id: number;
154
+ commitment: string;
155
+ pairs_digest: string;
156
+ }
157
+ /** One of "a", "b", "=" per assigned pair, claim ids flagged as spam, and the salt. */
158
+ | {
159
+ type: "reveal_votes";
160
+ seance_id: number;
161
+ votes: string;
162
+ spam: number[];
163
+ salt: string;
164
+ } | {
165
+ type: "fund_pool";
166
+ amount: string;
167
+ } | {
168
+ type: "withdraw_vested";
169
+ } | {
170
+ type: "clawback";
171
+ account: string;
172
+ reason: string;
173
+ }
174
+ /** Stake `amount` drops in a validator's pool (validators are named by address). */
175
+ | {
176
+ type: "delegate";
177
+ validator: string;
178
+ amount: string;
179
+ }
180
+ /**
181
+ * Start unbonding stake in a pool: exactly `shares`, or (with `shares` "0") the shares worth
182
+ * `amount` drops at the pool's price when the tx runs (rounded up: at least `amount` unbonds).
183
+ * One of the two is set. Naming an amount, a wallet never converts FANG to shares at a price
184
+ * some node reported (audit gap-7-5). `withdraw_unbonded` pays it out after the unbonding period.
185
+ */
186
+ | {
187
+ type: "undelegate";
188
+ validator: string;
189
+ shares: string;
190
+ amount?: string;
191
+ } | {
192
+ type: "redelegate";
193
+ from_validator: string;
194
+ to_validator: string;
195
+ shares: string;
196
+ } | {
197
+ type: "withdraw_unbonded";
198
+ }
199
+ /** A validator's owner: commission (bps) and, when non-empty, new addresses. */
200
+ | {
201
+ type: "update_validator";
202
+ commission_bps: number;
203
+ p2p_addr: string;
204
+ http_addr: string;
205
+ } | {
206
+ type: "unjail";
207
+ validator: string;
208
+ }
209
+ /** Two conflicting signed votes, hex (at most 16 KiB decoded). */
210
+ | {
211
+ type: "report_equivocation";
212
+ evidence: string;
213
+ }
214
+ /** A validator's commitment to its secret for the randomness beacon of `epoch`: `beaconCommitment(...)`. */
215
+ | {
216
+ type: "beacon_commit";
217
+ epoch: number;
218
+ commitment: string;
219
+ } | {
220
+ type: "beacon_reveal";
221
+ epoch: number;
222
+ secret: string;
223
+ }
224
+ /** Put `kind` to a vote, bonding `deposit` drops; `url` (https) links the full text. */
225
+ | {
226
+ type: "propose";
227
+ kind: ProposalKind;
228
+ deposit: string;
229
+ title: string;
230
+ url?: string;
231
+ }
232
+ /** Lock `amount` drops for `conviction` (0–6) lock periods: weight 0.1× with no lock, then 1×–6× for 1, 2, 4, 8, 16, 32 periods. */
233
+ /** `proposal_digest`: `proposalDigest(kind, title, url)` of the proposal the voter was shown; a vote on other content is refused (audit gap-7-6). */
234
+ | {
235
+ type: "vote";
236
+ proposal_id: number;
237
+ aye: boolean;
238
+ amount: string;
239
+ conviction: number;
240
+ proposal_digest: string;
241
+ }
242
+ /** Release expired vote locks. */
243
+ | {
244
+ type: "unlock";
245
+ }
246
+ /** Make this account an M-of-N multisig of its owner keys (key ids). */
247
+ | {
248
+ type: "multisig_create";
249
+ owners: string[];
250
+ threshold: number;
251
+ }
252
+ /** Propose an action for a multisig account (never another multisig proposal or approval). */
253
+ | {
254
+ type: "multisig_propose";
255
+ action: Action;
256
+ }
257
+ /** `action_digest`: `actionDigest(action)` of the action the approver was shown; approving anything else is refused (audit gap-7-6). */
258
+ | {
259
+ type: "multisig_approve";
260
+ id: number;
261
+ action_digest: string;
262
+ } | {
263
+ type: "renew_name";
264
+ name: string;
265
+ years: number;
266
+ } | {
267
+ type: "transfer_name";
268
+ name: string;
269
+ to: string;
270
+ } | {
271
+ type: "release_name";
272
+ name: string;
273
+ }
274
+ /** `proof`: hex 32-byte hashes from the leaf (distribution_id, address, amount) to the distribution's Merkle root. */
275
+ | {
276
+ type: "claim_distribution";
277
+ distribution_id: number;
278
+ amount: string;
279
+ proof: string[];
280
+ }
281
+ /** Validators: a matured claim's PR was reverted by commit `revert_sha` (40 hex). */
282
+ | {
283
+ type: "attest_revert";
284
+ claim_id: number;
285
+ revert_sha: string;
286
+ }
287
+ /** Move `amount` drops into the shielded pool as the bundle's output notes. Signed; also burns the chain's `ghost_verify_fee`. */
288
+ | {
289
+ type: "shield";
290
+ amount: string;
291
+ bundle: GhostBundle;
292
+ }
293
+ /** Unsigned (the proof authorizes it): send it with `from`, `memo`, `public_key`, `signature` empty and `nonce` 0. Its `fee` leaves the pool. */
294
+ | {
295
+ type: "private_transfer";
296
+ bundle: GhostBundle;
297
+ }
298
+ /** Unsigned: pay `amount` drops out of the pool to `to` (address or name), plus the fee. */
299
+ | {
300
+ type: "unshield";
301
+ to: string;
302
+ amount: string;
303
+ bundle: GhostBundle;
304
+ }
305
+ /** Publish this account's 1,216-byte Ghost Mode address (hex) so wallets find it under the account's names. */
306
+ | {
307
+ type: "set_ghost_address";
308
+ address: string;
309
+ }
310
+ /** Validators: vote to pause Ghost Mode (it pauses once f + 1 of the epoch's validators have). */
311
+ | {
312
+ type: "ghost_pause";
313
+ }
314
+ /** A candidate's consensus key: its node is running, in the last tenth of `epoch` (the epoch the tx lands in). Changes nothing but the readiness record; refused until the members admitted it. Nodes send it themselves. */
315
+ | {
316
+ type: "validator_ready";
317
+ epoch: number;
318
+ }
319
+ /** An active member's consensus key admits candidate `validator` (an address) into the set at the end of `epoch` (the epoch the tx lands in): its operator's decision, once an epoch. */
320
+ | {
321
+ type: "admit_validator";
322
+ validator: string;
323
+ epoch: number;
324
+ }
325
+ /**
326
+ * Upload a program's code (WebAssembly 1.0) and its interface (format 1), both lowercase hex,
327
+ * bonding a storage deposit for each that isn't stored yet: at most `storage_limit` drops. The
328
+ * code is usable from the block after the upload's; a create names the two by their hashes
329
+ * (`wasmHash`, `interfaceHash`).
330
+ */
331
+ | {
332
+ type: "upload_code";
333
+ wasm: string;
334
+ interface: string;
335
+ storage_limit: string;
336
+ }
337
+ /**
338
+ * Create a program from stored code and interface, named by their hashes (64 lowercase hex). Its
339
+ * address is `programAddress(from, nonce)`: don't send FANG there before the create has applied
340
+ * (a failed create spends its nonce, stranding whatever was sent). `authority` (an address, or
341
+ * null for an immutable program), `upgrade_delay_blocks` and `policy` are stored with no power
342
+ * until program upgrades exist; an immutable program has delay 0 and policy "open". `init` runs
343
+ * the interface's `Init` method, present exactly when the interface declares one; without it,
344
+ * `fuel_limit` is 0 and there are no bindings.
345
+ */
346
+ | {
347
+ type: "create_program";
348
+ wasm_hash: string;
349
+ interface_hash: string;
350
+ authority?: string | null;
351
+ upgrade_delay_blocks: number;
352
+ policy: ProgramPolicy;
353
+ accepts_transfers: boolean;
354
+ init?: InitCall | null;
355
+ fuel_limit: number;
356
+ storage_limit: string;
357
+ bindings: ProgramBinding[];
358
+ }
359
+ /**
360
+ * Call programs: 1–8 calls run in order, all or nothing, sharing `fuel_limit` (1 to 20,000,000,
361
+ * and at most the chain's `program_max_tx_fuel`) and `storage_limit` (the most their storage
362
+ * deposits may bond, drops). Each call names the `versionDigest` of the program it was shown. The
363
+ * code a call may reach is the calls' own programs' and the `bindings`'.
364
+ */
365
+ | {
366
+ type: "call_program";
367
+ calls: ProgramCall[];
368
+ fuel_limit: number;
369
+ storage_limit: string;
370
+ bindings: ProgramBinding[];
371
+ }
372
+ /** An active validator (from its own account or its owner's) votes to pause programs; they pause once f + 1 of the epoch's validators have. */
373
+ | {
374
+ type: "programs_pause";
375
+ };
376
+ /**
377
+ * What a `create_program`'s authority may later do to it, once program upgrades exist (inert in
378
+ * v0; node/src/types.rs `ProgramPolicy`): replace its code freely ("open"), or only with code
379
+ * whose interface keeps every method ("additive").
380
+ */
381
+ export type ProgramPolicy = "open" | "additive";
382
+ /**
383
+ * A `create_program`'s initializer (node/src/types.rs `InitCall`): the interface's `Init` method,
384
+ * its input (lowercase hex) and the FANG sent with it (drops; only if the method is payable).
385
+ */
386
+ export interface InitCall {
387
+ method: string;
388
+ input: string;
389
+ value: string;
390
+ }
391
+ /**
392
+ * One call of a `call_program` (node/src/types.rs `ProgramCall`): a program (by address), the
393
+ * `versionDigest` of it the signer was shown (never 64 zeros), a method of kind `Call`, its input
394
+ * (lowercase hex) and the FANG sent with it (drops; only if the method is payable).
395
+ */
396
+ export interface ProgramCall {
397
+ program: string;
398
+ version_digest: string;
399
+ method: string;
400
+ input: string;
401
+ value: string;
402
+ }
403
+ /**
404
+ * A program whose code a program action may reach besides its calls' own (node/src/types.rs
405
+ * `Binding`): by address, at the version digest given, or at any version for 64 zeros.
406
+ */
407
+ export interface ProgramBinding {
408
+ program: string;
409
+ version_digest: string;
410
+ }
411
+ /**
412
+ * What a ghost action carries (node/src/types.rs `GhostBundle`), every field lowercase hex: the
413
+ * chain `instance` (from `/api/ghost`), the `anchor` root, two 32-byte `nullifiers` and
414
+ * `commitments`, two note ciphertexts `enc` (1,401 bytes each) and outgoing ciphertexts `out`
415
+ * (80 bytes each), and the Action `proof`. Proofs come from the `blockula-ghost` prover; this SDK
416
+ * only encodes.
417
+ */
418
+ export interface GhostBundle {
419
+ instance: string;
420
+ anchor: string;
421
+ nullifiers: [string, string];
422
+ commitments: [string, string];
423
+ enc: [string, string];
424
+ out: [string, string];
425
+ proof: string;
426
+ }
427
+ /** What a `propose` asks for (node/src/types.rs `ProposalKind`): every former admin lever, parameters, spending, upgrades and features. */
428
+ export type ProposalKind =
429
+ /** Set a governance parameter (a key of node/src/params.rs `ChainParams`, e.g. "max_validators"), within its bounds. */
430
+ {
431
+ type: "param_change";
432
+ key: string;
433
+ value: string;
434
+ } | {
435
+ type: "treasury_spend";
436
+ to: string;
437
+ amount: string;
438
+ }
439
+ /** Open a community distribution of `total` drops, claimable with Merkle proofs until block `claim_until`. `distribution_id` is the id its tree was built for, one no distribution has yet (the node's `next_distribution_id`; at most its `max_distribution_id`). */
440
+ | {
441
+ type: "distribution";
442
+ distribution_id: number;
443
+ merkle_root: string;
444
+ total: string;
445
+ claim_until: number;
446
+ } | {
447
+ type: "set_repo";
448
+ repo: string;
449
+ weight: number;
450
+ }
451
+ /** milli-Soul, at most 100 Soul. */
452
+ | {
453
+ type: "grant_soul";
454
+ to: string;
455
+ amount: number;
456
+ reason: string;
457
+ } | {
458
+ type: "flag_sybil";
459
+ account: string;
460
+ reason: string;
461
+ } | {
462
+ type: "reject_claim";
463
+ claim_id: number;
464
+ reason: string;
465
+ } | {
466
+ type: "clawback";
467
+ account: string;
468
+ reason: string;
469
+ } | {
470
+ type: "unlink_github";
471
+ handle: string;
472
+ } | {
473
+ type: "refund_hunt";
474
+ hunt_id: number;
475
+ } | {
476
+ type: "schedule_upgrade";
477
+ version: number;
478
+ activation_height: number;
479
+ } | {
480
+ type: "activate_feature";
481
+ feature: string;
482
+ } | {
483
+ type: "deactivate_feature";
484
+ feature: string;
485
+ }
486
+ /** No on-chain effect: a signal. */
487
+ | {
488
+ type: "text";
489
+ }
490
+ /** Lift a sybil flag (`flag_sybil`'s appeal path): the account can earn again; nothing the flag took comes back. */
491
+ | {
492
+ type: "unflag_sybil";
493
+ account: string;
494
+ reason: string;
495
+ }
496
+ /** Withdraw the upgrade to `version` scheduled at `activation_height` (and any after it) before it activates (a supermajority, no timelock). Tag 15. */
497
+ | {
498
+ type: "cancel_upgrade";
499
+ version: number;
500
+ activation_height: number;
86
501
  };
87
502
  export interface UnsignedTx {
88
503
  chain_id: string;
504
+ /**
505
+ * The chain instance the tx is for: hex BLAKE3 digest of its genesis block (`genesis_hash` in
506
+ * `/api/status`). Signed right after `chain_id`, so the tx can't replay on another chain that
507
+ * reuses the id (e.g. a relaunched testnet). `Wallet.build` fills it in; offline signers pass it.
508
+ */
509
+ genesis_hash: string;
89
510
  /** The account acting; the signing key must be authorized on it. */
90
511
  from: string;
91
512
  nonce: number;
513
+ /** The most the sender will pay, in drops. The tx is charged its block's base fee + `tip` (see `txCharge`). */
92
514
  fee: string;
515
+ /** Drops paid to the block's proposer on top of the burned base fee (default "0"). Blocks take the highest tip per byte first. */
516
+ tip?: string;
517
+ /** Last block height at which the tx may execute (at most an hour of blocks ahead). After it, the tx can never execute. */
518
+ valid_until: number;
93
519
  action: Action;
94
520
  memo: string;
95
521
  }
@@ -99,14 +525,178 @@ export interface Tx extends UnsignedTx {
99
525
  }
100
526
  export declare const PUBLIC_KEY_LEN = 1952;
101
527
  export declare const SIGNATURE_LEN = 3309;
528
+ /** Domain of the unsigned ghost wire form (`private_transfer`, `unshield`). */
529
+ export declare const GHOST_TX_DOMAIN = "BLOCKULA_GHOST_V1";
530
+ export declare const GHOST_ENC_BYTES = 1401;
531
+ export declare const GHOST_OUT_BYTES = 80;
532
+ export declare const GHOST_ADDRESS_BYTES = 1216;
533
+ /** The Action circuit the node verifies proofs against (blockula-ghost `CIRCUIT_ID`). */
534
+ export declare const GHOST_CIRCUIT_ID = 1;
102
535
  export declare const DROPS_PER_FANG = 1000000000n;
536
+ /**
537
+ * The largest value of a whole-number field a tx carries as a JSON number, not a string (ids,
538
+ * heights, PR numbers, the nonce): 2^53 − 1, what a JavaScript number holds exactly
539
+ * (node/src/types.rs `MAX_JSON_INT`). The chain refuses larger ones, so every stored proposal
540
+ * kind and multisig action reads back exactly here, and its digest can be computed.
541
+ */
542
+ export declare const MAX_JSON_INT: bigint;
543
+ /**
544
+ * An unsigned integer field as the node reads it from JSON (node/src/types.rs: a JSON number,
545
+ * or for amounts a decimal string), checked to be in `0 ..= max`. Anything the node's JSON
546
+ * parser would refuse is refused here, so `signingBytes`/`txBytes` never encode a value other
547
+ * than the one in the tx object (no wrapping of negative or oversized numbers).
548
+ */
549
+ export declare function uintField(v: unknown, max: bigint, what?: string): bigint;
550
+ /** A u64 field (`uintField` up to 2^64 − 1). */
551
+ export declare const u64Field: (v: unknown, what?: string) => bigint;
552
+ /** A chain's genesis hash as its 32 bytes (`/api/status` `genesis_hash`, lowercase hex). */
553
+ export declare function genesisHashBytes(genesisHash: string): Uint8Array;
554
+ /** Unsigned ghost txs (`private_transfer`, `unshield`): no key signs them, their proof authorizes them. */
555
+ export declare function isUnsignedAction(a: Action): boolean;
556
+ /** A program action (tags 62–64 and 69, node/src/types.rs `Action::is_program`). */
557
+ export declare function isProgramAction(a: Action): boolean;
558
+ /**
559
+ * The bytes a key signs (node/src/types.rs `Tx::signing_bytes`). For an unsigned ghost tx this is
560
+ * its whole wire form instead: `BLOCKULA_GHOST_V1 ‖ chain_id ‖ genesis hash ‖ fee ‖ tip ‖ valid_until ‖ action`.
561
+ */
103
562
  export declare function signingBytes(tx: UnsignedTx): Uint8Array;
563
+ /**
564
+ * What a ghost tx's Action proof is bound to (node/src/types.rs `Tx::ghost_sighash`):
565
+ * BLAKE3-KDF("blockula ghost v1 tx sighash", chain_id ‖ genesis hash ‖ tag ‖ valid_until ‖ fee ‖
566
+ * tip ‖ the tag's own fields (shield: from, nonce, amount; unshield: to, amount) ‖ the bundle
567
+ * without its proof ‖ circuit id). A wallet proves with this as the witness's sighash, then fills
568
+ * in the proof.
569
+ */
570
+ export declare function ghostSighash(tx: UnsignedTx): Uint8Array;
571
+ /**
572
+ * What a Séance juror seals before revealing (node/src/types.rs `seance_commitment`): hex
573
+ * BLAKE3 of the Séance id, the juror's account, the votes, spam flags and a secret salt.
574
+ */
575
+ export declare function seanceCommitment(seanceId: number, juror: string, votes: string, spam: number[], salt: string): string;
576
+ /**
577
+ * A validator's randomness-beacon commitment (node/src/beacon.rs `commitment`): hex BLAKE3 in
578
+ * derive-key mode ("blockula beacon commitment v1") over the chain id, the target epoch, the
579
+ * validator's address and its 32-byte hex secret. Strings are u64-length-prefixed, integers
580
+ * u64 little-endian.
581
+ */
582
+ export declare function beaconCommitment(chainId: string, epoch: number, validator: string, secret: string): string;
583
+ /** "2.5" Soul → 2500 milli-Soul. */
584
+ export declare function parseSoul(soul: string | number): number;
585
+ /**
586
+ * What a `multisig_approve` binds (node/src/types.rs `action_digest`): BLAKE3 (derive-key mode,
587
+ * context "blockula multisig action v1") of the action's encoding, as inside the signing bytes.
588
+ * Compute it from the action you show the approver (`client.multisig(account)` `pending[].action`).
589
+ */
590
+ export declare function actionDigest(action: Action): string;
591
+ /**
592
+ * What a `vote` binds (node/src/types.rs `proposal_digest`): the proposal's kind (accounts as
593
+ * stored, resolved), title and link. Compute it from the proposal you show the voter.
594
+ */
595
+ export declare function proposalDigest(kind: ProposalKind, title: string, url?: string): string;
596
+ /**
597
+ * The contexts of programs' five digests, each BLAKE3 in derive-key mode: node/src/programs/digest.rs
598
+ * `CODE_CONTEXT`, `INTERFACE_CONTEXT`, `VERSION_CONTEXT` and `ADDRESS_CONTEXT`, and the VM's
599
+ * `SELECTOR_CONTEXT` (node/vm/src/interface.rs), the selector's only home on the node.
600
+ */
601
+ export declare const PROGRAM_DIGEST_CONTEXTS: Readonly<{
602
+ code: "blockula program code v1";
603
+ interface: "blockula program interface v1";
604
+ version: "blockula program version v1";
605
+ address: "blockula program address v1";
606
+ method: "blockula program method v1";
607
+ }>;
608
+ /** Every v0 program's version (node/src/programs/digest.rs `FIRST_VERSION`): only a program upgrade, in a later protocol version, raises it. */
609
+ export declare const FIRST_PROGRAM_VERSION = 1;
610
+ /**
611
+ * The hash that names a program's code (node/src/programs/digest.rs `wasm_hash`): BLAKE3-KDF("blockula
612
+ * program code v1", wasm), as 64 lowercase hex. A `create_program` names its code by it, once an
613
+ * `upload_code` of the same bytes (as bytes, or lowercase hex) has applied.
614
+ */
615
+ export declare function wasmHash(wasm: Uint8Array | string): string;
616
+ /** The hash that names an interface, its format-1 bytes (node/src/programs/digest.rs `interface_hash`): as `wasmHash`, under "blockula program interface v1". */
617
+ export declare function interfaceHash(iface: Uint8Array | string): string;
618
+ /**
619
+ * What a call to `program` binds (node/src/programs/digest.rs `version_digest`): BLAKE3-KDF("blockula
620
+ * program version v1", the program's address as a string field (u16 LE length, its bytes) ‖ its
621
+ * code's hash ‖ its interface's hash ‖ its version, u32 LE), as 64 lowercase hex. A call runs only
622
+ * while this is the program's digest in force, so it runs the code its signer was shown: compute it
623
+ * from the record you show (its hashes and version), rather than sign a digest a node reported.
624
+ */
625
+ export declare function versionDigest(program: string, wasmHashHex: string, interfaceHashHex: string, version?: number): string;
626
+ /**
627
+ * The address of the program `creator` creates with its transaction of `nonce` (node/src/programs/digest.rs
628
+ * `program_address`): bech32m(prefix, BLAKE3-KDF("blockula program address v1", the creator's 32
629
+ * address bytes ‖ nonce u64 LE)). `prefix` defaults to the creator's own (a chain admits only its
630
+ * prefix, so for any create it runs the two are the same).
631
+ *
632
+ * Don't send FANG to it before the create has applied: a create that fails spends its nonce, no
633
+ * later create reaches the address, and what was sent there is stranded for good (docs/PROGRAMS-V0.md
634
+ * §2.3). Fund a program through its initializer's value, or by transfer once it exists.
635
+ */
636
+ export declare function programAddress(creator: string, nonce: number | bigint | string, prefix?: string): string;
637
+ /**
638
+ * A method's selector (node/vm/src/interface.rs `selector`): the first 8 bytes of
639
+ * BLAKE3-KDF("blockula program method v1", its name), as 16 lowercase hex. An interface's methods
640
+ * have distinct selectors. Only identifiers are method names, so anything else is refused.
641
+ */
642
+ export declare function methodSelector(name: string): string;
643
+ /** One claim of a Séance pair, as the juror judged it. */
644
+ export interface SeanceClaimRef {
645
+ id: number;
646
+ repo: string;
647
+ pr: number;
648
+ }
649
+ /**
650
+ * What a `commit_votes` binds (node/src/types.rs `seance_pairs_digest`): the Séance, the juror and,
651
+ * per assigned pair in order, both claims' ids, repos and PR numbers.
652
+ */
653
+ export declare function seancePairsDigest(seanceId: number, juror: string, pairs: [SeanceClaimRef, SeanceClaimRef][]): string;
654
+ /** FIPS 204 context string for a key's proof of possession in `add_key` (node/src/types.rs `KEY_POP_CONTEXT`). */
655
+ export declare const KEY_POP_CONTEXT: Uint8Array<ArrayBuffer>;
656
+ /**
657
+ * What a key signs to consent to being added to `account` (node/src/types.rs `key_pop_message`):
658
+ * the chain instance, the account and the key's own id (audit gap-7-2).
659
+ */
660
+ export declare function keyPopMessage(chainId: string, genesisHash: string, account: string, keyId: string): Uint8Array;
104
661
  /** FIPS 204 context string for validator proofs of possession (node/src/types.rs `POP_CONTEXT`). */
105
662
  export declare const POP_CONTEXT: Uint8Array<ArrayBuffer>;
106
663
  /** What a validator's consensus key signs to register (node/src/types.rs `pop_message`). */
107
664
  export declare function popMessage(chainId: string, owner: string, p2pAddr: string, httpAddr: string): Uint8Array;
108
- /** Mirrors `min_fee` in node/src/types.rs: base fee is priced per byte and burned. */
665
+ /** Wire size in bytes (node/src/types.rs `Tx::size`): signing bytes plus the key and signature (none for an unsigned ghost tx). Fees are priced on it. */
666
+ export declare function txSize(tx: UnsignedTx): number;
667
+ /**
668
+ * A block's base fee (node/src/econ.rs `FeeSlot`): `flat` drops per tx plus `rate` milli-drops per
669
+ * byte. It moves with block fullness and is fixed 17 blocks ahead; `/api/fees` serves the upcoming
670
+ * ones and `suggested`, the highest of them (what `Wallet.build` prices txs at).
671
+ */
672
+ export interface BaseFee {
673
+ flat: string | bigint;
674
+ rate: string | bigint;
675
+ }
676
+ /** The base fee at its genesis floor: 10,000 drops + 10 per byte (`min_fee`). */
677
+ export declare const FLOOR_BASE_FEE: BaseFee;
678
+ /** Mirrors `FeeSlot::fee` in node/src/econ.rs: `flat + rate × size / 1000`, rounded down. Burned. */
679
+ export declare function baseFee(tx: UnsignedTx, fee?: BaseFee): bigint;
680
+ /** Mirrors `min_fee` in node/src/types.rs: the base fee at its floor (an idle chain's). */
109
681
  export declare function minFee(tx: UnsignedTx): bigint;
682
+ /** The chain's default `tip_cap_multiple` (node/src/params.rs): a tip may be at most this many times the base fee of the block that includes it. */
683
+ export declare const DEFAULT_TIP_CAP_MULTIPLE = 20;
684
+ /**
685
+ * The most this tx may tip in a block with this base fee (node/src/econ.rs `max_tip`): `multiple` × its base fee. Nodes refuse
686
+ * a bigger tip. `/api/fees` serves the chain's `tip_cap_multiple` and `lowest`, the base fee a tip fits under in any upcoming block.
687
+ * Tips are also paid only from transferable FANG (locks hold them), and a multisig's owner keys or a validator's consensus key
688
+ * acting for its owner can't tip at all.
689
+ */
690
+ export declare function maxTip(tx: UnsignedTx, fee?: BaseFee, multiple?: number | bigint): bigint;
691
+ /** What the tx is charged in a block with this base fee (node/src/econ.rs `charge`): base fee + tip. Its `fee` must cover it; nothing more is debited. */
692
+ export declare function txCharge(tx: UnsignedTx, fee?: BaseFee): bigint;
693
+ /**
694
+ * Wire form (node/src/types.rs `Tx::to_bytes`): signing bytes ‖ public key (1,952 B) ‖ signature (3,309 B), or just the
695
+ * unsigned form for an unsigned ghost tx. Blocks and gossip carry this; `POST /api/tx` takes it as `application/octet-stream`.
696
+ */
697
+ export declare function txBytes(tx: Tx): Uint8Array;
698
+ /** A tx's id (node/src/types.rs `Tx::id`): hex BLAKE3 of the signing bytes and the signature. Known before submitting. */
699
+ export declare function txId(tx: Tx): string;
110
700
  /** "1.5" → 1500000000n drops. Accepts numbers, decimal strings or bigint drops. */
111
701
  export declare function parseFang(amount: string | number | bigint): bigint;
112
702
  export declare function formatFang(drops: bigint | string): string;