@cardananium/cquisitor-lib 0.1.0-beta.57 → 0.1.0-beta.58

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.
@@ -445,6 +445,41 @@ export function decode_plutus_program_pretty_uplc(hex: string): string;
445
445
  */
446
446
  export function get_ref_script_bytes(tx_hex: string, output_index: number): string;
447
447
 
448
+ /**
449
+ * Add witnesses to an already built transaction, accepting witnesses in many
450
+ * shapes. The transaction body bytes (and therefore the transaction id and every
451
+ * existing signature) are preserved exactly.
452
+ *
453
+ * Each entry of `witnesses` is auto-detected and may be a single Vkeywitness, a
454
+ * single BootstrapWitness, a whole TransactionWitnessSet (e.g. a CIP-30 `signTx`
455
+ * result), or a whole transaction (its vkey/bootstrap witnesses are taken) —
456
+ * encoded as hex, base64, or a cardano-cli JSON text-envelope (`{ "cborHex": ... }`).
457
+ * Only vkey and bootstrap witnesses are merged; duplicates are ignored.
458
+ * @param {string} tx_hex
459
+ * @param {string[]} witnesses
460
+ * @returns {string}
461
+ */
462
+ export function add_witnesses_to_tx(tx_hex: string, witnesses: string[]): string;
463
+
464
+ /**
465
+ * Strict helper: add vkey witnesses, each the CBOR-hex of a single Vkeywitness
466
+ * (`[ vkey, signature ]`). Use `add_witnesses_to_tx` if the input format may vary.
467
+ * @param {string} tx_hex
468
+ * @param {string[]} vkey_witnesses_hex
469
+ * @returns {string}
470
+ */
471
+ export function add_vkey_witnesses_to_tx(tx_hex: string, vkey_witnesses_hex: string[]): string;
472
+
473
+ /**
474
+ * Strict helper: merge a whole TransactionWitnessSet (CBOR-hex) into a transaction.
475
+ * This is the canonical shape returned by a CIP-30 `signTx`.
476
+ * Use `add_witnesses_to_tx` if the input format may vary.
477
+ * @param {string} tx_hex
478
+ * @param {string} witness_set_hex
479
+ * @returns {string}
480
+ */
481
+ export function add_witness_set_to_tx(tx_hex: string, witness_set_hex: string): string;
482
+
448
483
  export interface CborPosition {
449
484
  offset: number;
450
485
  length: number;
@@ -1474,6 +1509,12 @@ export type NetworkType = "mainnet" | "preview" | "preprod";
1474
1509
 
1475
1510
  export interface ValidationInputContext {
1476
1511
  accountContexts: AccountInputContext[];
1512
+ /**
1513
+ * Current constitution. When present, enables the ParameterChange /
1514
+ * TreasuryWithdrawals guardrails-policy-hash check; when absent (older
1515
+ * callers, or a provider that can't supply it) that check is skipped.
1516
+ */
1517
+ constitution?: ConstitutionContext | null;
1477
1518
  currentCommitteeMembers: CommitteeInputContext[];
1478
1519
  drepContexts: DrepInputContext[];
1479
1520
  govActionContexts: GovActionInputContext[];
@@ -1494,6 +1535,17 @@ export interface AccountInputContext {
1494
1535
  isRegistered: boolean;
1495
1536
  payedDeposit?: number | null;
1496
1537
  }
1538
+ /**
1539
+ * Current on-chain constitution, as far as the caller can supply it. Only the
1540
+ * guardrails (constitution policy) script hash matters for validation.
1541
+ */
1542
+ export interface ConstitutionContext {
1543
+ /**
1544
+ * Guardrails script hash (hex). `None` means the constitution defines no
1545
+ * guardrails script.
1546
+ */
1547
+ guardrailScriptHash?: string | null;
1548
+ }
1497
1549
  export interface CommitteeInputContext {
1498
1550
  committeeMemberCold: LocalCredential;
1499
1551
  committeeMemberHot?: LocalCredential | null;
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./cquisitor_lib_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- Address, AddressKind, Anchor, AnchorDataHash, AssetName, AssetNames, Assets, AuxiliaryData, AuxiliaryDataHash, AuxiliaryDataSet, BaseAddress, BigInt, BigNum, Bip32PrivateKey, Bip32PublicKey, Block, BlockEra, BlockHash, BootstrapWitness, BootstrapWitnesses, ByronAddress, ByronAddressType, CborContainerType, CborSetType, Certificate, CertificateKind, Certificates, CertificatesBuilder, ChangeConfig, CoinSelectionStrategyCIP2, Committee, CommitteeColdResign, CommitteeHotAuth, Constitution, ConstrPlutusData, CostModel, Costmdls, CredKind, Credential, Credentials, DNSRecordAorAAAA, DNSRecordSRV, DRep, DRepDeregistration, DRepKind, DRepRegistration, DRepUpdate, DRepVotingThresholds, DataCost, DataHash, DatumSource, Ed25519KeyHash, Ed25519KeyHashes, Ed25519Signature, EnterpriseAddress, ExUnitPrices, ExUnits, FixedBlock, FixedTransaction, FixedTransactionBodies, FixedTransactionBody, FixedTxWitnessesSet, FixedVersionedBlock, GeneralTransactionMetadata, GenesisDelegateHash, GenesisHash, GenesisHashes, GenesisKeyDelegation, GovernanceAction, GovernanceActionId, GovernanceActionIds, GovernanceActionKind, HardForkInitiationAction, Header, HeaderBody, InfoAction, Int, Ipv4, Ipv6, KESSignature, KESVKey, Language, LanguageKind, Languages, LegacyDaedalusPrivateKey, LinearFee, MIRKind, MIRPot, MIRToStakeCredentials, MalformedAddress, MetadataJsonSchema, MetadataList, MetadataMap, Mint, MintAssets, MintBuilder, MintWitness, MintsAssets, MoveInstantaneousReward, MoveInstantaneousRewardsCert, MultiAsset, MultiHostName, NativeScript, NativeScriptKind, NativeScriptSource, NativeScripts, NetworkId, NetworkIdKind, NetworkInfo, NewConstitutionAction, NoConfidenceAction, Nonce, OperationalCert, OutputDatum, ParameterChangeAction, PlutusData, PlutusDataKind, PlutusDatumSchema, PlutusList, PlutusMap, PlutusMapValues, PlutusScript, PlutusScriptSource, PlutusScripts, PlutusWitness, PlutusWitnesses, Pointer, PointerAddress, PoolMetadata, PoolMetadataHash, PoolParams, PoolRegistration, PoolRetirement, PoolVotingThresholds, PrivateKey, ProposedProtocolParameterUpdates, ProtocolParamUpdate, ProtocolVersion, PublicKey, PublicKeys, Redeemer, RedeemerTag, RedeemerTagKind, Redeemers, Relay, RelayKind, Relays, RewardAddress, RewardAddresses, ScriptAll, ScriptAny, ScriptDataHash, ScriptHash, ScriptHashNamespace, ScriptHashes, ScriptNOfK, ScriptPubkey, ScriptRef, ScriptSchema, SingleHostAddr, SingleHostName, StakeAndVoteDelegation, StakeDelegation, StakeDeregistration, StakeRegistration, StakeRegistrationAndDelegation, StakeVoteRegistrationAndDelegation, Strings, TimelockExpiry, TimelockStart, Transaction, TransactionBatch, TransactionBatchList, TransactionBodies, TransactionBody, TransactionBuilder, TransactionBuilderConfig, TransactionBuilderConfigBuilder, TransactionHash, TransactionInput, TransactionInputs, TransactionMetadatum, TransactionMetadatumKind, TransactionMetadatumLabels, TransactionOutput, TransactionOutputAmountBuilder, TransactionOutputBuilder, TransactionOutputs, TransactionSetsState, TransactionUnspentOutput, TransactionUnspentOutputs, TransactionWitnessSet, TransactionWitnessSets, TreasuryWithdrawals, TreasuryWithdrawalsAction, TxInputsBuilder, URL, UnitInterval, Update, UpdateCommitteeAction, VRFCert, VRFKeyHash, VRFVKey, Value, VersionedBlock, Vkey, Vkeys, Vkeywitness, Vkeywitnesses, VoteDelegation, VoteKind, VoteRegistrationAndDelegation, Voter, VoterKind, Voters, VotingBuilder, VotingProcedure, VotingProcedures, VotingProposal, VotingProposalBuilder, VotingProposals, Withdrawals, WithdrawalsBuilder, calculate_ex_units_ceil_cost, cbor_to_json, cddl_format, cddl_from_str, cddl_outline, cddl_references, cddl_symbol_at, check_block_or_tx_signatures, create_send_all, decode_arbitrary_bytes_from_metadatum, decode_cbor_against_cddl, decode_metadatum_to_json_str, decode_plutus_datum_to_json_str, decode_plutus_program_pretty_uplc, decode_plutus_program_uplc_json, decode_specific_type, decrypt_with_password, encode_arbitrary_bytes_as_metadatum, encode_json_str_to_metadatum, encode_json_str_to_native_script, encode_json_str_to_plutus_datum, encrypt_with_password, execute_tx_scripts, extract_hashes_from_transaction_js, get_decodable_types, get_deposit, get_implicit_input, get_necessary_data_list_js, get_possible_types_for_input, get_ref_script_bytes, get_utxo_list_from_tx, has_transaction_set_tag, hash_auxiliary_data, hash_plutus_data, hash_script_data, make_daedalus_bootstrap_witness, make_icarus_bootstrap_witness, make_vkey_witness, map_cbor_to_cddl, min_ada_for_output, min_fee, min_ref_script_fee, min_script_fee, validate_cbor_against_cddl, validate_cbor_from_slice, validate_cddl, validate_cddl_from_str, validate_json_from_str, validate_transaction_js
8
+ Address, AddressKind, Anchor, AnchorDataHash, AssetName, AssetNames, Assets, AuxiliaryData, AuxiliaryDataHash, AuxiliaryDataSet, BaseAddress, BigInt, BigNum, Bip32PrivateKey, Bip32PublicKey, Block, BlockEra, BlockHash, BootstrapWitness, BootstrapWitnesses, ByronAddress, ByronAddressType, CborContainerType, CborSetType, Certificate, CertificateKind, Certificates, CertificatesBuilder, ChangeConfig, CoinSelectionStrategyCIP2, Committee, CommitteeColdResign, CommitteeHotAuth, Constitution, ConstrPlutusData, CostModel, Costmdls, CredKind, Credential, Credentials, DNSRecordAorAAAA, DNSRecordSRV, DRep, DRepDeregistration, DRepKind, DRepRegistration, DRepUpdate, DRepVotingThresholds, DataCost, DataHash, DatumSource, Ed25519KeyHash, Ed25519KeyHashes, Ed25519Signature, EnterpriseAddress, ExUnitPrices, ExUnits, FixedBlock, FixedTransaction, FixedTransactionBodies, FixedTransactionBody, FixedTxWitnessesSet, FixedVersionedBlock, GeneralTransactionMetadata, GenesisDelegateHash, GenesisHash, GenesisHashes, GenesisKeyDelegation, GovernanceAction, GovernanceActionId, GovernanceActionIds, GovernanceActionKind, HardForkInitiationAction, Header, HeaderBody, InfoAction, Int, Ipv4, Ipv6, KESSignature, KESVKey, Language, LanguageKind, Languages, LegacyDaedalusPrivateKey, LinearFee, MIRKind, MIRPot, MIRToStakeCredentials, MalformedAddress, MetadataJsonSchema, MetadataList, MetadataMap, Mint, MintAssets, MintBuilder, MintWitness, MintsAssets, MoveInstantaneousReward, MoveInstantaneousRewardsCert, MultiAsset, MultiHostName, NativeScript, NativeScriptKind, NativeScriptSource, NativeScripts, NetworkId, NetworkIdKind, NetworkInfo, NewConstitutionAction, NoConfidenceAction, Nonce, OperationalCert, OutputDatum, ParameterChangeAction, PlutusData, PlutusDataKind, PlutusDatumSchema, PlutusList, PlutusMap, PlutusMapValues, PlutusScript, PlutusScriptSource, PlutusScripts, PlutusWitness, PlutusWitnesses, Pointer, PointerAddress, PoolMetadata, PoolMetadataHash, PoolParams, PoolRegistration, PoolRetirement, PoolVotingThresholds, PrivateKey, ProposedProtocolParameterUpdates, ProtocolParamUpdate, ProtocolVersion, PublicKey, PublicKeys, Redeemer, RedeemerTag, RedeemerTagKind, Redeemers, Relay, RelayKind, Relays, RewardAddress, RewardAddresses, ScriptAll, ScriptAny, ScriptDataHash, ScriptHash, ScriptHashNamespace, ScriptHashes, ScriptNOfK, ScriptPubkey, ScriptRef, ScriptSchema, SingleHostAddr, SingleHostName, StakeAndVoteDelegation, StakeDelegation, StakeDeregistration, StakeRegistration, StakeRegistrationAndDelegation, StakeVoteRegistrationAndDelegation, Strings, TimelockExpiry, TimelockStart, Transaction, TransactionBatch, TransactionBatchList, TransactionBodies, TransactionBody, TransactionBuilder, TransactionBuilderConfig, TransactionBuilderConfigBuilder, TransactionHash, TransactionInput, TransactionInputs, TransactionMetadatum, TransactionMetadatumKind, TransactionMetadatumLabels, TransactionOutput, TransactionOutputAmountBuilder, TransactionOutputBuilder, TransactionOutputs, TransactionSetsState, TransactionUnspentOutput, TransactionUnspentOutputs, TransactionWitnessSet, TransactionWitnessSets, TreasuryWithdrawals, TreasuryWithdrawalsAction, TxInputsBuilder, URL, UnitInterval, Update, UpdateCommitteeAction, VRFCert, VRFKeyHash, VRFVKey, Value, VersionedBlock, Vkey, Vkeys, Vkeywitness, Vkeywitnesses, VoteDelegation, VoteKind, VoteRegistrationAndDelegation, Voter, VoterKind, Voters, VotingBuilder, VotingProcedure, VotingProcedures, VotingProposal, VotingProposalBuilder, VotingProposals, Withdrawals, WithdrawalsBuilder, add_vkey_witnesses_to_tx, add_witness_set_to_tx, add_witnesses_to_tx, calculate_ex_units_ceil_cost, cbor_to_json, cddl_format, cddl_from_str, cddl_outline, cddl_references, cddl_symbol_at, check_block_or_tx_signatures, create_send_all, decode_arbitrary_bytes_from_metadatum, decode_cbor_against_cddl, decode_metadatum_to_json_str, decode_plutus_datum_to_json_str, decode_plutus_program_pretty_uplc, decode_plutus_program_uplc_json, decode_specific_type, decrypt_with_password, encode_arbitrary_bytes_as_metadatum, encode_json_str_to_metadatum, encode_json_str_to_native_script, encode_json_str_to_plutus_datum, encrypt_with_password, execute_tx_scripts, extract_hashes_from_transaction_js, get_decodable_types, get_deposit, get_implicit_input, get_necessary_data_list_js, get_possible_types_for_input, get_ref_script_bytes, get_utxo_list_from_tx, has_transaction_set_tag, hash_auxiliary_data, hash_plutus_data, hash_script_data, make_daedalus_bootstrap_witness, make_icarus_bootstrap_witness, make_vkey_witness, map_cbor_to_cddl, min_ada_for_output, min_fee, min_ref_script_fee, min_script_fee, validate_cbor_against_cddl, validate_cbor_from_slice, validate_cddl, validate_cddl_from_str, validate_json_from_str, validate_transaction_js
9
9
  } from "./cquisitor_lib_bg.js";
@@ -28421,6 +28421,114 @@ export class WithdrawalsBuilder {
28421
28421
  }
28422
28422
  if (Symbol.dispose) WithdrawalsBuilder.prototype[Symbol.dispose] = WithdrawalsBuilder.prototype.free;
28423
28423
 
28424
+ /**
28425
+ * Strict helper: add a list of vkey witnesses, each the CBOR-hex of a single
28426
+ * `Vkeywitness` (`[ vkey, signature ]`). Use [`add_witnesses_to_tx`] if the
28427
+ * input format may vary.
28428
+ * @param {string} tx_hex
28429
+ * @param {string[]} vkey_witnesses_hex
28430
+ * @returns {string}
28431
+ */
28432
+ export function add_vkey_witnesses_to_tx(tx_hex, vkey_witnesses_hex) {
28433
+ let deferred4_0;
28434
+ let deferred4_1;
28435
+ try {
28436
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28437
+ const len0 = WASM_VECTOR_LEN;
28438
+ const ptr1 = passArrayJsValueToWasm0(vkey_witnesses_hex, wasm.__wbindgen_malloc);
28439
+ const len1 = WASM_VECTOR_LEN;
28440
+ const ret = wasm.add_vkey_witnesses_to_tx(ptr0, len0, ptr1, len1);
28441
+ var ptr3 = ret[0];
28442
+ var len3 = ret[1];
28443
+ if (ret[3]) {
28444
+ ptr3 = 0; len3 = 0;
28445
+ throw takeFromExternrefTable0(ret[2]);
28446
+ }
28447
+ deferred4_0 = ptr3;
28448
+ deferred4_1 = len3;
28449
+ return getStringFromWasm0(ptr3, len3);
28450
+ } finally {
28451
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
28452
+ }
28453
+ }
28454
+
28455
+ /**
28456
+ * Strict helper: merge a whole `TransactionWitnessSet` (CBOR-hex) into a
28457
+ * transaction. This is the canonical shape returned by a CIP-30 `signTx`.
28458
+ * Use [`add_witnesses_to_tx`] if the input format may vary.
28459
+ * @param {string} tx_hex
28460
+ * @param {string} witness_set_hex
28461
+ * @returns {string}
28462
+ */
28463
+ export function add_witness_set_to_tx(tx_hex, witness_set_hex) {
28464
+ let deferred4_0;
28465
+ let deferred4_1;
28466
+ try {
28467
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28468
+ const len0 = WASM_VECTOR_LEN;
28469
+ const ptr1 = passStringToWasm0(witness_set_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28470
+ const len1 = WASM_VECTOR_LEN;
28471
+ const ret = wasm.add_witness_set_to_tx(ptr0, len0, ptr1, len1);
28472
+ var ptr3 = ret[0];
28473
+ var len3 = ret[1];
28474
+ if (ret[3]) {
28475
+ ptr3 = 0; len3 = 0;
28476
+ throw takeFromExternrefTable0(ret[2]);
28477
+ }
28478
+ deferred4_0 = ptr3;
28479
+ deferred4_1 = len3;
28480
+ return getStringFromWasm0(ptr3, len3);
28481
+ } finally {
28482
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
28483
+ }
28484
+ }
28485
+
28486
+ /**
28487
+ * Add witnesses to an already built transaction, accepting witnesses in many
28488
+ * shapes — mirroring the format-flexible behaviour of the original PR.
28489
+ *
28490
+ * The transaction body bytes (and therefore the transaction id / every existing
28491
+ * signature) are preserved exactly, because we rely on CSL's `FixedTransaction`,
28492
+ * which keeps the original body bytes and only re-encodes the witness set.
28493
+ *
28494
+ * Each entry of `witnesses` is auto-detected and may be any of:
28495
+ * - a single `Vkeywitness` (`[ vkey, signature ]`);
28496
+ * - a single `BootstrapWitness`;
28497
+ * - a whole `TransactionWitnessSet` (e.g. the result of a CIP-30 `signTx`);
28498
+ * - a whole transaction (signed or not) — its vkey/bootstrap witnesses are taken;
28499
+ *
28500
+ * each of those encoded as hex, base64, or wrapped in a cardano-cli style JSON
28501
+ * text-envelope (`{ "cborHex": "..." }`). Only vkey and bootstrap witnesses are
28502
+ * merged (the parts a signer can contribute); duplicates are ignored by CSL.
28503
+ *
28504
+ * Returns the hex of the resulting transaction.
28505
+ * @param {string} tx_hex
28506
+ * @param {string[]} witnesses
28507
+ * @returns {string}
28508
+ */
28509
+ export function add_witnesses_to_tx(tx_hex, witnesses) {
28510
+ let deferred4_0;
28511
+ let deferred4_1;
28512
+ try {
28513
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28514
+ const len0 = WASM_VECTOR_LEN;
28515
+ const ptr1 = passArrayJsValueToWasm0(witnesses, wasm.__wbindgen_malloc);
28516
+ const len1 = WASM_VECTOR_LEN;
28517
+ const ret = wasm.add_witnesses_to_tx(ptr0, len0, ptr1, len1);
28518
+ var ptr3 = ret[0];
28519
+ var len3 = ret[1];
28520
+ if (ret[3]) {
28521
+ ptr3 = 0; len3 = 0;
28522
+ throw takeFromExternrefTable0(ret[2]);
28523
+ }
28524
+ deferred4_0 = ptr3;
28525
+ deferred4_1 = len3;
28526
+ return getStringFromWasm0(ptr3, len3);
28527
+ } finally {
28528
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
28529
+ }
28530
+ }
28531
+
28424
28532
  /**
28425
28533
  * @param {ExUnits} ex_units
28426
28534
  * @param {ExUnitPrices} ex_unit_prices
Binary file
@@ -4,12 +4,18 @@ export const memory: WebAssembly.Memory;
4
4
  export const decode_specific_type: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
5
5
  export const get_decodable_types: () => [number, number];
6
6
  export const get_possible_types_for_input: (a: number, b: number) => [number, number];
7
- export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
7
+ export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
8
+ export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
9
+ export const extract_hashes_from_transaction_js: (a: number, b: number) => [number, number, number, number];
8
10
  export const decode_plutus_program_pretty_uplc: (a: number, b: number) => [number, number, number, number];
9
11
  export const decode_plutus_program_uplc_json: (a: number, b: number) => [number, number, number];
10
12
  export const execute_tx_scripts: (a: number, b: number, c: any, d: any) => [number, number, number];
11
13
  export const get_ref_script_bytes: (a: number, b: number, c: number) => [number, number, number, number];
12
14
  export const get_utxo_list_from_tx: (a: number, b: number) => [number, number, number, number];
15
+ export const add_vkey_witnesses_to_tx: (a: number, b: number, c: number, d: number) => [number, number, number, number];
16
+ export const add_witness_set_to_tx: (a: number, b: number, c: number, d: number) => [number, number, number, number];
17
+ export const add_witnesses_to_tx: (a: number, b: number, c: number, d: number) => [number, number, number, number];
18
+ export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
13
19
  export const cbor_to_json: (a: number, b: number) => [number, number, number];
14
20
  export const cddl_format: (a: number, b: number) => [number, number, number, number];
15
21
  export const cddl_outline: (a: number, b: number) => [number, number, number];
@@ -19,9 +25,6 @@ export const decode_cbor_against_cddl: (a: number, b: number, c: number, d: numb
19
25
  export const map_cbor_to_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
20
26
  export const validate_cbor_against_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
21
27
  export const validate_cddl: (a: number, b: number) => [number, number, number];
22
- export const extract_hashes_from_transaction_js: (a: number, b: number) => [number, number, number, number];
23
- export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
24
- export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
25
28
  export const validate_cbor_from_slice: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
26
29
  export const validate_json_from_str: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
27
30
  export const cddl_from_str: (a: number, b: number) => [number, number, number];
@@ -445,6 +445,41 @@ export function decode_plutus_program_pretty_uplc(hex: string): string;
445
445
  */
446
446
  export function get_ref_script_bytes(tx_hex: string, output_index: number): string;
447
447
 
448
+ /**
449
+ * Add witnesses to an already built transaction, accepting witnesses in many
450
+ * shapes. The transaction body bytes (and therefore the transaction id and every
451
+ * existing signature) are preserved exactly.
452
+ *
453
+ * Each entry of `witnesses` is auto-detected and may be a single Vkeywitness, a
454
+ * single BootstrapWitness, a whole TransactionWitnessSet (e.g. a CIP-30 `signTx`
455
+ * result), or a whole transaction (its vkey/bootstrap witnesses are taken) —
456
+ * encoded as hex, base64, or a cardano-cli JSON text-envelope (`{ "cborHex": ... }`).
457
+ * Only vkey and bootstrap witnesses are merged; duplicates are ignored.
458
+ * @param {string} tx_hex
459
+ * @param {string[]} witnesses
460
+ * @returns {string}
461
+ */
462
+ export function add_witnesses_to_tx(tx_hex: string, witnesses: string[]): string;
463
+
464
+ /**
465
+ * Strict helper: add vkey witnesses, each the CBOR-hex of a single Vkeywitness
466
+ * (`[ vkey, signature ]`). Use `add_witnesses_to_tx` if the input format may vary.
467
+ * @param {string} tx_hex
468
+ * @param {string[]} vkey_witnesses_hex
469
+ * @returns {string}
470
+ */
471
+ export function add_vkey_witnesses_to_tx(tx_hex: string, vkey_witnesses_hex: string[]): string;
472
+
473
+ /**
474
+ * Strict helper: merge a whole TransactionWitnessSet (CBOR-hex) into a transaction.
475
+ * This is the canonical shape returned by a CIP-30 `signTx`.
476
+ * Use `add_witnesses_to_tx` if the input format may vary.
477
+ * @param {string} tx_hex
478
+ * @param {string} witness_set_hex
479
+ * @returns {string}
480
+ */
481
+ export function add_witness_set_to_tx(tx_hex: string, witness_set_hex: string): string;
482
+
448
483
  export interface CborPosition {
449
484
  offset: number;
450
485
  length: number;
@@ -1474,6 +1509,12 @@ export type NetworkType = "mainnet" | "preview" | "preprod";
1474
1509
 
1475
1510
  export interface ValidationInputContext {
1476
1511
  accountContexts: AccountInputContext[];
1512
+ /**
1513
+ * Current constitution. When present, enables the ParameterChange /
1514
+ * TreasuryWithdrawals guardrails-policy-hash check; when absent (older
1515
+ * callers, or a provider that can't supply it) that check is skipped.
1516
+ */
1517
+ constitution?: ConstitutionContext | null;
1477
1518
  currentCommitteeMembers: CommitteeInputContext[];
1478
1519
  drepContexts: DrepInputContext[];
1479
1520
  govActionContexts: GovActionInputContext[];
@@ -1494,6 +1535,17 @@ export interface AccountInputContext {
1494
1535
  isRegistered: boolean;
1495
1536
  payedDeposit?: number | null;
1496
1537
  }
1538
+ /**
1539
+ * Current on-chain constitution, as far as the caller can supply it. Only the
1540
+ * guardrails (constitution policy) script hash matters for validation.
1541
+ */
1542
+ export interface ConstitutionContext {
1543
+ /**
1544
+ * Guardrails script hash (hex). `None` means the constitution defines no
1545
+ * guardrails script.
1546
+ */
1547
+ guardrailScriptHash?: string | null;
1548
+ }
1497
1549
  export interface CommitteeInputContext {
1498
1550
  committeeMemberCold: LocalCredential;
1499
1551
  committeeMemberHot?: LocalCredential | null;
@@ -28646,6 +28646,117 @@ class WithdrawalsBuilder {
28646
28646
  if (Symbol.dispose) WithdrawalsBuilder.prototype[Symbol.dispose] = WithdrawalsBuilder.prototype.free;
28647
28647
  exports.WithdrawalsBuilder = WithdrawalsBuilder;
28648
28648
 
28649
+ /**
28650
+ * Strict helper: add a list of vkey witnesses, each the CBOR-hex of a single
28651
+ * `Vkeywitness` (`[ vkey, signature ]`). Use [`add_witnesses_to_tx`] if the
28652
+ * input format may vary.
28653
+ * @param {string} tx_hex
28654
+ * @param {string[]} vkey_witnesses_hex
28655
+ * @returns {string}
28656
+ */
28657
+ function add_vkey_witnesses_to_tx(tx_hex, vkey_witnesses_hex) {
28658
+ let deferred4_0;
28659
+ let deferred4_1;
28660
+ try {
28661
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28662
+ const len0 = WASM_VECTOR_LEN;
28663
+ const ptr1 = passArrayJsValueToWasm0(vkey_witnesses_hex, wasm.__wbindgen_malloc);
28664
+ const len1 = WASM_VECTOR_LEN;
28665
+ const ret = wasm.add_vkey_witnesses_to_tx(ptr0, len0, ptr1, len1);
28666
+ var ptr3 = ret[0];
28667
+ var len3 = ret[1];
28668
+ if (ret[3]) {
28669
+ ptr3 = 0; len3 = 0;
28670
+ throw takeFromExternrefTable0(ret[2]);
28671
+ }
28672
+ deferred4_0 = ptr3;
28673
+ deferred4_1 = len3;
28674
+ return getStringFromWasm0(ptr3, len3);
28675
+ } finally {
28676
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
28677
+ }
28678
+ }
28679
+ exports.add_vkey_witnesses_to_tx = add_vkey_witnesses_to_tx;
28680
+
28681
+ /**
28682
+ * Strict helper: merge a whole `TransactionWitnessSet` (CBOR-hex) into a
28683
+ * transaction. This is the canonical shape returned by a CIP-30 `signTx`.
28684
+ * Use [`add_witnesses_to_tx`] if the input format may vary.
28685
+ * @param {string} tx_hex
28686
+ * @param {string} witness_set_hex
28687
+ * @returns {string}
28688
+ */
28689
+ function add_witness_set_to_tx(tx_hex, witness_set_hex) {
28690
+ let deferred4_0;
28691
+ let deferred4_1;
28692
+ try {
28693
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28694
+ const len0 = WASM_VECTOR_LEN;
28695
+ const ptr1 = passStringToWasm0(witness_set_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28696
+ const len1 = WASM_VECTOR_LEN;
28697
+ const ret = wasm.add_witness_set_to_tx(ptr0, len0, ptr1, len1);
28698
+ var ptr3 = ret[0];
28699
+ var len3 = ret[1];
28700
+ if (ret[3]) {
28701
+ ptr3 = 0; len3 = 0;
28702
+ throw takeFromExternrefTable0(ret[2]);
28703
+ }
28704
+ deferred4_0 = ptr3;
28705
+ deferred4_1 = len3;
28706
+ return getStringFromWasm0(ptr3, len3);
28707
+ } finally {
28708
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
28709
+ }
28710
+ }
28711
+ exports.add_witness_set_to_tx = add_witness_set_to_tx;
28712
+
28713
+ /**
28714
+ * Add witnesses to an already built transaction, accepting witnesses in many
28715
+ * shapes — mirroring the format-flexible behaviour of the original PR.
28716
+ *
28717
+ * The transaction body bytes (and therefore the transaction id / every existing
28718
+ * signature) are preserved exactly, because we rely on CSL's `FixedTransaction`,
28719
+ * which keeps the original body bytes and only re-encodes the witness set.
28720
+ *
28721
+ * Each entry of `witnesses` is auto-detected and may be any of:
28722
+ * - a single `Vkeywitness` (`[ vkey, signature ]`);
28723
+ * - a single `BootstrapWitness`;
28724
+ * - a whole `TransactionWitnessSet` (e.g. the result of a CIP-30 `signTx`);
28725
+ * - a whole transaction (signed or not) — its vkey/bootstrap witnesses are taken;
28726
+ *
28727
+ * each of those encoded as hex, base64, or wrapped in a cardano-cli style JSON
28728
+ * text-envelope (`{ "cborHex": "..." }`). Only vkey and bootstrap witnesses are
28729
+ * merged (the parts a signer can contribute); duplicates are ignored by CSL.
28730
+ *
28731
+ * Returns the hex of the resulting transaction.
28732
+ * @param {string} tx_hex
28733
+ * @param {string[]} witnesses
28734
+ * @returns {string}
28735
+ */
28736
+ function add_witnesses_to_tx(tx_hex, witnesses) {
28737
+ let deferred4_0;
28738
+ let deferred4_1;
28739
+ try {
28740
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28741
+ const len0 = WASM_VECTOR_LEN;
28742
+ const ptr1 = passArrayJsValueToWasm0(witnesses, wasm.__wbindgen_malloc);
28743
+ const len1 = WASM_VECTOR_LEN;
28744
+ const ret = wasm.add_witnesses_to_tx(ptr0, len0, ptr1, len1);
28745
+ var ptr3 = ret[0];
28746
+ var len3 = ret[1];
28747
+ if (ret[3]) {
28748
+ ptr3 = 0; len3 = 0;
28749
+ throw takeFromExternrefTable0(ret[2]);
28750
+ }
28751
+ deferred4_0 = ptr3;
28752
+ deferred4_1 = len3;
28753
+ return getStringFromWasm0(ptr3, len3);
28754
+ } finally {
28755
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
28756
+ }
28757
+ }
28758
+ exports.add_witnesses_to_tx = add_witnesses_to_tx;
28759
+
28649
28760
  /**
28650
28761
  * @param {ExUnits} ex_units
28651
28762
  * @param {ExUnitPrices} ex_unit_prices
Binary file
@@ -4,12 +4,18 @@ export const memory: WebAssembly.Memory;
4
4
  export const decode_specific_type: (a: number, b: number, c: number, d: number, e: any) => [number, number, number];
5
5
  export const get_decodable_types: () => [number, number];
6
6
  export const get_possible_types_for_input: (a: number, b: number) => [number, number];
7
- export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
7
+ export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
8
+ export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
9
+ export const extract_hashes_from_transaction_js: (a: number, b: number) => [number, number, number, number];
8
10
  export const decode_plutus_program_pretty_uplc: (a: number, b: number) => [number, number, number, number];
9
11
  export const decode_plutus_program_uplc_json: (a: number, b: number) => [number, number, number];
10
12
  export const execute_tx_scripts: (a: number, b: number, c: any, d: any) => [number, number, number];
11
13
  export const get_ref_script_bytes: (a: number, b: number, c: number) => [number, number, number, number];
12
14
  export const get_utxo_list_from_tx: (a: number, b: number) => [number, number, number, number];
15
+ export const add_vkey_witnesses_to_tx: (a: number, b: number, c: number, d: number) => [number, number, number, number];
16
+ export const add_witness_set_to_tx: (a: number, b: number, c: number, d: number) => [number, number, number, number];
17
+ export const add_witnesses_to_tx: (a: number, b: number, c: number, d: number) => [number, number, number, number];
18
+ export const check_block_or_tx_signatures: (a: number, b: number) => [number, number, number];
13
19
  export const cbor_to_json: (a: number, b: number) => [number, number, number];
14
20
  export const cddl_format: (a: number, b: number) => [number, number, number, number];
15
21
  export const cddl_outline: (a: number, b: number) => [number, number, number];
@@ -19,9 +25,6 @@ export const decode_cbor_against_cddl: (a: number, b: number, c: number, d: numb
19
25
  export const map_cbor_to_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
20
26
  export const validate_cbor_against_cddl: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
21
27
  export const validate_cddl: (a: number, b: number) => [number, number, number];
22
- export const extract_hashes_from_transaction_js: (a: number, b: number) => [number, number, number, number];
23
- export const get_necessary_data_list_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
24
- export const validate_transaction_js: (a: number, b: number, c: number, d: number) => [number, number, number, number];
25
28
  export const validate_cbor_from_slice: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
26
29
  export const validate_json_from_str: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
27
30
  export const cddl_from_str: (a: number, b: number) => [number, number, number];
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Evgenii Lisitskii <evgeniilisitskii@gmail.com>"
5
5
  ],
6
6
  "description": "Cardano transaction validation library",
7
- "version": "0.1.0-beta.57",
7
+ "version": "0.1.0-beta.58",
8
8
  "license": "Apache-2.0",
9
9
  "files": [
10
10
  "node/cquisitor_lib_bg.wasm",