@cardananium/cquisitor-lib 0.1.0-beta.6 → 0.1.0-beta.7

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.
@@ -1014,72 +1014,94 @@ function handleError(f, args) {
1014
1014
  }
1015
1015
  /**
1016
1016
  */
1017
- export const CborContainerType = Object.freeze({ Array:0,"0":"Array",Map:1,"1":"Map", });
1017
+ export const LanguageKind = Object.freeze({ PlutusV1:0,"0":"PlutusV1",PlutusV2:1,"1":"PlutusV2",PlutusV3:2,"2":"PlutusV3", });
1018
1018
  /**
1019
1019
  */
1020
- export const 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", });
1020
+ export const ByronAddressType = Object.freeze({ ATPubKey:0,"0":"ATPubKey",ATScript:1,"1":"ATScript",ATRedeem:2,"2":"ATRedeem", });
1021
1021
  /**
1022
1022
  */
1023
- export const RelayKind = Object.freeze({ SingleHostAddr:0,"0":"SingleHostAddr",SingleHostName:1,"1":"SingleHostName",MultiHostName:2,"2":"MultiHostName", });
1023
+ export const CredKind = Object.freeze({ Key:0,"0":"Key",Script:1,"1":"Script", });
1024
1024
  /**
1025
1025
  */
1026
- export const ByronAddressType = Object.freeze({ ATPubKey:0,"0":"ATPubKey",ATScript:1,"1":"ATScript",ATRedeem:2,"2":"ATRedeem", });
1026
+ export const VoterKind = Object.freeze({ ConstitutionalCommitteeHotKeyHash:0,"0":"ConstitutionalCommitteeHotKeyHash",ConstitutionalCommitteeHotScriptHash:1,"1":"ConstitutionalCommitteeHotScriptHash",DRepKeyHash:2,"2":"DRepKeyHash",DRepScriptHash:3,"3":"DRepScriptHash",StakingPoolKeyHash:4,"4":"StakingPoolKeyHash", });
1027
1027
  /**
1028
1028
  */
1029
- export const 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", });
1029
+ export const TransactionSetsState = Object.freeze({ AllSetsHaveTag:0,"0":"AllSetsHaveTag",AllSetsHaveNoTag:1,"1":"AllSetsHaveNoTag",MixedSets:2,"2":"MixedSets", });
1030
1030
  /**
1031
- * Each new language uses a different namespace for hashing its script
1032
- * This is because you could have a language where the same bytes have different semantics
1033
- * So this avoids scripts in different languages mapping to the same hash
1034
- * Note that the enum value here is different than the enum value for deciding the cost model of a script
1035
1031
  */
1036
- export const ScriptHashNamespace = Object.freeze({ NativeScript:0,"0":"NativeScript",PlutusScript:1,"1":"PlutusScript",PlutusScriptV2:2,"2":"PlutusScriptV2",PlutusScriptV3:3,"3":"PlutusScriptV3", });
1032
+ export const 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", });
1033
+ /**
1034
+ */
1035
+ export const CborSetType = Object.freeze({ Tagged:0,"0":"Tagged",Untagged:1,"1":"Untagged", });
1037
1036
  /**
1038
1037
  * Used to choosed the schema for a script JSON string
1039
1038
  */
1040
1039
  export const ScriptSchema = Object.freeze({ Wallet:0,"0":"Wallet",Node:1,"1":"Node", });
1041
1040
  /**
1042
1041
  */
1042
+ export const 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", });
1043
+ /**
1044
+ */
1045
+ export const 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", });
1046
+ /**
1047
+ */
1048
+ export const 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", });
1049
+ /**
1050
+ */
1051
+ export const 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", });
1052
+ /**
1053
+ */
1043
1054
  export const TransactionMetadatumKind = Object.freeze({ MetadataMap:0,"0":"MetadataMap",MetadataList:1,"1":"MetadataList",Int:2,"2":"Int",Bytes:3,"3":"Bytes",Text:4,"4":"Text", });
1044
1055
  /**
1045
1056
  */
