@hardkas/accounts 0.12.0-rc.2 → 0.12.0-rc.21

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.
@@ -1,17 +1,37 @@
1
1
  // src/internal/wasm-rpc-serialization.ts
2
- function parseWasmTxToRpc(wasmTxStr, signedTx, inputOverrides, plan) {
2
+ function toRpcNumber(value, field) {
3
+ if (typeof value === "bigint") {
4
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
5
+ throw new Error(`RPC_SERIALIZATION_UNSAFE_INTEGER: ${field} ${value} exceeds 2^53`);
6
+ }
7
+ return Number(value);
8
+ }
9
+ return typeof value === "number" ? value : Number(value || 0);
10
+ }
11
+ function storageMassOf(txInner) {
12
+ const value = txInner.storageMass ?? txInner.mass;
13
+ if (value === void 0 || value === null) {
14
+ throw new Error("RPC_STORAGE_MASS_MISSING: the serialized transaction carries no storageMass commitment");
15
+ }
16
+ return toRpcNumber(value, "storageMass");
17
+ }
18
+ function parseWasmTxToRpc(wasmTx, signedTx, inputOverrides, plan) {
3
19
  let parsed;
4
- try {
5
- parsed = JSON.parse(wasmTxStr);
6
- } catch (e) {
7
- throw new Error("Failed to parse WASM transaction JSON: " + String(e));
20
+ if (typeof wasmTx === "string") {
21
+ try {
22
+ parsed = JSON.parse(wasmTx);
23
+ } catch (e) {
24
+ throw new Error("Failed to parse WASM transaction JSON: " + String(e));
25
+ }
26
+ } else {
27
+ parsed = wasmTx;
8
28
  }
9
29
  while (typeof parsed === "string") {
10
30
  parsed = JSON.parse(parsed);
11
31
  }
12
32
  const txInner = parsed.outputs ? parsed : parsed.tx ? parsed.tx.inner : parsed.inner;
13
33
  if (!txInner) throw new Error("Could not find inner tx data");
14
- const version = txInner.version || 0;
34
+ const version = toRpcNumber(txInner.version || 0, "version");
15
35
  const numInputs = txInner.inputs ? txInner.inputs.length : 0;
16
36
  if (inputOverrides) {
17
37
  for (const idxStr of Object.keys(inputOverrides)) {
@@ -38,19 +58,19 @@ function parseWasmTxToRpc(wasmTxStr, signedTx, inputOverrides, plan) {
38
58
  if (!finalSigScript || finalSigScript.length === 0 || !/^[0-9a-fA-F]+$/.test(finalSigScript)) {
39
59
  throw new Error(`INVALID_SIGNATURE_SCRIPT: Missing or invalid hex signature script at input ${idx}`);
40
60
  }
41
- const sigOpCount = version === 1 ? 0 : originalSigOpCount !== void 0 ? originalSigOpCount : 1;
61
+ const sigOpCount = version === 1 ? 0 : originalSigOpCount !== void 0 ? toRpcNumber(originalSigOpCount, "sigOpCount") : 1;
42
62
  if (version === 1 && sigOpCount !== 0) {
43
63
  throw new Error("INVALID_V1_SIG_OP_COUNT: V1 transactions must have sigOpCount = 0.");
44
64
  }
45
65
  const overrideBudget = plan?.computeBudget;
46
- const finalComputeBudget = overrideBudget !== void 0 ? Number(overrideBudget) : computeBudget !== void 0 && computeBudget !== 0 ? computeBudget : 0;
66
+ const finalComputeBudget = overrideBudget !== void 0 ? Number(overrideBudget) : toRpcNumber(computeBudget ?? 0, "computeBudget");
47
67
  return {
48
68
  previousOutpoint: {
49
- transactionId: prevOut.transactionId || prevOut.transactionId,
50
- index: prevOut.index || prevOut.index
69
+ transactionId: prevOut.transactionId,
70
+ index: toRpcNumber(prevOut.index ?? 0, "index")
51
71
  },
52
72
  signatureScript: finalSigScript,
53
- sequence: isFlattened ? i.sequence || 0 : i.inner.sequence || 0,
73
+ sequence: toRpcNumber(isFlattened ? i.sequence || 0 : i.inner.sequence || 0, "sequence"),
54
74
  sigOpCount,
55
75
  computeBudget: finalComputeBudget
56
76
  };
@@ -89,11 +109,13 @@ function parseWasmTxToRpc(wasmTxStr, signedTx, inputOverrides, plan) {
89
109
  }
90
110
  return ret;
91
111
  }),
92
- lockTime: txInner.lockTime || 0,
112
+ lockTime: toRpcNumber(txInner.lockTime || 0, "lockTime"),
93
113
  subnetworkId: txInner.subnetworkId || "0000000000000000000000000000000000000000",
94
- gas: txInner.gas || 0,
95
- mass: txInner.mass || 0,
96
- storageMass: txInner.storageMass || 0,
114
+ gas: toRpcNumber(txInner.gas || 0, "gas"),
115
+ // The transaction's storage mass commitment, under its Toccata name only. The
116
+ // node refuses a `mass` that differs from `storageMass`, so the deprecated
117
+ // field is read (older serializations) but never written.
118
+ storageMass: storageMassOf(txInner),
97
119
  payload: txInner.payload && txInner.payload.length > 0 ? typeof txInner.payload === "string" ? txInner.payload : toHex(txInner.payload) : ""
98
120
  };
99
121
  }
@@ -4,10 +4,10 @@ import {
4
4
  ensureDevAccounts,
5
5
  getOrCreateDevAccount,
6
6
  listDevAccountsSync
7
- } from "./chunk-6Q4K4A24.js";
8
- import "./chunk-R5P3WIWR.js";
9
- import "./chunk-TRVIQTIO.js";
10
- import "./chunk-6DPO5V3N.js";
7
+ } from "./chunk-CELVD4YG.js";
8
+ import "./chunk-GM2BY4VS.js";
9
+ import "./chunk-BNF566PS.js";
10
+ import "./chunk-7KKJXU73.js";
11
11
  import "./chunk-YLG2NIAU.js";
