@meshsdk/common 1.5.29 → 1.5.32

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.
Files changed (3) hide show
  1. package/dist/index.js +1 -1316
  2. package/dist/index.mjs +1 -1189
  3. package/package.json +4 -3
package/dist/index.mjs CHANGED
@@ -1,1189 +1 @@
1
- // src/constants/protocol-parameters.ts
2
- var DEFAULT_PROTOCOL_PARAMETERS = {
3
- epoch: 0,
4
- coinsPerUtxoSize: 4310,
5
- priceMem: 0.0577,
6
- priceStep: 721e-7,
7
- minFeeA: 44,
8
- minFeeB: 155381,
9
- keyDeposit: 2e6,
10
- maxTxSize: 16384,
11
- maxValSize: 5e3,
12
- poolDeposit: 5e8,
13
- maxCollateralInputs: 3,
14
- decentralisation: 0,
15
- maxBlockSize: 98304,
16
- collateralPercent: 150,
17
- maxBlockHeaderSize: 1100,
18
- minPoolCost: "340000000",
19
- maxTxExMem: "16000000",
20
- maxTxExSteps: "10000000000",
21
- maxBlockExMem: "80000000",
22
- maxBlockExSteps: "40000000000"
23
- };
24
- var resolveTxFees = (txSize, minFeeA = DEFAULT_PROTOCOL_PARAMETERS.minFeeA, minFeeB = DEFAULT_PROTOCOL_PARAMETERS.minFeeB) => {
25
- const fees = BigInt(minFeeA) * BigInt(txSize) + BigInt(minFeeB);
26
- return fees.toString();
27
- };
28
-
29
- // src/constants/supported-wallets.ts
30
- var SUPPORTED_WALLETS = [
31
- "begin",
32
- "eternl",
33
- "flint",
34
- "lace",
35
- "nami",
36
- "nufi",
37
- "gerowallet",
38
- "typhoncip30",
39
- "vespr",
40
- "yoroi"
41
- ];
42
-
43
- // src/constants/cost-models.ts
44
- var DEFAULT_V1_COST_MODEL_LIST = [
45
- 205665,
46
- 812,
47
- 1,
48
- 1,
49
- 1e3,
50
- 571,
51
- 0,
52
- 1,
53
- 1e3,
54
- 24177,
55
- 4,
56
- 1,
57
- 1e3,
58
- 32,
59
- 117366,
60
- 10475,
61
- 4,
62
- 23e3,
63
- 100,
64
- 23e3,
65
- 100,
66
- 23e3,
67
- 100,
68
- 23e3,
69
- 100,
70
- 23e3,
71
- 100,
72
- 23e3,
73
- 100,
74
- 100,
75
- 100,
76
- 23e3,
77
- 100,
78
- 19537,
79
- 32,
80
- 175354,
81
- 32,
82
- 46417,
83
- 4,
84
- 221973,
85
- 511,
86
- 0,
87
- 1,
88
- 89141,
89
- 32,
90
- 497525,
91
- 14068,
92
- 4,
93
- 2,
94
- 196500,
95
- 453240,
96
- 220,
97
- 0,
98
- 1,
99
- 1,
100
- 1e3,
101
- 28662,
102
- 4,
103
- 2,
104
- 245e3,
105
- 216773,
106
- 62,
107
- 1,
108
- 1060367,
109
- 12586,
110
- 1,
111
- 208512,
112
- 421,
113
- 1,
114
- 187e3,
115
- 1e3,
116
- 52998,
117
- 1,
118
- 80436,
119
- 32,
120
- 43249,
121
- 32,
122
- 1e3,
123
- 32,
124
- 80556,
125
- 1,
126
- 57667,
127
- 4,
128
- 1e3,
129
- 10,
130
- 197145,
131
- 156,
132
- 1,
133
- 197145,
134
- 156,
135
- 1,
136
- 204924,
137
- 473,
138
- 1,
139
- 208896,
140
- 511,
141
- 1,
142
- 52467,
143
- 32,
144
- 64832,
145
- 32,
146
- 65493,
147
- 32,
148
- 22558,
149
- 32,
150
- 16563,
151
- 32,
152
- 76511,
153
- 32,
154
- 196500,
155
- 453240,
156
- 220,
157
- 0,
158
- 1,
159
- 1,
160
- 69522,
161
- 11687,
162
- 0,
163
- 1,
164
- 60091,
165
- 32,
166
- 196500,
167
- 453240,
168
- 220,
169
- 0,
170
- 1,
171
- 1,
172
- 196500,
173
- 453240,
174
- 220,
175
- 0,
176
- 1,
177
- 1,
178
- 806990,
179
- 30482,
180
- 4,
181
- 1927926,
182
- 82523,
183
- 4,
184
- 265318,
185
- 0,
186
- 4,
187
- 0,
188
- 85931,
189
- 32,
190
- 205665,
191
- 812,
192
- 1,
193
- 1,
194
- 41182,
195
- 32,
196
- 212342,
197
- 32,
198
- 31220,
199
- 32,
200
- 32696,
201
- 32,
202
- 43357,
203
- 32,
204
- 32247,
205
- 32,
206
- 38314,
207
- 32,
208
- 57996947,
209
- 18975,
210
- 10
211
- ];
212
- var DEFAULT_V2_COST_MODEL_LIST = [
213
- 205665,
214
- 812,
215
- 1,
216
- 1,
217
- 1e3,
218
- 571,
219
- 0,
220
- 1,
221
- 1e3,
222
- 24177,
223
- 4,
224
- 1,
225
- 1e3,
226
- 32,
227
- 117366,
228
- 10475,
229
- 4,
230
- 23e3,
231
- 100,
232
- 23e3,
233
- 100,
234
- 23e3,
235
- 100,
236
- 23e3,
237
- 100,
238
- 23e3,
239
- 100,
240
- 23e3,
241
- 100,
242
- 100,
243
- 100,
244
- 23e3,
245
- 100,
246
- 19537,
247
- 32,
248
- 175354,
249
- 32,
250
- 46417,
251
- 4,
252
- 221973,
253
- 511,
254
- 0,
255
- 1,
256
- 89141,
257
- 32,
258
- 497525,
259
- 14068,
260
- 4,
261
- 2,
262
- 196500,
263
- 453240,
264
- 220,
265
- 0,
266
- 1,
267
- 1,
268
- 1e3,
269
- 28662,
270
- 4,
271
- 2,
272
- 245e3,
273
- 216773,
274
- 62,
275
- 1,
276
- 1060367,
277
- 12586,
278
- 1,
279
- 208512,
280
- 421,
281
- 1,
282
- 187e3,
283
- 1e3,
284
- 52998,
285
- 1,
286
- 80436,
287
- 32,
288
- 43249,
289
- 32,
290
- 1e3,
291
- 32,
292
- 80556,
293
- 1,
294
- 57667,
295
- 4,
296
- 1e3,
297
- 10,
298
- 197145,
299
- 156,
300
- 1,
301
- 197145,
302
- 156,
303
- 1,
304
- 204924,
305
- 473,
306
- 1,
307
- 208896,
308
- 511,
309
- 1,
310
- 52467,
311
- 32,
312
- 64832,
313
- 32,
314
- 65493,
315
- 32,
316
- 22558,
317
- 32,
318
- 16563,
319
- 32,
320
- 76511,
321
- 32,
322
- 196500,
323
- 453240,
324
- 220,
325
- 0,
326
- 1,
327
- 1,
328
- 69522,
329
- 11687,
330
- 0,
331
- 1,
332
- 60091,
333
- 32,
334
- 196500,
335
- 453240,
336
- 220,
337
- 0,
338
- 1,
339
- 1,
340
- 196500,
341
- 453240,
342
- 220,
343
- 0,
344
- 1,
345
- 1,
346
- 1159724,
347
- 392670,
348
- 0,
349
- 2,
350
- 806990,
351
- 30482,
352
- 4,
353
- 1927926,
354
- 82523,
355
- 4,
356
- 265318,
357
- 0,
358
- 4,
359
- 0,
360
- 85931,
361
- 32,
362
- 205665,
363
- 812,
364
- 1,
365
- 1,
366
- 41182,
367
- 32,
368
- 212342,
369
- 32,
370
- 31220,
371
- 32,
372
- 32696,
373
- 32,
374
- 43357,
375
- 32,
376
- 32247,
377
- 32,
378
- 38314,
379
- 32,
380
- 35892428,
381
- 10,
382
- 57996947,
383
- 18975,
384
- 10,
385
- 38887044,
386
- 32947,
387
- 10
388
- ];
389
-
390
- // src/constants/language-views.ts
391
- var SUPPORTED_LANGUAGE_VIEWS = {
392
- ALONZO: {
393
- V1: "a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"
394
- },
395
- BABBAGE: {
396
- V1: "a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",
397
- V2: "a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"
398
- }
399
- };
400
- var resolveLanguageView = (era, version) => {
401
- return SUPPORTED_LANGUAGE_VIEWS[era][version];
402
- };
403
-
404
- // src/constants/index.ts
405
- var DEFAULT_REDEEMER_BUDGET = {
406
- mem: 7e6,
407
- steps: 3e9
408
- };
409
- var POLICY_ID_LENGTH = 56;
410
- var LANGUAGE_VERSIONS = {
411
- V1: "V1",
412
- V2: "V2",
413
- V3: "V3"
414
- };
415
- var HARDENED_KEY_START = 2147483648;
416
- var SUPPORTED_CLOCKS = {
417
- testnet: ["74", "1598400", "1595967616", "432000"],
418
- preview: ["183", "15811222", "1682467200", "86400"],
419
- preprod: ["65", "26438400", "1682121600", "432000"],
420
- mainnet: ["208", "4492800", "1596059091", "432000"]
421
- };
422
- var SUPPORTED_HANDLES = {
423
- 0: "8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",
424
- 1: "f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"
425
- };
426
- var SUPPORTED_OGMIOS_LINKS = {
427
- mainnet: "wss://ogmios-api.mainnet.dandelion.link",
428
- preprod: "wss://ogmios-api.iohk-preprod.dandelion.link",
429
- preview: "__TBD_SOON_TM__",
430
- testnet: "wss://ogmios-api.testnet.dandelion.link"
431
- };
432
- var SUPPORTED_TOKENS = {
433
- LQ: "da8c30857834c6ae7203935b89278c532b3995245295456f993e1d244c51",
434
- MIN: "29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e",
435
- NTX: "edfd7a1d77bcb8b884c474bdc92a16002d1fb720e454fa6e993444794e5458",
436
- iBTC: "f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069425443",
437
- iETH: "f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069455448",
438
- iUSD: "f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344",
439
- MILK: "8a1cfae21368b8bebbbed9800fec304e95cce39a2a57dc35e2e3ebaa4d494c4b",
440
- AGIX: "f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc53541474958",
441
- MELD: "6ac8ef33b510ec004fe11585f7c5a9f0c07f0c23428ab4f29c1d7d104d454c44",
442
- INDY: "533bb94a8850ee3ccbe483106489399112b74c905342cb1792a797a0494e4459",
443
- CLAY: "38ad9dc3aec6a2f38e220142b9aa6ade63ebe71f65e7cc2b7d8a8535434c4159",
444
- MCOS: "6f46e1304b16d884c85c62fb0eef35028facdc41aaa0fd319a152ed64d434f53",
445
- DING: "ce5b9e0f8a88255b65f2e4d065c6e716e9fa9a8a86dfb86423dd1ac044494e47",
446
- GERO: "10a49b996e2402269af553a8a96fb8eb90d79e9eca79e2b4223057b64745524f",
447
- NMKR: "5dac8536653edc12f6f5e1045d8164b9f59998d3bdc300fc928434894e4d4b52",
448
- PAVIA: "884892bcdc360bcef87d6b3f806e7f9cd5ac30d999d49970e7a903ae5041564941",
449
- HOSKY: "a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235484f534b59",
450
- YUMMI: "078eafce5cd7edafdf63900edef2c1ea759e77f30ca81d6bbdeec92479756d6d69",
451
- C3: "8e51398904a5d3fc129fbf4f1589701de23c7824d5c90fdb9490e15a434841524c4933",
452
- GIMBAL: "2b0a04a7b60132b1805b296c7fcb3b217ff14413991bf76f72663c3067696d62616c",
453
- SUNDAE: "9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d7753554e444145",
454
- GREENS: "4623ab311b7d982d8d26fcbe1a9439ca56661aafcdcd8d8a0ef31fd6475245454e53",
455
- GENS: "dda5fdb1002f7389b33e036b6afee82a8189becb6cba852e8b79b4fb0014df1047454e53",
456
- SOCIETY: "25f0fc240e91bd95dcdaebd2ba7713fc5168ac77234a3d79449fc20c534f4349455459",
457
- DJED: "8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344",
458
- SHEN: "8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344",
459
- WMT: "1d7f33bd23d85e1a25d87d86fac4f199c3197a2f7afeb662a0f34e1e776f726c646d6f62696c65746f6b656e",
460
- COPI: "b6a7467ea1deb012808ef4e87b5ff371e85f7142d7b356a40d9b42a0436f726e75636f70696173205b76696120436861696e506f72742e696f5d"
461
- };
462
- var CIP68_100 = (tokenNameHex) => {
463
- return `000643b0${tokenNameHex}`;
464
- };
465
- var CIP68_222 = (tokenNameHex) => {
466
- return `000de140${tokenNameHex}`;
467
- };
468
-
469
- // src/types/asset.ts
470
- var mergeAssets = (assets) => {
471
- const merged = [];
472
- assets.forEach((asset) => {
473
- const existing = merged.find((a) => a.unit === asset.unit);
474
- if (existing) {
475
- existing.quantity = (BigInt(existing.quantity) + BigInt(asset.quantity)).toString();
476
- } else {
477
- merged.push(asset);
478
- }
479
- });
480
- return merged;
481
- };
482
-
483
- // src/types/asset-metadata.ts
484
- var royaltiesStandardKeys = ["rate", "address"];
485
- var metadataStandardKeys = [
486
- "name",
487
- "image",
488
- "mediaType",
489
- "description",
490
- "instagram",
491
- "twitter",
492
- "discord",
493
- "website"
494
- ];
495
- var fungibleAssetKeys = ["ticker", "decimals"];
496
- var metadataToCip68 = (metadata) => {
497
- switch (typeof metadata) {
498
- case "object":
499
- if (metadata instanceof Array) {
500
- return metadata.map((item) => metadataToCip68(item));
501
- }
502
- const metadataMap = /* @__PURE__ */ new Map();
503
- const keys = Object.keys(metadata);
504
- keys.forEach((key) => {
505
- metadataMap.set(key, metadataToCip68(metadata[key]));
506
- });
507
- return {
508
- alternative: 0,
509
- fields: [metadataMap, 1]
510
- };
511
- default:
512
- return metadata;
513
- }
514
- };
515
-
516
- // src/types/network.ts
517
- var ALL_NETWORKS = ["testnet", "preview", "preprod", "mainnet"];
518
- var isNetwork = (value2) => {
519
- return ALL_NETWORKS.includes(value2);
520
- };
521
-
522
- // src/types/relay.ts
523
- var relayToObj = (relay) => {
524
- switch (relay.type) {
525
- case "SingleHostAddr":
526
- return {
527
- singleHostAddr: {
528
- ipv4: relay.IPV4,
529
- ipv6: relay.IPV6,
530
- port: relay.port
531
- }
532
- };
533
- case "SingleHostName":
534
- return {
535
- singleHostName: {
536
- hostname: relay.domainName,
537
- port: relay.port
538
- }
539
- };
540
- case "MultiHostName":
541
- return {
542
- multiHostName: {
543
- dnsName: relay.domainName
544
- }
545
- };
546
- }
547
- };
548
-
549
- // src/types/pool-params.ts
550
- var poolParamsToObj = (poolParams) => {
551
- return {
552
- vrfKeyHash: poolParams.vrfKeyHash,
553
- operator: poolParams.operator,
554
- pledge: poolParams.pledge,
555
- cost: poolParams.cost,
556
- margin: poolParams.margin,
557
- relays: poolParams.relays.map((relay) => relayToObj(relay)),
558
- owners: poolParams.owners,
559
- rewardAddress: poolParams.rewardAddress,
560
- metadata: poolParams.metadata ? poolMetadataToObj(poolParams.metadata) : void 0
561
- };
562
- };
563
- var poolMetadataToObj = (poolMetadata) => {
564
- return {
565
- url: poolMetadata.URL,
566
- metadata: poolMetadata.hash
567
- };
568
- };
569
-
570
- // src/types/transaction-builder/withdrawal.ts
571
- var certificateToObj = (certificate) => {
572
- switch (certificate.type) {
573
- case "RegisterPool":
574
- return {
575
- registerPool: {
576
- poolParams: poolParamsToObj(certificate.poolParams)
577
- }
578
- };
579
- case "RegisterStake":
580
- return {
581
- registerStake: {
582
- stakeKeyHash: certificate.stakeKeyHash
583
- }
584
- };
585
- case "DelegateStake":
586
- return {
587
- delegateStake: {
588
- stakeKeyHash: certificate.stakeKeyHash,
589
- poolId: certificate.poolId
590
- }
591
- };
592
- case "DeregisterStake":
593
- return {
594
- deregisterStake: {
595
- stakeKeyHash: certificate.stakeKeyHash
596
- }
597
- };
598
- case "RetirePool":
599
- return {
600
- retirePool: {
601
- poolId: certificate.poolId,
602
- epoch: certificate.epoch
603
- }
604
- };
605
- case "VoteDelegation":
606
- return {
607
- voteDelegation: {
608
- stakeKeyHash: certificate.stakeKeyHash,
609
- drep: certificate.drep
610
- }
611
- };
612
- case "StakeAndVoteDelegation":
613
- return {
614
- stakeAndVoteDelegation: {
615
- stakeKeyHash: certificate.stakeKeyHash,
616
- poolKeyHash: certificate.poolKeyHash,
617
- drep: certificate.drep
618
- }
619
- };
620
- case "StakeRegistrationAndDelegation":
621
- return {
622
- stakeRegistrationAndDelegation: {
623
- stakeKeyHash: certificate.stakeKeyHash,
624
- poolKeyHash: certificate.poolKeyHash,
625
- coin: certificate.coin
626
- }
627
- };
628
- case "VoteRegistrationAndDelegation":
629
- return {
630
- voteRegistrationAndDelegation: {
631
- stakeKeyHash: certificate.stakeKeyHash,
632
- drep: certificate.drep,
633
- coin: certificate.coin
634
- }
635
- };
636
- case "StakeVoteRegistrationAndDelegation":
637
- return {
638
- stakeVoteRegistrationAndDelegation: {
639
- stakeKeyHash: certificate.stakeKeyHash,
640
- poolKeyHash: certificate.poolKeyHash,
641
- drep: certificate.drep,
642
- coin: certificate.coin
643
- }
644
- };
645
- case "CommitteeHotAuth":
646
- return {
647
- committeeHotAuth: {
648
- committeeColdKeyHash: certificate.committeeColdKeyHash,
649
- committeeHotKeyHash: certificate.committeeHotKeyHash
650
- }
651
- };
652
- case "CommitteeColdResign":
653
- return {
654
- committeeColdResign: {
655
- committeeColdKeyHash: certificate.committeeColdKeyHash,
656
- anchor: certificate.anchor ?? null
657
- }
658
- };
659
- case "DRepRegistration":
660
- return {
661
- dRepRegistration: {
662
- votingKeyHash: certificate.votingKeyHash,
663
- coin: certificate.coin,
664
- anchor: certificate.anchor ?? null
665
- }
666
- };
667
- case "DRepDeregistration":
668
- return {
669
- dRepDeregistration: {
670
- votingKeyHash: certificate.votingKeyHash,
671
- coin: certificate.coin
672
- }
673
- };
674
- case "DRepUpdate":
675
- return {
676
- dRepUpdate: {
677
- votingKeyHash: certificate.votingKeyHash,
678
- anchor: certificate.anchor
679
- }
680
- };
681
- }
682
- };
683
-
684
- // src/types/transaction-builder/index.ts
685
- var emptyTxBuilderBody = () => ({
686
- inputs: [],
687
- outputs: [],
688
- extraInputs: [],
689
- selectionThreshold: 0,
690
- collaterals: [],
691
- requiredSignatures: [],
692
- referenceInputs: [],
693
- mints: [],
694
- changeAddress: "",
695
- metadata: [],
696
- validityRange: {},
697
- certificates: [],
698
- withdrawals: [],
699
- signingKey: []
700
- });
701
- var validityRangeToObj = (validityRange) => {
702
- return {
703
- invalidBefore: validityRange.invalidBefore ?? null,
704
- invalidHereafter: validityRange.invalidHereafter ?? null
705
- };
706
- };
707
-
708
- // src/data/mesh/constructors.ts
709
- var mConStr = (alternative, fields) => ({
710
- alternative,
711
- fields
712
- });
713
- var mConStr0 = (fields) => ({
714
- alternative: 0,
715
- fields
716
- });
717
- var mConStr1 = (fields) => ({
718
- alternative: 1,
719
- fields
720
- });
721
- var mConStr2 = (fields) => ({
722
- alternative: 2,
723
- fields
724
- });
725
-
726
- // src/data/mesh/aliases.ts
727
- var mAssetClass = (currencySymbolHex, tokenNameHex) => {
728
- if (currencySymbolHex.length !== 56 && currencySymbolHex !== "") {
729
- throw new Error(
730
- `Invalid policy id for [${currencySymbolHex}] - should be ${POLICY_ID_LENGTH} bytes long or empty string for lovelace`
731
- );
732
- }
733
- if (tokenNameHex.length > 64) {
734
- throw new Error(
735
- `Invalid asset name for [${tokenNameHex}] - should be less than 32 bytes (64 hex length) long`
736
- );
737
- }
738
- return mConStr0([currencySymbolHex, tokenNameHex]);
739
- };
740
- var mOutputReference = (txHash, index) => {
741
- if (txHash.length !== 64) {
742
- throw new Error("Invalid transaction hash - should be 32 bytes long");
743
- }
744
- return mConStr0([mConStr0([txHash]), index]);
745
- };
746
- var mTxOutRef = (txHash, index) => mOutputReference(txHash, index);
747
- var mTuple = (key, value2) => [key, value2];
748
-
749
- // src/data/mesh/credentials.ts
750
- var mMaybeStakingHash = (stakeCredential, isScriptCredential = false) => {
751
- if (stakeCredential === "") {
752
- return mConStr1([]);
753
- }
754
- if (isScriptCredential) {
755
- return mConStr0([mConStr0([mConStr1([stakeCredential])])]);
756
- }
757
- return mConStr0([mConStr0([mConStr0([stakeCredential])])]);
758
- };
759
- var mPubKeyAddress = (bytes, stakeCredential) => mConStr0([
760
- { alternative: 0, fields: [bytes] },
761
- mMaybeStakingHash(stakeCredential || "")
762
- ]);
763
- var mScriptAddress = (bytes, stakeCredential) => mConStr0([
764
- { alternative: 1, fields: [bytes] },
765
- mMaybeStakingHash(stakeCredential || "")
766
- ]);
767
-
768
- // src/data/mesh/primitives.ts
769
- var mBool = (b) => b ? mConStr1([]) : mConStr0([]);
770
- var mStringToPlutusBSArray = (hexString) => {
771
- const chunks = [];
772
- for (let i = 0; i < hexString.length; i += 64) {
773
- const chunk = hexString.substring(i, i + 64);
774
- chunks.push(chunk);
775
- }
776
- return chunks;
777
- };
778
- var mPlutusBSArrayToString = (bsArray) => {
779
- return bsArray.join("");
780
- };
781
-
782
- // src/data/json/constructors.ts
783
- var conStr = (constructor, fields) => {
784
- if (!Array.isArray(fields)) {
785
- throw new Error("fields of a constructor must be an array");
786
- }
787
- return {
788
- constructor,
789
- fields
790
- };
791
- };
792
- var conStr0 = (fields) => conStr(0, fields);
793
- var conStr1 = (fields) => conStr(1, fields);
794
- var conStr2 = (fields) => conStr(2, fields);
795
-
796
- // src/data/json/primitives.ts
797
- var bool = (b) => b ? conStr1([]) : conStr0([]);
798
- var builtinByteString = (bytes) => {
799
- return byteString(bytes);
800
- };
801
- var byteString = (bytes) => {
802
- if (bytes.length % 2 !== 0) {
803
- throw new Error("Invalid hex string - odd length: " + bytes);
804
- }
805
- if (!/^[0-9a-fA-F]*$/.test(bytes)) {
806
- throw new Error("Invalid hex string - non-hex string character: " + bytes);
807
- }
808
- return {
809
- bytes
810
- };
811
- };
812
- var integer = (int) => ({ int });
813
- var list = (pList, validation = true) => {
814
- if (validation) {
815
- pList.forEach((item) => {
816
- if (typeof item !== "object") {
817
- throw new Error(
818
- "List item of JSON Cardano data type must be an object - " + item
819
- );
820
- }
821
- });
822
- }
823
- return { list: pList };
824
- };
825
- var stringToBSArray = (hexString) => {
826
- const processRawStringIntoPlutusByteArray = (hexString2) => {
827
- const chunks = [];
828
- for (let i = 0; i < hexString2.length; i += 64) {
829
- const chunk = hexString2.substring(i, i + 64);
830
- chunks.push(chunk);
831
- }
832
- return chunks;
833
- };
834
- return list(
835
- processRawStringIntoPlutusByteArray(hexString).map(builtinByteString)
836
- );
837
- };
838
- var plutusBSArrayToString = (bsArray) => {
839
- return bsArray.list.map((bs) => bs.bytes).join("");
840
- };
841
- var assocMap = (mapItems, validation = true) => ({
842
- map: mapItems.map(([k, v]) => {
843
- if (validation) {
844
- if (typeof k !== "object" || typeof v !== "object") {
845
- throw new Error(
846
- `Map item of JSON Cardano data type must be an object - ${k}, ${v}`
847
- );
848
- }
849
- }
850
- return { k, v };
851
- })
852
- });
853
-
854
- // src/data/json/aliases.ts
855
- var hashByteString = (bytes) => {
856
- if (bytes.length !== 56) {
857
- throw new Error(`Invalid hash for [${bytes}] - should be 56 bytes long`);
858
- }
859
- return byteString(bytes);
860
- };
861
- var scriptHash = (bytes) => hashByteString(bytes);
862
- var pubKeyHash = (bytes) => hashByteString(bytes);
863
- var policyId = (bytes) => {
864
- if (bytes.length !== POLICY_ID_LENGTH && bytes !== "") {
865
- throw new Error(
866
- `Invalid policy id for [${bytes}] - should be ${POLICY_ID_LENGTH} bytes long or empty string for lovelace`
867
- );
868
- }
869
- return byteString(bytes);
870
- };
871
- var currencySymbol = (bytes) => policyId(bytes);
872
- var assetName = (bytes) => {
873
- if (bytes.length > 64) {
874
- throw new Error(
875
- `Invalid asset name for [${bytes}] - should be less than 32 bytes (64 hex length) long`
876
- );
877
- }
878
- return byteString(bytes);
879
- };
880
- var tokenName = (bytes) => assetName(bytes);
881
- var assetClass = (currencySymbolHex, tokenNameHex) => conStr0([currencySymbol(currencySymbolHex), tokenName(tokenNameHex)]);
882
- var outputReference = (txHash, index) => {
883
- if (txHash.length !== 64) {
884
- throw new Error("Invalid transaction hash - should be 32 bytes long");
885
- }
886
- return conStr0([conStr0([byteString(txHash)]), integer(index)]);
887
- };
888
- var txOutRef = (txHash, index) => outputReference(txHash, index);
889
- var posixTime = (int) => ({ int });
890
- var dict = (itemsMap) => ({
891
- map: itemsMap.map(([k, v]) => ({ k, v }))
892
- });
893
- var tuple = (key, value2) => ({ list: [key, value2] });
894
-
895
- // src/data/json/credentials.ts
896
- var maybeStakingHash = (stakeCredential, isScriptCredential = false) => {
897
- if (stakeCredential === "") {
898
- return conStr1([]);
899
- }
900
- if (isScriptCredential) {
901
- return conStr0([
902
- conStr0([conStr1([scriptHash(stakeCredential)])])
903
- ]);
904
- }
905
- return conStr0([
906
- conStr0([conStr0([pubKeyHash(stakeCredential)])])
907
- ]);
908
- };
909
- var pubKeyAddress = (bytes, stakeCredential, isScriptCredential = false) => conStr0([
910
- conStr0([pubKeyHash(bytes)]),
911
- maybeStakingHash(stakeCredential || "", isScriptCredential)
912
- ]);
913
- var scriptAddress = (bytes, stakeCredential, isScriptCredential = false) => conStr0([
914
- conStr1([scriptHash(bytes)]),
915
- maybeStakingHash(stakeCredential || "", isScriptCredential)
916
- ]);
917
-
918
- // src/data/parser.ts
919
- var bytesToHex = (bytes) => Buffer.from(bytes).toString("hex");
920
- var hexToBytes = (hex) => Buffer.from(hex, "hex");
921
- var stringToHex = (str) => Buffer.from(str, "utf8").toString("hex");
922
- var hexToString = (hex) => Buffer.from(hex, "hex").toString("utf8");
923
- var toBytes = (hex) => {
924
- if (hex.length % 2 === 0 && /^[0-9A-F]*$/i.test(hex))
925
- return Buffer.from(hex, "hex");
926
- return Buffer.from(hex, "utf-8");
927
- };
928
- var fromUTF8 = (utf8) => {
929
- if (utf8.length % 2 === 0 && /^[0-9A-F]*$/i.test(utf8)) return utf8;
930
- return bytesToHex(Buffer.from(utf8, "utf-8"));
931
- };
932
- var toUTF8 = (hex) => Buffer.from(hex, "hex").toString("utf-8");
933
- var parseAssetUnit = (unit) => {
934
- const policyId2 = unit.slice(0, POLICY_ID_LENGTH);
935
- const assetName2 = unit.includes(".") ? fromUTF8(unit.split(".")[1]) : unit.slice(POLICY_ID_LENGTH);
936
- return { policyId: policyId2, assetName: assetName2 };
937
- };
938
-
939
- // src/data/time.ts
940
- var SLOT_CONFIG_NETWORK = {
941
- mainnet: {
942
- zeroTime: 1596059091e3,
943
- zeroSlot: 4492800,
944
- slotLength: 1e3,
945
- startEpoch: 208,
946
- epochLength: 432e3
947
- },
948
- // Starting at Shelley era
949
- preview: {
950
- zeroTime: 1666656e6,
951
- zeroSlot: 0,
952
- slotLength: 1e3,
953
- startEpoch: 183,
954
- epochLength: 86400
955
- },
956
- // Starting at Shelley era
957
- preprod: {
958
- zeroTime: 16540416e5 + 1728e6,
959
- zeroSlot: 86400,
960
- slotLength: 1e3,
961
- startEpoch: 65,
962
- epochLength: 432e3
963
- },
964
- // Starting at Shelley era
965
- /** Customizable slot config (Initialized with 0 values). */
966
- testnet: {
967
- zeroTime: 0,
968
- zeroSlot: 0,
969
- slotLength: 0,
970
- startEpoch: 0,
971
- epochLength: 0
972
- }
973
- };
974
- var slotToBeginUnixTime = (slot, slotConfig) => {
975
- const msAfterBegin = (slot - slotConfig.zeroSlot) * slotConfig.slotLength;
976
- return slotConfig.zeroTime + msAfterBegin;
977
- };
978
- var unixTimeToEnclosingSlot = (unixTime, slotConfig) => {
979
- const timePassed = unixTime - slotConfig.zeroTime;
980
- const slotsPassed = Math.floor(timePassed / slotConfig.slotLength);
981
- return slotsPassed + slotConfig.zeroSlot;
982
- };
983
- var resolveSlotNo = (network, milliseconds = Date.now()) => {
984
- return unixTimeToEnclosingSlot(
985
- milliseconds,
986
- SLOT_CONFIG_NETWORK[network]
987
- ).toString();
988
- };
989
- var resolveEpochNo = (network, milliseconds = Date.now()) => {
990
- const config = SLOT_CONFIG_NETWORK[network];
991
- const msBigInt = BigInt(milliseconds);
992
- const epoch = (msBigInt / 1000n - BigInt(config.zeroTime)) / BigInt(config.epochLength) + BigInt(config.startEpoch);
993
- return Number(epoch);
994
- };
995
-
996
- // src/data/value.ts
997
- var value = (assets) => {
998
- const valueMapToParse = [];
999
- const valueMap = {};
1000
- assets.forEach((asset) => {
1001
- const sanitizedName = asset.unit.replace("lovelace", "");
1002
- const policy = sanitizedName.slice(0, 56) || "";
1003
- const token = sanitizedName.slice(56) || "";
1004
- if (!valueMap[policy]) {
1005
- valueMap[policy] = {};
1006
- }
1007
- if (!valueMap[policy][token]) {
1008
- valueMap[policy][token] = Number(asset.quantity);
1009
- } else {
1010
- valueMap[policy][token] += Number(asset.quantity);
1011
- }
1012
- });
1013
- Object.keys(valueMap).forEach((policy) => {
1014
- const policyByte = currencySymbol(policy);
1015
- const tokens = Object.keys(valueMap[policy]).map(
1016
- (name) => [tokenName(name), integer(valueMap[policy][name])]
1017
- );
1018
- const policyMap = assocMap(tokens);
1019
- valueMapToParse.push([policyByte, policyMap]);
1020
- });
1021
- return assocMap(valueMapToParse);
1022
- };
1023
- var parsePlutusValueToAssets = (plutusValue) => {
1024
- const assets = [];
1025
- plutusValue.map.forEach((policyMap) => {
1026
- const policy = policyMap.k.bytes;
1027
- policyMap.v.map.forEach((tokenMap) => {
1028
- const token = tokenMap.k.bytes;
1029
- const quantity = tokenMap.v.int.toString();
1030
- const unsanitizedUnit = policy + token;
1031
- const unit = unsanitizedUnit === "" ? "lovelace" : unsanitizedUnit;
1032
- assets.push({ unit, quantity });
1033
- });
1034
- });
1035
- return assets;
1036
- };
1037
-
1038
- // src/utils/bigNum.ts
1039
- var _BigNum = class _BigNum {
1040
- constructor(value2) {
1041
- this.value = BigInt(value2);
1042
- }
1043
- // Operators
1044
- divFloor(other) {
1045
- this.value = this.value / other.value;
1046
- return this;
1047
- }
1048
- checkedMul(other) {
1049
- this.value *= other.value;
1050
- return this;
1051
- }
1052
- checkedAdd(other) {
1053
- this.value += other.value;
1054
- return this;
1055
- }
1056
- checkedSub(other) {
1057
- this.value -= other.value;
1058
- return this;
1059
- }
1060
- clampedSub(other) {
1061
- const result = this.value - other.value;
1062
- this.value = result < 0n ? 0n : result;
1063
- return this;
1064
- }
1065
- // Comparators
1066
- lessThan(other) {
1067
- return this.value < other.value;
1068
- }
1069
- compare(other) {
1070
- if (this.value === other.value) {
1071
- return 0;
1072
- } else if (this.value < other.value) {
1073
- return -1;
1074
- } else {
1075
- return 1;
1076
- }
1077
- }
1078
- // Override
1079
- toString() {
1080
- return this.value.toString();
1081
- }
1082
- };
1083
- _BigNum.new = (value2) => {
1084
- return new _BigNum(value2);
1085
- };
1086
- var BigNum = _BigNum;
1087
-
1088
- // src/utils/asset-fingerprint.ts
1089
- import CIP14 from "@emurgo/cip14-js";
1090
- var AssetFingerprint = CIP14;
1091
- var resolveFingerprint = (policyId2, assetName2) => {
1092
- return AssetFingerprint.default.fromParts(toBytes(policyId2), toBytes(assetName2)).fingerprint();
1093
- };
1094
-
1095
- // src/index.ts
1096
- import { generateMnemonic, mnemonicToEntropy } from "bip39";
1097
- export {
1098
- AssetFingerprint,
1099
- BigNum,
1100
- CIP68_100,
1101
- CIP68_222,
1102
- DEFAULT_PROTOCOL_PARAMETERS,
1103
- DEFAULT_REDEEMER_BUDGET,
1104
- DEFAULT_V1_COST_MODEL_LIST,
1105
- DEFAULT_V2_COST_MODEL_LIST,
1106
- HARDENED_KEY_START,
1107
- LANGUAGE_VERSIONS,
1108
- POLICY_ID_LENGTH,
1109
- SLOT_CONFIG_NETWORK,
1110
- SUPPORTED_CLOCKS,
1111
- SUPPORTED_HANDLES,
1112
- SUPPORTED_LANGUAGE_VIEWS,
1113
- SUPPORTED_OGMIOS_LINKS,
1114
- SUPPORTED_TOKENS,
1115
- SUPPORTED_WALLETS,
1116
- assetClass,
1117
- assetName,
1118
- assocMap,
1119
- bool,
1120
- builtinByteString,
1121
- byteString,
1122
- bytesToHex,
1123
- certificateToObj,
1124
- conStr,
1125
- conStr0,
1126
- conStr1,
1127
- conStr2,
1128
- currencySymbol,
1129
- dict,
1130
- emptyTxBuilderBody,
1131
- fromUTF8,
1132
- fungibleAssetKeys,
1133
- generateMnemonic,
1134
- hashByteString,
1135
- hexToBytes,
1136
- hexToString,
1137
- integer,
1138
- isNetwork,
1139
- list,
1140
- mAssetClass,
1141
- mBool,
1142
- mConStr,
1143
- mConStr0,
1144
- mConStr1,
1145
- mConStr2,
1146
- mMaybeStakingHash,
1147
- mOutputReference,
1148
- mPlutusBSArrayToString,
1149
- mPubKeyAddress,
1150
- mScriptAddress,
1151
- mStringToPlutusBSArray,
1152
- mTuple,
1153
- mTxOutRef,
1154
- maybeStakingHash,
1155
- mergeAssets,
1156
- metadataStandardKeys,
1157
- metadataToCip68,
1158
- mnemonicToEntropy,
1159
- outputReference,
1160
- parseAssetUnit,
1161
- parsePlutusValueToAssets,
1162
- plutusBSArrayToString,
1163
- policyId,
1164
- poolMetadataToObj,
1165
- poolParamsToObj,
1166
- posixTime,
1167
- pubKeyAddress,
1168
- pubKeyHash,
1169
- relayToObj,
1170
- resolveEpochNo,
1171
- resolveFingerprint,
1172
- resolveLanguageView,
1173
- resolveSlotNo,
1174
- resolveTxFees,
1175
- royaltiesStandardKeys,
1176
- scriptAddress,
1177
- scriptHash,
1178
- slotToBeginUnixTime,
1179
- stringToBSArray,
1180
- stringToHex,
1181
- toBytes,
1182
- toUTF8,
1183
- tokenName,
1184
- tuple,
1185
- txOutRef,
1186
- unixTimeToEnclosingSlot,
1187
- validityRangeToObj,
1188
- value
1189
- };
1
+ var M={epoch:0,coinsPerUtxoSize:4310,priceMem:.0577,priceStep:721e-7,minFeeA:44,minFeeB:155381,keyDeposit:2e6,maxTxSize:16384,maxValSize:5e3,poolDeposit:5e8,maxCollateralInputs:3,decentralisation:0,maxBlockSize:98304,collateralPercent:150,maxBlockHeaderSize:1100,minPoolCost:"340000000",maxTxExMem:"16000000",maxTxExSteps:"10000000000",maxBlockExMem:"80000000",maxBlockExSteps:"40000000000"},q=(e,t=M.minFeeA,r=M.minFeeB)=>(BigInt(t)*BigInt(e)+BigInt(r)).toString();var Y=["begin","eternl","flint","lace","nami","nufi","gerowallet","typhoncip30","vespr","yoroi"];var J=[205665,812,1,1,1e3,571,0,1,1e3,24177,4,1,1e3,32,117366,10475,4,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,100,100,23e3,100,19537,32,175354,32,46417,4,221973,511,0,1,89141,32,497525,14068,4,2,196500,453240,220,0,1,1,1e3,28662,4,2,245e3,216773,62,1,1060367,12586,1,208512,421,1,187e3,1e3,52998,1,80436,32,43249,32,1e3,32,80556,1,57667,4,1e3,10,197145,156,1,197145,156,1,204924,473,1,208896,511,1,52467,32,64832,32,65493,32,22558,32,16563,32,76511,32,196500,453240,220,0,1,1,69522,11687,0,1,60091,32,196500,453240,220,0,1,1,196500,453240,220,0,1,1,806990,30482,4,1927926,82523,4,265318,0,4,0,85931,32,205665,812,1,1,41182,32,212342,32,31220,32,32696,32,43357,32,32247,32,38314,32,57996947,18975,10],Q=[205665,812,1,1,1e3,571,0,1,1e3,24177,4,1,1e3,32,117366,10475,4,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,100,100,23e3,100,19537,32,175354,32,46417,4,221973,511,0,1,89141,32,497525,14068,4,2,196500,453240,220,0,1,1,1e3,28662,4,2,245e3,216773,62,1,1060367,12586,1,208512,421,1,187e3,1e3,52998,1,80436,32,43249,32,1e3,32,80556,1,57667,4,1e3,10,197145,156,1,197145,156,1,204924,473,1,208896,511,1,52467,32,64832,32,65493,32,22558,32,16563,32,76511,32,196500,453240,220,0,1,1,69522,11687,0,1,60091,32,196500,453240,220,0,1,1,196500,453240,220,0,1,1,1159724,392670,0,2,806990,30482,4,1927926,82523,4,265318,0,4,0,85931,32,205665,812,1,1,41182,32,212342,32,31220,32,32696,32,43357,32,32247,32,38314,32,35892428,10,57996947,18975,10,38887044,32947,10];var N={ALONZO:{V1:"a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"},BABBAGE:{V1:"a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",V2:"a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"}},ee=(e,t)=>N[e][t];var re={mem:7e6,steps:3e9},p=56,oe={V1:"V1",V2:"V2",V3:"V3"},ae=2147483648,ne={testnet:["74","1598400","1595967616","432000"],preview:["183","15811222","1682467200","86400"],preprod:["65","26438400","1682121600","432000"],mainnet:["208","4492800","1596059091","432000"]},se={0:"8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",1:"f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"},ie={mainnet:"wss://ogmios-api.mainnet.dandelion.link",preprod:"wss://ogmios-api.iohk-preprod.dandelion.link",preview:"__TBD_SOON_TM__",testnet:"wss://ogmios-api.testnet.dandelion.link"},pe={LQ:"da8c30857834c6ae7203935b89278c532b3995245295456f993e1d244c51",MIN:"29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e",NTX:"edfd7a1d77bcb8b884c474bdc92a16002d1fb720e454fa6e993444794e5458",iBTC:"f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069425443",iETH:"f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069455448",iUSD:"f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344",MILK:"8a1cfae21368b8bebbbed9800fec304e95cce39a2a57dc35e2e3ebaa4d494c4b",AGIX:"f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc53541474958",MELD:"6ac8ef33b510ec004fe11585f7c5a9f0c07f0c23428ab4f29c1d7d104d454c44",INDY:"533bb94a8850ee3ccbe483106489399112b74c905342cb1792a797a0494e4459",CLAY:"38ad9dc3aec6a2f38e220142b9aa6ade63ebe71f65e7cc2b7d8a8535434c4159",MCOS:"6f46e1304b16d884c85c62fb0eef35028facdc41aaa0fd319a152ed64d434f53",DING:"ce5b9e0f8a88255b65f2e4d065c6e716e9fa9a8a86dfb86423dd1ac044494e47",GERO:"10a49b996e2402269af553a8a96fb8eb90d79e9eca79e2b4223057b64745524f",NMKR:"5dac8536653edc12f6f5e1045d8164b9f59998d3bdc300fc928434894e4d4b52",PAVIA:"884892bcdc360bcef87d6b3f806e7f9cd5ac30d999d49970e7a903ae5041564941",HOSKY:"a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235484f534b59",YUMMI:"078eafce5cd7edafdf63900edef2c1ea759e77f30ca81d6bbdeec92479756d6d69",C3:"8e51398904a5d3fc129fbf4f1589701de23c7824d5c90fdb9490e15a434841524c4933",GIMBAL:"2b0a04a7b60132b1805b296c7fcb3b217ff14413991bf76f72663c3067696d62616c",SUNDAE:"9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d7753554e444145",GREENS:"4623ab311b7d982d8d26fcbe1a9439ca56661aafcdcd8d8a0ef31fd6475245454e53",GENS:"dda5fdb1002f7389b33e036b6afee82a8189becb6cba852e8b79b4fb0014df1047454e53",SOCIETY:"25f0fc240e91bd95dcdaebd2ba7713fc5168ac77234a3d79449fc20c534f4349455459",DJED:"8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344",SHEN:"8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344",WMT:"1d7f33bd23d85e1a25d87d86fac4f199c3197a2f7afeb662a0f34e1e776f726c646d6f62696c65746f6b656e",COPI:"b6a7467ea1deb012808ef4e87b5ff371e85f7142d7b356a40d9b42a0436f726e75636f70696173205b76696120436861696e506f72742e696f5d"},ce=e=>`000643b0${e}`,de=e=>`000de140${e}`;var Me=e=>{let t=[];return e.forEach(r=>{let o=t.find(a=>a.unit===r.unit);o?o.quantity=(BigInt(o.quantity)+BigInt(r.quantity)).toString():t.push(r)}),t};var He=["rate","address"],Ke=["name","image","mediaType","description","instagram","twitter","discord","website"],Ie=["ticker","decimals"],A=e=>{switch(typeof e){case"object":if(e instanceof Array)return e.map(o=>A(o));let t=new Map;return Object.keys(e).forEach(o=>{t.set(o,A(e[o]))}),{alternative:0,fields:[t,1]};default:return e}};var P=["testnet","preview","preprod","mainnet"],Be=e=>P.includes(e);var H=e=>{switch(e.type){case"SingleHostAddr":return{singleHostAddr:{ipv4:e.IPV4,ipv6:e.IPV6,port:e.port}};case"SingleHostName":return{singleHostName:{hostname:e.domainName,port:e.port}};case"MultiHostName":return{multiHostName:{dnsName:e.domainName}}}};var K=e=>({vrfKeyHash:e.vrfKeyHash,operator:e.operator,pledge:e.pledge,cost:e.cost,margin:e.margin,relays:e.relays.map(t=>H(t)),owners:e.owners,rewardAddress:e.rewardAddress,metadata:e.metadata?v(e.metadata):void 0}),v=e=>({url:e.URL,metadata:e.hash});var Oe=e=>{switch(e.type){case"RegisterPool":return{registerPool:{poolParams:K(e.poolParams)}};case"RegisterStake":return{registerStake:{stakeKeyHash:e.stakeKeyHash}};case"DelegateStake":return{delegateStake:{stakeKeyHash:e.stakeKeyHash,poolId:e.poolId}};case"DeregisterStake":return{deregisterStake:{stakeKeyHash:e.stakeKeyHash}};case"RetirePool":return{retirePool:{poolId:e.poolId,epoch:e.epoch}};case"VoteDelegation":return{voteDelegation:{stakeKeyHash:e.stakeKeyHash,drep:e.drep}};case"StakeAndVoteDelegation":return{stakeAndVoteDelegation:{stakeKeyHash:e.stakeKeyHash,poolKeyHash:e.poolKeyHash,drep:e.drep}};case"StakeRegistrationAndDelegation":return{stakeRegistrationAndDelegation:{stakeKeyHash:e.stakeKeyHash,poolKeyHash:e.poolKeyHash,coin:e.coin}};case"VoteRegistrationAndDelegation":return{voteRegistrationAndDelegation:{stakeKeyHash:e.stakeKeyHash,drep:e.drep,coin:e.coin}};case"StakeVoteRegistrationAndDelegation":return{stakeVoteRegistrationAndDelegation:{stakeKeyHash:e.stakeKeyHash,poolKeyHash:e.poolKeyHash,drep:e.drep,coin:e.coin}};case"CommitteeHotAuth":return{committeeHotAuth:{committeeColdKeyHash:e.committeeColdKeyHash,committeeHotKeyHash:e.committeeHotKeyHash}};case"CommitteeColdResign":return{committeeColdResign:{committeeColdKeyHash:e.committeeColdKeyHash,anchor:e.anchor??null}};case"DRepRegistration":return{dRepRegistration:{votingKeyHash:e.votingKeyHash,coin:e.coin,anchor:e.anchor??null}};case"DRepDeregistration":return{dRepDeregistration:{votingKeyHash:e.votingKeyHash,coin:e.coin}};case"DRepUpdate":return{dRepUpdate:{votingKeyHash:e.votingKeyHash,anchor:e.anchor}}}};var Le=()=>({inputs:[],outputs:[],extraInputs:[],selectionThreshold:0,collaterals:[],requiredSignatures:[],referenceInputs:[],mints:[],changeAddress:"",metadata:[],validityRange:{},certificates:[],withdrawals:[],signingKey:[]}),_e=e=>({invalidBefore:e.invalidBefore??null,invalidHereafter:e.invalidHereafter??null});var Tt=(e,t)=>({alternative:e,fields:t}),s=e=>({alternative:0,fields:e}),g=e=>({alternative:1,fields:e}),Ct=e=>({alternative:2,fields:e});var It=(e,t)=>{if(e.length!==56&&e!=="")throw new Error(`Invalid policy id for [${e}] - should be ${p} bytes long or empty string for lovelace`);if(t.length>64)throw new Error(`Invalid asset name for [${t}] - should be less than 32 bytes (64 hex length) long`);return s([e,t])},w=(e,t)=>{if(e.length!==64)throw new Error("Invalid transaction hash - should be 32 bytes long");return s([s([e]),t])},kt=(e,t)=>w(e,t),Bt=(e,t)=>[e,t];var I=(e,t=!1)=>e===""?g([]):t?s([s([g([e])])]):s([s([s([e])])]),Pt=(e,t)=>s([{alternative:0,fields:[e]},I(t||"")]),vt=(e,t)=>s([{alternative:1,fields:[e]},I(t||"")]);var _t=e=>e?g([]):s([]),Ut=e=>{let t=[];for(let r=0;r<e.length;r+=64){let o=e.substring(r,r+64);t.push(o)}return t},Ft=e=>e.join("");var y=(e,t)=>{if(!Array.isArray(t))throw new Error("fields of a constructor must be an array");return{constructor:e,fields:t}},n=e=>y(0,e),d=e=>y(1,e),Yt=e=>y(2,e);var e0=e=>e?d([]):n([]),O=e=>f(e),f=e=>{if(e.length%2!==0)throw new Error("Invalid hex string - odd length: "+e);if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("Invalid hex string - non-hex string character: "+e);return{bytes:e}},u=e=>({int:e}),V=(e,t=!0)=>(t&&e.forEach(r=>{if(typeof r!="object")throw new Error("List item of JSON Cardano data type must be an object - "+r)}),{list:e}),t0=e=>V((r=>{let o=[];for(let a=0;a<r.length;a+=64){let i=r.substring(a,a+64);o.push(i)}return o})(e).map(O)),r0=e=>e.list.map(t=>t.bytes).join(""),b=(e,t=!0)=>({map:e.map(([r,o])=>{if(t&&(typeof r!="object"||typeof o!="object"))throw new Error(`Map item of JSON Cardano data type must be an object - ${r}, ${o}`);return{k:r,v:o}})});var k=e=>{if(e.length!==56)throw new Error(`Invalid hash for [${e}] - should be 56 bytes long`);return f(e)},S=e=>k(e),x=e=>k(e),L=e=>{if(e.length!==p&&e!=="")throw new Error(`Invalid policy id for [${e}] - should be ${p} bytes long or empty string for lovelace`);return f(e)},h=e=>L(e),_=e=>{if(e.length>64)throw new Error(`Invalid asset name for [${e}] - should be less than 32 bytes (64 hex length) long`);return f(e)},T=e=>_(e),d0=(e,t)=>n([h(e),T(t)]),U=(e,t)=>{if(e.length!==64)throw new Error("Invalid transaction hash - should be 32 bytes long");return n([n([f(e)]),u(t)])},f0=(e,t)=>U(e,t),m0=e=>({int:e}),g0=e=>({map:e.map(([t,r])=>({k:t,v:r}))}),u0=(e,t)=>({list:[e,t]});var B=(e,t=!1)=>e===""?d([]):t?n([n([d([S(e)])])]):n([n([n([x(e)])])]),C0=(e,t,r=!1)=>n([n([x(e)]),B(t||"",r)]),M0=(e,t,r=!1)=>n([d([S(e)]),B(t||"",r)]);var F=e=>Buffer.from(e).toString("hex"),D0=e=>Buffer.from(e,"hex"),E0=e=>Buffer.from(e,"utf8").toString("hex"),N0=e=>Buffer.from(e,"hex").toString("utf8"),C=e=>e.length%2===0&&/^[0-9A-F]*$/i.test(e)?Buffer.from(e,"hex"):Buffer.from(e,"utf-8"),j=e=>e.length%2===0&&/^[0-9A-F]*$/i.test(e)?e:F(Buffer.from(e,"utf-8")),P0=e=>Buffer.from(e,"hex").toString("utf-8"),v0=e=>{let t=e.slice(0,p),r=e.includes(".")?j(e.split(".")[1]):e.slice(p);return{policyId:t,assetName:r}};var R={mainnet:{zeroTime:1596059091e3,zeroSlot:4492800,slotLength:1e3,startEpoch:208,epochLength:432e3},preview:{zeroTime:1666656e6,zeroSlot:0,slotLength:1e3,startEpoch:183,epochLength:86400},preprod:{zeroTime:16540416e5+1728e6,zeroSlot:86400,slotLength:1e3,startEpoch:65,epochLength:432e3},testnet:{zeroTime:0,zeroSlot:0,slotLength:0,startEpoch:0,epochLength:0}},O0=(e,t)=>{let r=(e-t.zeroSlot)*t.slotLength;return t.zeroTime+r},z=(e,t)=>{let r=e-t.zeroTime;return Math.floor(r/t.slotLength)+t.zeroSlot},V0=(e,t=Date.now())=>z(t,R[e]).toString(),L0=(e,t=Date.now())=>{let r=R[e],a=(BigInt(t)/1000n-BigInt(r.zeroTime))/BigInt(r.epochLength)+BigInt(r.startEpoch);return Number(a)};var $0=e=>{let t=[],r={};return e.forEach(o=>{let a=o.unit.replace("lovelace",""),i=a.slice(0,56)||"",c=a.slice(56)||"";r[i]||(r[i]={}),r[i][c]?r[i][c]+=Number(o.quantity):r[i][c]=Number(o.quantity)}),Object.keys(r).forEach(o=>{let a=h(o),i=Object.keys(r[o]).map(m=>[T(m),u(r[o][m])]),c=b(i);t.push([a,c])}),b(t)},q0=e=>{let t=[];return e.map.forEach(r=>{let o=r.k.bytes;r.v.map.forEach(a=>{let i=a.k.bytes,c=a.v.int.toString(),m=o+i,E=m===""?"lovelace":m;t.push({unit:E,quantity:c})})}),t};var l=class l{constructor(t){this.value=BigInt(t)}divFloor(t){return this.value=this.value/t.value,this}checkedMul(t){return this.value*=t.value,this}checkedAdd(t){return this.value+=t.value,this}checkedSub(t){return this.value-=t.value,this}clampedSub(t){let r=this.value-t.value;return this.value=r<0n?0n:r,this}lessThan(t){return this.value<t.value}compare(t){return this.value===t.value?0:this.value<t.value?-1:1}toString(){return this.value.toString()}};l.new=t=>new l(t);var D=l;import G from"@emurgo/cip14-js";var $=G,ar=(e,t)=>$.default.fromParts(C(e),C(t)).fingerprint();import{generateMnemonic as yr,mnemonicToEntropy as br}from"bip39";export{$ as AssetFingerprint,D as BigNum,ce as CIP68_100,de as CIP68_222,M as DEFAULT_PROTOCOL_PARAMETERS,re as DEFAULT_REDEEMER_BUDGET,J as DEFAULT_V1_COST_MODEL_LIST,Q as DEFAULT_V2_COST_MODEL_LIST,ae as HARDENED_KEY_START,oe as LANGUAGE_VERSIONS,p as POLICY_ID_LENGTH,R as SLOT_CONFIG_NETWORK,ne as SUPPORTED_CLOCKS,se as SUPPORTED_HANDLES,N as SUPPORTED_LANGUAGE_VIEWS,ie as SUPPORTED_OGMIOS_LINKS,pe as SUPPORTED_TOKENS,Y as SUPPORTED_WALLETS,d0 as assetClass,_ as assetName,b as assocMap,e0 as bool,O as builtinByteString,f as byteString,F as bytesToHex,Oe as certificateToObj,y as conStr,n as conStr0,d as conStr1,Yt as conStr2,h as currencySymbol,g0 as dict,Le as emptyTxBuilderBody,j as fromUTF8,Ie as fungibleAssetKeys,yr as generateMnemonic,k as hashByteString,D0 as hexToBytes,N0 as hexToString,u as integer,Be as isNetwork,V as list,It as mAssetClass,_t as mBool,Tt as mConStr,s as mConStr0,g as mConStr1,Ct as mConStr2,I as mMaybeStakingHash,w as mOutputReference,Ft as mPlutusBSArrayToString,Pt as mPubKeyAddress,vt as mScriptAddress,Ut as mStringToPlutusBSArray,Bt as mTuple,kt as mTxOutRef,B as maybeStakingHash,Me as mergeAssets,Ke as metadataStandardKeys,A as metadataToCip68,br as mnemonicToEntropy,U as outputReference,v0 as parseAssetUnit,q0 as parsePlutusValueToAssets,r0 as plutusBSArrayToString,L as policyId,v as poolMetadataToObj,K as poolParamsToObj,m0 as posixTime,C0 as pubKeyAddress,x as pubKeyHash,H as relayToObj,L0 as resolveEpochNo,ar as resolveFingerprint,ee as resolveLanguageView,V0 as resolveSlotNo,q as resolveTxFees,He as royaltiesStandardKeys,M0 as scriptAddress,S as scriptHash,O0 as slotToBeginUnixTime,t0 as stringToBSArray,E0 as stringToHex,C as toBytes,P0 as toUTF8,T as tokenName,u0 as tuple,f0 as txOutRef,z as unixTimeToEnclosingSlot,_e as validityRangeToObj,$0 as value};