1046
- export const MIRKind = Object.freeze({ ToOtherPot:0,"0":"ToOtherPot",ToStakeCredentials:1,"1":"ToStakeCredentials", });
1057
+ export const DRepKind = Object.freeze({ KeyHash:0,"0":"KeyHash",ScriptHash:1,"1":"ScriptHash",AlwaysAbstain:2,"2":"AlwaysAbstain",AlwaysNoConfidence:3,"3":"AlwaysNoConfidence", });
1047
1058
  /**
1048
1059
  */
1049
- export const MIRPot = Object.freeze({ Reserves:0,"0":"Reserves",Treasury:1,"1":"Treasury", });
1060
+ export const CoinSelectionStrategyCIP2 = Object.freeze({
1050
1061
  /**
1062
+ * Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
1051
1063
  */
1052
- export const TransactionSetsState = Object.freeze({ AllSetsHaveTag:0,"0":"AllSetsHaveTag",AllSetsHaveNoTag:1,"1":"AllSetsHaveNoTag",MixedSets:2,"2":"MixedSets", });
1064
+ LargestFirst:0,"0":"LargestFirst",
1053
1065
  /**
1066
+ * Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
1054
1067
  */
1055
- export const MetadataJsonSchema = Object.freeze({ NoConversions:0,"0":"NoConversions",BasicConversions:1,"1":"BasicConversions",DetailedSchema:2,"2":"DetailedSchema", });
1068
+ RandomImprove:1,"1":"RandomImprove",
1056
1069
  /**
1070
+ * Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
1057
1071
  */
1058
- export const 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", });
1072
+ LargestFirstMultiAsset:2,"2":"LargestFirstMultiAsset",
1059
1073
  /**
1074
+ * Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
1060
1075
  */
1061
- export const 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", });
1076
+ RandomImproveMultiAsset:3,"3":"RandomImproveMultiAsset", });
1062
1077
  /**
1063
1078
  */
1064
- export const LanguageKind = Object.freeze({ PlutusV1:0,"0":"PlutusV1",PlutusV2:1,"1":"PlutusV2",PlutusV3:2,"2":"PlutusV3", });
1079
+ export const PlutusDataKind = Object.freeze({ ConstrPlutusData:0,"0":"ConstrPlutusData",Map:1,"1":"Map",List:2,"2":"List",Integer:3,"3":"Integer",Bytes:4,"4":"Bytes", });
1065
1080
  /**
1066
1081
  */
1067
- export const CredKind = Object.freeze({ Key:0,"0":"Key",Script:1,"1":"Script", });
1082
+ export const MIRKind = Object.freeze({ ToOtherPot:0,"0":"ToOtherPot",ToStakeCredentials:1,"1":"ToStakeCredentials", });
1068
1083
  /**
1069
1084
  */
1070
- export const CborSetType = Object.freeze({ Tagged:0,"0":"Tagged",Untagged:1,"1":"Untagged", });
1085
+ export const VoteKind = Object.freeze({ No:0,"0":"No",Yes:1,"1":"Yes",Abstain:2,"2":"Abstain", });
1086
+ /**
1087
+ * Each new language uses a different namespace for hashing its script
1088
+ * This is because you could have a language where the same bytes have different semantics
1089
+ * So this avoids scripts in different languages mapping to the same hash
1090
+ * Note that the enum value here is different than the enum value for deciding the cost model of a script
1091
+ */
1092
+ export const ScriptHashNamespace = Object.freeze({ NativeScript:0,"0":"NativeScript",PlutusScript:1,"1":"PlutusScript",PlutusScriptV2:2,"2":"PlutusScriptV2",PlutusScriptV3:3,"3":"PlutusScriptV3", });
1071
1093
  /**
1072
1094
  */
1073
1095
  export const NetworkIdKind = Object.freeze({ Testnet:0,"0":"Testnet",Mainnet:1,"1":"Mainnet", });
1074
1096
  /**
1075
1097
  */
1076
- export const 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", });
1098
+ export const RelayKind = Object.freeze({ SingleHostAddr:0,"0":"SingleHostAddr",SingleHostName:1,"1":"SingleHostName",MultiHostName:2,"2":"MultiHostName", });
1077
1099
  /**
1078
1100
  */
1079
- export const 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", });
1101
+ export const 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", });
1080
1102
  /**
1081
1103
  */