12
12
  export {
13
13
  DEV_ACCOUNTS_PASSWORD,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { TxPlanArtifact, SignedTxArtifact, HardkasArtifactBase } from '@hardkas/artifacts';
2
- import { HardkasConfig } from '@hardkas/config';
3
2
  import * as _hardkas_core from '@hardkas/core';
4
- import { NetworkId } from '@hardkas/core';
3
+ import { SilArtifactValue, SilAbiArtifact, NetworkId } from '@hardkas/core';
4
+ import { HardkasConfig } from '@hardkas/config';
5
+ export { parseWasmTxToRpc } from './internal/wasm-rpc-serialization.js';
5
6
  import { TxPlan } from '@hardkas/tx-builder';
6
7
 
7
8
  interface TxInputAuthorizationContext {
@@ -151,9 +152,11 @@ declare class SimulatedSigner implements HardkasSigner {
151
152
  interface ResolveAccountOptions {
152
153
  nameOrAddress: string;
153
154
  config?: HardkasConfig | undefined;
155
+ executionTarget?: _hardkas_core.HardkasExecutionTarget | undefined;
154
156
  }
155
157
  declare function resolveHardkasAccount(options: ResolveAccountOptions): HardkasAccount;
156
- declare function listHardkasAccounts(config?: HardkasConfig): HardkasAccount[];
158
+ declare function assertAccountCompatible(account: HardkasAccount, target: _hardkas_core.HardkasExecutionTarget): void;
159
+ declare function listHardkasAccounts(config?: HardkasConfig, executionTarget?: _hardkas_core.HardkasExecutionTarget): HardkasAccount[];
157
160
  declare function resolveHardkasAccountAddress(accountOrAddress: string, config?: HardkasConfig, context?: "L1" | "L2"): Promise<string>;
158
161
  declare function describeAccount(account: HardkasAccount): Record<string, unknown>;
159
162
 
@@ -207,16 +210,29 @@ interface KaspaSigningBackendStatus {
207
210
  };
208
211
  }
209
212
  interface WasmProviderConfig {
210
- provider: "npm" | "local" | "release-asset";
213
+ /**
214
+ * - `managed` (default): the official rusty-kaspa release SDK installed by
215
+ * `hardkas toolchain install kaspa-wasm`, verified against the pin in
216
+ * @hardkas/core on every load. There is no fallback to any other SDK.
217
+ * - `local` / `release-asset`: an explicit path chosen by the user (unverified).
218
+ */
219
+ provider: "managed" | "local" | "release-asset";
211
220
  path?: string;
212
221
  }
213
222
  /**
214
- * Loads the official Kaspa WASM SDK dynamically.
215
- * This ensures the toolkit remains usable even if the SDK is not installed.
223
+ * Loads the pinned official SDK (see loadManagedKaspaWasmSync in @hardkas/core).
224
+ * Synchronous because some callers (AddressManager) expose synchronous APIs.
225
+ */
226
+ declare function loadKaspaWasmSync(): any;
227
+ /**
228
+ * Loads the official Kaspa WASM SDK. Every HardKAS component loads the SDK
229
+ * through here, so the pin and the integrity check apply everywhere.
216
230
  */
217
231
  declare function loadKaspaWasm(config?: WasmProviderConfig): Promise<any>;
218
232
  /**
219
- * Detects the specific capabilities supported by the installed kaspa-wasm SDK.
233
+ * Detects the specific capabilities supported by the loaded kaspa-wasm SDK.
234
+ * Transaction v1 (Toccata) is present when `Transaction` carries `storageMass`,
235
+ * as in the pinned 2.0.x SDK.
220
236
  */
221
237
  declare function detectCapabilities(sdk: any): {
222
238
  transactionV1Signing: boolean;
@@ -226,6 +242,339 @@ declare function detectCapabilities(sdk: any): {
226
242
  */
227
243
  declare function getKaspaSigningBackendStatus(config?: WasmProviderConfig): Promise<KaspaSigningBackendStatus>;
228
244
 
245
+ /**
246
+ * Transaction construction against the pinned kaspa-wasm 2.0.x SDK.
247
+ *
248
+ * `createTransaction(utxos, outputs, priorityFee)` in 2.0.x spends exactly the
249
+ * given inputs into exactly the given outputs. Unlike 0.13.x it adds no change
250
+ * output, and it does not check `priorityFee` against inputs minus outputs. So
251
+ * change must be passed as an explicit output, and HardKAS checks conservation
252
+ * itself: an unbalanced plan must never silently turn the difference into fee.
253
+ */
254
+ interface WasmUtxoEntrySource {
255
+ readonly utxoEntry: {
256
+ readonly amount: bigint;
257
+ };
258
+ }
259
+ interface BalancedOutput {
260
+ /** Value of the output, used for the conservation check. */
261
+ readonly amountSompi: bigint;
262
+ /** What is handed to the SDK: `{ address, amount }` or a `PaymentOutput`. */
263
+ readonly output: unknown;
264
+ }
265
+ declare function assertValueConservation(input: {
266
+ readonly inputAmounts: readonly bigint[];
267
+ readonly outputAmounts: readonly bigint[];
268
+ readonly feeSompi: bigint;
269
+ }): void;
270
+ /** Builds an unsigned transaction whose outputs (change included) and fee balance the inputs exactly. */
271
+ declare function createBalancedTransaction(sdk: any, input: {
272
+ readonly utxos: readonly WasmUtxoEntrySource[];
273
+ readonly outputs: readonly BalancedOutput[];
274
+ readonly feeSompi: bigint;
275
+ }): any;
276
+ interface WasmUtxoInput {
277
+ readonly address?: string | undefined;
278
+ readonly outpoint: {
279
+ readonly transactionId: string;
280
+ readonly index: number;
281
+ };
282
+ readonly utxoEntry: {
283
+ readonly amount: bigint;
284
+ /** A WASM ScriptPublicKey (see toWasmScriptPublicKey). */
285
+ readonly scriptPublicKey: unknown;
286
+ readonly blockDaaScore: bigint;
287
+ readonly isCoinbase: boolean;
288
+ };
289
+ }
290
+ interface ScriptOutput {
291
+ readonly value: bigint;
292
+ /** A WASM ScriptPublicKey: outputs that pay a script rather than an address. */
293
+ readonly scriptPublicKey: unknown;
294
+ }
295
+ /**
296
+ * Builds an unsigned version-0 transaction whose outputs are arbitrary scripts
297
+ * (P2SH/covenant locks), balanced exactly against its inputs.
298
+ *
299
+ * Every output is fixed at construction: in 2.x `tx.outputs` returns a copy, so
300
+ * pushing to it afterwards silently drops the output. Each input carries its
301
+ * UTXO entry, which signTransaction() needs.
302
+ */
303
+ declare function createScriptTransaction(sdk: any, input: {
304
+ readonly utxos: readonly WasmUtxoInput[];
305
+ readonly outputs: readonly ScriptOutput[];
306
+ readonly feeSompi: bigint;
307
+ }): any;
308
+ /**
309
+ * A plan's scriptPublicKey as a WASM ScriptPublicKey with an explicit version
310
+ * (ADJ-002 transport rule): `{ version, scriptPublicKey | script }` is used as
311
+ * is; a 72-hex string starting with `0000` is version 0 + a 34-byte script;
312
+ * any other string is a bare version-0 script. Handing the SDK a bare hex
313
+ * string would make it read the first two bytes as the version.
314
+ */
315
+ declare function toWasmScriptPublicKey(sdk: any, spk: unknown): any;
316
+ /**
317
+ * Plan outputs plus the plan's change, in order, as `{ address, amount }`.
318
+ * Change is part of the transaction in 2.0.x; nothing adds it later.
319
+ */
320
+ declare function planOutputsWithChange(plan: {
321
+ readonly outputs: readonly {
322
+ readonly address?: string;
323
+ readonly amountSompi: string | bigint;
324
+ }[];
325
+ readonly change?: {
326
+ readonly address: string;
327
+ readonly amountSompi: string | bigint;
328
+ } | null | undefined;
329
+ }): BalancedOutput[];
330
+
331
+ /** A contract output as the node reports it. */
332
+ interface SilverContractUtxo {
333
+ readonly outpoint: {
334
+ readonly transactionId: string;
335
+ readonly index: number;
336
+ };
337
+ readonly amountSompi: bigint;
338
+ readonly scriptPublicKey: {
339
+ readonly version: number;
340
+ readonly script: string;
341
+ };
342
+ readonly blockDaaScore: bigint;
343
+ readonly isCoinbase: boolean;
344
+ }
345
+ /** A `sig` argument: a Schnorr signature of this spend (SIGHASH_ALL) by the given key. */
346
+ interface SilverSignatureArg {
347
+ readonly kind: "signature";
348
+ readonly privateKey: string;
349
+ }
350
+ type SilverSpendArg = SilArtifactValue | SilverSignatureArg;
351
+ interface SilverSweepRequest {
352
+ readonly artifact: SilAbiArtifact;
353
+ readonly contractName?: string | undefined;
354
+ readonly entry: string;
355
+ readonly args: readonly SilverSpendArg[];
356
+ readonly utxo: SilverContractUtxo;
357
+ /** Receives the whole value minus the fee. */
358
+ readonly to: string;
359
+ readonly networkId: string;
360
+ /** Input sequence, for contracts with relative time locks. Default 0. */
361
+ readonly sequence?: bigint | undefined;
362
+ /** Declared signature operations of the input (script-execution budget). Default 1. */
363
+ readonly sigOpCount?: number | undefined;
364
+ /** Fee rate above the node minimum, sompi per gram. Default: the minimum. */
365
+ readonly feeRateSompiPerGram?: bigint | undefined;
366
+ }
367
+ interface SilverSpendResult {
368
+ /** The signed WASM transaction. */
369
+ readonly transaction: any;
370
+ /** The transaction in RPC shape, ready for submitTransaction. */
371
+ readonly rpcTransaction: any;
372
+ readonly txId: string;
373
+ readonly contractName: string;
374
+ readonly entry: string;
375
+ readonly outputSompi: bigint;
376
+ readonly feeSompi: bigint;
377
+ readonly mass: bigint;
378
+ readonly storageMass: bigint;
379
+ readonly signatureScriptHex: string;
380
+ readonly assumptions: readonly string[];
381
+ }
382
+ /**
383
+ * Builds and signs a transaction spending one SilverScript contract output
384
+ * entirely to `to`, through the named entry.
385
+ *
386
+ * Fails closed: the output must be locked to this contract's bytecode, the
387
+ * fee must meet the SDK's minimum for the final transaction, and the signed
388
+ * unlock must have the size the fee was computed for.
389
+ */
390
+ declare function buildSilverSweep(request: SilverSweepRequest): SilverSpendResult;
391
+ declare const SILVER_SPEND_DRAFT_SCHEMA = "hardkas.silver.spendDraft.v1";
392
+ /** A `sig` argument to be filled by a named signer (see signSilverSpend). */
393
+ interface SilverSignerSlot {
394
+ readonly kind: "signer";
395
+ readonly signer: string;
396
+ }
397
+ type SilverDraftArg = SilArtifactValue | SilverSignerSlot;
398
+ /**
399
+ * An unsigned P2SH spend with fixed outputs, as plain JSON: it can be stored
400
+ * and handed to each signer. Every signer signs the same transaction; the
401
+ * signatures are placed into the entry's arguments only at finalization.
402
+ */
403
+ interface SilverSpendDraft {
404
+ readonly schema: typeof SILVER_SPEND_DRAFT_SCHEMA;
405
+ readonly networkId: string;
406
+ readonly contractName: string;
407
+ readonly entry: string;
408
+ readonly signers: readonly string[];
409
+ readonly input: {
410
+ readonly outpoint: {
411
+ readonly transactionId: string;
412
+ readonly index: number;
413
+ };
414
+ readonly amountSompi: string;
415
+ readonly scriptPublicKey: {
416
+ readonly version: number;
417
+ readonly script: string;
418
+ };
419
+ readonly blockDaaScore: string;
420
+ readonly isCoinbase: boolean;
421
+ readonly sequence: string;
422
+ readonly sigOpCount: number;
423
+ };
424
+ readonly outputs: readonly {
425
+ readonly valueSompi: string;
426
+ readonly scriptPublicKey: {
427
+ readonly version: number;
428
+ readonly script: string;
429
+ };
430
+ }[];
431
+ readonly feeSompi: string;
432
+ readonly mass: string;
433
+ readonly storageMass: string;
434
+ /** Hex length of the final signature script the fee was checked against. */
435
+ readonly unlockHexLength: number;
436
+ readonly unsignedTxId: string;
437
+ }
438
+ interface SilverSpendDraftRequest {
439
+ readonly artifact: SilAbiArtifact;
440
+ readonly contractName?: string | undefined;
441
+ readonly entry: string;
442
+ /** Entry arguments; `sig` slots are named signers filled at finalization. */
443
+ readonly args: readonly SilverDraftArg[];
444
+ readonly utxo: SilverContractUtxo;
445
+ /** The outputs exactly as the contract requires; the rest of the input value is the fee. */
446
+ readonly outputs: readonly {
447
+ readonly amountSompi: bigint;
448
+ readonly address?: string;
449
+ readonly scriptPublicKey?: {
450
+ readonly version: number;
451
+ readonly script: string;
452
+ };
453
+ }[];
454
+ readonly networkId: string;
455
+ readonly sequence?: bigint | undefined;
456
+ /** Declared signature operations; defaults to the number of signer slots. */
457
+ readonly sigOpCount?: number | undefined;
458
+ }
459
+ /**
460
+ * Prepares a spend of one SilverScript output into fixed outputs. Fails
461
+ * closed if the output is not locked to the contract or if what the outputs
462
+ * leave as fee is below the SDK minimum for the final (signed) transaction.
463
+ */
464
+ declare function prepareSilverSpend(request: SilverSpendDraftRequest): SilverSpendDraft;
465
+ /** One signer's `sig` value (65-byte hex) for a draft, from the SDK's input signature. */
466
+ declare function signSilverSpend(draft: SilverSpendDraft, privateKey: string): string;
467
+ /**
468
+ * The signed spend: each signer slot takes that signer's signature, the entry
469
+ * arguments are encoded, and the unlock must have the size the fee was checked for.
470
+ */
471
+ declare function finalizeSilverSpend(draft: SilverSpendDraft, artifact: SilAbiArtifact, args: readonly SilverDraftArg[], signatures: Readonly<Record<string, string>>): {
472
+ readonly rpcTransaction: any;
473
+ readonly txId: string;
474
+ readonly signatureScriptHex: string;
475
+ };
476
+
477
+ /** A P2PK (Schnorr) output funding a covenant genesis. */
478
+ interface CovenantFundingInput extends SilverContractUtxo {
479
+ readonly privateKey: string;
480
+ /** Compute budget committed by this input. Explicit: there is no estimator. */
481
+ readonly computeBudget: number;
482
+ }
483
+ interface CovenantGenesisRequest {
484
+ readonly artifact: SilAbiArtifact;
485
+ readonly contractName?: string | undefined;
486
+ /** Value locked in the covenant output (output 0). */
487
+ readonly valueSompi: bigint;
488
+ readonly funding: readonly CovenantFundingInput[];
489
+ readonly changeAddress: string;
490
+ readonly networkId: string;
491
+ readonly feeRateSompiPerGram?: bigint | undefined;
492
+ /** Required when an input commits a compute budget > 0 (see COVENANT_V1_FEE_UNPRICED). */
493
+ readonly feeSompi?: bigint | undefined;
494
+ }
495
+ interface CovenantTransactionResult {
496
+ readonly transaction: any;
497
+ readonly rpcTransaction: any;
498
+ readonly txId: string;
499
+ readonly covenantId: string;
500
+ readonly lockingScript: {
501
+ readonly version: number;
502
+ readonly script: string;
503
+ };
504
+ readonly feeSompi: bigint;
505
+ readonly mass: bigint;
506
+ readonly storageMass: bigint;
507
+ readonly computeBudgets: readonly number[];
508
+ readonly assumptions: readonly string[];
509
+ }
510
+ /**
511
+ * A v1 transaction creating a new covenant: output 0 locks `valueSompi` to the
512
+ * contract's P2SH script and is bound, by the SDK, to the covenant id derived
513
+ * from input 0's outpoint; output 1 returns the change.
514
+ */
515
+ declare function buildCovenantGenesis(request: CovenantGenesisRequest): CovenantTransactionResult & {
516
+ readonly changeSompi: bigint;
517
+ };
518
+ interface CovenantUtxo extends SilverContractUtxo {
519
+ /** The covenant id the node reports for this UTXO. */
520
+ readonly covenantId: string;
521
+ }
522
+ interface CovenantTransitionRequest {
523
+ /** Artifact of the state the covenant output holds now. */
524
+ readonly current: SilAbiArtifact;
525
+ /** Artifact of the successor state (compileSilverSuccessor). */
526
+ readonly successor: SilAbiArtifact;
527
+ readonly contractName?: string | undefined;
528
+ /** The covenant declaration's policy name (its key in cov_decl_to_abi). */
529
+ readonly policy: string;
530
+ /** Arguments of the generated entry (the policy's extra call args). */
531
+ readonly args: readonly SilArtifactValue[];
532
+ readonly utxo: CovenantUtxo;
533
+ readonly networkId: string;
534
+ /** Compute budget committed by the covenant input. Explicit: there is no estimator. */
535
+ readonly computeBudget: number;
536
+ readonly feeRateSompiPerGram?: bigint | undefined;
537
+ /** Required when computeBudget > 0 (see COVENANT_V1_FEE_UNPRICED). */
538
+ readonly feeSompi?: bigint | undefined;
539
+ }
540
+ /**
541
+ * A v1 transaction advancing a singleton covenant by one transition: the
542
+ * covenant output is spent through the compiler-generated entry and its whole
543
+ * value, minus the fee, moves to one successor output locked to the successor
544
+ * state and bound to the same covenant id.
545
+ *
546
+ * Only single-successor, auth-bound declarations are built. The ABI does not
547
+ * record a declaration's binding or cardinality, so the node enforces them;
548
+ * leader contracts (cov binding, with a delegate entry) are NOT_IMPLEMENTED.
549
+ */
550
+ declare function buildCovenantTransition(request: CovenantTransitionRequest): CovenantTransactionResult & {
551
+ readonly successorSompi: bigint;
552
+ };
553
+
554
+ interface ScriptFundingRequest {
555
+ /** Candidate P2PK outputs of the key, in spending order. */
556
+ readonly utxos: readonly SilverContractUtxo[];
557
+ readonly privateKey: string;
558
+ readonly lockingScript: {
559
+ readonly version: number;
560
+ readonly script: string;
561
+ };
562
+ readonly valueSompi: bigint;
563
+ readonly networkId: string;
564
+ }
565
+ interface ScriptFundingResult {
566
+ readonly rpcTransaction: any;
567
+ readonly txId: string;
568
+ readonly outputIndex: 0;
569
+ readonly feeSompi: bigint;
570
+ readonly changeSompi: bigint;
571
+ readonly spent: readonly {
572
+ readonly transactionId: string;
573
+ readonly index: number;
574
+ }[];
575
+ }
576
+ declare function buildScriptFunding(request: ScriptFundingRequest): ScriptFundingResult;
577
+
229
578
  interface GeneratedKaspaDevAccount {
230
579
  readonly address: string;
231
580
  readonly publicKey?: string;
@@ -260,8 +609,7 @@ interface KaspaWasmSignerOptions {
260
609
  wasmConfig?: WasmProviderConfig;
261
610
  }
262
611
  /**
263
- * Real Kaspa signer using the official WASM SDK.
264
- * Only works if the 'kaspa' package is installed.
612
+ * Real Kaspa signer using the official WASM SDK (the pinned managed toolchain).
265
613
  */
266
614
  declare class KaspaWasmPrivateKeySigner implements HardkasTxPlanSigner {
267
615
  private options;
@@ -565,4 +913,4 @@ declare class WalletStateStoreJson {
565
913
  nextChangeIndex(walletId: string): number;
566
914
  }
567
915
 
568
- export { AddressManager, type ChainType, type CreateKaspaWalletOptions, DEV_ACCOUNTS_PASSWORD, type DeriveRequest, type DerivedAddress, type EncryptedKeystoreV2, type EvmExportResult, type GeneratedKaspaDevAccount, type HardkasAccount, type HardkasAccountKind, type HardkasBaseAccount, type HardkasEvmPrivateKeyAccount, type HardkasExternalWalletAccount, type HardkasKaspaAccount, type HardkasSigner, type HardkasSignerKind, type HardkasSyntheticAccount, type HardkasTxPlanSigner, type HelperDeriveRequest, type InputAuthorization, type KaspaKeyGenerator, KaspaSdkKeyGenerator, type KaspaSdkKeyGeneratorOptions, KaspaSdkRealTxSigner, type KaspaSdkRealTxSignerOptions, type KaspaSigningBackendStatus, KaspaWasmPrivateKeySigner, type KaspaWasmSignerOptions, type KeystoreCipherParams, type KeystoreKdfParams, KeystoreManager, type KeystorePayload, type KeystoreUnlockResult, LazyAccountAuthorizer, type NetworkType, type PathRequest, PrivateKeyAuthorizer, type RealAccountStore, type RealDevAccount, type RealTxSigner, type RealTxSigningInput, type RealTxSigningResult, type ResolveAccountOptions, type SignTxPlanInput, type SignTxPlanResult, SimulatedSigner, StaticSignatureScriptAuthorizer, type TxInputAuthorizationContext, type TxInputAuthorizer, UnsupportedKaspaKeyGenerator, UnsupportedRealKaspaSigner, UnsupportedRealTxSigner, type WalletArtifact, type WalletClaims, type WalletCreateRequest, type WalletImportRequest, WalletManager, WalletManagerImpl, type WalletMetadata, type WalletState, WalletStateStoreJson, type WalletStateStoreOptions, type WasmInputSigner, type WasmProviderConfig, appendToKeystoreJson, assertSigningNetworkAllowed, createDevSigner, createEmptyRealAccountStore, createLocalKaspaWallet, describeAccount, detectCapabilities, ensureDevAccounts, getDefaultRealAccountsPath, getKaspaSigningBackendStatus, getOrCreateDevAccount, getRealDevAccount, getRequiredEnv, importRealDevAccount, listDevAccountsSync, listHardkasAccounts, listRealDevAccounts, loadKaspaWasm, loadOrCreateRealAccountStore, loadRealAccountStore, loadRealAccountStoreSync, prepareEvmAccountExport, removeRealDevAccount, resolveHardkasAccount, resolveHardkasAccountAddress, resolveRealAccountOrAddress, saveRealAccountStore, signTxPlanArtifact, validateAccountName, validateAddressNetwork, validateAddressPrefix, withKeystoreLock };
916
+ export { AddressManager, type BalancedOutput, type ChainType, type CovenantFundingInput, type CovenantGenesisRequest, type CovenantTransactionResult, type CovenantTransitionRequest, type CovenantUtxo, type CreateKaspaWalletOptions, DEV_ACCOUNTS_PASSWORD, type DeriveRequest, type DerivedAddress, type EncryptedKeystoreV2, type EvmExportResult, type GeneratedKaspaDevAccount, type HardkasAccount, type HardkasAccountKind, type HardkasBaseAccount, type HardkasEvmPrivateKeyAccount, type HardkasExternalWalletAccount, type HardkasKaspaAccount, type HardkasSigner, type HardkasSignerKind, type HardkasSyntheticAccount, type HardkasTxPlanSigner, type HelperDeriveRequest, type InputAuthorization, type KaspaKeyGenerator, KaspaSdkKeyGenerator, type KaspaSdkKeyGeneratorOptions, KaspaSdkRealTxSigner, type KaspaSdkRealTxSignerOptions, type KaspaSigningBackendStatus, KaspaWasmPrivateKeySigner, type KaspaWasmSignerOptions, type KeystoreCipherParams, type KeystoreKdfParams, KeystoreManager, type KeystorePayload, type KeystoreUnlockResult, LazyAccountAuthorizer, type NetworkType, type PathRequest, PrivateKeyAuthorizer, type RealAccountStore, type RealDevAccount, type RealTxSigner, type RealTxSigningInput, type RealTxSigningResult, SILVER_SPEND_DRAFT_SCHEMA, type ScriptFundingRequest, type ScriptFundingResult, type ScriptOutput, type SignTxPlanInput, type SignTxPlanResult, type SilverContractUtxo, type SilverDraftArg, type SilverSignatureArg, type SilverSignerSlot, type SilverSpendArg, type SilverSpendDraft, type SilverSpendDraftRequest, type SilverSpendResult, type SilverSweepRequest, SimulatedSigner, StaticSignatureScriptAuthorizer, type TxInputAuthorizationContext, type TxInputAuthorizer, UnsupportedKaspaKeyGenerator, UnsupportedRealKaspaSigner, UnsupportedRealTxSigner, type WalletArtifact, type WalletClaims, type WalletCreateRequest, type WalletImportRequest, WalletManager, WalletManagerImpl, type WalletMetadata, type WalletState, WalletStateStoreJson, type WalletStateStoreOptions, type WasmInputSigner, type WasmProviderConfig, type WasmUtxoEntrySource, type WasmUtxoInput, appendToKeystoreJson, assertAccountCompatible, assertSigningNetworkAllowed, assertValueConservation, buildCovenantGenesis, buildCovenantTransition, buildScriptFunding, buildSilverSweep, createBalancedTransaction, createDevSigner, createEmptyRealAccountStore, createLocalKaspaWallet, createScriptTransaction, describeAccount, detectCapabilities, ensureDevAccounts, finalizeSilverSpend, getDefaultRealAccountsPath, getKaspaSigningBackendStatus, getOrCreateDevAccount, getRealDevAccount, getRequiredEnv, importRealDevAccount, listDevAccountsSync, listHardkasAccounts, listRealDevAccounts, loadKaspaWasm, loadKaspaWasmSync, loadOrCreateRealAccountStore, loadRealAccountStore, loadRealAccountStoreSync, planOutputsWithChange, prepareEvmAccountExport, prepareSilverSpend, removeRealDevAccount, resolveHardkasAccount, resolveHardkasAccountAddress, resolveRealAccountOrAddress, saveRealAccountStore, signSilverSpend, signTxPlanArtifact, toWasmScriptPublicKey, validateAccountName, validateAddressNetwork, validateAddressPrefix, withKeystoreLock };