@cardananium/cquisitor-lib 0.1.0-beta.33 → 0.1.0-beta.34

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.
@@ -371,6 +371,39 @@ module.exports.validate_transaction_js = function(tx_hex, validation_context) {
371
371
  }
372
372
  };
373
373
 
374
+ /**
375
+ * WASM export: Extracts all script and datum hashes from a transaction
376
+ * Returns JSON string with ExtractedHashes structure
377
+ * @param {string} tx_hex
378
+ * @returns {string}
379
+ */
380
+ module.exports.extract_hashes_from_transaction_js = function(tx_hex) {
381
+ let deferred3_0;
382
+ let deferred3_1;
383
+ try {
384
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
385
+ const ptr0 = passStringToWasm0(tx_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
386
+ const len0 = WASM_VECTOR_LEN;
387
+ wasm.extract_hashes_from_transaction_js(retptr, ptr0, len0);
388
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
389
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
390
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
391
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
392
+ var ptr2 = r0;
393
+ var len2 = r1;
394
+ if (r3) {
395
+ ptr2 = 0; len2 = 0;
396
+ throw takeObject(r2);
397
+ }
398
+ deferred3_0 = ptr2;
399
+ deferred3_1 = len2;
400
+ return getStringFromWasm0(ptr2, len2);
401
+ } finally {
402
+ wasm.__wbindgen_add_to_stack_pointer(16);
403
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
404
+ }
405
+ };
406
+
374
407
  /**
375
408
  * @param {string} hex
376
409
  * @returns {any}
@@ -473,28 +506,6 @@ module.exports.execute_tx_scripts = function(tx_hex, utxo_json, cost_models_json
473
506
  }
474
507
  };
475
508
 
476
- /**
477
- * @param {string} cbor_hex
478
- * @returns {any}
479
- */
480
- module.exports.cbor_to_json = function(cbor_hex) {
481
- try {
482
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
483
- const ptr0 = passStringToWasm0(cbor_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
484
- const len0 = WASM_VECTOR_LEN;
485
- wasm.cbor_to_json(retptr, ptr0, len0);
486
- var r0 = getInt32Memory0()[retptr / 4 + 0];
487
- var r1 = getInt32Memory0()[retptr / 4 + 1];
488
- var r2 = getInt32Memory0()[retptr / 4 + 2];
489
- if (r2) {
490
- throw takeObject(r1);
491
- }
492
- return takeObject(r0);
493
- } finally {
494
- wasm.__wbindgen_add_to_stack_pointer(16);
495
- }
496
- };
497
-
498
509
  /**
499
510
  * @param {string} tx_hex
500
511
  * @param {number} output_index
@@ -527,6 +538,28 @@ module.exports.get_ref_script_bytes = function(tx_hex, output_index) {
527
538
  }
528
539
  };
529
540
 
541
+ /**
542
+ * @param {string} cbor_hex
543
+ * @returns {any}
544
+ */
545
+ module.exports.cbor_to_json = function(cbor_hex) {
546
+ try {
547
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
548
+ const ptr0 = passStringToWasm0(cbor_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
549
+ const len0 = WASM_VECTOR_LEN;
550
+ wasm.cbor_to_json(retptr, ptr0, len0);
551
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
552
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
553
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
554
+ if (r2) {
555
+ throw takeObject(r1);
556
+ }
557
+ return takeObject(r0);
558
+ } finally {
559
+ wasm.__wbindgen_add_to_stack_pointer(16);
560
+ }
561
+ };
562
+
530
563
  function getArrayU8FromWasm0(ptr, len) {
531
564
  ptr = ptr >>> 0;
532
565
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
@@ -1113,73 +1146,78 @@ function handleError(f, args) {
1113
1146
  }
1114
1147
  /**
1115
1148
  */
1116
- module.exports.NativeScriptKind = Object.freeze({ ScriptPubkey:0,"0":"ScriptPubkey",ScriptAll:1,"1":"ScriptAll",ScriptAny:2,"2":"ScriptAny",ScriptNOfK:3,"3":"ScriptNOfK",TimelockStart:4,"4":"TimelockStart",TimelockExpiry:5,"5":"TimelockExpiry", });
1149
+ module.exports.LanguageKind = Object.freeze({ PlutusV1:0,"0":"PlutusV1",PlutusV2:1,"1":"PlutusV2",PlutusV3:2,"2":"PlutusV3", });
1117
1150
  /**
1118
1151
  */
1119
- module.exports.CborContainerType = Object.freeze({ Array:0,"0":"Array",Map:1,"1":"Map", });
1152
+ module.exports.CertificateKind = Object.freeze({ StakeRegistration:0,"0":"StakeRegistration",StakeDeregistration:1,"1":"StakeDeregistration",StakeDelegation:2,"2":"StakeDelegation",PoolRegistration:3,"3":"PoolRegistration",PoolRetirement:4,"4":"PoolRetirement",GenesisKeyDelegation:5,"5":"GenesisKeyDelegation",MoveInstantaneousRewardsCert:6,"6":"MoveInstantaneousRewardsCert",CommitteeHotAuth:7,"7":"CommitteeHotAuth",CommitteeColdResign:8,"8":"CommitteeColdResign",DRepDeregistration:9,"9":"DRepDeregistration",DRepRegistration:10,"10":"DRepRegistration",DRepUpdate:11,"11":"DRepUpdate",StakeAndVoteDelegation:12,"12":"StakeAndVoteDelegation",StakeRegistrationAndDelegation:13,"13":"StakeRegistrationAndDelegation",StakeVoteRegistrationAndDelegation:14,"14":"StakeVoteRegistrationAndDelegation",VoteDelegation:15,"15":"VoteDelegation",VoteRegistrationAndDelegation:16,"16":"VoteRegistrationAndDelegation", });
1120
1153
  /**
1121
- * Each new language uses a different namespace for hashing its script
1122
- * This is because you could have a language where the same bytes have different semantics
1123
- * So this avoids scripts in different languages mapping to the same hash
1124
- * Note that the enum value here is different than the enum value for deciding the cost model of a script
1125
1154
  */
1126
- module.exports.ScriptHashNamespace = Object.freeze({ NativeScript:0,"0":"NativeScript",PlutusScript:1,"1":"PlutusScript",PlutusScriptV2:2,"2":"PlutusScriptV2",PlutusScriptV3:3,"3":"PlutusScriptV3", });
1155
+ module.exports.PlutusDataKind = Object.freeze({ ConstrPlutusData:0,"0":"ConstrPlutusData",Map:1,"1":"Map",List:2,"2":"List",Integer:3,"3":"Integer",Bytes:4,"4":"Bytes", });
1127
1156
  /**
1128
1157
  */
1129
- module.exports.CborSetType = Object.freeze({ Tagged:0,"0":"Tagged",Untagged:1,"1":"Untagged", });
1158
+ module.exports.GovernanceActionKind = Object.freeze({ ParameterChangeAction:0,"0":"ParameterChangeAction",HardForkInitiationAction:1,"1":"HardForkInitiationAction",TreasuryWithdrawalsAction:2,"2":"TreasuryWithdrawalsAction",NoConfidenceAction:3,"3":"NoConfidenceAction",UpdateCommitteeAction:4,"4":"UpdateCommitteeAction",NewConstitutionAction:5,"5":"NewConstitutionAction",InfoAction:6,"6":"InfoAction", });
1130
1159
  /**
1131
1160
  */
1132
- module.exports.NetworkIdKind = Object.freeze({ Testnet:0,"0":"Testnet",Mainnet:1,"1":"Mainnet", });
1161
+ module.exports.MetadataJsonSchema = Object.freeze({ NoConversions:0,"0":"NoConversions",BasicConversions:1,"1":"BasicConversions",DetailedSchema:2,"2":"DetailedSchema", });
1133
1162
  /**
1163
+ * Used to choosed the schema for a script JSON string
1134
1164
  */
1135
- module.exports.TransactionMetadatumKind = Object.freeze({ MetadataMap:0,"0":"MetadataMap",MetadataList:1,"1":"MetadataList",Int:2,"2":"Int",Bytes:3,"3":"Bytes",Text:4,"4":"Text", });
1165
+ module.exports.ScriptSchema = Object.freeze({ Wallet:0,"0":"Wallet",Node:1,"1":"Node", });
1136
1166
  /**
1137
1167
  */
1138
- module.exports.RelayKind = Object.freeze({ SingleHostAddr:0,"0":"SingleHostAddr",SingleHostName:1,"1":"SingleHostName",MultiHostName:2,"2":"MultiHostName", });
1168
+ module.exports.ByronAddressType = Object.freeze({ ATPubKey:0,"0":"ATPubKey",ATScript:1,"1":"ATScript",ATRedeem:2,"2":"ATRedeem", });
1139
1169
  /**
1140
1170
  */
1141
- module.exports.VoteKind = Object.freeze({ No:0,"0":"No",Yes:1,"1":"Yes",Abstain:2,"2":"Abstain", });
1171
+ module.exports.NativeScriptKind = Object.freeze({ ScriptPubkey:0,"0":"ScriptPubkey",ScriptAll:1,"1":"ScriptAll",ScriptAny:2,"2":"ScriptAny",ScriptNOfK:3,"3":"ScriptNOfK",TimelockStart:4,"4":"TimelockStart",TimelockExpiry:5,"5":"TimelockExpiry", });
1142
1172
  /**
1143
1173
  */
1144
- module.exports.TransactionSetsState = Object.freeze({ AllSetsHaveTag:0,"0":"AllSetsHaveTag",AllSetsHaveNoTag:1,"1":"AllSetsHaveNoTag",MixedSets:2,"2":"MixedSets", });
1174
+ module.exports.NetworkIdKind = Object.freeze({ Testnet:0,"0":"Testnet",Mainnet:1,"1":"Mainnet", });
1145
1175
  /**
1146
1176
  */
1147
- module.exports.CoinSelectionStrategyCIP2 = Object.freeze({
1177
+ module.exports.VoterKind = Object.freeze({ ConstitutionalCommitteeHotKeyHash:0,"0":"ConstitutionalCommitteeHotKeyHash",ConstitutionalCommitteeHotScriptHash:1,"1":"ConstitutionalCommitteeHotScriptHash",DRepKeyHash:2,"2":"DRepKeyHash",DRepScriptHash:3,"3":"DRepScriptHash",StakingPoolKeyHash:4,"4":"StakingPoolKeyHash", });
1148
1178
  /**
1149
- * Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
1150
1179
  */
1151
- LargestFirst:0,"0":"LargestFirst",
1180
+ module.exports.MIRKind = Object.freeze({ ToOtherPot:0,"0":"ToOtherPot",ToStakeCredentials:1,"1":"ToStakeCredentials", });
1152
1181
  /**
1153
- * Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
1154
1182
  */
1155
- RandomImprove:1,"1":"RandomImprove",
1183
+ module.exports.DRepKind = Object.freeze({ KeyHash:0,"0":"KeyHash",ScriptHash:1,"1":"ScriptHash",AlwaysAbstain:2,"2":"AlwaysAbstain",AlwaysNoConfidence:3,"3":"AlwaysNoConfidence", });
1156
1184
  /**
1157
- * Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
1158
1185
  */
1159
- LargestFirstMultiAsset:2,"2":"LargestFirstMultiAsset",
1186
+ module.exports.CborSetType = Object.freeze({ Tagged:0,"0":"Tagged",Untagged:1,"1":"Untagged", });
1160
1187
  /**
1161
- * Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
1162
1188
  */
1163
- RandomImproveMultiAsset:3,"3":"RandomImproveMultiAsset", });
1189
+ module.exports.RelayKind = Object.freeze({ SingleHostAddr:0,"0":"SingleHostAddr",SingleHostName:1,"1":"SingleHostName",MultiHostName:2,"2":"MultiHostName", });
1164
1190
  /**
1165
1191
  */
1166
- module.exports.CertificateKind = Object.freeze({ StakeRegistration:0,"0":"StakeRegistration",StakeDeregistration:1,"1":"StakeDeregistration",StakeDelegation:2,"2":"StakeDelegation",PoolRegistration:3,"3":"PoolRegistration",PoolRetirement:4,"4":"PoolRetirement",GenesisKeyDelegation:5,"5":"GenesisKeyDelegation",MoveInstantaneousRewardsCert:6,"6":"MoveInstantaneousRewardsCert",CommitteeHotAuth:7,"7":"CommitteeHotAuth",CommitteeColdResign:8,"8":"CommitteeColdResign",DRepDeregistration:9,"9":"DRepDeregistration",DRepRegistration:10,"10":"DRepRegistration",DRepUpdate:11,"11":"DRepUpdate",StakeAndVoteDelegation:12,"12":"StakeAndVoteDelegation",StakeRegistrationAndDelegation:13,"13":"StakeRegistrationAndDelegation",StakeVoteRegistrationAndDelegation:14,"14":"StakeVoteRegistrationAndDelegation",VoteDelegation:15,"15":"VoteDelegation",VoteRegistrationAndDelegation:16,"16":"VoteRegistrationAndDelegation", });
1192
+ module.exports.TransactionSetsState = Object.freeze({ AllSetsHaveTag:0,"0":"AllSetsHaveTag",AllSetsHaveNoTag:1,"1":"AllSetsHaveNoTag",MixedSets:2,"2":"MixedSets", });
1167
1193
  /**
1168
- * Used to choosed the schema for a script JSON string
1194
+ * Each new language uses a different namespace for hashing its script
1195
+ * This is because you could have a language where the same bytes have different semantics
1196
+ * So this avoids scripts in different languages mapping to the same hash
1197
+ * Note that the enum value here is different than the enum value for deciding the cost model of a script
1169
1198
  */
1170
- module.exports.ScriptSchema = Object.freeze({ Wallet:0,"0":"Wallet",Node:1,"1":"Node", });
1199
+ module.exports.ScriptHashNamespace = Object.freeze({ NativeScript:0,"0":"NativeScript",PlutusScript:1,"1":"PlutusScript",PlutusScriptV2:2,"2":"PlutusScriptV2",PlutusScriptV3:3,"3":"PlutusScriptV3", });
1171
1200
  /**
1172
1201
  */
1173
- module.exports.LanguageKind = Object.freeze({ PlutusV1:0,"0":"PlutusV1",PlutusV2:1,"1":"PlutusV2",PlutusV3:2,"2":"PlutusV3", });
1202
+ module.exports.TransactionMetadatumKind = Object.freeze({ MetadataMap:0,"0":"MetadataMap",MetadataList:1,"1":"MetadataList",Int:2,"2":"Int",Bytes:3,"3":"Bytes",Text:4,"4":"Text", });
1174
1203
  /**
1175
1204
  */
1176
- module.exports.MetadataJsonSchema = Object.freeze({ NoConversions:0,"0":"NoConversions",BasicConversions:1,"1":"BasicConversions",DetailedSchema:2,"2":"DetailedSchema", });
1205
+ module.exports.MIRPot = Object.freeze({ Reserves:0,"0":"Reserves",Treasury:1,"1":"Treasury", });
1177
1206
  /**
1178
1207
  */
1179
- module.exports.MIRPot = Object.freeze({ Reserves:0,"0":"Reserves",Treasury:1,"1":"Treasury", });
1208
+ module.exports.CborContainerType = Object.freeze({ Array:0,"0":"Array",Map:1,"1":"Map", });
1180
1209
  /**
1181
1210
  */
1182
- module.exports.GovernanceActionKind = Object.freeze({ ParameterChangeAction:0,"0":"ParameterChangeAction",HardForkInitiationAction:1,"1":"HardForkInitiationAction",TreasuryWithdrawalsAction:2,"2":"TreasuryWithdrawalsAction",NoConfidenceAction:3,"3":"NoConfidenceAction",UpdateCommitteeAction:4,"4":"UpdateCommitteeAction",NewConstitutionAction:5,"5":"NewConstitutionAction",InfoAction:6,"6":"InfoAction", });
1211
+ module.exports.CredKind = Object.freeze({ Key:0,"0":"Key",Script:1,"1":"Script", });
1212
+ /**
1213
+ */
1214
+ module.exports.AddressKind = Object.freeze({ Base:0,"0":"Base",Pointer:1,"1":"Pointer",Enterprise:2,"2":"Enterprise",Reward:3,"3":"Reward",Byron:4,"4":"Byron",Malformed:5,"5":"Malformed", });
1215
+ /**
1216
+ */
1217
+ module.exports.RedeemerTagKind = Object.freeze({ Spend:0,"0":"Spend",Mint:1,"1":"Mint",Cert:2,"2":"Cert",Reward:3,"3":"Reward",Vote:4,"4":"Vote",VotingProposal:5,"5":"VotingProposal", });
1218
+ /**
1219
+ */
1220
+ module.exports.VoteKind = Object.freeze({ No:0,"0":"No",Yes:1,"1":"Yes",Abstain:2,"2":"Abstain", });
1183
1221
  /**
1184
1222
  * JSON <-> PlutusData conversion schemas.
1185
1223
  * Follows ScriptDataJsonSchema in cardano-cli defined at:
@@ -1233,31 +1271,26 @@ BasicConversions:0,"0":"BasicConversions",
1233
1271
  DetailedSchema:1,"1":"DetailedSchema", });
1234
1272
  /**
1235
1273
  */
1236
- module.exports.MIRKind = Object.freeze({ ToOtherPot:0,"0":"ToOtherPot",ToStakeCredentials:1,"1":"ToStakeCredentials", });
1237
- /**
1238
- */
1239
- module.exports.VoterKind = Object.freeze({ ConstitutionalCommitteeHotKeyHash:0,"0":"ConstitutionalCommitteeHotKeyHash",ConstitutionalCommitteeHotScriptHash:1,"1":"ConstitutionalCommitteeHotScriptHash",DRepKeyHash:2,"2":"DRepKeyHash",DRepScriptHash:3,"3":"DRepScriptHash",StakingPoolKeyHash:4,"4":"StakingPoolKeyHash", });
1240
- /**
1241
- */
1242
- module.exports.CredKind = Object.freeze({ Key:0,"0":"Key",Script:1,"1":"Script", });
1243
- /**
1244
- */
1245
1274
  module.exports.BlockEra = Object.freeze({ Byron:0,"0":"Byron",Shelley:1,"1":"Shelley",Allegra:2,"2":"Allegra",Mary:3,"3":"Mary",Alonzo:4,"4":"Alonzo",Babbage:5,"5":"Babbage",Conway:6,"6":"Conway",Unknown:7,"7":"Unknown", });
1246
1275
  /**
1247
1276
  */
1248
- module.exports.AddressKind = Object.freeze({ Base:0,"0":"Base",Pointer:1,"1":"Pointer",Enterprise:2,"2":"Enterprise",Reward:3,"3":"Reward",Byron:4,"4":"Byron",Malformed:5,"5":"Malformed", });
1277
+ module.exports.CoinSelectionStrategyCIP2 = Object.freeze({
1249
1278
  /**
1279
+ * Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
1250
1280
  */
1251
- module.exports.PlutusDataKind = Object.freeze({ ConstrPlutusData:0,"0":"ConstrPlutusData",Map:1,"1":"Map",List:2,"2":"List",Integer:3,"3":"Integer",Bytes:4,"4":"Bytes", });
1281
+ LargestFirst:0,"0":"LargestFirst",
1252
1282
  /**
1283
+ * Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
1253
1284
  */
1254
- module.exports.ByronAddressType = Object.freeze({ ATPubKey:0,"0":"ATPubKey",ATScript:1,"1":"ATScript",ATRedeem:2,"2":"ATRedeem", });
1285
+ RandomImprove:1,"1":"RandomImprove",
1255
1286
  /**
1287
+ * Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
1256
1288
  */
1257
- module.exports.DRepKind = Object.freeze({ KeyHash:0,"0":"KeyHash",ScriptHash:1,"1":"ScriptHash",AlwaysAbstain:2,"2":"AlwaysAbstain",AlwaysNoConfidence:3,"3":"AlwaysNoConfidence", });
1289
+ LargestFirstMultiAsset:2,"2":"LargestFirstMultiAsset",
1258
1290
  /**
1291
+ * Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
1259
1292
  */
1260
- module.exports.RedeemerTagKind = Object.freeze({ Spend:0,"0":"Spend",Mint:1,"1":"Mint",Cert:2,"2":"Cert",Reward:3,"3":"Reward",Vote:4,"4":"Vote",VotingProposal:5,"5":"VotingProposal", });
1293
+ RandomImproveMultiAsset:3,"3":"RandomImproveMultiAsset", });
1261
1294
 
1262
1295
  const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
1263
1296
  ? { register: () => {}, unregister: () => {} }
Binary file
@@ -7,12 +7,13 @@ export function get_possible_types_for_input(a: number, b: number, c: number): v
7
7
  export function check_block_or_tx_signatures(a: number, b: number, c: number): void;
8
8
  export function get_necessary_data_list_js(a: number, b: number, c: number): void;
9
9
  export function validate_transaction_js(a: number, b: number, c: number, d: number, e: number): void;
10
+ export function extract_hashes_from_transaction_js(a: number, b: number, c: number): void;
10
11
  export function decode_plutus_program_uplc_json(a: number, b: number, c: number): void;
11
12
  export function decode_plutus_program_pretty_uplc(a: number, b: number, c: number): void;
12
13
  export function get_utxo_list_from_tx(a: number, b: number, c: number): void;
13
14
  export function execute_tx_scripts(a: number, b: number, c: number, d: number, e: number): void;
14
- export function cbor_to_json(a: number, b: number, c: number): void;
15
15
  export function get_ref_script_bytes(a: number, b: number, c: number, d: number): void;
16
+ export function cbor_to_json(a: number, b: number, c: number): void;
16
17
  export function __wbg_noconfidenceaction_free(a: number): void;
17
18
  export function noconfidenceaction_to_bytes(a: number, b: number): void;
18
19
  export function noconfidenceaction_from_bytes(a: number, b: number, c: number): void;
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.33",
7
+ "version": "0.1.0-beta.34",
8
8
  "license": "Apache-2.0",
9
9
  "files": [
10
10
  "node/cquisitor_lib_bg.wasm",