1082
- export const PlutusDataKind = Object.freeze({ ConstrPlutusData:0,"0":"ConstrPlutusData",Map:1,"1":"Map",List:2,"2":"List",Integer:3,"3":"Integer",Bytes:4,"4":"Bytes", });
1104
+ export const MIRPot = Object.freeze({ Reserves:0,"0":"Reserves",Treasury:1,"1":"Treasury", });
1083
1105
  /**
1084
1106
  * JSON <-> PlutusData conversion schemas.
1085
1107
  * Follows ScriptDataJsonSchema in cardano-cli defined at:
@@ -1133,32 +1155,10 @@ BasicConversions:0,"0":"BasicConversions",
1133
1155
  DetailedSchema:1,"1":"DetailedSchema", });
1134
1156
  /**
1135
1157
  */
1136
- export const DRepKind = Object.freeze({ KeyHash:0,"0":"KeyHash",ScriptHash:1,"1":"ScriptHash",AlwaysAbstain:2,"2":"AlwaysAbstain",AlwaysNoConfidence:3,"3":"AlwaysNoConfidence", });
1137
- /**
1138
- */
1139
- export const CoinSelectionStrategyCIP2 = Object.freeze({
1140
- /**
1141
- * Performs CIP2's Largest First ada-only selection. Will error if outputs contain non-ADA assets.
1142
- */
1143
- LargestFirst:0,"0":"LargestFirst",
1144
- /**
1145
- * Performs CIP2's Random Improve ada-only selection. Will error if outputs contain non-ADA assets.
1146
- */
1147
- RandomImprove:1,"1":"RandomImprove",
1148
- /**
1149
- * Same as LargestFirst, but before adding ADA, will insert by largest-first for each asset type.
1150
- */
1151
- LargestFirstMultiAsset:2,"2":"LargestFirstMultiAsset",
1152
- /**
1153
- * Same as RandomImprove, but before adding ADA, will insert by random-improve for each asset type.
1154
- */
1155
- RandomImproveMultiAsset:3,"3":"RandomImproveMultiAsset", });
1156
- /**
1157
- */
1158
- export const VoterKind = Object.freeze({ ConstitutionalCommitteeHotKeyHash:0,"0":"ConstitutionalCommitteeHotKeyHash",ConstitutionalCommitteeHotScriptHash:1,"1":"ConstitutionalCommitteeHotScriptHash",DRepKeyHash:2,"2":"DRepKeyHash",DRepScriptHash:3,"3":"DRepScriptHash",StakingPoolKeyHash:4,"4":"StakingPoolKeyHash", });
1158
+ export const CborContainerType = Object.freeze({ Array:0,"0":"Array",Map:1,"1":"Map", });
1159
1159
  /**
1160
1160
  */
1161
- export const VoteKind = Object.freeze({ No:0,"0":"No",Yes:1,"1":"Yes",Abstain:2,"2":"Abstain", });
1161
+ export const MetadataJsonSchema = Object.freeze({ NoConversions:0,"0":"NoConversions",BasicConversions:1,"1":"BasicConversions",DetailedSchema:2,"2":"DetailedSchema", });
1162
1162
 
1163
1163
  const AddressFinalization = (typeof FinalizationRegistry === 'undefined')
1164
1164
  ? { register: () => {}, unregister: () => {} }
package/package.json CHANGED
@@ -3,28 +3,24 @@
3
3
  "collaborators": [
4
4
  "Evgenii Lisitskii <evgeniilisitskii@gmail.com>"
5
5
  ],
6
- "version": "0.1.0-beta.6",
6
+ "version": "0.1.0-beta.7",
7
7
  "files": [
8
- "node/cquisitor_lib_bg.wasm",
9
- "node/cquisitor_lib.js",
10
- "node/cquisitor_lib.d.ts",
11
- "node/cquisitor_lib_bg.wasm.d.ts",
12
8
  "browser/cquisitor_lib_bg.wasm",
13
9
  "browser/cquisitor_lib.js",
14
10
  "browser/cquisitor_lib.d.ts",
15
11
  "browser/cquisitor_lib_bg.wasm.d.ts"
16
12
  ],
17
- "main": "./node/cquisitor_lib.js",
18
- "types": "./node/cquisitor_lib.d.ts",
13
+ "main": "./browser/cquisitor_lib.js",
14
+ "types": "./browser/cquisitor_lib.d.ts",
19
15
  "browser": "./browser/cquisitor_lib.js",
20
16
  "exports": {
21
17
  ".": {
22
18
  "node": {
23
- "import": "./node/cquisitor_lib.js",
24
- "require": "./node/cquisitor_lib.js"
19
+ "import": "./browser/cquisitor_lib.js",
20
+ "require": "./browser/cquisitor_lib.js"
25
21
  },
26
22
  "browser": "./browser/cquisitor_lib.js",
27
- "default": "./node/cquisitor_lib.js"
23
+ "default": "./browser/cquisitor_lib.js"
28
24
  }
29
25
  }
30
26
  }
@@ -1,417 +0,0 @@
1
- /**
2
- * @returns {(string)[]}
3
- */
4
- export function get_decodable_types(): (string)[];
5
- /**
6
- * @param {string} input
7
- * @param {string} type_name
8
- * @param {any} params_json
9
- * @returns {any}
10
- */
11
- export function decode_specific_type(input: string, type_name: string, params_json: DecodingParams): any;
12
- /**
13
- * @param {string} input
14
- * @returns {(string)[]}
15
- */
16
- export function get_possible_types_for_input(input: string): (string)[];
17
- /**
18
- * @param {string} cbor_hex
19
- * @returns {any}
20
- */
21
- export function cbor_to_json(cbor_hex: string): CborValue;
22
-
23
- export function check_block_or_tx_signatures(hex_str: string): CheckSignaturesResult;
24
-
25
- /**
26
- * @param {string} tx_hex
27
- * @returns {(string)[]}
28
- */
29
- export function get_utxo_list_from_tx(tx_hex: string): string[];
30
-
31
- /**
32
- * @param {string} tx_hex
33
- * @param {UTxO[]} utxo_json
34
- * @param {CostModels} cost_models_json
35
- * @returns {ExecuteTxScriptsResult}
36
- */
37
- export function execute_tx_scripts(tx_hex: string, utxo_json: UTxO[], cost_models_json: CostModels): ExecuteTxScriptsResult;
38
- /**
39
- * @param {string} hex
40
- * @returns {ProgramJson}
41
- */
42
- export function decode_plutus_program_uplc_json(hex: string): ProgramJson;
43
- /**
44
- * @param {string} hex
45
- * @returns {string}
46
- */
47
- export function decode_plutus_program_pretty_uplc(hex: string): string;
48
-
49
- export interface CborPosition {
50
- offset: number;
51
- length: number;
52
- }
53
-
54
- export type CborSimpleType =
55
- | "Null"
56
- | "Bool"
57
- | "U8"
58
- | "U16"
59
- | "U32"
60
- | "U64"
61
- | "I8"
62
- | "I16"
63
- | "I32"
64
- | "I64"
65
- | "Int"
66
- | "F16"
67
- | "F32"
68
- | "F64"
69
- | "Bytes"
70
- | "String"
71
- | "Simple"
72
- | "Undefined"
73
- | "Break";
74
-
75
- export interface CborSimple {
76
- position_info: CborPosition;
77
- struct_position_info?: CborPosition;
78
- value: any;
79
- }
80
-
81
- export interface CborArray {
82
- type: "Array";
83
- position_info: CborPosition;
84
- struct_position_info: CborPosition;
85
- items: number | "Indefinite";
86
- values: CborValue[]; // nested
87
- }
88
-
89
- export interface CborMap {
90
- type: "Map";
91
- position_info: CborPosition;
92
- struct_position_info: CborPosition;
93
- items: number | "Indefinite";
94
- values: {
95
- key: CborValue;
96
- value: CborValue;
97
- }[];
98
- }
99
-
100
- export interface CborTag {
101
- type: "Tag";
102
- position_info: CborPosition;
103
- struct_position_info: CborPosition;
104
- tag: string;
105
- value: CborValue;
106
- }
107
-
108
- export interface CborIndefiniteString {
109
- type: "IndefiniteLengthString";
110
- position_info: CborPosition;
111
- struct_position_info: CborPosition;
112
- chunks: CborValue[];
113
- }
114
-
115
- export interface CborIndefiniteBytes {
116
- type: "IndefiniteLengthBytes";
117
- position_info: CborPosition;
118
- struct_position_info: CborPosition;
119
- chunks: CborValue[];
120
- }
121
-
122
- export type CborValue =
123
- | CborSimple
124
- | CborArray
125
- | CborMap
126
- | CborTag
127
- | CborIndefiniteString
128
- | CborIndefiniteBytes;
129
-
130
- export interface DecodingParams {
131
- plutus_script_version?: number;
132
- plutus_data_schema?: PlutusDataSchema;
133
- }
134
-
135
- export type PlutusDataSchema = "BasicConversions" | "DetailedSchema";
136
-
137
- export interface CheckSignaturesResult {
138
- /** Indicates whether the transaction or block is valid. */
139
- valid: boolean;
140
- /** The transaction hash as a hexadecimal string (if available). */
141
- tx_hash?: string;
142
- /** An array of invalid Catalyst witness signatures (hex strings). */
143
- invalidCatalystWitnesses: string[];
144
- /** An array of invalid VKey witness signatures (hex strings). */
145
- invalidVkeyWitnesses: string[];
146
- }
147
-
148
-
149
- // The execution units object contains two numeric fields.
150
- export type ExUnits = {
151
- steps: number;
152
- mem: number;
153
- };
154
-
155
- // The redeemer tag is one of the following literal strings.
156
- export type RedeemerTag = "Spend" | "Mint" | "Cert" | "Reward" | "Propose" | "Vote";
157
-
158
- // A successful redeemer evaluation contains the original execution units,
159
- // the calculated execution units, and additional redeemer info.
160
- export interface RedeemerSuccess {
161
- original_ex_units: ExUnits;
162
- calculated_ex_units: ExUnits;
163
- redeemer_index: number;
164
- redeemer_tag: RedeemerTag;
165
- }
166
-
167
- // A failed redeemer evaluation contains the original execution units,
168
- // an error message, and additional redeemer info.
169
- export interface RedeemerError {
170
- original_ex_units: ExUnits;
171
- error: string;
172
- redeemer_index: number;
173
- redeemer_tag: RedeemerTag;
174
- }
175
-
176
- // The result from executing the transaction scripts is an array of redeemer results.
177
- // Each result can be either a success or an error.
178
- export type RedeemerResult = RedeemerSuccess | RedeemerError;
179
-
180
- // Type for the `execute_tx_scripts` response after JSON-parsing.
181
- export type ExecuteTxScriptsResult = RedeemerResult[];
182
-
183
-
184
- // The overall JSON produced by `to_json_program`:
185
- export interface ProgramJson {
186
- program: {
187
- version: string;
188
- term: Term;
189
- };
190
- }
191
-
192
- // A UPLC term can be one of several forms.
193
- export type Term =
194
- | VarTerm
195
- | DelayTerm
196
- | LambdaTerm
197
- | ApplyTerm
198
- | ConstantTerm
199
- | ForceTerm
200
- | ErrorTerm
201
- | BuiltinTerm
202
- | ConstrTerm
203
- | CaseTerm;
204
-
205
- export interface VarTerm {
206
- var: string;
207
- }
208
-
209
- export interface DelayTerm {
210
- delay: Term;
211
- }
212
-
213
- export interface LambdaTerm {
214
- lambda: {
215
- parameter_name: string;
216
- body: Term;
217
- };
218
- }
219
-
220
- export interface ApplyTerm {
221
- apply: {
222
- function: Term;
223
- argument: Term;
224
- };
225
- }
226
-
227
- export interface ConstantTerm {
228
- constant: Constant;
229
- }
230
-
231
- export interface ForceTerm {
232
- force: Term;
233
- }
234
-
235
- export interface ErrorTerm {
236
- error: "error";
237
- }
238
-
239
- export interface BuiltinTerm {
240
- builtin: string;
241
- }
242
-
243
- export interface ConstrTerm {
244
- constr: {
245
- tag: number;
246
- fields: Term[];
247
- };
248
- }
249
-
250
- export interface CaseTerm {
251
- case: {
252
- constr: Term;
253
- branches: Term[];
254
- };
255
- }
256
-
257
- // The UPLC constant is one of several union types.
258
- export type Constant =
259
- | IntegerConstant
260
- | ByteStringConstant
261
- | StringConstant
262
- | UnitConstant
263
- | BoolConstant
264
- | ListConstant
265
- | PairConstant
266
- | DataConstant
267
- | Bls12_381G1ElementConstant
268
- | Bls12_381G2ElementConstant;
269
-
270
- export interface IntegerConstant {
271
- integer: string; // represented as a string
272
- }
273
-
274
- export interface ByteStringConstant {
275
- bytestring: string; // hex-encoded string
276
- }
277
-
278
- export interface StringConstant {
279
- string: string;
280
- }
281
-
282
- export interface UnitConstant {
283
- unit: "()";
284
- }
285
-
286
- export interface BoolConstant {
287
- bool: boolean;
288
- }
289
-
290
- export interface ListConstant {
291
- list: {
292
- type: Type;
293
- items: Constant[];
294
- };
295
- }
296
-
297
- export interface PairConstant {
298
- pair: {
299
- type_left: Type;
300
- type_right: Type;
301
- left: Constant;
302
- right: Constant;
303
- };
304
- }
305
-
306
- export interface DataConstant {
307
- data: PlutusData;
308
- }
309
-
310
- export interface Bls12_381G1ElementConstant {
311
- bls12_381_G1_element: {
312
- x: number;
313
- y: number;
314
- z: number;
315
- };
316
- }
317
-
318
- export interface Bls12_381G2ElementConstant {
319
- bls12_381_G2_element: BlstP2;
320
- }
321
-
322
- // The UPLC type is represented either as a string literal or an object.
323
- export type Type =
324
- | "bool"
325
- | "integer"
326
- | "string"
327
- | "bytestring"
328
- | "unit"
329
- | "data"
330
- | "bls12_381_G1_element"
331
- | "bls12_381_G2_element"
332
- | "bls12_381_mlresult"
333
- | ListType
334
- | PairType;
335
-
336
- export interface ListType {
337
- list: Type;
338
- }
339
-
340
- export interface PairType {
341
- pair: {
342
- left: Type;
343
- right: Type;
344
- };
345
- }
346
-
347
- // The JSON representation for a blst_p2 element: each coordinate is an array of numbers.
348
- export interface BlstP2 {
349
- x: number[];
350
- y: number[];
351
- z: number[];
352
- }
353
-
354
- // Plutus data is also a tagged union.
355
- export type PlutusData =
356
- | ConstrData
357
- | MapData
358
- | BigIntData
359
- | BoundedBytesData
360
- | ArrayData;
361
-
362
- export interface ConstrData {
363
- constr: {
364
- tag: number;
365
- any_constructor: boolean;
366
- fields: PlutusData[];
367
- };
368
- }
369
-
370
- export interface MapData {
371
- map: Array<{
372
- key: PlutusData;
373
- value: PlutusData;
374
- }>;
375
- }
376
-
377
- export interface BigIntData {
378
- integer: string; // big integers are represented as strings
379
- }
380
-
381
- export interface BoundedBytesData {
382
- bytestring: string; // hex-encoded
383
- }
384
-
385
- export interface ArrayData {
386
- list: PlutusData[];
387
- }
388
-
389
- export interface Asset {
390
- unit: string;
391
- quantity: string;
392
- }
393
-
394
- export interface TxInput {
395
- outputIndex: number;
396
- txHash: string;
397
- }
398
-
399
- export interface TxOutput {
400
- address: string;
401
- amount: Asset[];
402
- dataHash?: string;
403
- plutusData?: string;
404
- scriptRef?: string;
405
- scriptHash?: string;
406
- }
407
-
408
- export interface UTxO {
409
- input: TxInput;
410
- output: TxOutput;
411
- }
412
-
413
- export interface CostModels {
414
- plutusV1?: number[];
415
- plutusV2?: number[];
416
- plutusV3?: number[];
417
- }