@meshsdk/core 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MetadataStandard, Files } from '@mesh/core';
|
|
2
|
-
export declare type AssetMetadata = FungibleAssetMetadata | NonFungibleAssetMetadata;
|
|
1
|
+
import type { MetadataStandard, Files, RoyaltiesStandard } from '@mesh/core';
|
|
2
|
+
export declare type AssetMetadata = FungibleAssetMetadata | NonFungibleAssetMetadata | RoyaltiesStandard;
|
|
3
3
|
export declare type FungibleAssetMetadata = MetadataStandard & {
|
|
4
4
|
ticker: string;
|
|
5
5
|
decimals: number;
|
package/dist/core/index.d.ts
CHANGED
package/dist/core.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const fe=require("nanoid"),Ge=require("@emurgo/cardano-serialization-lib-nodejs"),Re=require("axios"),Kt=require("bip39"),p=require("@emurgo/cardano-message-signing-nodejs"),$e=s=>s&&typeof s=="object"&&"default"in s?s:{default:s};function ze(s){if(s&&s.__esModule)return s;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const n=ze(Ge),J=$e(Re),We=["testnet","preview","preprod","mainnet"],pe=s=>We.includes(s),_e={mem:7e6,steps:3e9},q={epoch:0,coinsPerUTxOSize:"4310",priceMem:.0577,priceStep:721e-7,minFeeA:44,minFeeB:155381,keyDeposit:"2000000",maxTxSize:16384,maxValSize:"5000",poolDeposit:"500000000",maxCollateralInputs:3,decentralisation:0,maxBlockSize:98304,collateralPercent:150,maxBlockHeaderSize:1100,minPoolCost:"340000000",maxTxExMem:"16000000",maxTxExSteps:"10000000000",maxBlockExMem:"80000000",maxBlockExSteps:"40000000000"},kt=2147483648,wt={V1:n.Language.new_plutus_v1(),V2:n.Language.new_plutus_v2()},T=56,Je={CERT:n.RedeemerTag.new_cert(),MINT:n.RedeemerTag.new_mint(),REWARD:n.RedeemerTag.new_reward(),SPEND:n.RedeemerTag.new_spend()},Bt={testnet:["74","1598400","1595967616","432000"],preview:["0","0","1660003200","86400"],preprod:["0","0","1654041600","432000"],mainnet:["208","4492800","1596059091","432000"]},$t={ALONZO:n.TxBuilderConstants.plutus_alonzo_cost_models(),BABBAGE:(()=>{const s=n.Costmdls.new(),e=n.CostModel.new();Object.values({"addInteger-cpu-arguments-intercept":205665,"addInteger-cpu-arguments-slope":812,"addInteger-memory-arguments-intercept":1,"addInteger-memory-arguments-slope":1,"appendByteString-cpu-arguments-intercept":1e3,"appendByteString-cpu-arguments-slope":571,"appendByteString-memory-arguments-intercept":0,"appendByteString-memory-arguments-slope":1,"appendString-cpu-arguments-intercept":1e3,"appendString-cpu-arguments-slope":24177,"appendString-memory-arguments-intercept":4,"appendString-memory-arguments-slope":1,"bData-cpu-arguments":1e3,"bData-memory-arguments":32,"blake2b_256-cpu-arguments-intercept":117366,"blake2b_256-cpu-arguments-slope":10475,"blake2b_256-memory-arguments":4,"cekApplyCost-exBudgetCPU":23e3,"cekApplyCost-exBudgetMemory":100,"cekBuiltinCost-exBudgetCPU":23e3,"cekBuiltinCost-exBudgetMemory":100,"cekConstCost-exBudgetCPU":23e3,"cekConstCost-exBudgetMemory":100,"cekDelayCost-exBudgetCPU":23e3,"cekDelayCost-exBudgetMemory":100,"cekForceCost-exBudgetCPU":23e3,"cekForceCost-exBudgetMemory":100,"cekLamCost-exBudgetCPU":23e3,"cekLamCost-exBudgetMemory":100,"cekStartupCost-exBudgetCPU":100,"cekStartupCost-exBudgetMemory":100,"cekVarCost-exBudgetCPU":23e3,"cekVarCost-exBudgetMemory":100,"chooseData-cpu-arguments":19537,"chooseData-memory-arguments":32,"chooseList-cpu-arguments":175354,"chooseList-memory-arguments":32,"chooseUnit-cpu-arguments":46417,"chooseUnit-memory-arguments":4,"consByteString-cpu-arguments-intercept":221973,"consByteString-cpu-arguments-slope":511,"consByteString-memory-arguments-intercept":0,"consByteString-memory-arguments-slope":1,"constrData-cpu-arguments":89141,"constrData-memory-arguments":32,"decodeUtf8-cpu-arguments-intercept":497525,"decodeUtf8-cpu-arguments-slope":14068,"decodeUtf8-memory-arguments-intercept":4,"decodeUtf8-memory-arguments-slope":2,"divideInteger-cpu-arguments-constant":196500,"divideInteger-cpu-arguments-model-arguments-intercept":453240,"divideInteger-cpu-arguments-model-arguments-slope":220,"divideInteger-memory-arguments-intercept":0,"divideInteger-memory-arguments-minimum":1,"divideInteger-memory-arguments-slope":1,"encodeUtf8-cpu-arguments-intercept":1e3,"encodeUtf8-cpu-arguments-slope":28662,"encodeUtf8-memory-arguments-intercept":4,"encodeUtf8-memory-arguments-slope":2,"equalsByteString-cpu-arguments-constant":245e3,"equalsByteString-cpu-arguments-intercept":216773,"equalsByteString-cpu-arguments-slope":62,"equalsByteString-memory-arguments":1,"equalsData-cpu-arguments-intercept":1060367,"equalsData-cpu-arguments-slope":12586,"equalsData-memory-arguments":1,"equalsInteger-cpu-arguments-intercept":208512,"equalsInteger-cpu-arguments-slope":421,"equalsInteger-memory-arguments":1,"equalsString-cpu-arguments-constant":187e3,"equalsString-cpu-arguments-intercept":1e3,"equalsString-cpu-arguments-slope":52998,"equalsString-memory-arguments":1,"fstPair-cpu-arguments":80436,"fstPair-memory-arguments":32,"headList-cpu-arguments":43249,"headList-memory-arguments":32,"iData-cpu-arguments":1e3,"iData-memory-arguments":32,"ifThenElse-cpu-arguments":80556,"ifThenElse-memory-arguments":1,"indexByteString-cpu-arguments":57667,"indexByteString-memory-arguments":4,"lengthOfByteString-cpu-arguments":1e3,"lengthOfByteString-memory-arguments":10,"lessThanByteString-cpu-arguments-intercept":197145,"lessThanByteString-cpu-arguments-slope":156,"lessThanByteString-memory-arguments":1,"lessThanEqualsByteString-cpu-arguments-intercept":197145,"lessThanEqualsByteString-cpu-arguments-slope":156,"lessThanEqualsByteString-memory-arguments":1,"lessThanEqualsInteger-cpu-arguments-intercept":204924,"lessThanEqualsInteger-cpu-arguments-slope":473,"lessThanEqualsInteger-memory-arguments":1,"lessThanInteger-cpu-arguments-intercept":208896,"lessThanInteger-cpu-arguments-slope":511,"lessThanInteger-memory-arguments":1,"listData-cpu-arguments":52467,"listData-memory-arguments":32,"mapData-cpu-arguments":64832,"mapData-memory-arguments":32,"mkCons-cpu-arguments":65493,"mkCons-memory-arguments":32,"mkNilData-cpu-arguments":22558,"mkNilData-memory-arguments":32,"mkNilPairData-cpu-arguments":16563,"mkNilPairData-memory-arguments":32,"mkPairData-cpu-arguments":76511,"mkPairData-memory-arguments":32,"modInteger-cpu-arguments-constant":196500,"modInteger-cpu-arguments-model-arguments-intercept":453240,"modInteger-cpu-arguments-model-arguments-slope":220,"modInteger-memory-arguments-intercept":0,"modInteger-memory-arguments-minimum":1,"modInteger-memory-arguments-slope":1,"multiplyInteger-cpu-arguments-intercept":69522,"multiplyInteger-cpu-arguments-slope":11687,"multiplyInteger-memory-arguments-intercept":0,"multiplyInteger-memory-arguments-slope":1,"nullList-cpu-arguments":60091,"nullList-memory-arguments":32,"quotientInteger-cpu-arguments-constant":196500,"quotientInteger-cpu-arguments-model-arguments-intercept":453240,"quotientInteger-cpu-arguments-model-arguments-slope":220,"quotientInteger-memory-arguments-intercept":0,"quotientInteger-memory-arguments-minimum":1,"quotientInteger-memory-arguments-slope":1,"remainderInteger-cpu-arguments-constant":196500,"remainderInteger-cpu-arguments-model-arguments-intercept":453240,"remainderInteger-cpu-arguments-model-arguments-slope":220,"remainderInteger-memory-arguments-intercept":0,"remainderInteger-memory-arguments-minimum":1,"remainderInteger-memory-arguments-slope":1,"sha2_256-cpu-arguments-intercept":806990,"sha2_256-cpu-arguments-slope":30482,"sha2_256-memory-arguments":4,"sha3_256-cpu-arguments-intercept":1927926,"sha3_256-cpu-arguments-slope":82523,"sha3_256-memory-arguments":4,"sliceByteString-cpu-arguments-intercept":265318,"sliceByteString-cpu-arguments-slope":0,"sliceByteString-memory-arguments-intercept":4,"sliceByteString-memory-arguments-slope":0,"sndPair-cpu-arguments":85931,"sndPair-memory-arguments":32,"subtractInteger-cpu-arguments-intercept":205665,"subtractInteger-cpu-arguments-slope":812,"subtractInteger-memory-arguments-intercept":1,"subtractInteger-memory-arguments-slope":1,"tailList-cpu-arguments":41182,"tailList-memory-arguments":32,"trace-cpu-arguments":212342,"trace-memory-arguments":32,"unBData-cpu-arguments":31220,"unBData-memory-arguments":32,"unConstrData-cpu-arguments":32696,"unConstrData-memory-arguments":32,"unIData-cpu-arguments":43357,"unIData-memory-arguments":32,"unListData-cpu-arguments":32247,"unListData-memory-arguments":32,"unMapData-cpu-arguments":38314,"unMapData-memory-arguments":32,"verifyEd25519Signature-cpu-arguments-intercept":57996947,"verifyEd25519Signature-cpu-arguments-slope":18975,"verifyEd25519Signature-memory-arguments":10}).forEach((r,a)=>e.set(a,n.Int.new_i32(r)));const t=n.CostModel.new();return Object.values({"addInteger-cpu-arguments-intercept":205665,"addInteger-cpu-arguments-slope":812,"addInteger-memory-arguments-intercept":1,"addInteger-memory-arguments-slope":1,"appendByteString-cpu-arguments-intercept":1e3,"appendByteString-cpu-arguments-slope":571,"appendByteString-memory-arguments-intercept":0,"appendByteString-memory-arguments-slope":1,"appendString-cpu-arguments-intercept":1e3,"appendString-cpu-arguments-slope":24177,"appendString-memory-arguments-intercept":4,"appendString-memory-arguments-slope":1,"bData-cpu-arguments":1e3,"bData-memory-arguments":32,"blake2b_256-cpu-arguments-intercept":117366,"blake2b_256-cpu-arguments-slope":10475,"blake2b_256-memory-arguments":4,"cekApplyCost-exBudgetCPU":23e3,"cekApplyCost-exBudgetMemory":100,"cekBuiltinCost-exBudgetCPU":23e3,"cekBuiltinCost-exBudgetMemory":100,"cekConstCost-exBudgetCPU":23e3,"cekConstCost-exBudgetMemory":100,"cekDelayCost-exBudgetCPU":23e3,"cekDelayCost-exBudgetMemory":100,"cekForceCost-exBudgetCPU":23e3,"cekForceCost-exBudgetMemory":100,"cekLamCost-exBudgetCPU":23e3,"cekLamCost-exBudgetMemory":100,"cekStartupCost-exBudgetCPU":100,"cekStartupCost-exBudgetMemory":100,"cekVarCost-exBudgetCPU":23e3,"cekVarCost-exBudgetMemory":100,"chooseData-cpu-arguments":19537,"chooseData-memory-arguments":32,"chooseList-cpu-arguments":175354,"chooseList-memory-arguments":32,"chooseUnit-cpu-arguments":46417,"chooseUnit-memory-arguments":4,"consByteString-cpu-arguments-intercept":221973,"consByteString-cpu-arguments-slope":511,"consByteString-memory-arguments-intercept":0,"consByteString-memory-arguments-slope":1,"constrData-cpu-arguments":89141,"constrData-memory-arguments":32,"decodeUtf8-cpu-arguments-intercept":497525,"decodeUtf8-cpu-arguments-slope":14068,"decodeUtf8-memory-arguments-intercept":4,"decodeUtf8-memory-arguments-slope":2,"divideInteger-cpu-arguments-constant":196500,"divideInteger-cpu-arguments-model-arguments-intercept":453240,"divideInteger-cpu-arguments-model-arguments-slope":220,"divideInteger-memory-arguments-intercept":0,"divideInteger-memory-arguments-minimum":1,"divideInteger-memory-arguments-slope":1,"encodeUtf8-cpu-arguments-intercept":1e3,"encodeUtf8-cpu-arguments-slope":28662,"encodeUtf8-memory-arguments-intercept":4,"encodeUtf8-memory-arguments-slope":2,"equalsByteString-cpu-arguments-constant":245e3,"equalsByteString-cpu-arguments-intercept":216773,"equalsByteString-cpu-arguments-slope":62,"equalsByteString-memory-arguments":1,"equalsData-cpu-arguments-intercept":1060367,"equalsData-cpu-arguments-slope":12586,"equalsData-memory-arguments":1,"equalsInteger-cpu-arguments-intercept":208512,"equalsInteger-cpu-arguments-slope":421,"equalsInteger-memory-arguments":1,"equalsString-cpu-arguments-constant":187e3,"equalsString-cpu-arguments-intercept":1e3,"equalsString-cpu-arguments-slope":52998,"equalsString-memory-arguments":1,"fstPair-cpu-arguments":80436,"fstPair-memory-arguments":32,"headList-cpu-arguments":43249,"headList-memory-arguments":32,"iData-cpu-arguments":1e3,"iData-memory-arguments":32,"ifThenElse-cpu-arguments":80556,"ifThenElse-memory-arguments":1,"indexByteString-cpu-arguments":57667,"indexByteString-memory-arguments":4,"lengthOfByteString-cpu-arguments":1e3,"lengthOfByteString-memory-arguments":10,"lessThanByteString-cpu-arguments-intercept":197145,"lessThanByteString-cpu-arguments-slope":156,"lessThanByteString-memory-arguments":1,"lessThanEqualsByteString-cpu-arguments-intercept":197145,"lessThanEqualsByteString-cpu-arguments-slope":156,"lessThanEqualsByteString-memory-arguments":1,"lessThanEqualsInteger-cpu-arguments-intercept":204924,"lessThanEqualsInteger-cpu-arguments-slope":473,"lessThanEqualsInteger-memory-arguments":1,"lessThanInteger-cpu-arguments-intercept":208896,"lessThanInteger-cpu-arguments-slope":511,"lessThanInteger-memory-arguments":1,"listData-cpu-arguments":52467,"listData-memory-arguments":32,"mapData-cpu-arguments":64832,"mapData-memory-arguments":32,"mkCons-cpu-arguments":65493,"mkCons-memory-arguments":32,"mkNilData-cpu-arguments":22558,"mkNilData-memory-arguments":32,"mkNilPairData-cpu-arguments":16563,"mkNilPairData-memory-arguments":32,"mkPairData-cpu-arguments":76511,"mkPairData-memory-arguments":32,"modInteger-cpu-arguments-constant":196500,"modInteger-cpu-arguments-model-arguments-intercept":453240,"modInteger-cpu-arguments-model-arguments-slope":220,"modInteger-memory-arguments-intercept":0,"modInteger-memory-arguments-minimum":1,"modInteger-memory-arguments-slope":1,"multiplyInteger-cpu-arguments-intercept":69522,"multiplyInteger-cpu-arguments-slope":11687,"multiplyInteger-memory-arguments-intercept":0,"multiplyInteger-memory-arguments-slope":1,"nullList-cpu-arguments":60091,"nullList-memory-arguments":32,"quotientInteger-cpu-arguments-constant":196500,"quotientInteger-cpu-arguments-model-arguments-intercept":453240,"quotientInteger-cpu-arguments-model-arguments-slope":220,"quotientInteger-memory-arguments-intercept":0,"quotientInteger-memory-arguments-minimum":1,"quotientInteger-memory-arguments-slope":1,"remainderInteger-cpu-arguments-constant":196500,"remainderInteger-cpu-arguments-model-arguments-intercept":453240,"remainderInteger-cpu-arguments-model-arguments-slope":220,"remainderInteger-memory-arguments-intercept":0,"remainderInteger-memory-arguments-minimum":1,"remainderInteger-memory-arguments-slope":1,"serialiseData-cpu-arguments-intercept":1159724,"serialiseData-cpu-arguments-slope":392670,"serialiseData-memory-arguments-intercept":0,"serialiseData-memory-arguments-slope":2,"sha2_256-cpu-arguments-intercept":806990,"sha2_256-cpu-arguments-slope":30482,"sha2_256-memory-arguments":4,"sha3_256-cpu-arguments-intercept":1927926,"sha3_256-cpu-arguments-slope":82523,"sha3_256-memory-arguments":4,"sliceByteString-cpu-arguments-intercept":265318,"sliceByteString-cpu-arguments-slope":0,"sliceByteString-memory-arguments-intercept":4,"sliceByteString-memory-arguments-slope":0,"sndPair-cpu-arguments":85931,"sndPair-memory-arguments":32,"subtractInteger-cpu-arguments-intercept":205665,"subtractInteger-cpu-arguments-slope":812,"subtractInteger-memory-arguments-intercept":1,"subtractInteger-memory-arguments-slope":1,"tailList-cpu-arguments":41182,"tailList-memory-arguments":32,"trace-cpu-arguments":212342,"trace-memory-arguments":32,"unBData-cpu-arguments":31220,"unBData-memory-arguments":32,"unConstrData-cpu-arguments":32696,"unConstrData-memory-arguments":32,"unIData-cpu-arguments":43357,"unIData-memory-arguments":32,"unListData-cpu-arguments":32247,"unListData-memory-arguments":32,"unMapData-cpu-arguments":38314,"unMapData-memory-arguments":32,"verifyEcdsaSecp256k1Signature-cpu-arguments":35892428,"verifyEcdsaSecp256k1Signature-memory-arguments":10,"verifyEd25519Signature-cpu-arguments-intercept":57996947,"verifyEd25519Signature-cpu-arguments-slope":18975,"verifyEd25519Signature-memory-arguments":10,"verifySchnorrSecp256k1Signature-cpu-arguments-intercept":38887044,"verifySchnorrSecp256k1Signature-cpu-arguments-slope":32947,"verifySchnorrSecp256k1Signature-memory-arguments":10}).forEach((r,a)=>t.set(a,n.Int.new_i32(r))),s.insert(n.Language.new_plutus_v1(),e),s.insert(n.Language.new_plutus_v2(),t),s})()},je={ALONZO:{V1:"a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"},BABBAGE:{V1:"a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",V2:"a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"}},Pt={[n.NetworkInfo.testnet().network_id()]:"8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",[n.NetworkInfo.mainnet().network_id()]:"f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"},Xe={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"},Ze={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"},zt=["begin","eternl","flint","nami","nufi","gerowallet","typhoncip30"],ye=(s,e,t="5000000")=>{const r=n.BigNum.from_str(s.get("lovelace")??"0").checked_add(n.BigNum.from_str(t)),a=e.filter(c=>c.output.amount.filter(u=>u.unit!=="lovelace").some(u=>s.has(u.unit))),i=rs(a);return[...i.less_than(r)?as(r.clamped_sub(i).to_str(),e.filter(c=>!a.map(u=>u.input.txHash).includes(c.input.txHash))):[],...a]},ts=(s,e,t=!1,{maxTxSize:r,minFeeA:a,minFeeB:i}=q)=>{const o=e.filter(g=>we(g)===!1).sort(Tt),c=n.BigNum.from_str(Vt(r,a,i)),u=t?n.BigNum.from_str(s).checked_add(c).to_str():s;return gt(o,new Map([["lovelace",u]]))},Ce=(s,e,t=!1,r=q)=>{const a=e.filter(we).sort(Tt),i=ss(r),o=s.get("lovelace")??"0",c=t?n.BigNum.from_str(o).checked_add(i).to_str():o;return s.set("lovelace",c),gt(a,s)},es=(s,e)=>Array.from(e,t=>({unit:t[0],quantity:n.BigNum.from_str(t[1])})).every(t=>s.filter(r=>r.output.amount.find(a=>a.unit===t.unit)!==void 0).reduce((r,a)=>{const i=a.output.amount.reduce((o,c)=>o.checked_add(n.BigNum.from_str(t.unit===c.unit?c.quantity:"0")),n.BigNum.from_str("0"));return r.checked_add(i)},n.BigNum.from_str("0")).less_than(t.quantity)===!1),Tt=(s,e)=>{var a,i;const t=n.BigNum.from_str(((a=s.output.amount.find(o=>o.unit==="lovelace"))==null?void 0:a.quantity)??"0");return n.BigNum.from_str(((i=e.output.amount.find(o=>o.unit==="lovelace"))==null?void 0:i.quantity)??"0").compare(t)},ss=s=>{const{maxTxSize:e,minFeeA:t,minFeeB:r}=s;return n.BigNum.from_str(Vt(e,t,r))},we=s=>s.output.amount.length>1,rs=s=>s.reduce((e,t)=>{var a;const r=((a=t.output.amount.find(i=>i.unit==="lovelace"))==null?void 0:a.quantity)??"0";return e.checked_add(n.BigNum.from_str(r))},n.BigNum.from_str("0")),as=(s,e)=>{const t=e.sort(Tt);return gt(t,new Map([["lovelace",s]]))},gt=(s,e,t=[])=>s.length===0||es(t,e)?t:ns(s[0],e)?gt(s.slice(1),e,[...t,s[0]]):gt(s.slice(1),e,t),ns=(s,e)=>Array.from(e.keys()).some(t=>s.output.amount.find(r=>r.unit===t)!==void 0),is=(s,e)=>{const t=us(e),r=As(s,e);return{coseKey:v(t.to_bytes()),coseSign1:v(r.to_bytes())}},os=(s,e,{key:t,signature:r})=>{var o,c;const a=p.COSEKey.from_bytes(m(t)),i=p.COSESign1.from_bytes(m(r));if((s==null?void 0:s.length)>0){const u=v(i.payload()??new Uint8Array);if(Q(s)!==u)return!1}if((e==null?void 0:e.length)>0){const A=(o=i.headers().protected().deserialized_headers().header(p.Label.new_text("address")))==null?void 0:o.as_bytes();if(A===void 0)throw new Error("Couldn't find a signer address in signature");const d=(c=a.header(p.Label.new_int(p.Int.new_negative(p.BigNum.from_str("2")))))==null?void 0:c.as_bytes();if(d===void 0)throw new Error("Couldn't find a signer key in signature");const g=st(v(A)),I=Ts(v(d));if(cs(e,g,I)===!1)throw new Error("Couldn't check signature because of address mismatch");const y=Ps(v(i.signature())),S=i.signed_data().to_bytes();return I.verify(S,y)}return!1},cs=(s,e,t)=>{if(s!==e.to_bech32())return!1;try{return rt(s)===t.hash().to_hex()}catch{return!1}},us=s=>{const e=p.COSEKey.new(p.Label.from_key_type(p.KeyType.OKP));return e.set_algorithm_id(p.Label.from_algorithm_id(p.AlgorithmId.EdDSA)),e.set_header(p.Label.new_int(p.Int.new_negative(p.BigNum.from_str("1"))),p.CBORValue.new_int(p.Int.new_i32(6))),e.set_header(p.Label.new_int(p.Int.new_negative(p.BigNum.from_str("2"))),p.CBORValue.new_bytes(s.key.to_public().as_bytes())),e},As=(s,e)=>{const t=p.HeaderMap.new(),r=p.HeaderMap.new();t.set_algorithm_id(p.Label.from_algorithm_id(p.AlgorithmId.EdDSA)),t.set_header(p.Label.new_text("address"),p.CBORValue.new_bytes(e.address.to_bytes()));const a=p.Headers.new(p.ProtectedHeaderMap.new(t),r),i=p.COSESign1Builder.new(a,m(s.payload),!1);s.externalAAD!==void 0&&i.set_external_aad(m(s.externalAAD));const o=i.make_data_to_sign(),c=e.key.sign(o.to_bytes());return i.build(c.to_bytes())};var Wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Be={},b={exports:{}};G.notEqual=ds;G.notOk=ls;G.equal=gs;G.ok=G;var Ee=G;function gs(s,e,t){G(s==e,t)}function ds(s,e,t){G(s!=e,t)}function ls(s,e){G(!s,e)}function G(s,e){if(!s)throw new Error(e||"AssertionError")}var M={exports:{}};function hs(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Is=Ft;Ft.supported=typeof WebAssembly<"u";function Ft(s){if(!Ft.supported)return null;var e=s&&s.imports,t=ms("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvO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BIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),r=null,a={buffer:t,memory:null,exports:null,realloc:i,onload:o};return o(function(){}),a;function i(u){a.exports.memory.grow(Math.ceil(Math.abs(u-a.memory.length)/65536)),a.memory=new Uint8Array(a.exports.memory.buffer)}function o(u){if(a.exports)return u();if(r){r.then(u.bind(null,null)).catch(u);return}try{if(s&&s.async)throw new Error("async");c({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{r=WebAssembly.instantiate(t,e).then(c)}o(u)}function c(u){a.exports=u.instance.exports,a.memory=a.exports.memory&&a.exports.memory.buffer&&new Uint8Array(a.exports.memory.buffer)}}function ms(s){return typeof atob=="function"?new Uint8Array(atob(s).split("").map(fs)):new(hs("buffer")).Buffer(s,"base64")}function fs(s){return s.charCodeAt(0)}var N=Ee,_=Is(),V=64,_t=[];M.exports=D;var Jt=M.exports.BYTES_MIN=16,jt=M.exports.BYTES_MAX=64;M.exports.BYTES=32;var Xt=M.exports.KEYBYTES_MIN=16,Zt=M.exports.KEYBYTES_MAX=64;M.exports.KEYBYTES=32;var te=M.exports.SALTBYTES=16,ee=M.exports.PERSONALBYTES=16;function D(s,e,t,r,a){if(!(this instanceof D))return new D(s,e,t,r,a);if(!(_&&_.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");s||(s=32),a!==!0&&(N(s>=Jt,"digestLength must be at least "+Jt+", was given "+s),N(s<=jt,"digestLength must be at most "+jt+", was given "+s),e!=null&&N(e.length>=Xt,"key must be at least "+Xt+", was given "+e.length),e!=null&&N(e.length<=Zt,"key must be at least "+Zt+", was given "+e.length),t!=null&&N(t.length===te,"salt must be exactly "+te+", was given "+t.length),r!=null&&N(r.length===ee,"personal must be exactly "+ee+", was given "+r.length)),_t.length||(_t.push(V),V+=216),this.digestLength=s,this.finalized=!1,this.pointer=_t.pop(),_.memory.fill(0,0,64),_.memory[0]=this.digestLength,_.memory[1]=e?e.length:0,_.memory[2]=1,_.memory[3]=1,t&&_.memory.set(t,32),r&&_.memory.set(r,48),this.pointer+216>_.memory.length&&_.realloc(this.pointer+216),_.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),_.memory.fill(0,V,V+e.length),_.memory[this.pointer+200]=128)}D.prototype.update=function(s){return N(this.finalized===!1,"Hash instance finalized"),N(s,"input must be TypedArray or Buffer"),V+s.length>_.memory.length&&_.realloc(V+s.length),_.memory.set(s,V),_.exports.blake2b_update(this.pointer,V,V+s.length),this};D.prototype.digest=function(s){if(N(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,_t.push(this.pointer),_.exports.blake2b_final(this.pointer),!s||s==="binary")return _.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(s==="hex")return _s(_.memory,this.pointer+128,this.digestLength);N(s.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e<this.digestLength;e++)s[e]=_.memory[this.pointer+128+e];return s};D.prototype.final=D.prototype.digest;D.WASM=_&&_.buffer;D.SUPPORTED=typeof WebAssembly<"u";D.ready=function(s){if(s||(s=ps),!_)return s(new Error("WebAssembly not supported"));var e=new Promise(function(t,r){_.onload(function(a){a?r():t(),s(a)})});return e};D.prototype.ready=D.ready;function ps(){}function _s(s,e,t){for(var r="",a=0;a<t;a++)r+=ys(s[e+a]);return r}function ys(s){return s<16?"0"+s.toString(16):s.toString(16)}var W=Ee,dt=M.exports;function It(s,e,t){var r=s[e]+s[t],a=s[e+1]+s[t+1];r>=4294967296&&a++,s[e]=r,s[e+1]=a}function se(s,e,t,r){var a=s[e]+t;t<0&&(a+=4294967296);var i=s[e+1]+r;a>=4294967296&&i++,s[e]=a,s[e+1]=i}function xe(s,e){return s[e]^s[e+1]<<8^s[e+2]<<16^s[e+3]<<24}function $(s,e,t,r,a,i){var o=ut[a],c=ut[a+1],u=ut[i],A=ut[i+1];It(h,s,e),se(h,s,o,c);var d=h[r]^h[s],g=h[r+1]^h[s+1];h[r]=g,h[r+1]=d,It(h,t,r),d=h[e]^h[t],g=h[e+1]^h[t+1],h[e]=d>>>24^g<<8,h[e+1]=g>>>24^d<<8,It(h,s,e),se(h,s,u,A),d=h[r]^h[s],g=h[r+1]^h[s+1],h[r]=d>>>16^g<<16,h[r+1]=g>>>16^d<<16,It(h,t,r),d=h[e]^h[t],g=h[e+1]^h[t+1],h[e]=g>>>31^d<<1,h[e+1]=d>>>31^g<<1}var Se=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Cs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],E=new Uint8Array(Cs.map(function(s){return s*2})),h=new Uint32Array(32),ut=new Uint32Array(32);function Qe(s,e){var t=0;for(t=0;t<16;t++)h[t]=s.h[t],h[t+16]=Se[t];for(h[24]=h[24]^s.t,h[25]=h[25]^s.t/4294967296,e&&(h[28]=~h[28],h[29]=~h[29]),t=0;t<32;t++)ut[t]=xe(s.b,4*t);for(t=0;t<12;t++)$(0,8,16,24,E[t*16+0],E[t*16+1]),$(2,10,18,26,E[t*16+2],E[t*16+3]),$(4,12,20,28,E[t*16+4],E[t*16+5]),$(6,14,22,30,E[t*16+6],E[t*16+7]),$(0,10,20,30,E[t*16+8],E[t*16+9]),$(2,12,22,24,E[t*16+10],E[t*16+11]),$(4,14,16,26,E[t*16+12],E[t*16+13]),$(6,8,18,28,E[t*16+14],E[t*16+15]);for(t=0;t<16;t++)s.h[t]=s.h[t]^h[t]^h[t+16]}var z=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function nt(s,e,t,r){z.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=s,z[0]=s,e&&(z[1]=e.length),z[2]=1,z[3]=1,t&&z.set(t,32),r&&z.set(r,48);for(var a=0;a<16;a++)this.h[a]=Se[a]^xe(z,a*4);e&&(be(this,e),this.c=128)}nt.prototype.update=function(s){return W(s!=null,"input must be Uint8Array or Buffer"),be(this,s),this};nt.prototype.digest=function(s){var e=!s||s==="binary"||s==="hex"?new Uint8Array(this.outlen):s;return W(e.length>=this.outlen,"out must have at least outlen bytes of space"),ws(this,e),s==="hex"?Bs(e):e};nt.prototype.final=nt.prototype.digest;nt.ready=function(s){dt.ready(function(){s()})};function be(s,e){for(var t=0;t<e.length;t++)s.c===128&&(s.t+=s.c,Qe(s,!1),s.c=0),s.b[s.c++]=e[t]}function ws(s,e){for(s.t+=s.c;s.c<128;)s.b[s.c++]=0;Qe(s,!0);for(var t=0;t<s.outlen;t++)e[t]=s.h[t>>2]>>8*(t&3);return e}function Bs(s){for(var e="",t=0;t<s.length;t++)e+=Es(s[t]);return e}function Es(s){return s<16?"0"+s.toString(16):s.toString(16)}var ve=nt;b.exports=function(e,t,r,a,i){return i!==!0&&(W(e>=re,"outlen must be at least "+re+", was given "+e),W(e<=ae,"outlen must be at most "+ae+", was given "+e),t!=null&&W(t.length>=ne,"key must be at least "+ne+", was given "+t.length),t!=null&&W(t.length<=ie,"key must be at most "+ie+", was given "+t.length),r!=null&&W(r.length===oe,"salt must be exactly "+oe+", was given "+r.length),a!=null&&W(a.length===ce,"personal must be exactly "+ce+", was given "+a.length)),new ve(e,t,r,a)};b.exports.ready=function(s){dt.ready(function(){s()})};b.exports.WASM_SUPPORTED=dt.SUPPORTED;b.exports.WASM_LOADED=!1;var re=b.exports.BYTES_MIN=16,ae=b.exports.BYTES_MAX=64;b.exports.BYTES=32;var ne=b.exports.KEYBYTES_MIN=16,ie=b.exports.KEYBYTES_MAX=64;b.exports.KEYBYTES=32;var oe=b.exports.SALTBYTES=16,ce=b.exports.PERSONALBYTES=16;dt.ready(function(s){s||(b.exports.WASM_LOADED=!0,ve=dt)});var it={};Object.defineProperty(it,"__esModule",{value:!0});it.bech32m=it.bech32=void 0;const Et="qpzry9x8gf2tvdw0s3jn54khce6mua7l",De={};for(let s=0;s<Et.length;s++){const e=Et.charAt(s);De[e]=s}function at(s){const e=s>>25;return(s&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function ue(s){let e=1;for(let t=0;t<s.length;++t){const r=s.charCodeAt(t);if(r<33||r>126)return"Invalid prefix ("+s+")";e=at(e)^r>>5}e=at(e);for(let t=0;t<s.length;++t){const r=s.charCodeAt(t);e=at(e)^r&31}return e}function Mt(s,e,t,r){let a=0,i=0;const o=(1<<t)-1,c=[];for(let u=0;u<s.length;++u)for(a=a<<e|s[u],i+=e;i>=t;)i-=t,c.push(a>>i&o);if(r)i>0&&c.push(a<<t-i&o);else{if(i>=e)return"Excess padding";if(a<<t-i&o)return"Non-zero padding"}return c}function xs(s){return Mt(s,8,5,!0)}function Ss(s){const e=Mt(s,5,8,!1);if(Array.isArray(e))return e}function Qs(s){const e=Mt(s,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function ke(s){let e;s==="bech32"?e=1:e=734539939;function t(o,c,u){if(u=u||90,o.length+7+c.length>u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let A=ue(o);if(typeof A=="string")throw new Error(A);let d=o+"1";for(let g=0;g<c.length;++g){const I=c[g];if(I>>5!==0)throw new Error("Non 5-bit word");A=at(A)^I,d+=Et.charAt(I)}for(let g=0;g<6;++g)A=at(A);A^=e;for(let g=0;g<6;++g){const I=A>>(5-g)*5&31;d+=Et.charAt(I)}return d}function r(o,c){if(c=c||90,o.length<8)return o+" too short";if(o.length>c)return"Exceeds length limit";const u=o.toLowerCase(),A=o.toUpperCase();if(o!==u&&o!==A)return"Mixed-case string "+o;o=u;const d=o.lastIndexOf("1");if(d===-1)return"No separator character for "+o;if(d===0)return"Missing prefix for "+o;const g=o.slice(0,d),I=o.slice(d+1);if(I.length<6)return"Data too short";let y=ue(g);if(typeof y=="string")return y;const S=[];for(let H=0;H<I.length;++H){const R=I.charAt(H),f=De[R];if(f===void 0)return"Unknown character "+R;y=at(y)^f,!(H+6>=I.length)&&S.push(f)}return y!==e?"Invalid checksum for "+o:{prefix:g,words:S}}function a(o,c){const u=r(o,c);if(typeof u=="object")return u}function i(o,c){const u=r(o,c);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:a,decode:i,encode:t,toWords:xs,fromWordsUnsafe:Ss,fromWords:Qs}}it.bech32=ke("bech32");it.bech32m=ke("bech32m");var bs=Wt&&Wt.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Be,"__esModule",{value:!0});const vs=bs(b.exports),mt=it,Ut="asset";class At{constructor(e){this.hashBuf=e}static fromHash(e){return new At(e)}static fromParts(e,t){const r=(0,vs.default)(20).update(new Uint8Array([...e,...t])).digest("binary");return At.fromHash(r)}static fromBech32(e){const{prefix:t,words:r}=mt.bech32.decode(e);if(t!==Ut)throw new Error("Invalid asset fingerprint");const a=Buffer.from(mt.bech32.fromWords(r));return At.fromHash(a)}fingerprint(){const e=mt.bech32.toWords(this.hashBuf);return mt.bech32.encode(Ut,e)}hash(){return Buffer.from(this.hashBuf).toString("hex")}prefix(){return Ut}checksum(){return this.fingerprint().slice(-6)}}var Ds=Be.default=At;const ks=Ds,Us=(s,e)=>{const t=Ks(s),r=t.derive(kt+1852).derive(kt+1815).derive(kt+e),a=r.derive(0).derive(0).to_raw_key(),i=r.derive(2).derive(0).to_raw_key();return r.free(),t.free(),{paymentKey:a,stakeKey:i}},st=s=>n.Address.from_bytes(m(s)),Ks=s=>n.Bip32PrivateKey.from_bytes(m(s)),Ns=s=>n.DataHash.from_bytes(m(s)),P=s=>n.Ed25519KeyHash.from_bytes(m(s)),Ps=s=>n.Ed25519Signature.from_bytes(m(s)),Qt=s=>n.NativeScript.from_bytes(m(s)),Ts=s=>n.PublicKey.from_bytes(m(s)),Ue=s=>n.PlutusData.from_bytes(m(s)),ot=(s,e)=>n.PlutusScript.from_bytes_with_version(m(s),wt[e]),Fs=s=>n.ScriptRef.from_bytes(m(s)),Ms=s=>n.ScriptHash.from_bytes(m(s)),L=s=>n.Transaction.from_bytes(m(s)),Ke=s=>n.TransactionHash.from_bytes(m(s)),Ae=s=>n.TransactionUnspentOutput.from_bytes(m(s)),Hs=s=>n.TransactionWitnessSet.from_bytes(m(s)),Os=s=>n.Value.from_bytes(m(s)),F=s=>n.Address.from_bech32(s),Ht=s=>n.BaseAddress.from_address(F(s)),Ne=s=>n.EnterpriseAddress.from_address(F(s)),Pe=s=>n.RewardAddress.from_address(F(s)),v=s=>Buffer.from(s).toString("hex"),m=s=>s.length%2===0&&/^[0-9A-F]*$/i.test(s)?Buffer.from(s,"hex"):Buffer.from(s,"utf-8"),bt=s=>{const e=t=>{const r=new Array;for(let a=0;a<t.len();a+=1)r.push(bt(t.get(a)));return r};switch(s.kind()){case n.NativeScriptKind.ScriptAll:{const t=s.as_script_all();return{type:"all",scripts:e(t.native_scripts())}}case n.NativeScriptKind.ScriptAny:{const t=s.as_script_any();return{type:"any",scripts:e(t.native_scripts())}}case n.NativeScriptKind.ScriptNOfK:{const t=s.as_script_n_of_k();return{type:"atLeast",required:t.n(),scripts:e(t.native_scripts())}}case n.NativeScriptKind.TimelockStart:{const t=s.as_timelock_start();return{type:"after",slot:t.slot_bignum().to_str()}}case n.NativeScriptKind.TimelockExpiry:{const t=s.as_timelock_expiry();return{type:"before",slot:t.slot_bignum().to_str()}}case n.NativeScriptKind.ScriptPubkey:{const t=s.as_script_pubkey();return{type:"sig",keyHash:t.addr_keyhash().to_hex()}}default:throw new Error(`Script Kind: ${s.kind()}, is not supported`)}},vt=s=>{const e=t=>{const r=n.NativeScripts.new();return t.forEach(a=>{r.add(vt(a))}),r};switch(s.type){case"all":return n.NativeScript.new_script_all(n.ScriptAll.new(e(s.scripts)));case"any":return n.NativeScript.new_script_any(n.ScriptAny.new(e(s.scripts)));case"atLeast":return n.NativeScript.new_script_n_of_k(n.ScriptNOfK.new(s.required,e(s.scripts)));case"after":return n.NativeScript.new_timelock_start(n.TimelockStart.new_timelockstart(n.BigNum.from_str(s.slot)));case"before":return n.NativeScript.new_timelock_expiry(n.TimelockExpiry.new_timelockexpiry(n.BigNum.from_str(s.slot)));case"sig":return n.NativeScript.new_script_pubkey(n.ScriptPubkey.new(P(s.keyHash)))}},yt=s=>{var r,a,i;const e=o=>{const c=[];for(let u=0;u<o.len();u+=1)c.push(yt(o.get(u)));return c},t=o=>{const c=new Map;for(let u=0;u<o.len();u+=1){const A=o.keys().get(u),d=o.get(A)??n.PlutusData.from_hex(Q("NO_ITEM_FOUND_INSIDE_GOLD_ROOM"));c.set(yt(A),yt(d))}return c};switch(s.kind()){case n.PlutusDataKind.Bytes:return v(s.as_bytes()??new Uint8Array);case n.PlutusDataKind.Integer:return parseInt(((r=s.as_integer())==null?void 0:r.to_str())??"0",10);case n.PlutusDataKind.List:return e(s.as_list()??n.PlutusList.new());case n.PlutusDataKind.Map:return t(s.as_map()??n.PlutusMap.new());case n.PlutusDataKind.ConstrPlutusData:return{alternative:parseInt(((a=s.as_constr_plutus_data())==null?void 0:a.alternative().to_str())??"0",10),fields:e(((i=s.as_constr_plutus_data())==null?void 0:i.data())??n.PlutusList.new())};default:throw new Error(`PlutusData Kind: ${s.kind()}, is not supported`)}},Z=s=>{const e=t=>{const r=n.PlutusList.new();return t.forEach(a=>{r.add(Z(a))}),r};switch(typeof s){case"string":return n.PlutusData.new_bytes(m(s));case"number":return n.PlutusData.new_integer(n.BigInt.from_str(s.toString()));case"object":if(s instanceof Array){const t=e(s);return n.PlutusData.new_list(t)}else if(s instanceof Map){const t=n.PlutusMap.new();return s.forEach((r,a)=>{t.insert(Z(a),Z(r))}),n.PlutusData.new_map(t)}else return n.PlutusData.new_constr_plutus_data(n.ConstrPlutusData.new(n.BigNum.from_str(s.alternative.toString()),e(s.fields)))}},Vs=s=>{const e=n.Relays.new();throw s.relays.forEach(t=>{e.add(Ys(t))}),new Error("toPoolParams not implemented.")},Te=s=>{const e=t=>Je[t];return n.Redeemer.new(e(s.tag),n.BigNum.from_str(s.index.toString()),Z(s.data),n.ExUnits.new(n.BigNum.from_str(s.budget.mem.toString()),n.BigNum.from_str(s.budget.steps.toString())))},Ys=s=>{switch(s.type){case"SingleHostAddr":{const e=s.IPV4?n.Ipv4.new(new Uint8Array(s.IPV4.split(".").map(r=>parseInt(r)))):void 0,t=s.IPV6?n.Ipv6.new(m(s.IPV6.replaceAll(":",""))):void 0;return n.Relay.new_single_host_addr(n.SingleHostAddr.new(s.port,e,t))}case"SingleHostName":return n.Relay.new_single_host_name(n.SingleHostName.new(s.port,n.DNSRecordAorAAAA.new(s.domainName)));case"MultiHostName":return n.Relay.new_multi_host_name(n.MultiHostName.new(n.DNSRecordSRV.new(s.domainName)))}},Fe=s=>{if(s.is_plutus_script()){const t=s.plutus_script();return{code:t.to_hex(),version:Object.keys(wt).find(r=>wt[r].to_hex()===t.language_version().to_hex())}}const e=s.native_script();return bt(e)},lt=s=>{if("code"in s){const e=ot(s.code,s.version);return n.ScriptRef.new_plutus_script(e)}return n.ScriptRef.new_native_script(vt(s))},xt=s=>{var a,i,o;const e=s.output().has_data_hash()?(a=s.output().data_hash())==null?void 0:a.to_hex():void 0,t=s.output().has_plutus_data()?(i=s.output().plutus_data())==null?void 0:i.to_hex():void 0,r=s.output().has_script_ref()?(o=s.output().script_ref())==null?void 0:o.to_hex():void 0;return{input:{outputIndex:s.input().index(),txHash:s.input().transaction_id().to_hex()},output:{address:s.output().address().to_bech32(),amount:Me(s.output().amount()),dataHash:e,plutusData:t,scriptRef:r}}},Y=s=>{const e=n.TransactionInput.new(Ke(s.input.txHash),s.input.outputIndex),t=n.TransactionOutput.new(F(s.output.address),Ct(s.output.amount));return s.output.dataHash!==void 0&&t.set_data_hash(Ns(s.output.dataHash)),s.output.plutusData!==void 0&&t.set_plutus_data(Ue(s.output.plutusData)),s.output.scriptRef!==void 0&&t.set_script_ref(Fs(s.output.scriptRef)),n.TransactionUnspentOutput.new(e,t)},ge=s=>{const e=s.split(".")[1]??"0",t=`${parseInt(e,10)}`,r="1"+"0".repeat(e.length);return n.UnitInterval.new(n.BigNum.from_str(t),n.BigNum.from_str(r))},Q=s=>s.length%2===0&&/^[0-9A-F]*$/i.test(s)?s:v(Buffer.from(s,"utf-8")),Ot=s=>Buffer.from(s,"hex").toString("utf-8"),Me=s=>{const e=[{unit:"lovelace",quantity:s.coin().to_str()}],t=s.multiasset();if(t!==void 0){const r=t.keys();for(let a=0;a<r.len();a+=1){const i=r.get(a),o=t.get(i);if(o!==void 0){const c=o.keys();for(let u=0;u<c.len();u+=1){const A=c.get(u),d=o.get(A)??n.BigNum.from_str("0"),g=i.to_hex()+v(A.name());e.push({unit:g,quantity:d.to_str()})}}}}return e},Ct=s=>{const e=s.find(i=>i.unit==="lovelace"),t=Array.from(new Set(s.filter(i=>i.unit!=="lovelace").map(i=>i.unit.slice(0,T)))),r=n.MultiAsset.new();t.forEach(i=>{const o=n.Assets.new();s.filter(c=>c.unit.slice(0,T)===i).forEach(c=>{o.insert(n.AssetName.new(m(c.unit.slice(T))),n.BigNum.from_str(c.quantity))}),r.insert(Ms(i),o)});const a=n.Value.new(n.BigNum.from_str(e?e.quantity:"0"));return(s.length>1||!e)&&a.set_multiasset(r),a},de=(s,e,t)=>n.BaseAddress.new(s,n.StakeCredential.from_keyhash(e),n.StakeCredential.from_keyhash(t)),He=(s,e="")=>n.Bip32PrivateKey.from_bip39_entropy(m(s),m(Q(e))),le=s=>n.DataCost.new_coins_per_byte(n.BigNum.from_str(s)),Ls=s=>{if(typeof s!="object"||!("input"in s))return n.DatumSource.new(Z(s));const e=Y(s);if(e.output().has_plutus_data())return n.DatumSource.new_ref_input(e.input());throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`)},he=(s,e)=>n.EnterpriseAddress.new(s,n.StakeCredential.from_keyhash(e)),Ie=(s,e)=>{if(typeof s=="string")return n.MintWitness.new_native_script(Qt(s));if(e===void 0)throw new Error("Minting with plutus requires a redeemer to be defined");if(e.tag!=="MINT")throw new Error("Minting redeemer's tag must be defined as 'MINT'");return n.MintWitness.new_plutus_script(Oe(s),Te({tag:"MINT",index:0,budget:_e,data:{alternative:0,fields:[]},...e}))},Nt=(s,e)=>n.RewardAddress.new(s,n.StakeCredential.from_keyhash(e)),Oe=s=>{if("code"in s)return n.PlutusScriptSource.new(ot(s.code,s.version));const e=Y(s);if(e.output().has_script_ref()){const t=e.output().script_ref();if(t.is_plutus_script()){const r=Fe(t),a=ot(r.code,r.version).hash();return n.PlutusScriptSource.new_ref_input_with_lang_ver(a,e.input(),wt[r.version])}}throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`)},ft=s=>{const e=n.ScriptPubkey.new(s);return n.NativeScript.new_script_pubkey(e)},qs=(s=q)=>{const e=n.TransactionBuilderConfigBuilder.new().coins_per_utxo_byte(n.BigNum.from_str(s.coinsPerUTxOSize)).ex_unit_prices(n.ExUnitPrices.new(ge(s.priceMem.toString()),ge(s.priceStep.toString()))).fee_algo(n.LinearFee.new(n.BigNum.from_str(s.minFeeA.toString()),n.BigNum.from_str(s.minFeeB.toString()))).key_deposit(n.BigNum.from_str(s.keyDeposit)).max_tx_size(s.maxTxSize).max_value_size(parseInt(s.maxValSize,10)).pool_deposit(n.BigNum.from_str(s.poolDeposit)).build();return n.TransactionBuilder.new(e)},me=s=>{const e=n.TxInputsBuilder.new();return s.map(t=>t instanceof n.TransactionUnspentOutput?t:Y(t)).forEach(t=>{e.add_input(t.output().address(),t.input(),t.output().amount())}),e},pt=s=>{if(typeof s=="string")return n.TransactionOutputBuilder.new().with_address(F(s));let e=n.TransactionOutputBuilder.new().with_address(F(s.address));if(s.datum){const{value:t,inline:r}=s.datum,a=Z(t);e=e.with_data_hash(n.hash_plutus_data(a)),r&&(e=e.with_plutus_data(a))}if(s.script){const t=lt(s.script);e=e.with_script_ref(t)}return e},tt=s=>{const e=s.slice(0,T),t=s.includes(".")?Q(s.split(".")[1]):s.slice(T);return{policyId:e,assetName:t}},l=s=>J.default.isAxiosError(s)?s.response?JSON.stringify({data:s.response.data,headers:s.response.headers,status:s.response.status}):s.request?JSON.stringify(s.request):s.message:JSON.stringify(s),Gs=s=>{const e=Z(s);return n.hash_plutus_data(e).to_hex()},Rs=(s,e=Date.now())=>{if(Bt[s]){const[t,r,a,i]=Bt[s];return parseInt(n.BigNum.from_str(e.toString()).div_floor(n.BigNum.from_str("1000")).checked_sub(n.BigNum.from_str(a)).div_floor(n.BigNum.from_str(i)).checked_add(n.BigNum.from_str(t)).to_str(),10)}throw new Error(`Couldn't resolve EpochNo for network: ${s}`)},Ve=(s,e)=>ks.fromParts(m(s),m(e)).fingerprint(),$s=(s,e)=>je[s][e],zs=s=>vt(s).hash().to_hex(),X=s=>{var e,t;try{const r=[(e=Ht(s))==null?void 0:e.payment_cred().to_keyhash(),(t=Ne(s))==null?void 0:t.payment_cred().to_keyhash()].find(a=>a!==void 0);if(r!==void 0)return r.to_hex();throw new Error(`Couldn't resolve payment key hash from address: ${s}`)}catch(r){throw new Error(`An error occurred during resolvePaymentKeyHash: ${r}.`)}},Ws=(s,e=0)=>{const t=ot(s.code,s.version);return n.EnterpriseAddress.new(e,n.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32()},Js=s=>{try{const e=Ne(s),t=e==null?void 0:e.payment_cred().to_scripthash();if(t!==void 0)return t.to_hex();throw new Error(`Couldn't resolve script hash from address: ${s}`)}catch(e){throw new Error(`An error occurred during resolveScriptHash: ${e}.`)}},js=s=>n.Ed25519KeyHash.from_hex(s).to_bech32("pool1"),Xs=s=>{const e=Kt.mnemonicToEntropy(s.join(" ")),t=He(e),r=t.to_bech32();return t.free(),r},Zs=s=>lt(s).to_hex(),tr=(s,e=Date.now())=>{if(Bt[s]){const[t,r,a]=Bt[s];return n.BigNum.from_str(e.toString()).div_floor(n.BigNum.from_str("1000")).checked_sub(n.BigNum.from_str(a)).checked_add(n.BigNum.from_str(r)).to_str()}throw new Error(`Couldn't resolve SlotNo for network: ${s}`)},Dt=s=>{try{const e=F(s),t=Ht(s),r=t==null?void 0:t.stake_cred().to_keyhash();if(r!==void 0)return Nt(e.network_id(),r).to_address().to_bech32();throw new Error(`Couldn't resolve reward address from address: ${s}`)}catch(e){throw new Error(`An error occurred during resolveRewardAddress: ${e}.`)}},rt=s=>{var e,t;try{const r=[(e=Ht(s))==null?void 0:e.stake_cred().to_keyhash(),(t=Pe(s))==null?void 0:t.payment_cred().to_keyhash()].find(a=>a!==void 0);if(r!==void 0)return r.to_hex();throw new Error(`Couldn't resolve stake key hash from address: ${s}`)}catch(r){throw new Error(`An error occurred during resolveStakeKeyHash: ${r}.`)}},Vt=(s,e=q.minFeeA,t=q.minFeeB)=>(BigInt(e)*BigInt(s)+BigInt(t)).toString(),Ye=s=>{const e=L(s).body();return n.hash_transaction(e).to_hex()},er=(s="",e=32)=>{if(e<=0||e>2048)throw new Error("Length must be bewteen 1 and 2048");const r=fe.customAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);return Q(`${s}${r}`)},Le=(s,e)=>{const t=s.vkeys();if(t!==void 0){const r=new Set;for(let i=0;i<t.len();i+=1)r.add(t.get(i).to_hex());for(let i=0;i<e.len();i+=1)r.add(e.get(i).to_hex());const a=n.Vkeywitnesses.new();return r.forEach(i=>{a.add(n.Vkeywitness.from_hex(i))}),a}return e},sr=s=>yt(Ue(s)),rr=s=>L(s).to_js_value();class ar{_axiosInstance;constructor(...e){if(typeof e[0]=="string"&&e[0].startsWith("http"))this._axiosInstance=J.default.create({baseURL:e[0]});else{const t=e[0],r=t.slice(0,7);this._axiosInstance=J.default.create({baseURL:`https://cardano-${r}.blockfrost.io/api/v${e[1]??0}`,headers:{project_id:t}})}}async fetchAccountInfo(e){const t=e.startsWith("addr")?Dt(e):e;try{const{data:r,status:a}=await this._axiosInstance.get(`accounts/${t}`);if(a===200)return{poolId:r.pool_id,active:r.active||r.active_epoch!==null,balance:r.controlled_amount,rewards:r.withdrawable_amount,withdrawals:r.withdrawals_sum};throw l(r)}catch(r){throw l(r)}}async fetchAddressUTxOs(e,t){const r=t!==void 0?`/${t}`:"",a=`addresses/${e}/utxos`+r,i=async(u=1,A=[])=>{const{data:d,status:g}=await this._axiosInstance.get(`${a}?page=${u}`);if(g===200)return d.length>0?i(u+1,[...A,...await Promise.all(d.map(c))]):A;throw l(d)},o=async u=>{if(u){const{data:A,status:d}=await this._axiosInstance.get(`scripts/${u}`);if(d===200){const g=A.type.startsWith("plutus")?{code:await this.fetchPlutusScriptCBOR(u),version:A.type.replace("plutus","")}:await this.fetchNativeScriptJSON(u);return lt(g).to_hex()}throw l(A)}},c=async u=>({input:{outputIndex:u.output_index,txHash:u.tx_hash},output:{address:e,amount:u.amount,dataHash:u.data_hash??void 0,plutusData:u.inline_datum??void 0,scriptRef:await o(u.reference_script_hash)}});try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const t=async(r=1,a=[])=>{const{policyId:i,assetName:o}=tt(e),{data:c,status:u}=await this._axiosInstance.get(`assets/${i}${o}/addresses?page=${r}`);if(u===200)return c.length>0?t(r+1,[...a,...c]):a;throw l(c)};try{return await t()}catch{return[]}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=tt(e),{data:a,status:i}=await this._axiosInstance.get(`assets/${t}${r}`);if(i===200)return{...a.onchain_metadata};throw l(a)}catch(t){throw l(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`blocks/${e}`);if(r===200)return{confirmations:t.confirmations,epoch:t.epoch,epochSlot:t.epoch_slot.toString(),fees:t.fees,hash:t.hash,nextBlock:t.next_block??"",operationalCertificate:t.op_cert,output:t.output??"0",previousBlock:t.previous_block,size:t.size,slot:t.slot.toString(),slotLeader:t.slot_leader??"",time:t.time,txCount:t.tx_count,VRFKey:t.block_vrf};throw l(t)}catch(t){throw l(t)}}async fetchCollectionAssets(e,t=1){try{const{data:r,status:a}=await this._axiosInstance.get(`assets/policy/${e}?page=${t}`);if(a===200)return{assets:r.map(i=>({unit:i.asset,quantity:i.quantity})),next:r.length===100?t+1:null};throw l(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=Q(e.replace("$","")),{data:r,status:a}=await this._axiosInstance.get(`assets/${Pt[1]}${t}/addresses`);if(a===200)return r[0].address;throw l(r)}catch(t){throw l(t)}}async fetchProtocolParameters(e=Number.NaN){try{const{data:t,status:r}=await this._axiosInstance.get(`epochs/${isNaN(e)?"latest":e}/parameters`);if(r===200)return{coinsPerUTxOSize:t.coins_per_utxo_word,collateralPercent:t.collateral_percent,decentralisation:t.decentralisation_param,epoch:t.epoch,keyDeposit:t.key_deposit,maxBlockExMem:t.max_block_ex_mem,maxBlockExSteps:t.max_block_ex_steps,maxBlockHeaderSize:t.max_block_header_size,maxBlockSize:t.max_block_size,maxCollateralInputs:t.max_collateral_inputs,maxTxExMem:t.max_tx_ex_mem,maxTxExSteps:t.max_tx_ex_steps,maxTxSize:t.max_tx_size,maxValSize:t.max_val_size,minFeeA:t.min_fee_a,minFeeB:t.min_fee_b,minPoolCost:t.min_pool_cost,poolDeposit:t.pool_deposit,priceMem:t.price_mem,priceStep:t.price_step};throw l(t)}catch(t){throw l(t)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`txs/${e}`);if(r===200)return{block:t.block,deposit:t.deposit,fees:t.fees,hash:t.hash,index:t.index,invalidAfter:t.invalid_hereafter??"",invalidBefore:t.invalid_before??"",slot:t.slot.toString(),size:t.size};throw l(t)}catch(t){throw l(t)}}onTxConfirmed(e,t,r=20){let a=0;const i=setInterval(()=>{a>=r&&clearInterval(i),this.fetchTxInfo(e).then(o=>{this.fetchBlockInfo(o.block).then(c=>{(c==null?void 0:c.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{a+=1})}).catch(()=>{a+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:a}=await this._axiosInstance.post("tx/submit",m(e),{headers:t});if(a===200)return r;throw l(r)}catch(t){throw l(t)}}async fetchPlutusScriptCBOR(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/cbor`);if(r===200)return t.cbor;throw l(t)}async fetchNativeScriptJSON(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/json`);if(r===200)return t.json;throw l(t)}}class nr{_axiosInstance;constructor(e,t,r){const a=r.host??"ipfs.infura.io",i=r.port??5001,o=r.version??0;this._axiosInstance=J.default.create({baseURL:`https://${a}:${i}/api/v${o}`,auth:{username:e,password:t}})}async uploadContent(e,t=!1){try{const r={"Content-Type":"multipart/form-data"},{data:a,status:i}=await this._axiosInstance.post(`add?recursive=${t}`,e,{headers:r});if(i===200)return a;throw l(a)}catch(r){throw l(r)}}}class ir{_axiosInstance;constructor(...e){typeof e[0]=="string"&&e[0].startsWith("http")?this._axiosInstance=J.default.create({baseURL:e[0]}):this._axiosInstance=J.default.create({baseURL:`https://${e[0]}.koios.rest/api/v${e[1]??0}`})}async fetchAccountInfo(e){try{const t=e.startsWith("addr")?Dt(e):e,{data:r,status:a}=await this._axiosInstance.post("account_info",{_stake_addresses:[t]});if(a===200)return{poolId:r[0].delegated_pool,active:r[0].status==="registered",balance:r[0].total_balance.toString(),rewards:r[0].rewards_available,withdrawals:r[0].withdrawals};throw l(r)}catch(t){throw l(t)}}async fetchAddressUTxOs(e,t){const r=a=>{if(a){const i=a.type.startsWith("plutus")?{code:a.bytes,version:a.type.replace("plutus","")}:bt(Qt(a.bytes));return lt(i).to_hex()}};try{const{data:a,status:i}=await this._axiosInstance.post("address_info",{_addresses:[e]});if(i===200){const o=a.flatMap(c=>c.utxo_set).map(c=>{var u;return{input:{outputIndex:c.tx_index,txHash:c.tx_hash},output:{address:e,amount:[{unit:"lovelace",quantity:c.value},...c.asset_list.map(A=>({unit:`${A.policy_id}${A.asset_name}`,quantity:`${A.quantity}`}))],dataHash:c.datum_hash??void 0,plutusData:((u=c.inline_datum)==null?void 0:u.bytes)??void 0,scriptRef:r(c.reference_script)}}});return t!==void 0?o.filter(c=>c.output.amount.find(u=>u.unit===t)!==void 0):o}throw l(a)}catch{return[]}}async fetchAssetAddresses(e){try{const{policyId:t,assetName:r}=tt(e),{data:a,status:i}=await this._axiosInstance.get(`asset_address_list?_asset_policy=${t}&_asset_name=${r}`);if(i===200)return a.map(o=>({address:o.payment_address,quantity:o.quantity}));throw l(a)}catch(t){throw l(t)}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=tt(e),{data:a,status:i}=await this._axiosInstance.get(`asset_info?_asset_policy=${t}&_asset_name=${r}`);if(i===200)return{...a[0].minting_tx_metadata[721][t][Ot(r)]};throw l(a)}catch(t){throw l(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.post("block_info",{_block_hashes:[e]});if(r===200)return{confirmations:t[0].num_confirmations,epoch:t[0].epoch_no,epochSlot:t[0].epoch_slot.toString(),fees:t[0].total_fees??"",hash:t[0].hash,nextBlock:t[0].child_hash??"",operationalCertificate:t[0].op_cert,output:t[0].total_output??"0",previousBlock:t[0].parent_hash,size:t[0].block_size,slot:t[0].abs_slot.toString(),slotLeader:t[0].pool??"",time:t[0].block_time,txCount:t[0].tx_count,VRFKey:t[0].vrf_key};throw l(t)}catch(t){throw l(t)}}async fetchCollectionAssets(e,t=0){try{const{data:r,status:a}=await this._axiosInstance.get(`asset_policy_info?_asset_policy=${e}&limit=100&offset=${t}`);if(a===200)return{assets:r.map(i=>({unit:`${e}${i.asset_name}`,quantity:i.total_supply})),next:r.length===100?t+100:null};throw l(r)}catch(r){throw l(r)}}async fetchHandleAddress(e){try{const t=Q(e.replace("$","")),{data:r,status:a}=await this._axiosInstance.get(`asset_address_list?_asset_policy=${Pt[1]}&_asset_name=${t}`);if(a===200)return r[0].payment_address;throw l(r)}catch(t){throw l(t)}}async fetchProtocolParameters(e){try{const{data:t,status:r}=await this._axiosInstance.get(`epoch_params?_epoch_no=${e}`);if(r===200)return{coinsPerUTxOSize:t[0].coins_per_utxo_size,collateralPercent:t[0].collateral_percent,decentralisation:t[0].decentralisation,epoch:t[0].epoch_no,keyDeposit:t[0].key_deposit,maxBlockExMem:t[0].max_block_ex_mem.toString(),maxBlockExSteps:t[0].max_block_ex_steps.toString(),maxBlockHeaderSize:t[0].max_bh_size,maxBlockSize:t[0].max_block_size,maxCollateralInputs:t[0].max_collateral_inputs,maxTxExMem:t[0].max_tx_ex_mem.toString(),maxTxExSteps:t[0].max_tx_ex_steps.toString(),maxTxSize:t[0].max_tx_size,maxValSize:t[0].max_val_size.toString(),minFeeA:t[0].min_fee_a,minFeeB:t[0].min_fee_b,minPoolCost:t[0].min_pool_cost,poolDeposit:t[0].pool_deposit,priceMem:t[0].price_mem,priceStep:t[0].price_step};throw l(t)}catch(t){throw l(t)}}async fetchTxInfo(e){var t,r;try{const{data:a,status:i}=await this._axiosInstance.post("tx_info",{_tx_hashes:[e]});if(i===200)return{block:a[0].block_hash,deposit:a[0].deposit,fees:a[0].fee,hash:a[0].tx_hash,index:a[0].tx_block_index,invalidAfter:((t=a[0].invalid_after)==null?void 0:t.toString())??"",invalidBefore:((r=a[0].invalid_before)==null?void 0:r.toString())??"",slot:a[0].absolute_slot.toString(),size:a[0].tx_size};throw l(a)}catch(a){throw l(a)}}onTxConfirmed(e,t,r=20){let a=0;const i=setInterval(()=>{a>=r&&clearInterval(i),this.fetchTxInfo(e).then(o=>{this.fetchBlockInfo(o.block).then(c=>{(c==null?void 0:c.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{a+=1})}).catch(()=>{a+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:a}=await this._axiosInstance.post("submittx",m(e),{headers:t});if(a===202)return r;throw l(r)}catch(t){throw l(t)}}}class or{_baseUrl;constructor(...e){this._baseUrl=pe(e[0])?Xe[e[0]]:e[0]}async evaluateTx(e){const t=await this.open();return this.send(t,"EvaluateTx",{evaluate:e}),new Promise((r,a)=>{t.addEventListener("message",i=>{try{const{result:o}=JSON.parse(i.data);o.EvaluationResult?r(Object.keys(o.EvaluationResult).map(c=>({index:parseInt(c.split(":")[1],10),tag:c.split(":")[0].toUpperCase(),budget:{mem:o.EvaluationResult[c].memory,steps:o.EvaluationResult[c].steps}}))):a(o.EvaluationFailure),t.close()}catch(o){a(o)}},{once:!0})})}async onNextTx(e){const t=await this.open();return this.send(t,"AwaitAcquire",{}),t.addEventListener("message",r=>{const{result:a}=JSON.parse(r.data);if(a===null)return this.send(t,"AwaitAcquire",{});a.AwaitAcquired===void 0&&e(a),this.send(t,"NextTx",{})}),()=>t.close()}async submitTx(e){const t=await this.open();return this.send(t,"SubmitTx",{submit:e}),new Promise((r,a)=>{t.addEventListener("message",i=>{try{const{result:o}=JSON.parse(i.data);o.SubmitSuccess?r(o.SubmitSuccess.txId):a(o.SubmitFail),t.close()}catch(o){a(o)}},{once:!0})})}async open(){const e=new WebSocket(this._baseUrl);return await new Promise(t=>{e.addEventListener("open",()=>t(!0),{once:!0})}),e}send(e,t,r){e.send(JSON.stringify({version:"1.0",type:"jsonwsp/request",servicename:"ogmios",methodname:t,args:r}))}}class cr{_axiosInstance;constructor(e,t,r,a=1){this._axiosInstance=J.default.create({baseURL:`https://cardano-${e}.tangocrypto.com/${t}/v${a}`,headers:{"x-api-key":r}})}async evaluateTx(e){try{const{data:t,status:r}=await this._axiosInstance.post("transactions/evaluate",{tx:e,utxos:[]});if(r===200)return t.redeemers.map(a=>({index:a.index,tag:a.purpose.toUpperCase(),budget:{mem:a.unit_mem,steps:a.unit_steps}}));throw l(t)}catch(t){throw l(t)}}async fetchAccountInfo(e){try{const t=e.startsWith("addr")?Dt(e):e,{data:r,status:a}=await this._axiosInstance.get(`wallets/${t}`);if(a===200)return{poolId:r.pool_id,active:r.active,balance:r.controlled_total_stake,rewards:r.rewards_sum,withdrawals:r.withdrawals_sum};throw l(r)}catch(t){throw l(t)}}async fetchAddressUTxOs(e,t){const r=t!==void 0?`/assets/${t}`:"",a=`addresses/${e}${r}/utxos?size=50`,i=async(A="",d=[])=>{var y;const{data:g,status:I}=await this._axiosInstance.get(`${a}&cursor=${A}`);if(I===200)return g.cursor!==null&&((y=g.cursor)==null?void 0:y.length)>0?i(g.cursor,[...d,...g.data.map(u)]):g.data.map(u);throw l(g)},o=(A,d)=>{const g=[{unit:"lovelace",quantity:A.toString()}];return d.forEach(I=>{const y=Q(I.asset_name);g.push({unit:`${I.policy_id}${y}`,quantity:I.quantity.toString()})}),g},c=A=>{if(A){const d=A.type.startsWith("plutus")?{code:A.code,version:A.type.replace("plutus","")}:bt(Qt(A.json));return lt(d).to_hex()}},u=A=>{var d;return{input:{outputIndex:A.index,txHash:A.hash},output:{address:e,amount:o(A.value,A.assets),dataHash:void 0,plutusData:((d=A.inline_datum)==null?void 0:d.value_raw)??void 0,scriptRef:c(A.reference_script)}}};try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const t=a=>({address:a.address,quantity:a.quantity.toString()}),r=async(a="",i=[])=>{var d;const{policyId:o,assetName:c}=tt(e),{data:u,status:A}=await this._axiosInstance.get(`assets/${o}${c}/addresses?size=100&cursor=${a}`);if(A===200)return u.cursor!==null&&((d=u.cursor)==null?void 0:d.length)>0?r(u.cursor,[...i,...u.data.map(t)]):u.data.map(t);throw l(u)};try{return await r()}catch{return[]}}async fetchAssetMetadata(e){var t;try{const{policyId:r,assetName:a}=tt(e),{data:i,status:o}=await this._axiosInstance.get(`assets/${r}${a}`);if(o===200)return{...(t=i.metadata.find(c=>c.label===721))==null?void 0:t.json[r][Ot(a)]};throw l(i)}catch(r){throw l(r)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`blocks/${e}`);if(r===200)return{confirmations:t.confirmations,epoch:t.epoch_no,epochSlot:t.epoch_slot_no.toString(),fees:t.fees.toString(),hash:t.hash,nextBlock:t.next_block.toString()??"",operationalCertificate:t.op_cert,output:t.out_sum.toString()??"0",previousBlock:t.previous_block.toString(),size:t.size,slot:t.slot_no.toString(),slotLeader:t.slot_leader??"",time:Date.parse(t.time),txCount:t.tx_count,VRFKey:t.vrf_key};throw l(t)}catch(t){throw l(t)}}async fetchCollectionAssets(e,t=""){try{const{data:r,status:a}=await this._axiosInstance.get(`policies/${e}/assets?size=100&cursor=${t}`);if(a===200)return{assets:r.data.map(i=>({unit:`${i.policy_id}${i.asset_name}`,quantity:i.quantity})),next:r.cursor};throw l(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=Q(e.replace("$","")),{data:r,status:a}=await this._axiosInstance.get(`assets/${Pt[1]}${t}/addresses`);if(a===200)return r.data[0].address;throw l(r)}catch(t){throw l(t)}}async fetchProtocolParameters(e){try{const{data:t,status:r}=await this._axiosInstance.get(`epochs/${e}/parameters`);if(r===200)return{coinsPerUTxOSize:t.coins_per_utxo_size.toString(),collateralPercent:t.collateral_percent,decentralisation:t.decentralisation,epoch:t.epoch_no,keyDeposit:t.key_deposit.toString(),maxBlockExMem:t.max_block_ex_mem.toString(),maxBlockExSteps:t.max_block_ex_steps.toString(),maxBlockHeaderSize:t.max_block_header_size,maxBlockSize:t.max_block_size,maxCollateralInputs:t.max_collateral_inputs,maxTxExMem:t.max_tx_ex_mem.toString(),maxTxExSteps:t.max_tx_ex_steps.toString(),maxTxSize:t.max_tx_size,maxValSize:t.max_val_size.toString(),minFeeA:t.min_fee_a,minFeeB:t.min_fee_b,minPoolCost:t.min_pool_cost.toString(),poolDeposit:t.pool_deposit.toString(),priceMem:t.price_mem,priceStep:t.price_step};throw l(t)}catch(t){throw l(t)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`transactions/${e}`);if(r===200)return{block:t.block.hash,deposit:t.deposit,fees:t.fee,hash:t.hash,index:t.block_index,invalidAfter:t.invalid_hereafter??"",invalidBefore:t.invalid_before??"",slot:t.block.slot_no.toString(),size:t.size};throw l(t)}catch(t){throw l(t)}}onTxConfirmed(e,t,r=20){let a=0;const i=setInterval(()=>{a>=r&&clearInterval(i),this.fetchTxInfo(e).then(o=>{this.fetchBlockInfo(o.block).then(c=>{(c==null?void 0:c.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{a+=1})}).catch(()=>{a+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/json"},{data:r,status:a}=await this._axiosInstance.post("transactions/submit",{tx:e},{headers:t});if(a===200)return r.tx_id;throw l(r)}catch(t){throw l(t)}}}class ur{static withOneSignature(e){const t=P(X(e));return ft(t).to_hex()}static withAtLeastNSignatures(e,t){const r=n.NativeScripts.new();e.forEach(i=>{const o=P(X(i));r.add(ft(o))});const a=n.ScriptNOfK.new(t,r);return n.NativeScript.new_script_any(a).to_hex()}static withAnySignature(e){const t=n.NativeScripts.new();e.forEach(a=>{const i=P(X(a));t.add(ft(i))});const r=n.ScriptAny.new(t);return n.NativeScript.new_script_any(r).to_hex()}static withAllSignatures(e){const t=n.NativeScripts.new();e.forEach(a=>{const i=P(X(a));t.add(ft(i))});const r=n.ScriptAll.new(t);return n.NativeScript.new_script_any(r).to_hex()}static fromNativeScript(e){return vt(e).to_hex()}}function j(s,e,t,r){var a=arguments.length,i=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var c=s.length-1;c>=0;c--)(o=s[c])&&(i=(a<3?o(i):a>3?o(e,t,i):o(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i}const Ar=s=>class extends s{__visits=[]},et=()=>function(s,e,t){const r=t.value;t.value=function(...a){const i=r.call(this,...a);return this.__visits&&this.__visits.push(e),i}};exports.Transaction=class{_changeAddress;_txOutputs=new Map;_recipients=new Map;_totalBurns=new Map;_totalMints=new Map;_era;_initiator;_mintBuilder;_protocolParameters;_txBuilder;_txCertificates;_txInputsBuilder;_txWithdrawals;constructor(e={}){this._era=e.era,this._initiator=e.initiator,this._mintBuilder=n.MintBuilder.new(),this._protocolParameters=e.parameters??q,this._txBuilder=qs(e.parameters),this._txCertificates=n.Certificates.new(),this._txInputsBuilder=n.TxInputsBuilder.new(),this._txWithdrawals=n.Withdrawals.new()}static maskMetadata(e,t="BABBAGE"){var i;const r=L(e),a=(i=r.auxiliary_data())==null?void 0:i.metadata();if(a!==void 0){const o=n.GeneralTransactionMetadata.new();for(let u=0;u<a.len();u+=1){const A=a.keys().get(u),d=a.get(A);o.insert(A,n.TransactionMetadatum.from_hex("0".repeat(((d==null?void 0:d.to_hex())??"").length)))}const c=r.auxiliary_data();return c!==void 0&&(c.set_metadata(o),c.set_prefer_alonzo_format(t==="ALONZO")),n.Transaction.new(r.body(),r.witness_set(),c).to_hex()}return e}static readMetadata(e){var r,a;return((a=(r=L(e).auxiliary_data())==null?void 0:r.metadata())==null?void 0:a.to_hex())??""}static writeMetadata(e,t,r="BABBAGE"){const a=L(e),i=a.auxiliary_data()??n.AuxiliaryData.new();return i.set_metadata(n.GeneralTransactionMetadata.from_hex(t)),i.set_prefer_alonzo_format(r==="ALONZO"),n.Transaction.new(a.body(),a.witness_set(),i).to_hex()}get size(){return this._txBuilder.full_size()}async build(){try{return(this._mintBuilder.has_plutus_scripts()||this.notVisited("redeemValue")===!1)&&(await this.addRequiredSignersIfNeeded(),await this.addCollateralIfNeeded()),await this.forgeAssetsIfNeeded(),await this.addTxInputsAsNeeded(),await this.addChangeAddress(),this._txBuilder.build_tx().to_hex()}catch(e){throw new Error(`[Transaction] An error occurred during build: ${e}.`)}}burnAsset(e,t,r){const a=this._totalBurns.has(t.unit)?n.BigNum.from_str(this._totalBurns.get(t.unit)??"0").checked_add(n.BigNum.from_str(t.quantity)).to_str():t.quantity;return this._mintBuilder.add_asset(Ie(e,r),n.AssetName.new(m(t.unit.slice(T))),n.Int.new_negative(n.BigNum.from_str(t.quantity))),this._totalBurns.set(t.unit,a),this}delegateStake(e,t){const r=n.Certificate.new_stake_delegation(n.StakeDelegation.new(n.StakeCredential.from_keyhash(P(rt(e))),n.Ed25519KeyHash.from_bech32(t)));return this._txCertificates.add(r),this}deregisterStake(e){const t=n.Certificate.new_stake_deregistration(n.StakeDeregistration.new(n.StakeCredential.from_keyhash(P(rt(e)))));return this._txCertificates.add(t),this}mintAsset(e,t,r){var A,d;const a=(g,I)=>{const y=typeof g=="string"?Qt(g).hash().to_hex():i(g).hash().to_hex(),S=Q(I.assetName);return{unit:`${y}${S}`,quantity:I.assetQuantity}},i=g=>{if("code"in g)return ot(g.code,g.version);const I=Y(g);if(I.output().has_script_ref()){const y=I.output().script_ref();if(y.is_plutus_script()){const S=Fe(y);return ot(S.code,S.version)}}throw new Error(`No plutus script reference found in UTxO: ${I.input().transaction_id().to_hex()}`)},o=a(e,t),u=n.BigNum.from_str(((A=this._totalMints.get(o.unit))==null?void 0:A.assetQuantity)??"0").checked_add(n.BigNum.from_str(o.quantity));return this._mintBuilder.add_asset(Ie(e,r),n.AssetName.new(m(Q(t.assetName))),n.Int.new(n.BigNum.from_str(o.quantity))),this._recipients.has(t.recipient)?(d=this._recipients.get(t.recipient))==null||d.push(o):this._recipients.set(t.recipient,[o]),this._totalMints.set(o.unit,{...t,assetQuantity:u.to_str()}),this}redeemValue(e){const t={tag:"SPEND",budget:_e,index:this._txInputsBuilder.inputs().len(),data:{alternative:0,fields:[]},...e.redeemer},r=Y(e.value),a=n.PlutusWitness.new_with_ref(Oe(e.script),Ls(e.datum),Te(t));return this._txInputsBuilder.add_plutus_script_input(a,r.input(),r.output().amount()),this}registerStake(e){const t=n.Certificate.new_stake_registration(n.StakeRegistration.new(n.StakeCredential.from_keyhash(P(rt(e)))));return this._txCertificates.add(t),this}registerPool(e){const t=n.Certificate.new_pool_registration(n.PoolRegistration.new(Vs(e)));return this._txCertificates.add(t),this}retirePool(e,t){const r=n.Certificate.new_pool_retirement(n.PoolRetirement.new(n.Ed25519KeyHash.from_bech32(e),t));return this._txCertificates.add(r),this}sendAssets(e,t){const r=Ct(t),a=r.multiasset();if(r.is_zero()||a===void 0)return this;const i=pt(e).next(),o=r.coin().is_zero()?i.with_asset_and_min_required_coin_by_utxo_cost(a,le(this._protocolParameters.coinsPerUTxOSize)).build():i.with_coin_and_asset(r.coin(),a).build();return t.forEach(c=>{this.setTxOutput(c)}),this._txBuilder.add_output(o),this}sendLovelace(e,t){const a=pt(e).next().with_coin(n.BigNum.from_str(t)).build();return this.setTxOutput({unit:"lovelace",quantity:t}),this._txBuilder.add_output(a),this}sendToken(e,t,r){return this.sendAssets(e,[{quantity:r,unit:Ze[t]}]),this}sendValue(e,t){const r=Ct(t.output.amount),i=pt(e).next().with_value(r).build();return t.output.amount.forEach(o=>{this.setTxOutput(o)}),this._txBuilder.add_output(i),this}setChangeAddress(e){return this._changeAddress=F(e),this}setCollateral(e){const t=me(e);return this._txBuilder.set_collateral(t),this}setMetadata(e,t){return this._txBuilder.add_json_metadatum_with_schema(n.BigNum.from_str(e.toString()),JSON.stringify(t),n.MetadataJsonSchema.NoConversions),this}setRequiredSigners(e){return Array.from(new Set(e.map(r=>r.startsWith("addr")?X(r):rt(r)).map(r=>P(r)))).forEach(r=>{this._txBuilder.add_required_signer(r)}),this}setTimeToStart(e){return this._txBuilder.set_validity_start_interval_bignum(n.BigNum.from_str(e)),this}setTimeToExpire(e){return this._txBuilder.set_ttl_bignum(n.BigNum.from_str(e)),this}setTxInputs(e){return e.map(t=>Y(t)).forEach(t=>{this._txInputsBuilder.add_input(t.output().address(),t.input(),t.output().amount())}),this}withdrawRewards(e,t){const r=Pe(e);return r!==void 0&&this._txWithdrawals.insert(r,n.BigNum.from_str(t)),this}async addBurnInputsIfNeeded(){if(this._initiator&&this._totalBurns.size>0&&this.notVisited("setTxInputs")){const e=await this._initiator.getUsedUTxOs();Ce(this._totalBurns,e.map(r=>xt(r))).map(r=>Y(r)).forEach(r=>{this._txInputsBuilder.add_input(r.output().address(),r.input(),r.output().amount())})}}async addChangeAddress(){if(this._initiator&&this._changeAddress===void 0){const e=await this._initiator.getUsedAddress();this._txBuilder.add_change_if_needed(e)}else this._changeAddress!==void 0&&this._txBuilder.add_change_if_needed(this._changeAddress)}async addCollateralIfNeeded(){if(this._initiator&&this.notVisited("setCollateral")){const e=await this._initiator.getUsedCollateral();this._txBuilder.set_collateral(me(e))}}async addRequiredSignersIfNeeded(){if(this._initiator&&this.notVisited("setRequiredSigners")){const e=await this._initiator.getUsedAddress(),t=X(e.to_bech32());this._txBuilder.add_required_signer(P(t))}}async addTxInputsAsNeeded(){if(this.notVisited("setTxInputs")){const e=await this.filterAvailableUTxOs();ye(this._txOutputs,e.map(r=>xt(r))).map(r=>Y(r)).forEach(r=>{this._txInputsBuilder.add_input(r.output().address(),r.input(),r.output().amount())})}if(this._txBuilder.set_inputs(this._txInputsBuilder),(this._mintBuilder.has_native_scripts()||this._mintBuilder.has_plutus_scripts())&&this._txBuilder.set_mint_builder(this._mintBuilder),this._txCertificates.len()>0&&this._txBuilder.set_certs(this._txCertificates),this._txWithdrawals.len()>0&&this._txBuilder.set_withdrawals(this._txWithdrawals),this._txBuilder.get_mint_builder()||this.notVisited("redeemValue")===!1){const e=this._era!==void 0?$t[this._era]:$t.BABBAGE;this._txBuilder.calc_script_data_hash(e)}}async forgeAssetsIfNeeded(){const e=(t,r)=>{const a=t.data.assetName,i=t.data.metadata,o=t.unit.slice(0,T);if(r&&r[o]){const{[o]:c,...u}=r,A={[a]:i,...c};return{[o]:{...A},...u}}return r!==void 0?{[o]:{[a]:i},...r}:{[o]:{[a]:i}}};await this.addBurnInputsIfNeeded(),Array.from(this._totalMints,t=>({unit:t[0],data:t[1]})).reduce((t,r)=>t.set(r.data.label,e(r,t.get(r.data.label))),new Map).forEach((t,r)=>{this._txBuilder.add_json_metadatum(n.BigNum.from_str(r),JSON.stringify(t))}),this.addMintOutputs()}async filterAvailableUTxOs(e=[]){return this._initiator===void 0?[]:(await this._initiator.getUsedUTxOs()).filter(r=>e.find(a=>a.input.txHash===r.input().transaction_id().to_hex())===void 0)}addMintOutputs(){this._recipients.forEach((e,t)=>{const a=Ct(e).multiasset();if(a!==void 0){const o=pt(t).next().with_asset_and_min_required_coin_by_utxo_cost(a,le(this._protocolParameters.coinsPerUTxOSize)).build();this._txBuilder.add_output(o)}})}notVisited(e){return this.__visits.includes(e)===!1}setTxOutput(e){const r=n.BigNum.from_str(this._txOutputs.get(e.unit)??"0").checked_add(n.BigNum.from_str(e.quantity)).to_str();this._txOutputs.set(e.unit,r)}};j([et()],exports.Transaction.prototype,"mintAsset",null);j([et()],exports.Transaction.prototype,"redeemValue",null);j([et()],exports.Transaction.prototype,"sendAssets",null);j([et()],exports.Transaction.prototype,"sendValue",null);j([et()],exports.Transaction.prototype,"setCollateral",null);j([et()],exports.Transaction.prototype,"setRequiredSigners",null);j([et()],exports.Transaction.prototype,"setTxInputs",null);exports.Transaction=j([Ar],exports.Transaction);class C{_networkId;_encryptedSecret;constructor(e,t){this._networkId=e,this._encryptedSecret=t}getAccount(e,t){return this.accountContext(e,t,(r,a)=>{const i=de(this._networkId,r.to_public().hash(),a.to_public().hash()).to_address().to_bech32(),o=he(this._networkId,r.to_public().hash()).to_address().to_bech32(),c=Nt(this._networkId,a.to_public().hash()).to_address().to_bech32();return{baseAddress:i,enterpriseAddress:o,rewardAddress:c}})}signData(e,t,r,a){try{return this.accountContext(e,t,(i,o)=>{const c={payload:a},u={address:C.resolveAddress(this._networkId,r,i,o),key:r.startsWith("stake")?o:i},{coseSign1:A,coseKey:d}=is(c,u);return{signature:A,key:d}})}catch(i){throw new Error(`An error occurred during signData: ${i}.`)}}signTx(e,t,r,a,i){try{const o=Ke(Ye(a));return this.accountContext(e,t,(c,u)=>{const A=n.Vkeywitnesses.new();return C.resolveSigners(a,r,c.to_public().hash().to_hex()).forEach(g=>{if(g===c.to_public().hash().to_hex())A.add(n.make_vkey_witness(o,c));else if(g===u.to_public().hash().to_hex())A.add(n.make_vkey_witness(o,u));else if(i===!1)throw new Error(`Missing key witness for: ${g}`)}),A})}catch(o){throw new Error(`An error occurred during signTx: ${o}.`)}}static encryptMnemonic(e,t){const r=Kt.mnemonicToEntropy(e.join(" ")),a=He(r),i=v(a.as_bytes());return a.free(),C.encrypt(i,t)}static encryptPrivateKey(e,t){const r=n.Bip32PrivateKey.from_bech32(e),a=v(r.as_bytes());return r.free(),C.encrypt(a,t)}static encryptSigningKeys(e,t,r){const a=C.encrypt(e.slice(4),r),i=C.encrypt(t.slice(4),r);return[a,i]}static generateMnemonic(e=256){return Kt.generateMnemonic(e).split(" ")}accountContext(e,t,r){const{paymentKey:a,stakeKey:i}=C.resolveKeys(e,t,this._encryptedSecret),o=r(a,i);return a.free(),i.free(),o}static decrypt(e,t){try{return n.decrypt_with_password(Q(t),e)}catch{throw new Error("The password is incorrect.")}}static encrypt(e,t){const r=fe.customAlphabet("0123456789abcdef"),a=r(64),i=r(24);return n.encrypt_with_password(Q(t),a,i,e)}static resolveAddress(e,t,r,a){const i=[de(e,r.to_public().hash(),a.to_public().hash()),he(e,r.to_public().hash()),Nt(e,a.to_public().hash())].find(o=>o.to_address().to_bech32()===t);if(i!==void 0)return i.to_address();throw new Error(`Address: ${t} doesn't belong to this account.`)}static resolveKeys(e,t,r){if(typeof r=="string"){const o=C.decrypt(r,t);return Us(o,e)}const a=C.decrypt(r[0],t),i=C.decrypt(r[1],t);return{paymentKey:n.PrivateKey.from_hex(a),stakeKey:n.PrivateKey.from_hex(i)}}static resolveSigners(e,t,r){const a=c=>{const u=(f,x=[],B=0)=>{var ht,ct,Yt,Lt,qt;if(f===void 0||B>=f.len())return x;const k=f.get(B),U=new Array;switch(k.kind()){case n.CertificateKind.StakeDeregistration:{const w=(ht=k.as_stake_deregistration())==null?void 0:ht.stake_credential(),O=(w==null?void 0:w.kind())===n.StakeCredKind.Key?w.to_keyhash():void 0;O&&U.push(O.to_hex());break}case n.CertificateKind.StakeDelegation:{const w=(ct=k.as_stake_delegation())==null?void 0:ct.stake_credential(),O=(w==null?void 0:w.kind())===n.StakeCredKind.Key?w.to_keyhash():void 0;O&&U.push(O.to_hex());break}case n.CertificateKind.PoolRegistration:{const w=(Yt=k.as_pool_registration())==null?void 0:Yt.pool_params().pool_owners();U.push(...d(w));break}case n.CertificateKind.PoolRetirement:{const w=(Lt=k.as_pool_retirement())==null?void 0:Lt.pool_keyhash();w&&U.push(w.to_hex());break}case n.CertificateKind.MoveInstantaneousRewardsCert:{const w=(qt=k.as_move_instantaneous_rewards_cert())==null?void 0:qt.move_instantaneous_reward().as_to_stake_creds();if(w)for(let O=0;O<w.len();O+=1){const Gt=w.keys().get(O),Rt=Gt.kind()===n.StakeCredKind.Key?Gt.to_keyhash():void 0;Rt&&U.push(Rt.to_hex())}break}}return u(f,[...x,...U],B+1)},A=(f,x=[],B=0)=>{if(f===void 0||B>=f.len())return x;const k=f.get(B).index(),U=f.get(B).transaction_id(),ht=t.find(ct=>ct.input.outputIndex===k&&ct.input.txHash===U.to_hex())!==void 0?r:"OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";return A(f,[...x,ht],B+1)},d=(f,x=[],B=0)=>f===void 0||B>=f.len()?x:d(f,[...x,f.get(B).to_hex()],B+1),g=(f,x=[],B=0)=>{if(f===void 0||B>=f.len())return x;const k=f.keys().get(B).payment_cred(),U=k.kind()===n.StakeCredKind.Key?k.to_keyhash():void 0;return g(f,U?[...x,U.to_hex()]:x,B+1)},I=c.certs(),y=c.collateral(),S=c.inputs(),H=c.required_signers(),R=c.withdrawals();return[...u(I),...A(y),...A(S),...d(H),...g(R)]},i=c=>{const u=(d,g=[])=>{var I,y,S,H;if(d)for(let R=0;R<d.len();R+=1){const f=d.get(R);switch(f.kind()){case n.NativeScriptKind.ScriptPubkey:{const x=(I=f.as_script_pubkey())==null?void 0:I.addr_keyhash().to_hex();return x?[...g,x]:g}case n.NativeScriptKind.ScriptAll:return u((y=f.as_script_all())==null?void 0:y.native_scripts(),g);case n.NativeScriptKind.ScriptAny:return u((S=f.as_script_any())==null?void 0:S.native_scripts(),g);case n.NativeScriptKind.ScriptNOfK:return u((H=f.as_script_n_of_k())==null?void 0:H.native_scripts(),g)}}return g},A=c.native_scripts();return[...u(A)]},o=L(e);return new Set([...a(o.body()),...i(o.witness_set())])}}const K="MARI0TIME";class gr{_fetcher;_submitter;_wallet;constructor(e){switch(this._fetcher=e.fetcher,this._submitter=e.submitter,e.key.type){case"mnemonic":this._wallet=new C(e.networkId,C.encryptMnemonic(e.key.words,K));break;case"root":this._wallet=new C(e.networkId,C.encryptPrivateKey(e.key.bech32,K));break;case"cli":this._wallet=new C(e.networkId,C.encryptSigningKeys(e.key.payment,e.key.stake??"f0".repeat(34),K))}}getPaymentAddress(e=0){return this._wallet.getAccount(e,K).enterpriseAddress}getRewardAddress(e=0){return this._wallet.getAccount(e,K).rewardAddress}getUsedAddress(e=0){const t=this._wallet.getAccount(e,K);return F(t.enterpriseAddress)}getUsedCollateral(e=q.maxCollateralInputs){throw new Error("getUsedCollateral not implemented.")}async getUsedUTxOs(e=0){const t=this._wallet.getAccount(e,K);return(await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map(a=>Y(a))}signData(e,t,r=0){try{return this._wallet.signData(r,K,e,t)}catch(a){throw new Error(`[AppWallet] An error occurred during signData: ${a}.`)}}async signTx(e,t=!1,r=0){try{const a=this._wallet.getAccount(r,K),i=await this._fetcher.fetchAddressUTxOs(a.enterpriseAddress),o=this._wallet.signTx(r,K,i,e,t),c=L(e),u=c.witness_set(),A=Le(u,o);return u.set_vkeys(A),n.Transaction.new(c.body(),u,c.auxiliary_data()).to_hex()}catch(a){throw new Error(`[AppWallet] An error occurred during signTx: ${a}.`)}}submitTx(e){return this._submitter.submitTx(e)}static brew(e=256){return C.generateMnemonic(e)}}class St{_walletInstance;constructor(e){this._walletInstance=e}static getInstalledWallets(){return window.cardano===void 0?[]:zt.filter(e=>window.cardano[e]!==void 0).map(e=>({name:window.cardano[e].name,icon:window.cardano[e].icon,version:window.cardano[e].apiVersion}))}static async enable(e){try{const t=await St.resolveInstance(e);if(t!==void 0)return new St(t);throw new Error(`Couldn't create an instance of wallet: ${e}`)}catch(t){throw new Error(`[BrowserWallet] An error occurred during enable: ${t}.`)}}async getBalance(){const e=await this._walletInstance.getBalance();return Me(Os(e))}async getChangeAddress(){const e=await this._walletInstance.getChangeAddress();return st(e).to_bech32()}async getCollateral(e=q.maxCollateralInputs){return(await this.getUsedCollateral(e)).map(r=>xt(r))}getNetworkId(){return this._walletInstance.getNetworkId()}async getRewardAddresses(){return(await this._walletInstance.getRewardAddresses()).map(t=>st(t).to_bech32())}async getUnusedAddresses(){return(await this._walletInstance.getUnusedAddresses()).map(t=>st(t).to_bech32())}async getUsedAddresses(){return(await this._walletInstance.getUsedAddresses()).map(t=>st(t).to_bech32())}async getUtxos(){return(await this.getUsedUTxOs()).map(t=>xt(t))}signData(e,t){const r=F(e).to_hex();return this._walletInstance.signData(r,Q(t))}async signTx(e,t=!1){try{const r=L(e),a=r.witness_set(),i=await this._walletInstance.signTx(e,t),o=Hs(i).vkeys()??n.Vkeywitnesses.new(),c=Le(a,o);return a.set_vkeys(c),v(n.Transaction.new(r.body(),a,r.auxiliary_data()).to_bytes())}catch(r){throw new Error(`[BrowserWallet] An error occurred during signTx: ${JSON.stringify(r)}.`)}}submitTx(e){return this._walletInstance.submitTx(e)}async getUsedAddress(){const e=await this._walletInstance.getUsedAddresses();return st(e[0])}async getUsedCollateral(e=q.maxCollateralInputs){return(await this._walletInstance.experimental.getCollateral()??[]).map(r=>Ae(r)).slice(0,e)}async getUsedUTxOs(){return(await this._walletInstance.getUtxos()??[]).map(t=>Ae(t))}async getAssets(){return(await this.getBalance()).filter(t=>t.unit!=="lovelace").map(t=>{const r=t.unit.slice(0,T),a=t.unit.slice(T),i=Ve(r,a);return{unit:t.unit,policyId:r,assetName:Ot(a),fingerprint:i,quantity:t.quantity}})}async getLovelace(){const t=(await this.getBalance()).find(r=>r.unit==="lovelace");return t!==void 0?t.quantity:"0"}async getPolicyIdAssets(e){return(await this.getAssets()).filter(r=>r.policyId===e)}async getPolicyIds(){const e=await this.getBalance();return Array.from(new Set(e.map(t=>t.unit.slice(0,T)))).filter(t=>t!=="lovelace")}static resolveInstance(e){if(window.cardano===void 0)return;const t=zt.map(r=>window.cardano[r]).filter(r=>r!==void 0).find(r=>r.name.toLowerCase()===e.toLowerCase());return t==null?void 0:t.enable()}}const qe="http://localhost:4000/",dr="http://localhost:5000/",lr=`${qe}access`,hr=`${qe}transaction/signtx`;class Ir{static getAxiosInstance(){return J.default.create({baseURL:dr,withCredentials:!0})}static getAppId(){return window.location.hostname}static async openMinaFrontend(e){const t=this.getAppId();e.includes("?")?e=`${e}&appId=${t}`:e=`${e}?appId=${t}`;const r="left=100,top=100,width=540,height=540",a=window.open(e,"meshWindow",r);return a||console.error("the window did not open",a),await(async()=>new Promise(i=>{window.addEventListener("message",async o=>{o.data.target=="minaWallet"&&i(o.data)})}))()}static async get(e,t={}){const r=this.getAppId();t={...t,appId:r};try{return(await this.getAxiosInstance().get(e,{params:t})).data}catch{console.error("Not logged in");return}}static async enable(){return await this.get("wallet/getuserwalletsmeta")===void 0?await this.openMinaFrontend(lr):!0}static async getChangeAddress(e=void 0,t=void 0){return await this.get("wallet/getchangeaddress",{walletId:e,accountIndex:t})}static async getUtxos(e=void 0,t=void 0){return await this.get("wallet/getutxo",{walletId:e,accountIndex:t})}static async signTx(e,t=!1){const r=await this.get("wallet/getuserwalletsmeta");if(console.log("userWalletsMeta",r),r){const a=await this.openMinaFrontend(`${hr}?unsignedTx=${e}&partialSign=${t}`);if(a instanceof n.Vkeywitnesses){const i=L(e),o=i.witness_set();o.set_vkeys(a);const c=n.Transaction.new(i.body(),o,i.auxiliary_data()).to_hex();return console.log("signedTx",c),c}}else return}}exports.AppWallet=gr;exports.BlockfrostProvider=ar;exports.BrowserWallet=St;exports.EmbeddedWallet=C;exports.ForgeScript=ur;exports.InfuraProvider=nr;exports.KoiosProvider=ir;exports.MinaWallet=Ir;exports.OgmiosProvider=or;exports.TangoProvider=cr;exports.checkSignature=os;exports.generateNonce=er;exports.isNetwork=pe;exports.keepRelevant=ye;exports.largestFirst=ts;exports.largestFirstMultiAsset=Ce;exports.parseAssetUnit=tt;exports.parseHttpError=l;exports.readPlutusData=sr;exports.readTransaction=rr;exports.resolveDataHash=Gs;exports.resolveEpochNo=Rs;exports.resolveFingerprint=Ve;exports.resolveLanguageView=$s;exports.resolveNativeScriptHash=zs;exports.resolvePaymentKeyHash=X;exports.resolvePlutusScriptAddress=Ws;exports.resolvePlutusScriptHash=Js;exports.resolvePoolId=js;exports.resolvePrivateKey=Xs;exports.resolveRewardAddress=Dt;exports.resolveScriptRef=Zs;exports.resolveSlotNo=tr;exports.resolveStakeKeyHash=rt;exports.resolveTxFees=Vt;exports.resolveTxHash=Ye;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const fe=require("nanoid"),Ge=require("@emurgo/cardano-serialization-lib-nodejs"),Re=require("axios"),Kt=require("bip39"),p=require("@emurgo/cardano-message-signing-nodejs"),$e=s=>s&&typeof s=="object"&&"default"in s?s:{default:s};function ze(s){if(s&&s.__esModule)return s;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const n=ze(Ge),J=$e(Re),We=["testnet","preview","preprod","mainnet"],pe=s=>We.includes(s),_e={mem:7e6,steps:3e9},q={epoch:0,coinsPerUTxOSize:"4310",priceMem:.0577,priceStep:721e-7,minFeeA:44,minFeeB:155381,keyDeposit:"2000000",maxTxSize:16384,maxValSize:"5000",poolDeposit:"500000000",maxCollateralInputs:3,decentralisation:0,maxBlockSize:98304,collateralPercent:150,maxBlockHeaderSize:1100,minPoolCost:"340000000",maxTxExMem:"16000000",maxTxExSteps:"10000000000",maxBlockExMem:"80000000",maxBlockExSteps:"40000000000"},kt=2147483648,wt={V1:n.Language.new_plutus_v1(),V2:n.Language.new_plutus_v2()},T=56,Je={CERT:n.RedeemerTag.new_cert(),MINT:n.RedeemerTag.new_mint(),REWARD:n.RedeemerTag.new_reward(),SPEND:n.RedeemerTag.new_spend()},Bt={testnet:["74","1598400","1595967616","432000"],preview:["183","15811222","1682467200","86400"],preprod:["65","26438400","1682121600","432000"],mainnet:["208","4492800","1596059091","432000"]},$t={ALONZO:n.TxBuilderConstants.plutus_alonzo_cost_models(),BABBAGE:(()=>{const s=n.Costmdls.new(),e=n.CostModel.new();Object.values({"addInteger-cpu-arguments-intercept":205665,"addInteger-cpu-arguments-slope":812,"addInteger-memory-arguments-intercept":1,"addInteger-memory-arguments-slope":1,"appendByteString-cpu-arguments-intercept":1e3,"appendByteString-cpu-arguments-slope":571,"appendByteString-memory-arguments-intercept":0,"appendByteString-memory-arguments-slope":1,"appendString-cpu-arguments-intercept":1e3,"appendString-cpu-arguments-slope":24177,"appendString-memory-arguments-intercept":4,"appendString-memory-arguments-slope":1,"bData-cpu-arguments":1e3,"bData-memory-arguments":32,"blake2b_256-cpu-arguments-intercept":117366,"blake2b_256-cpu-arguments-slope":10475,"blake2b_256-memory-arguments":4,"cekApplyCost-exBudgetCPU":23e3,"cekApplyCost-exBudgetMemory":100,"cekBuiltinCost-exBudgetCPU":23e3,"cekBuiltinCost-exBudgetMemory":100,"cekConstCost-exBudgetCPU":23e3,"cekConstCost-exBudgetMemory":100,"cekDelayCost-exBudgetCPU":23e3,"cekDelayCost-exBudgetMemory":100,"cekForceCost-exBudgetCPU":23e3,"cekForceCost-exBudgetMemory":100,"cekLamCost-exBudgetCPU":23e3,"cekLamCost-exBudgetMemory":100,"cekStartupCost-exBudgetCPU":100,"cekStartupCost-exBudgetMemory":100,"cekVarCost-exBudgetCPU":23e3,"cekVarCost-exBudgetMemory":100,"chooseData-cpu-arguments":19537,"chooseData-memory-arguments":32,"chooseList-cpu-arguments":175354,"chooseList-memory-arguments":32,"chooseUnit-cpu-arguments":46417,"chooseUnit-memory-arguments":4,"consByteString-cpu-arguments-intercept":221973,"consByteString-cpu-arguments-slope":511,"consByteString-memory-arguments-intercept":0,"consByteString-memory-arguments-slope":1,"constrData-cpu-arguments":89141,"constrData-memory-arguments":32,"decodeUtf8-cpu-arguments-intercept":497525,"decodeUtf8-cpu-arguments-slope":14068,"decodeUtf8-memory-arguments-intercept":4,"decodeUtf8-memory-arguments-slope":2,"divideInteger-cpu-arguments-constant":196500,"divideInteger-cpu-arguments-model-arguments-intercept":453240,"divideInteger-cpu-arguments-model-arguments-slope":220,"divideInteger-memory-arguments-intercept":0,"divideInteger-memory-arguments-minimum":1,"divideInteger-memory-arguments-slope":1,"encodeUtf8-cpu-arguments-intercept":1e3,"encodeUtf8-cpu-arguments-slope":28662,"encodeUtf8-memory-arguments-intercept":4,"encodeUtf8-memory-arguments-slope":2,"equalsByteString-cpu-arguments-constant":245e3,"equalsByteString-cpu-arguments-intercept":216773,"equalsByteString-cpu-arguments-slope":62,"equalsByteString-memory-arguments":1,"equalsData-cpu-arguments-intercept":1060367,"equalsData-cpu-arguments-slope":12586,"equalsData-memory-arguments":1,"equalsInteger-cpu-arguments-intercept":208512,"equalsInteger-cpu-arguments-slope":421,"equalsInteger-memory-arguments":1,"equalsString-cpu-arguments-constant":187e3,"equalsString-cpu-arguments-intercept":1e3,"equalsString-cpu-arguments-slope":52998,"equalsString-memory-arguments":1,"fstPair-cpu-arguments":80436,"fstPair-memory-arguments":32,"headList-cpu-arguments":43249,"headList-memory-arguments":32,"iData-cpu-arguments":1e3,"iData-memory-arguments":32,"ifThenElse-cpu-arguments":80556,"ifThenElse-memory-arguments":1,"indexByteString-cpu-arguments":57667,"indexByteString-memory-arguments":4,"lengthOfByteString-cpu-arguments":1e3,"lengthOfByteString-memory-arguments":10,"lessThanByteString-cpu-arguments-intercept":197145,"lessThanByteString-cpu-arguments-slope":156,"lessThanByteString-memory-arguments":1,"lessThanEqualsByteString-cpu-arguments-intercept":197145,"lessThanEqualsByteString-cpu-arguments-slope":156,"lessThanEqualsByteString-memory-arguments":1,"lessThanEqualsInteger-cpu-arguments-intercept":204924,"lessThanEqualsInteger-cpu-arguments-slope":473,"lessThanEqualsInteger-memory-arguments":1,"lessThanInteger-cpu-arguments-intercept":208896,"lessThanInteger-cpu-arguments-slope":511,"lessThanInteger-memory-arguments":1,"listData-cpu-arguments":52467,"listData-memory-arguments":32,"mapData-cpu-arguments":64832,"mapData-memory-arguments":32,"mkCons-cpu-arguments":65493,"mkCons-memory-arguments":32,"mkNilData-cpu-arguments":22558,"mkNilData-memory-arguments":32,"mkNilPairData-cpu-arguments":16563,"mkNilPairData-memory-arguments":32,"mkPairData-cpu-arguments":76511,"mkPairData-memory-arguments":32,"modInteger-cpu-arguments-constant":196500,"modInteger-cpu-arguments-model-arguments-intercept":453240,"modInteger-cpu-arguments-model-arguments-slope":220,"modInteger-memory-arguments-intercept":0,"modInteger-memory-arguments-minimum":1,"modInteger-memory-arguments-slope":1,"multiplyInteger-cpu-arguments-intercept":69522,"multiplyInteger-cpu-arguments-slope":11687,"multiplyInteger-memory-arguments-intercept":0,"multiplyInteger-memory-arguments-slope":1,"nullList-cpu-arguments":60091,"nullList-memory-arguments":32,"quotientInteger-cpu-arguments-constant":196500,"quotientInteger-cpu-arguments-model-arguments-intercept":453240,"quotientInteger-cpu-arguments-model-arguments-slope":220,"quotientInteger-memory-arguments-intercept":0,"quotientInteger-memory-arguments-minimum":1,"quotientInteger-memory-arguments-slope":1,"remainderInteger-cpu-arguments-constant":196500,"remainderInteger-cpu-arguments-model-arguments-intercept":453240,"remainderInteger-cpu-arguments-model-arguments-slope":220,"remainderInteger-memory-arguments-intercept":0,"remainderInteger-memory-arguments-minimum":1,"remainderInteger-memory-arguments-slope":1,"sha2_256-cpu-arguments-intercept":806990,"sha2_256-cpu-arguments-slope":30482,"sha2_256-memory-arguments":4,"sha3_256-cpu-arguments-intercept":1927926,"sha3_256-cpu-arguments-slope":82523,"sha3_256-memory-arguments":4,"sliceByteString-cpu-arguments-intercept":265318,"sliceByteString-cpu-arguments-slope":0,"sliceByteString-memory-arguments-intercept":4,"sliceByteString-memory-arguments-slope":0,"sndPair-cpu-arguments":85931,"sndPair-memory-arguments":32,"subtractInteger-cpu-arguments-intercept":205665,"subtractInteger-cpu-arguments-slope":812,"subtractInteger-memory-arguments-intercept":1,"subtractInteger-memory-arguments-slope":1,"tailList-cpu-arguments":41182,"tailList-memory-arguments":32,"trace-cpu-arguments":212342,"trace-memory-arguments":32,"unBData-cpu-arguments":31220,"unBData-memory-arguments":32,"unConstrData-cpu-arguments":32696,"unConstrData-memory-arguments":32,"unIData-cpu-arguments":43357,"unIData-memory-arguments":32,"unListData-cpu-arguments":32247,"unListData-memory-arguments":32,"unMapData-cpu-arguments":38314,"unMapData-memory-arguments":32,"verifyEd25519Signature-cpu-arguments-intercept":57996947,"verifyEd25519Signature-cpu-arguments-slope":18975,"verifyEd25519Signature-memory-arguments":10}).forEach((r,a)=>e.set(a,n.Int.new_i32(r)));const t=n.CostModel.new();return Object.values({"addInteger-cpu-arguments-intercept":205665,"addInteger-cpu-arguments-slope":812,"addInteger-memory-arguments-intercept":1,"addInteger-memory-arguments-slope":1,"appendByteString-cpu-arguments-intercept":1e3,"appendByteString-cpu-arguments-slope":571,"appendByteString-memory-arguments-intercept":0,"appendByteString-memory-arguments-slope":1,"appendString-cpu-arguments-intercept":1e3,"appendString-cpu-arguments-slope":24177,"appendString-memory-arguments-intercept":4,"appendString-memory-arguments-slope":1,"bData-cpu-arguments":1e3,"bData-memory-arguments":32,"blake2b_256-cpu-arguments-intercept":117366,"blake2b_256-cpu-arguments-slope":10475,"blake2b_256-memory-arguments":4,"cekApplyCost-exBudgetCPU":23e3,"cekApplyCost-exBudgetMemory":100,"cekBuiltinCost-exBudgetCPU":23e3,"cekBuiltinCost-exBudgetMemory":100,"cekConstCost-exBudgetCPU":23e3,"cekConstCost-exBudgetMemory":100,"cekDelayCost-exBudgetCPU":23e3,"cekDelayCost-exBudgetMemory":100,"cekForceCost-exBudgetCPU":23e3,"cekForceCost-exBudgetMemory":100,"cekLamCost-exBudgetCPU":23e3,"cekLamCost-exBudgetMemory":100,"cekStartupCost-exBudgetCPU":100,"cekStartupCost-exBudgetMemory":100,"cekVarCost-exBudgetCPU":23e3,"cekVarCost-exBudgetMemory":100,"chooseData-cpu-arguments":19537,"chooseData-memory-arguments":32,"chooseList-cpu-arguments":175354,"chooseList-memory-arguments":32,"chooseUnit-cpu-arguments":46417,"chooseUnit-memory-arguments":4,"consByteString-cpu-arguments-intercept":221973,"consByteString-cpu-arguments-slope":511,"consByteString-memory-arguments-intercept":0,"consByteString-memory-arguments-slope":1,"constrData-cpu-arguments":89141,"constrData-memory-arguments":32,"decodeUtf8-cpu-arguments-intercept":497525,"decodeUtf8-cpu-arguments-slope":14068,"decodeUtf8-memory-arguments-intercept":4,"decodeUtf8-memory-arguments-slope":2,"divideInteger-cpu-arguments-constant":196500,"divideInteger-cpu-arguments-model-arguments-intercept":453240,"divideInteger-cpu-arguments-model-arguments-slope":220,"divideInteger-memory-arguments-intercept":0,"divideInteger-memory-arguments-minimum":1,"divideInteger-memory-arguments-slope":1,"encodeUtf8-cpu-arguments-intercept":1e3,"encodeUtf8-cpu-arguments-slope":28662,"encodeUtf8-memory-arguments-intercept":4,"encodeUtf8-memory-arguments-slope":2,"equalsByteString-cpu-arguments-constant":245e3,"equalsByteString-cpu-arguments-intercept":216773,"equalsByteString-cpu-arguments-slope":62,"equalsByteString-memory-arguments":1,"equalsData-cpu-arguments-intercept":1060367,"equalsData-cpu-arguments-slope":12586,"equalsData-memory-arguments":1,"equalsInteger-cpu-arguments-intercept":208512,"equalsInteger-cpu-arguments-slope":421,"equalsInteger-memory-arguments":1,"equalsString-cpu-arguments-constant":187e3,"equalsString-cpu-arguments-intercept":1e3,"equalsString-cpu-arguments-slope":52998,"equalsString-memory-arguments":1,"fstPair-cpu-arguments":80436,"fstPair-memory-arguments":32,"headList-cpu-arguments":43249,"headList-memory-arguments":32,"iData-cpu-arguments":1e3,"iData-memory-arguments":32,"ifThenElse-cpu-arguments":80556,"ifThenElse-memory-arguments":1,"indexByteString-cpu-arguments":57667,"indexByteString-memory-arguments":4,"lengthOfByteString-cpu-arguments":1e3,"lengthOfByteString-memory-arguments":10,"lessThanByteString-cpu-arguments-intercept":197145,"lessThanByteString-cpu-arguments-slope":156,"lessThanByteString-memory-arguments":1,"lessThanEqualsByteString-cpu-arguments-intercept":197145,"lessThanEqualsByteString-cpu-arguments-slope":156,"lessThanEqualsByteString-memory-arguments":1,"lessThanEqualsInteger-cpu-arguments-intercept":204924,"lessThanEqualsInteger-cpu-arguments-slope":473,"lessThanEqualsInteger-memory-arguments":1,"lessThanInteger-cpu-arguments-intercept":208896,"lessThanInteger-cpu-arguments-slope":511,"lessThanInteger-memory-arguments":1,"listData-cpu-arguments":52467,"listData-memory-arguments":32,"mapData-cpu-arguments":64832,"mapData-memory-arguments":32,"mkCons-cpu-arguments":65493,"mkCons-memory-arguments":32,"mkNilData-cpu-arguments":22558,"mkNilData-memory-arguments":32,"mkNilPairData-cpu-arguments":16563,"mkNilPairData-memory-arguments":32,"mkPairData-cpu-arguments":76511,"mkPairData-memory-arguments":32,"modInteger-cpu-arguments-constant":196500,"modInteger-cpu-arguments-model-arguments-intercept":453240,"modInteger-cpu-arguments-model-arguments-slope":220,"modInteger-memory-arguments-intercept":0,"modInteger-memory-arguments-minimum":1,"modInteger-memory-arguments-slope":1,"multiplyInteger-cpu-arguments-intercept":69522,"multiplyInteger-cpu-arguments-slope":11687,"multiplyInteger-memory-arguments-intercept":0,"multiplyInteger-memory-arguments-slope":1,"nullList-cpu-arguments":60091,"nullList-memory-arguments":32,"quotientInteger-cpu-arguments-constant":196500,"quotientInteger-cpu-arguments-model-arguments-intercept":453240,"quotientInteger-cpu-arguments-model-arguments-slope":220,"quotientInteger-memory-arguments-intercept":0,"quotientInteger-memory-arguments-minimum":1,"quotientInteger-memory-arguments-slope":1,"remainderInteger-cpu-arguments-constant":196500,"remainderInteger-cpu-arguments-model-arguments-intercept":453240,"remainderInteger-cpu-arguments-model-arguments-slope":220,"remainderInteger-memory-arguments-intercept":0,"remainderInteger-memory-arguments-minimum":1,"remainderInteger-memory-arguments-slope":1,"serialiseData-cpu-arguments-intercept":1159724,"serialiseData-cpu-arguments-slope":392670,"serialiseData-memory-arguments-intercept":0,"serialiseData-memory-arguments-slope":2,"sha2_256-cpu-arguments-intercept":806990,"sha2_256-cpu-arguments-slope":30482,"sha2_256-memory-arguments":4,"sha3_256-cpu-arguments-intercept":1927926,"sha3_256-cpu-arguments-slope":82523,"sha3_256-memory-arguments":4,"sliceByteString-cpu-arguments-intercept":265318,"sliceByteString-cpu-arguments-slope":0,"sliceByteString-memory-arguments-intercept":4,"sliceByteString-memory-arguments-slope":0,"sndPair-cpu-arguments":85931,"sndPair-memory-arguments":32,"subtractInteger-cpu-arguments-intercept":205665,"subtractInteger-cpu-arguments-slope":812,"subtractInteger-memory-arguments-intercept":1,"subtractInteger-memory-arguments-slope":1,"tailList-cpu-arguments":41182,"tailList-memory-arguments":32,"trace-cpu-arguments":212342,"trace-memory-arguments":32,"unBData-cpu-arguments":31220,"unBData-memory-arguments":32,"unConstrData-cpu-arguments":32696,"unConstrData-memory-arguments":32,"unIData-cpu-arguments":43357,"unIData-memory-arguments":32,"unListData-cpu-arguments":32247,"unListData-memory-arguments":32,"unMapData-cpu-arguments":38314,"unMapData-memory-arguments":32,"verifyEcdsaSecp256k1Signature-cpu-arguments":35892428,"verifyEcdsaSecp256k1Signature-memory-arguments":10,"verifyEd25519Signature-cpu-arguments-intercept":57996947,"verifyEd25519Signature-cpu-arguments-slope":18975,"verifyEd25519Signature-memory-arguments":10,"verifySchnorrSecp256k1Signature-cpu-arguments-intercept":38887044,"verifySchnorrSecp256k1Signature-cpu-arguments-slope":32947,"verifySchnorrSecp256k1Signature-memory-arguments":10}).forEach((r,a)=>t.set(a,n.Int.new_i32(r))),s.insert(n.Language.new_plutus_v1(),e),s.insert(n.Language.new_plutus_v2(),t),s})()},je={ALONZO:{V1:"a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"},BABBAGE:{V1:"a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",V2:"a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"}},Pt={[n.NetworkInfo.testnet().network_id()]:"8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",[n.NetworkInfo.mainnet().network_id()]:"f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"},Xe={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"},Ze={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"},zt=["begin","eternl","flint","lace","nami","nufi","gerowallet","typhoncip30"],ye=(s,e,t="5000000")=>{const r=n.BigNum.from_str(s.get("lovelace")??"0").checked_add(n.BigNum.from_str(t)),a=e.filter(c=>c.output.amount.filter(u=>u.unit!=="lovelace").some(u=>s.has(u.unit))),i=rs(a);return[...i.less_than(r)?as(r.clamped_sub(i).to_str(),e.filter(c=>!a.map(u=>u.input.txHash).includes(c.input.txHash))):[],...a]},ts=(s,e,t=!1,{maxTxSize:r,minFeeA:a,minFeeB:i}=q)=>{const o=e.filter(g=>we(g)===!1).sort(Tt),c=n.BigNum.from_str(Vt(r,a,i)),u=t?n.BigNum.from_str(s).checked_add(c).to_str():s;return gt(o,new Map([["lovelace",u]]))},Ce=(s,e,t=!1,r=q)=>{const a=e.filter(we).sort(Tt),i=ss(r),o=s.get("lovelace")??"0",c=t?n.BigNum.from_str(o).checked_add(i).to_str():o;return s.set("lovelace",c),gt(a,s)},es=(s,e)=>Array.from(e,t=>({unit:t[0],quantity:n.BigNum.from_str(t[1])})).every(t=>s.filter(r=>r.output.amount.find(a=>a.unit===t.unit)!==void 0).reduce((r,a)=>{const i=a.output.amount.reduce((o,c)=>o.checked_add(n.BigNum.from_str(t.unit===c.unit?c.quantity:"0")),n.BigNum.from_str("0"));return r.checked_add(i)},n.BigNum.from_str("0")).less_than(t.quantity)===!1),Tt=(s,e)=>{var a,i;const t=n.BigNum.from_str(((a=s.output.amount.find(o=>o.unit==="lovelace"))==null?void 0:a.quantity)??"0");return n.BigNum.from_str(((i=e.output.amount.find(o=>o.unit==="lovelace"))==null?void 0:i.quantity)??"0").compare(t)},ss=s=>{const{maxTxSize:e,minFeeA:t,minFeeB:r}=s;return n.BigNum.from_str(Vt(e,t,r))},we=s=>s.output.amount.length>1,rs=s=>s.reduce((e,t)=>{var a;const r=((a=t.output.amount.find(i=>i.unit==="lovelace"))==null?void 0:a.quantity)??"0";return e.checked_add(n.BigNum.from_str(r))},n.BigNum.from_str("0")),as=(s,e)=>{const t=e.sort(Tt);return gt(t,new Map([["lovelace",s]]))},gt=(s,e,t=[])=>s.length===0||es(t,e)?t:ns(s[0],e)?gt(s.slice(1),e,[...t,s[0]]):gt(s.slice(1),e,t),ns=(s,e)=>Array.from(e.keys()).some(t=>s.output.amount.find(r=>r.unit===t)!==void 0),is=(s,e)=>{const t=us(e),r=As(s,e);return{coseKey:v(t.to_bytes()),coseSign1:v(r.to_bytes())}},os=(s,e,{key:t,signature:r})=>{var o,c;const a=p.COSEKey.from_bytes(m(t)),i=p.COSESign1.from_bytes(m(r));if((s==null?void 0:s.length)>0){const u=v(i.payload()??new Uint8Array);if(Q(s)!==u)return!1}if((e==null?void 0:e.length)>0){const A=(o=i.headers().protected().deserialized_headers().header(p.Label.new_text("address")))==null?void 0:o.as_bytes();if(A===void 0)throw new Error("Couldn't find a signer address in signature");const d=(c=a.header(p.Label.new_int(p.Int.new_negative(p.BigNum.from_str("2")))))==null?void 0:c.as_bytes();if(d===void 0)throw new Error("Couldn't find a signer key in signature");const g=st(v(A)),I=Ts(v(d));if(cs(e,g,I)===!1)throw new Error("Couldn't check signature because of address mismatch");const y=Ps(v(i.signature())),S=i.signed_data().to_bytes();return I.verify(S,y)}return!1},cs=(s,e,t)=>{if(s!==e.to_bech32())return!1;try{return rt(s)===t.hash().to_hex()}catch{return!1}},us=s=>{const e=p.COSEKey.new(p.Label.from_key_type(p.KeyType.OKP));return e.set_algorithm_id(p.Label.from_algorithm_id(p.AlgorithmId.EdDSA)),e.set_header(p.Label.new_int(p.Int.new_negative(p.BigNum.from_str("1"))),p.CBORValue.new_int(p.Int.new_i32(6))),e.set_header(p.Label.new_int(p.Int.new_negative(p.BigNum.from_str("2"))),p.CBORValue.new_bytes(s.key.to_public().as_bytes())),e},As=(s,e)=>{const t=p.HeaderMap.new(),r=p.HeaderMap.new();t.set_algorithm_id(p.Label.from_algorithm_id(p.AlgorithmId.EdDSA)),t.set_header(p.Label.new_text("address"),p.CBORValue.new_bytes(e.address.to_bytes()));const a=p.Headers.new(p.ProtectedHeaderMap.new(t),r),i=p.COSESign1Builder.new(a,m(s.payload),!1);s.externalAAD!==void 0&&i.set_external_aad(m(s.externalAAD));const o=i.make_data_to_sign(),c=e.key.sign(o.to_bytes());return i.build(c.to_bytes())};var Wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Be={},b={exports:{}};G.notEqual=ds;G.notOk=ls;G.equal=gs;G.ok=G;var Ee=G;function gs(s,e,t){G(s==e,t)}function ds(s,e,t){G(s!=e,t)}function ls(s,e){G(!s,e)}function G(s,e){if(!s)throw new Error(e||"AssertionError")}var M={exports:{}};function hs(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Is=Ft;Ft.supported=typeof WebAssembly<"u";function Ft(s){if(!Ft.supported)return null;var e=s&&s.imports,t=ms("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFq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IB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),r=null,a={buffer:t,memory:null,exports:null,realloc:i,onload:o};return o(function(){}),a;function i(u){a.exports.memory.grow(Math.ceil(Math.abs(u-a.memory.length)/65536)),a.memory=new Uint8Array(a.exports.memory.buffer)}function o(u){if(a.exports)return u();if(r){r.then(u.bind(null,null)).catch(u);return}try{if(s&&s.async)throw new Error("async");c({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{r=WebAssembly.instantiate(t,e).then(c)}o(u)}function c(u){a.exports=u.instance.exports,a.memory=a.exports.memory&&a.exports.memory.buffer&&new Uint8Array(a.exports.memory.buffer)}}function ms(s){return typeof atob=="function"?new Uint8Array(atob(s).split("").map(fs)):new(hs("buffer")).Buffer(s,"base64")}function fs(s){return s.charCodeAt(0)}var N=Ee,_=Is(),V=64,_t=[];M.exports=D;var Jt=M.exports.BYTES_MIN=16,jt=M.exports.BYTES_MAX=64;M.exports.BYTES=32;var Xt=M.exports.KEYBYTES_MIN=16,Zt=M.exports.KEYBYTES_MAX=64;M.exports.KEYBYTES=32;var te=M.exports.SALTBYTES=16,ee=M.exports.PERSONALBYTES=16;function D(s,e,t,r,a){if(!(this instanceof D))return new D(s,e,t,r,a);if(!(_&&_.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");s||(s=32),a!==!0&&(N(s>=Jt,"digestLength must be at least "+Jt+", was given "+s),N(s<=jt,"digestLength must be at most "+jt+", was given "+s),e!=null&&N(e.length>=Xt,"key must be at least "+Xt+", was given "+e.length),e!=null&&N(e.length<=Zt,"key must be at least "+Zt+", was given "+e.length),t!=null&&N(t.length===te,"salt must be exactly "+te+", was given "+t.length),r!=null&&N(r.length===ee,"personal must be exactly "+ee+", was given "+r.length)),_t.length||(_t.push(V),V+=216),this.digestLength=s,this.finalized=!1,this.pointer=_t.pop(),_.memory.fill(0,0,64),_.memory[0]=this.digestLength,_.memory[1]=e?e.length:0,_.memory[2]=1,_.memory[3]=1,t&&_.memory.set(t,32),r&&_.memory.set(r,48),this.pointer+216>_.memory.length&&_.realloc(this.pointer+216),_.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),_.memory.fill(0,V,V+e.length),_.memory[this.pointer+200]=128)}D.prototype.update=function(s){return N(this.finalized===!1,"Hash instance finalized"),N(s,"input must be TypedArray or Buffer"),V+s.length>_.memory.length&&_.realloc(V+s.length),_.memory.set(s,V),_.exports.blake2b_update(this.pointer,V,V+s.length),this};D.prototype.digest=function(s){if(N(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,_t.push(this.pointer),_.exports.blake2b_final(this.pointer),!s||s==="binary")return _.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(s==="hex")return _s(_.memory,this.pointer+128,this.digestLength);N(s.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e<this.digestLength;e++)s[e]=_.memory[this.pointer+128+e];return s};D.prototype.final=D.prototype.digest;D.WASM=_&&_.buffer;D.SUPPORTED=typeof WebAssembly<"u";D.ready=function(s){if(s||(s=ps),!_)return s(new Error("WebAssembly not supported"));var e=new Promise(function(t,r){_.onload(function(a){a?r():t(),s(a)})});return e};D.prototype.ready=D.ready;function ps(){}function _s(s,e,t){for(var r="",a=0;a<t;a++)r+=ys(s[e+a]);return r}function ys(s){return s<16?"0"+s.toString(16):s.toString(16)}var W=Ee,dt=M.exports;function It(s,e,t){var r=s[e]+s[t],a=s[e+1]+s[t+1];r>=4294967296&&a++,s[e]=r,s[e+1]=a}function se(s,e,t,r){var a=s[e]+t;t<0&&(a+=4294967296);var i=s[e+1]+r;a>=4294967296&&i++,s[e]=a,s[e+1]=i}function xe(s,e){return s[e]^s[e+1]<<8^s[e+2]<<16^s[e+3]<<24}function $(s,e,t,r,a,i){var o=ut[a],c=ut[a+1],u=ut[i],A=ut[i+1];It(h,s,e),se(h,s,o,c);var d=h[r]^h[s],g=h[r+1]^h[s+1];h[r]=g,h[r+1]=d,It(h,t,r),d=h[e]^h[t],g=h[e+1]^h[t+1],h[e]=d>>>24^g<<8,h[e+1]=g>>>24^d<<8,It(h,s,e),se(h,s,u,A),d=h[r]^h[s],g=h[r+1]^h[s+1],h[r]=d>>>16^g<<16,h[r+1]=g>>>16^d<<16,It(h,t,r),d=h[e]^h[t],g=h[e+1]^h[t+1],h[e]=g>>>31^d<<1,h[e+1]=d>>>31^g<<1}var Se=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Cs=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],E=new Uint8Array(Cs.map(function(s){return s*2})),h=new Uint32Array(32),ut=new Uint32Array(32);function Qe(s,e){var t=0;for(t=0;t<16;t++)h[t]=s.h[t],h[t+16]=Se[t];for(h[24]=h[24]^s.t,h[25]=h[25]^s.t/4294967296,e&&(h[28]=~h[28],h[29]=~h[29]),t=0;t<32;t++)ut[t]=xe(s.b,4*t);for(t=0;t<12;t++)$(0,8,16,24,E[t*16+0],E[t*16+1]),$(2,10,18,26,E[t*16+2],E[t*16+3]),$(4,12,20,28,E[t*16+4],E[t*16+5]),$(6,14,22,30,E[t*16+6],E[t*16+7]),$(0,10,20,30,E[t*16+8],E[t*16+9]),$(2,12,22,24,E[t*16+10],E[t*16+11]),$(4,14,16,26,E[t*16+12],E[t*16+13]),$(6,8,18,28,E[t*16+14],E[t*16+15]);for(t=0;t<16;t++)s.h[t]=s.h[t]^h[t]^h[t+16]}var z=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function nt(s,e,t,r){z.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=s,z[0]=s,e&&(z[1]=e.length),z[2]=1,z[3]=1,t&&z.set(t,32),r&&z.set(r,48);for(var a=0;a<16;a++)this.h[a]=Se[a]^xe(z,a*4);e&&(be(this,e),this.c=128)}nt.prototype.update=function(s){return W(s!=null,"input must be Uint8Array or Buffer"),be(this,s),this};nt.prototype.digest=function(s){var e=!s||s==="binary"||s==="hex"?new Uint8Array(this.outlen):s;return W(e.length>=this.outlen,"out must have at least outlen bytes of space"),ws(this,e),s==="hex"?Bs(e):e};nt.prototype.final=nt.prototype.digest;nt.ready=function(s){dt.ready(function(){s()})};function be(s,e){for(var t=0;t<e.length;t++)s.c===128&&(s.t+=s.c,Qe(s,!1),s.c=0),s.b[s.c++]=e[t]}function ws(s,e){for(s.t+=s.c;s.c<128;)s.b[s.c++]=0;Qe(s,!0);for(var t=0;t<s.outlen;t++)e[t]=s.h[t>>2]>>8*(t&3);return e}function Bs(s){for(var e="",t=0;t<s.length;t++)e+=Es(s[t]);return e}function Es(s){return s<16?"0"+s.toString(16):s.toString(16)}var ve=nt;b.exports=function(e,t,r,a,i){return i!==!0&&(W(e>=re,"outlen must be at least "+re+", was given "+e),W(e<=ae,"outlen must be at most "+ae+", was given "+e),t!=null&&W(t.length>=ne,"key must be at least "+ne+", was given "+t.length),t!=null&&W(t.length<=ie,"key must be at most "+ie+", was given "+t.length),r!=null&&W(r.length===oe,"salt must be exactly "+oe+", was given "+r.length),a!=null&&W(a.length===ce,"personal must be exactly "+ce+", was given "+a.length)),new ve(e,t,r,a)};b.exports.ready=function(s){dt.ready(function(){s()})};b.exports.WASM_SUPPORTED=dt.SUPPORTED;b.exports.WASM_LOADED=!1;var re=b.exports.BYTES_MIN=16,ae=b.exports.BYTES_MAX=64;b.exports.BYTES=32;var ne=b.exports.KEYBYTES_MIN=16,ie=b.exports.KEYBYTES_MAX=64;b.exports.KEYBYTES=32;var oe=b.exports.SALTBYTES=16,ce=b.exports.PERSONALBYTES=16;dt.ready(function(s){s||(b.exports.WASM_LOADED=!0,ve=dt)});var it={};Object.defineProperty(it,"__esModule",{value:!0});it.bech32m=it.bech32=void 0;const Et="qpzry9x8gf2tvdw0s3jn54khce6mua7l",De={};for(let s=0;s<Et.length;s++){const e=Et.charAt(s);De[e]=s}function at(s){const e=s>>25;return(s&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function ue(s){let e=1;for(let t=0;t<s.length;++t){const r=s.charCodeAt(t);if(r<33||r>126)return"Invalid prefix ("+s+")";e=at(e)^r>>5}e=at(e);for(let t=0;t<s.length;++t){const r=s.charCodeAt(t);e=at(e)^r&31}return e}function Mt(s,e,t,r){let a=0,i=0;const o=(1<<t)-1,c=[];for(let u=0;u<s.length;++u)for(a=a<<e|s[u],i+=e;i>=t;)i-=t,c.push(a>>i&o);if(r)i>0&&c.push(a<<t-i&o);else{if(i>=e)return"Excess padding";if(a<<t-i&o)return"Non-zero padding"}return c}function xs(s){return Mt(s,8,5,!0)}function Ss(s){const e=Mt(s,5,8,!1);if(Array.isArray(e))return e}function Qs(s){const e=Mt(s,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function ke(s){let e;s==="bech32"?e=1:e=734539939;function t(o,c,u){if(u=u||90,o.length+7+c.length>u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let A=ue(o);if(typeof A=="string")throw new Error(A);let d=o+"1";for(let g=0;g<c.length;++g){const I=c[g];if(I>>5!==0)throw new Error("Non 5-bit word");A=at(A)^I,d+=Et.charAt(I)}for(let g=0;g<6;++g)A=at(A);A^=e;for(let g=0;g<6;++g){const I=A>>(5-g)*5&31;d+=Et.charAt(I)}return d}function r(o,c){if(c=c||90,o.length<8)return o+" too short";if(o.length>c)return"Exceeds length limit";const u=o.toLowerCase(),A=o.toUpperCase();if(o!==u&&o!==A)return"Mixed-case string "+o;o=u;const d=o.lastIndexOf("1");if(d===-1)return"No separator character for "+o;if(d===0)return"Missing prefix for "+o;const g=o.slice(0,d),I=o.slice(d+1);if(I.length<6)return"Data too short";let y=ue(g);if(typeof y=="string")return y;const S=[];for(let H=0;H<I.length;++H){const R=I.charAt(H),f=De[R];if(f===void 0)return"Unknown character "+R;y=at(y)^f,!(H+6>=I.length)&&S.push(f)}return y!==e?"Invalid checksum for "+o:{prefix:g,words:S}}function a(o,c){const u=r(o,c);if(typeof u=="object")return u}function i(o,c){const u=r(o,c);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:a,decode:i,encode:t,toWords:xs,fromWordsUnsafe:Ss,fromWords:Qs}}it.bech32=ke("bech32");it.bech32m=ke("bech32m");var bs=Wt&&Wt.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Be,"__esModule",{value:!0});const vs=bs(b.exports),mt=it,Ut="asset";class At{constructor(e){this.hashBuf=e}static fromHash(e){return new At(e)}static fromParts(e,t){const r=(0,vs.default)(20).update(new Uint8Array([...e,...t])).digest("binary");return At.fromHash(r)}static fromBech32(e){const{prefix:t,words:r}=mt.bech32.decode(e);if(t!==Ut)throw new Error("Invalid asset fingerprint");const a=Buffer.from(mt.bech32.fromWords(r));return At.fromHash(a)}fingerprint(){const e=mt.bech32.toWords(this.hashBuf);return mt.bech32.encode(Ut,e)}hash(){return Buffer.from(this.hashBuf).toString("hex")}prefix(){return Ut}checksum(){return this.fingerprint().slice(-6)}}var Ds=Be.default=At;const ks=Ds,Us=(s,e)=>{const t=Ks(s),r=t.derive(kt+1852).derive(kt+1815).derive(kt+e),a=r.derive(0).derive(0).to_raw_key(),i=r.derive(2).derive(0).to_raw_key();return r.free(),t.free(),{paymentKey:a,stakeKey:i}},st=s=>n.Address.from_bytes(m(s)),Ks=s=>n.Bip32PrivateKey.from_bytes(m(s)),Ns=s=>n.DataHash.from_bytes(m(s)),P=s=>n.Ed25519KeyHash.from_bytes(m(s)),Ps=s=>n.Ed25519Signature.from_bytes(m(s)),Qt=s=>n.NativeScript.from_bytes(m(s)),Ts=s=>n.PublicKey.from_bytes(m(s)),Ue=s=>n.PlutusData.from_bytes(m(s)),ot=(s,e)=>n.PlutusScript.from_bytes_with_version(m(s),wt[e]),Fs=s=>n.ScriptRef.from_bytes(m(s)),Ms=s=>n.ScriptHash.from_bytes(m(s)),L=s=>n.Transaction.from_bytes(m(s)),Ke=s=>n.TransactionHash.from_bytes(m(s)),Ae=s=>n.TransactionUnspentOutput.from_bytes(m(s)),Hs=s=>n.TransactionWitnessSet.from_bytes(m(s)),Os=s=>n.Value.from_bytes(m(s)),F=s=>n.Address.from_bech32(s),Ht=s=>n.BaseAddress.from_address(F(s)),Ne=s=>n.EnterpriseAddress.from_address(F(s)),Pe=s=>n.RewardAddress.from_address(F(s)),v=s=>Buffer.from(s).toString("hex"),m=s=>s.length%2===0&&/^[0-9A-F]*$/i.test(s)?Buffer.from(s,"hex"):Buffer.from(s,"utf-8"),bt=s=>{const e=t=>{const r=new Array;for(let a=0;a<t.len();a+=1)r.push(bt(t.get(a)));return r};switch(s.kind()){case n.NativeScriptKind.ScriptAll:{const t=s.as_script_all();return{type:"all",scripts:e(t.native_scripts())}}case n.NativeScriptKind.ScriptAny:{const t=s.as_script_any();return{type:"any",scripts:e(t.native_scripts())}}case n.NativeScriptKind.ScriptNOfK:{const t=s.as_script_n_of_k();return{type:"atLeast",required:t.n(),scripts:e(t.native_scripts())}}case n.NativeScriptKind.TimelockStart:{const t=s.as_timelock_start();return{type:"after",slot:t.slot_bignum().to_str()}}case n.NativeScriptKind.TimelockExpiry:{const t=s.as_timelock_expiry();return{type:"before",slot:t.slot_bignum().to_str()}}case n.NativeScriptKind.ScriptPubkey:{const t=s.as_script_pubkey();return{type:"sig",keyHash:t.addr_keyhash().to_hex()}}default:throw new Error(`Script Kind: ${s.kind()}, is not supported`)}},vt=s=>{const e=t=>{const r=n.NativeScripts.new();return t.forEach(a=>{r.add(vt(a))}),r};switch(s.type){case"all":return n.NativeScript.new_script_all(n.ScriptAll.new(e(s.scripts)));case"any":return n.NativeScript.new_script_any(n.ScriptAny.new(e(s.scripts)));case"atLeast":return n.NativeScript.new_script_n_of_k(n.ScriptNOfK.new(s.required,e(s.scripts)));case"after":return n.NativeScript.new_timelock_start(n.TimelockStart.new_timelockstart(n.BigNum.from_str(s.slot)));case"before":return n.NativeScript.new_timelock_expiry(n.TimelockExpiry.new_timelockexpiry(n.BigNum.from_str(s.slot)));case"sig":return n.NativeScript.new_script_pubkey(n.ScriptPubkey.new(P(s.keyHash)))}},yt=s=>{var r,a,i;const e=o=>{const c=[];for(let u=0;u<o.len();u+=1)c.push(yt(o.get(u)));return c},t=o=>{const c=new Map;for(let u=0;u<o.len();u+=1){const A=o.keys().get(u),d=o.get(A)??n.PlutusData.from_hex(Q("NO_ITEM_FOUND_INSIDE_GOLD_ROOM"));c.set(yt(A),yt(d))}return c};switch(s.kind()){case n.PlutusDataKind.Bytes:return v(s.as_bytes()??new Uint8Array);case n.PlutusDataKind.Integer:return parseInt(((r=s.as_integer())==null?void 0:r.to_str())??"0",10);case n.PlutusDataKind.List:return e(s.as_list()??n.PlutusList.new());case n.PlutusDataKind.Map:return t(s.as_map()??n.PlutusMap.new());case n.PlutusDataKind.ConstrPlutusData:return{alternative:parseInt(((a=s.as_constr_plutus_data())==null?void 0:a.alternative().to_str())??"0",10),fields:e(((i=s.as_constr_plutus_data())==null?void 0:i.data())??n.PlutusList.new())};default:throw new Error(`PlutusData Kind: ${s.kind()}, is not supported`)}},Z=s=>{const e=t=>{const r=n.PlutusList.new();return t.forEach(a=>{r.add(Z(a))}),r};switch(typeof s){case"string":return n.PlutusData.new_bytes(m(s));case"number":return n.PlutusData.new_integer(n.BigInt.from_str(s.toString()));case"object":if(s instanceof Array){const t=e(s);return n.PlutusData.new_list(t)}else if(s instanceof Map){const t=n.PlutusMap.new();return s.forEach((r,a)=>{t.insert(Z(a),Z(r))}),n.PlutusData.new_map(t)}else return n.PlutusData.new_constr_plutus_data(n.ConstrPlutusData.new(n.BigNum.from_str(s.alternative.toString()),e(s.fields)))}},Vs=s=>{const e=n.Relays.new();throw s.relays.forEach(t=>{e.add(Ys(t))}),new Error("toPoolParams not implemented.")},Te=s=>{const e=t=>Je[t];return n.Redeemer.new(e(s.tag),n.BigNum.from_str(s.index.toString()),Z(s.data),n.ExUnits.new(n.BigNum.from_str(s.budget.mem.toString()),n.BigNum.from_str(s.budget.steps.toString())))},Ys=s=>{switch(s.type){case"SingleHostAddr":{const e=s.IPV4?n.Ipv4.new(new Uint8Array(s.IPV4.split(".").map(r=>parseInt(r)))):void 0,t=s.IPV6?n.Ipv6.new(m(s.IPV6.replaceAll(":",""))):void 0;return n.Relay.new_single_host_addr(n.SingleHostAddr.new(s.port,e,t))}case"SingleHostName":return n.Relay.new_single_host_name(n.SingleHostName.new(s.port,n.DNSRecordAorAAAA.new(s.domainName)));case"MultiHostName":return n.Relay.new_multi_host_name(n.MultiHostName.new(n.DNSRecordSRV.new(s.domainName)))}},Fe=s=>{if(s.is_plutus_script()){const t=s.plutus_script();return{code:t.to_hex(),version:Object.keys(wt).find(r=>wt[r].to_hex()===t.language_version().to_hex())}}const e=s.native_script();return bt(e)},lt=s=>{if("code"in s){const e=ot(s.code,s.version);return n.ScriptRef.new_plutus_script(e)}return n.ScriptRef.new_native_script(vt(s))},xt=s=>{var a,i,o;const e=s.output().has_data_hash()?(a=s.output().data_hash())==null?void 0:a.to_hex():void 0,t=s.output().has_plutus_data()?(i=s.output().plutus_data())==null?void 0:i.to_hex():void 0,r=s.output().has_script_ref()?(o=s.output().script_ref())==null?void 0:o.to_hex():void 0;return{input:{outputIndex:s.input().index(),txHash:s.input().transaction_id().to_hex()},output:{address:s.output().address().to_bech32(),amount:Me(s.output().amount()),dataHash:e,plutusData:t,scriptRef:r}}},Y=s=>{const e=n.TransactionInput.new(Ke(s.input.txHash),s.input.outputIndex),t=n.TransactionOutput.new(F(s.output.address),Ct(s.output.amount));return s.output.dataHash!==void 0&&t.set_data_hash(Ns(s.output.dataHash)),s.output.plutusData!==void 0&&t.set_plutus_data(Ue(s.output.plutusData)),s.output.scriptRef!==void 0&&t.set_script_ref(Fs(s.output.scriptRef)),n.TransactionUnspentOutput.new(e,t)},ge=s=>{const e=s.split(".")[1]??"0",t=`${parseInt(e,10)}`,r="1"+"0".repeat(e.length);return n.UnitInterval.new(n.BigNum.from_str(t),n.BigNum.from_str(r))},Q=s=>s.length%2===0&&/^[0-9A-F]*$/i.test(s)?s:v(Buffer.from(s,"utf-8")),Ot=s=>Buffer.from(s,"hex").toString("utf-8"),Me=s=>{const e=[{unit:"lovelace",quantity:s.coin().to_str()}],t=s.multiasset();if(t!==void 0){const r=t.keys();for(let a=0;a<r.len();a+=1){const i=r.get(a),o=t.get(i);if(o!==void 0){const c=o.keys();for(let u=0;u<c.len();u+=1){const A=c.get(u),d=o.get(A)??n.BigNum.from_str("0"),g=i.to_hex()+v(A.name());e.push({unit:g,quantity:d.to_str()})}}}}return e},Ct=s=>{const e=s.find(i=>i.unit==="lovelace"),t=Array.from(new Set(s.filter(i=>i.unit!=="lovelace").map(i=>i.unit.slice(0,T)))),r=n.MultiAsset.new();t.forEach(i=>{const o=n.Assets.new();s.filter(c=>c.unit.slice(0,T)===i).forEach(c=>{o.insert(n.AssetName.new(m(c.unit.slice(T))),n.BigNum.from_str(c.quantity))}),r.insert(Ms(i),o)});const a=n.Value.new(n.BigNum.from_str(e?e.quantity:"0"));return(s.length>1||!e)&&a.set_multiasset(r),a},de=(s,e,t)=>n.BaseAddress.new(s,n.StakeCredential.from_keyhash(e),n.StakeCredential.from_keyhash(t)),He=(s,e="")=>n.Bip32PrivateKey.from_bip39_entropy(m(s),m(Q(e))),le=s=>n.DataCost.new_coins_per_byte(n.BigNum.from_str(s)),Ls=s=>{if(typeof s!="object"||!("input"in s))return n.DatumSource.new(Z(s));const e=Y(s);if(e.output().has_plutus_data())return n.DatumSource.new_ref_input(e.input());throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`)},he=(s,e)=>n.EnterpriseAddress.new(s,n.StakeCredential.from_keyhash(e)),Ie=(s,e)=>{if(typeof s=="string")return n.MintWitness.new_native_script(Qt(s));if(e===void 0)throw new Error("Minting with plutus requires a redeemer to be defined");if(e.tag!=="MINT")throw new Error("Minting redeemer's tag must be defined as 'MINT'");return n.MintWitness.new_plutus_script(Oe(s),Te({tag:"MINT",index:0,budget:_e,data:{alternative:0,fields:[]},...e}))},Nt=(s,e)=>n.RewardAddress.new(s,n.StakeCredential.from_keyhash(e)),Oe=s=>{if("code"in s)return n.PlutusScriptSource.new(ot(s.code,s.version));const e=Y(s);if(e.output().has_script_ref()){const t=e.output().script_ref();if(t.is_plutus_script()){const r=Fe(t),a=ot(r.code,r.version).hash();return n.PlutusScriptSource.new_ref_input_with_lang_ver(a,e.input(),wt[r.version])}}throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`)},ft=s=>{const e=n.ScriptPubkey.new(s);return n.NativeScript.new_script_pubkey(e)},qs=(s=q)=>{const e=n.TransactionBuilderConfigBuilder.new().coins_per_utxo_byte(n.BigNum.from_str(s.coinsPerUTxOSize)).ex_unit_prices(n.ExUnitPrices.new(ge(s.priceMem.toString()),ge(s.priceStep.toString()))).fee_algo(n.LinearFee.new(n.BigNum.from_str(s.minFeeA.toString()),n.BigNum.from_str(s.minFeeB.toString()))).key_deposit(n.BigNum.from_str(s.keyDeposit)).max_tx_size(s.maxTxSize).max_value_size(parseInt(s.maxValSize,10)).pool_deposit(n.BigNum.from_str(s.poolDeposit)).build();return n.TransactionBuilder.new(e)},me=s=>{const e=n.TxInputsBuilder.new();return s.map(t=>t instanceof n.TransactionUnspentOutput?t:Y(t)).forEach(t=>{e.add_input(t.output().address(),t.input(),t.output().amount())}),e},pt=s=>{if(typeof s=="string")return n.TransactionOutputBuilder.new().with_address(F(s));let e=n.TransactionOutputBuilder.new().with_address(F(s.address));if(s.datum){const{value:t,inline:r}=s.datum,a=Z(t);e=e.with_data_hash(n.hash_plutus_data(a)),r&&(e=e.with_plutus_data(a))}if(s.script){const t=lt(s.script);e=e.with_script_ref(t)}return e},tt=s=>{const e=s.slice(0,T),t=s.includes(".")?Q(s.split(".")[1]):s.slice(T);return{policyId:e,assetName:t}},l=s=>J.default.isAxiosError(s)?s.response?JSON.stringify({data:s.response.data,headers:s.response.headers,status:s.response.status}):s.request?JSON.stringify(s.request):s.message:JSON.stringify(s),Gs=s=>{const e=Z(s);return n.hash_plutus_data(e).to_hex()},Rs=(s,e=Date.now())=>{if(Bt[s]){const[t,r,a,i]=Bt[s];return parseInt(n.BigNum.from_str(e.toString()).div_floor(n.BigNum.from_str("1000")).checked_sub(n.BigNum.from_str(a)).div_floor(n.BigNum.from_str(i)).checked_add(n.BigNum.from_str(t)).to_str(),10)}throw new Error(`Couldn't resolve EpochNo for network: ${s}`)},Ve=(s,e)=>ks.fromParts(m(s),m(e)).fingerprint(),$s=(s,e)=>je[s][e],zs=s=>vt(s).hash().to_hex(),X=s=>{var e,t;try{const r=[(e=Ht(s))==null?void 0:e.payment_cred().to_keyhash(),(t=Ne(s))==null?void 0:t.payment_cred().to_keyhash()].find(a=>a!==void 0);if(r!==void 0)return r.to_hex();throw new Error(`Couldn't resolve payment key hash from address: ${s}`)}catch(r){throw new Error(`An error occurred during resolvePaymentKeyHash: ${r}.`)}},Ws=(s,e=0)=>{const t=ot(s.code,s.version);return n.EnterpriseAddress.new(e,n.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32()},Js=s=>{try{const e=Ne(s),t=e==null?void 0:e.payment_cred().to_scripthash();if(t!==void 0)return t.to_hex();throw new Error(`Couldn't resolve script hash from address: ${s}`)}catch(e){throw new Error(`An error occurred during resolveScriptHash: ${e}.`)}},js=s=>n.Ed25519KeyHash.from_hex(s).to_bech32("pool1"),Xs=s=>{const e=Kt.mnemonicToEntropy(s.join(" ")),t=He(e),r=t.to_bech32();return t.free(),r},Zs=s=>lt(s).to_hex(),tr=(s,e=Date.now())=>{if(Bt[s]){const[t,r,a]=Bt[s];return n.BigNum.from_str(e.toString()).div_floor(n.BigNum.from_str("1000")).checked_sub(n.BigNum.from_str(a)).checked_add(n.BigNum.from_str(r)).to_str()}throw new Error(`Couldn't resolve SlotNo for network: ${s}`)},Dt=s=>{try{const e=F(s),t=Ht(s),r=t==null?void 0:t.stake_cred().to_keyhash();if(r!==void 0)return Nt(e.network_id(),r).to_address().to_bech32();throw new Error(`Couldn't resolve reward address from address: ${s}`)}catch(e){throw new Error(`An error occurred during resolveRewardAddress: ${e}.`)}},rt=s=>{var e,t;try{const r=[(e=Ht(s))==null?void 0:e.stake_cred().to_keyhash(),(t=Pe(s))==null?void 0:t.payment_cred().to_keyhash()].find(a=>a!==void 0);if(r!==void 0)return r.to_hex();throw new Error(`Couldn't resolve stake key hash from address: ${s}`)}catch(r){throw new Error(`An error occurred during resolveStakeKeyHash: ${r}.`)}},Vt=(s,e=q.minFeeA,t=q.minFeeB)=>(BigInt(e)*BigInt(s)+BigInt(t)).toString(),Ye=s=>{const e=L(s).body();return n.hash_transaction(e).to_hex()},er=(s="",e=32)=>{if(e<=0||e>2048)throw new Error("Length must be bewteen 1 and 2048");const r=fe.customAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);return Q(`${s}${r}`)},Le=(s,e)=>{const t=s.vkeys();if(t!==void 0){const r=new Set;for(let i=0;i<t.len();i+=1)r.add(t.get(i).to_hex());for(let i=0;i<e.len();i+=1)r.add(e.get(i).to_hex());const a=n.Vkeywitnesses.new();return r.forEach(i=>{a.add(n.Vkeywitness.from_hex(i))}),a}return e},sr=s=>yt(Ue(s)),rr=s=>L(s).to_js_value();class ar{_axiosInstance;constructor(...e){if(typeof e[0]=="string"&&e[0].startsWith("http"))this._axiosInstance=J.default.create({baseURL:e[0]});else{const t=e[0],r=t.slice(0,7);this._axiosInstance=J.default.create({baseURL:`https://cardano-${r}.blockfrost.io/api/v${e[1]??0}`,headers:{project_id:t}})}}async fetchAccountInfo(e){const t=e.startsWith("addr")?Dt(e):e;try{const{data:r,status:a}=await this._axiosInstance.get(`accounts/${t}`);if(a===200)return{poolId:r.pool_id,active:r.active||r.active_epoch!==null,balance:r.controlled_amount,rewards:r.withdrawable_amount,withdrawals:r.withdrawals_sum};throw l(r)}catch(r){throw l(r)}}async fetchAddressUTxOs(e,t){const r=t!==void 0?`/${t}`:"",a=`addresses/${e}/utxos`+r,i=async(u=1,A=[])=>{const{data:d,status:g}=await this._axiosInstance.get(`${a}?page=${u}`);if(g===200)return d.length>0?i(u+1,[...A,...await Promise.all(d.map(c))]):A;throw l(d)},o=async u=>{if(u){const{data:A,status:d}=await this._axiosInstance.get(`scripts/${u}`);if(d===200){const g=A.type.startsWith("plutus")?{code:await this.fetchPlutusScriptCBOR(u),version:A.type.replace("plutus","")}:await this.fetchNativeScriptJSON(u);return lt(g).to_hex()}throw l(A)}},c=async u=>({input:{outputIndex:u.output_index,txHash:u.tx_hash},output:{address:e,amount:u.amount,dataHash:u.data_hash??void 0,plutusData:u.inline_datum??void 0,scriptRef:await o(u.reference_script_hash)}});try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const t=async(r=1,a=[])=>{const{policyId:i,assetName:o}=tt(e),{data:c,status:u}=await this._axiosInstance.get(`assets/${i}${o}/addresses?page=${r}`);if(u===200)return c.length>0?t(r+1,[...a,...c]):a;throw l(c)};try{return await t()}catch{return[]}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=tt(e),{data:a,status:i}=await this._axiosInstance.get(`assets/${t}${r}`);if(i===200)return{...a.onchain_metadata};throw l(a)}catch(t){throw l(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`blocks/${e}`);if(r===200)return{confirmations:t.confirmations,epoch:t.epoch,epochSlot:t.epoch_slot.toString(),fees:t.fees,hash:t.hash,nextBlock:t.next_block??"",operationalCertificate:t.op_cert,output:t.output??"0",previousBlock:t.previous_block,size:t.size,slot:t.slot.toString(),slotLeader:t.slot_leader??"",time:t.time,txCount:t.tx_count,VRFKey:t.block_vrf};throw l(t)}catch(t){throw l(t)}}async fetchCollectionAssets(e,t=1){try{const{data:r,status:a}=await this._axiosInstance.get(`assets/policy/${e}?page=${t}`);if(a===200)return{assets:r.map(i=>({unit:i.asset,quantity:i.quantity})),next:r.length===100?t+1:null};throw l(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=Q(e.replace("$","")),{data:r,status:a}=await this._axiosInstance.get(`assets/${Pt[1]}${t}/addresses`);if(a===200)return r[0].address;throw l(r)}catch(t){throw l(t)}}async fetchProtocolParameters(e=Number.NaN){try{const{data:t,status:r}=await this._axiosInstance.get(`epochs/${isNaN(e)?"latest":e}/parameters`);if(r===200)return{coinsPerUTxOSize:t.coins_per_utxo_word,collateralPercent:t.collateral_percent,decentralisation:t.decentralisation_param,epoch:t.epoch,keyDeposit:t.key_deposit,maxBlockExMem:t.max_block_ex_mem,maxBlockExSteps:t.max_block_ex_steps,maxBlockHeaderSize:t.max_block_header_size,maxBlockSize:t.max_block_size,maxCollateralInputs:t.max_collateral_inputs,maxTxExMem:t.max_tx_ex_mem,maxTxExSteps:t.max_tx_ex_steps,maxTxSize:t.max_tx_size,maxValSize:t.max_val_size,minFeeA:t.min_fee_a,minFeeB:t.min_fee_b,minPoolCost:t.min_pool_cost,poolDeposit:t.pool_deposit,priceMem:t.price_mem,priceStep:t.price_step};throw l(t)}catch(t){throw l(t)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`txs/${e}`);if(r===200)return{block:t.block,deposit:t.deposit,fees:t.fees,hash:t.hash,index:t.index,invalidAfter:t.invalid_hereafter??"",invalidBefore:t.invalid_before??"",slot:t.slot.toString(),size:t.size};throw l(t)}catch(t){throw l(t)}}onTxConfirmed(e,t,r=100){let a=0;const i=setInterval(()=>{a>=r&&clearInterval(i),this.fetchTxInfo(e).then(o=>{this.fetchBlockInfo(o.block).then(c=>{(c==null?void 0:c.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{a+=1})}).catch(()=>{a+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:a}=await this._axiosInstance.post("tx/submit",m(e),{headers:t});if(a===200)return r;throw l(r)}catch(t){throw l(t)}}async fetchPlutusScriptCBOR(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/cbor`);if(r===200)return t.cbor;throw l(t)}async fetchNativeScriptJSON(e){const{data:t,status:r}=await this._axiosInstance.get(`scripts/${e}/json`);if(r===200)return t.json;throw l(t)}}class nr{_axiosInstance;constructor(e,t,r){const a=r.host??"ipfs.infura.io",i=r.port??5001,o=r.version??0;this._axiosInstance=J.default.create({baseURL:`https://${a}:${i}/api/v${o}`,auth:{username:e,password:t}})}async uploadContent(e,t=!1){try{const r={"Content-Type":"multipart/form-data"},{data:a,status:i}=await this._axiosInstance.post(`add?recursive=${t}`,e,{headers:r});if(i===200)return a;throw l(a)}catch(r){throw l(r)}}}class ir{_axiosInstance;constructor(...e){typeof e[0]=="string"&&e[0].startsWith("http")?this._axiosInstance=J.default.create({baseURL:e[0]}):this._axiosInstance=J.default.create({baseURL:`https://${e[0]}.koios.rest/api/v${e[1]??0}`})}async fetchAccountInfo(e){try{const t=e.startsWith("addr")?Dt(e):e,{data:r,status:a}=await this._axiosInstance.post("account_info",{_stake_addresses:[t]});if(a===200)return{poolId:r[0].delegated_pool,active:r[0].status==="registered",balance:r[0].total_balance.toString(),rewards:r[0].rewards_available,withdrawals:r[0].withdrawals};throw l(r)}catch(t){throw l(t)}}async fetchAddressUTxOs(e,t){const r=a=>{if(a){const i=a.type.startsWith("plutus")?{code:a.bytes,version:a.type.replace("plutus","")}:bt(Qt(a.bytes));return lt(i).to_hex()}};try{const{data:a,status:i}=await this._axiosInstance.post("address_info",{_addresses:[e]});if(i===200){const o=a.flatMap(c=>c.utxo_set).map(c=>{var u;return{input:{outputIndex:c.tx_index,txHash:c.tx_hash},output:{address:e,amount:[{unit:"lovelace",quantity:c.value},...c.asset_list.map(A=>({unit:`${A.policy_id}${A.asset_name}`,quantity:`${A.quantity}`}))],dataHash:c.datum_hash??void 0,plutusData:((u=c.inline_datum)==null?void 0:u.bytes)??void 0,scriptRef:r(c.reference_script)}}});return t!==void 0?o.filter(c=>c.output.amount.find(u=>u.unit===t)!==void 0):o}throw l(a)}catch{return[]}}async fetchAssetAddresses(e){try{const{policyId:t,assetName:r}=tt(e),{data:a,status:i}=await this._axiosInstance.get(`asset_address_list?_asset_policy=${t}&_asset_name=${r}`);if(i===200)return a.map(o=>({address:o.payment_address,quantity:o.quantity}));throw l(a)}catch(t){throw l(t)}}async fetchAssetMetadata(e){try{const{policyId:t,assetName:r}=tt(e),{data:a,status:i}=await this._axiosInstance.get(`asset_info?_asset_policy=${t}&_asset_name=${r}`);if(i===200)return{...a[0].minting_tx_metadata[721][t][Ot(r)]};throw l(a)}catch(t){throw l(t)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.post("block_info",{_block_hashes:[e]});if(r===200)return{confirmations:t[0].num_confirmations,epoch:t[0].epoch_no,epochSlot:t[0].epoch_slot.toString(),fees:t[0].total_fees??"",hash:t[0].hash,nextBlock:t[0].child_hash??"",operationalCertificate:t[0].op_cert,output:t[0].total_output??"0",previousBlock:t[0].parent_hash,size:t[0].block_size,slot:t[0].abs_slot.toString(),slotLeader:t[0].pool??"",time:t[0].block_time,txCount:t[0].tx_count,VRFKey:t[0].vrf_key};throw l(t)}catch(t){throw l(t)}}async fetchCollectionAssets(e,t=0){try{const{data:r,status:a}=await this._axiosInstance.get(`asset_policy_info?_asset_policy=${e}&limit=100&offset=${t}`);if(a===200)return{assets:r.map(i=>({unit:`${e}${i.asset_name}`,quantity:i.total_supply})),next:r.length===100?t+100:null};throw l(r)}catch(r){throw l(r)}}async fetchHandleAddress(e){try{const t=Q(e.replace("$","")),{data:r,status:a}=await this._axiosInstance.get(`asset_address_list?_asset_policy=${Pt[1]}&_asset_name=${t}`);if(a===200)return r[0].payment_address;throw l(r)}catch(t){throw l(t)}}async fetchProtocolParameters(e){try{const{data:t,status:r}=await this._axiosInstance.get(`epoch_params?_epoch_no=${e}`);if(r===200)return{coinsPerUTxOSize:t[0].coins_per_utxo_size,collateralPercent:t[0].collateral_percent,decentralisation:t[0].decentralisation,epoch:t[0].epoch_no,keyDeposit:t[0].key_deposit,maxBlockExMem:t[0].max_block_ex_mem.toString(),maxBlockExSteps:t[0].max_block_ex_steps.toString(),maxBlockHeaderSize:t[0].max_bh_size,maxBlockSize:t[0].max_block_size,maxCollateralInputs:t[0].max_collateral_inputs,maxTxExMem:t[0].max_tx_ex_mem.toString(),maxTxExSteps:t[0].max_tx_ex_steps.toString(),maxTxSize:t[0].max_tx_size,maxValSize:t[0].max_val_size.toString(),minFeeA:t[0].min_fee_a,minFeeB:t[0].min_fee_b,minPoolCost:t[0].min_pool_cost,poolDeposit:t[0].pool_deposit,priceMem:t[0].price_mem,priceStep:t[0].price_step};throw l(t)}catch(t){throw l(t)}}async fetchTxInfo(e){var t,r;try{const{data:a,status:i}=await this._axiosInstance.post("tx_info",{_tx_hashes:[e]});if(i===200)return{block:a[0].block_hash,deposit:a[0].deposit,fees:a[0].fee,hash:a[0].tx_hash,index:a[0].tx_block_index,invalidAfter:((t=a[0].invalid_after)==null?void 0:t.toString())??"",invalidBefore:((r=a[0].invalid_before)==null?void 0:r.toString())??"",slot:a[0].absolute_slot.toString(),size:a[0].tx_size};throw l(a)}catch(a){throw l(a)}}onTxConfirmed(e,t,r=100){let a=0;const i=setInterval(()=>{a>=r&&clearInterval(i),this.fetchTxInfo(e).then(o=>{this.fetchBlockInfo(o.block).then(c=>{(c==null?void 0:c.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{a+=1})}).catch(()=>{a+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/cbor"},{data:r,status:a}=await this._axiosInstance.post("submittx",m(e),{headers:t});if(a===202)return r;throw l(r)}catch(t){throw l(t)}}}class or{_baseUrl;constructor(...e){this._baseUrl=pe(e[0])?Xe[e[0]]:e[0]}async evaluateTx(e){const t=await this.open();return this.send(t,"EvaluateTx",{evaluate:e}),new Promise((r,a)=>{t.addEventListener("message",i=>{try{const{result:o}=JSON.parse(i.data);o.EvaluationResult?r(Object.keys(o.EvaluationResult).map(c=>({index:parseInt(c.split(":")[1],10),tag:c.split(":")[0].toUpperCase(),budget:{mem:o.EvaluationResult[c].memory,steps:o.EvaluationResult[c].steps}}))):a(o.EvaluationFailure),t.close()}catch(o){a(o)}},{once:!0})})}async onNextTx(e){const t=await this.open();return this.send(t,"AwaitAcquire",{}),t.addEventListener("message",r=>{const{result:a}=JSON.parse(r.data);if(a===null)return this.send(t,"AwaitAcquire",{});a.AwaitAcquired===void 0&&e(a),this.send(t,"NextTx",{})}),()=>t.close()}async submitTx(e){const t=await this.open();return this.send(t,"SubmitTx",{submit:e}),new Promise((r,a)=>{t.addEventListener("message",i=>{try{const{result:o}=JSON.parse(i.data);o.SubmitSuccess?r(o.SubmitSuccess.txId):a(o.SubmitFail),t.close()}catch(o){a(o)}},{once:!0})})}async open(){const e=new WebSocket(this._baseUrl);return await new Promise(t=>{e.addEventListener("open",()=>t(!0),{once:!0})}),e}send(e,t,r){e.send(JSON.stringify({version:"1.0",type:"jsonwsp/request",servicename:"ogmios",methodname:t,args:r}))}}class cr{_axiosInstance;constructor(e,t,r,a=1){this._axiosInstance=J.default.create({baseURL:`https://cardano-${e}.tangocrypto.com/${t}/v${a}`,headers:{"x-api-key":r}})}async evaluateTx(e){try{const{data:t,status:r}=await this._axiosInstance.post("transactions/evaluate",{tx:e,utxos:[]});if(r===200)return t.redeemers.map(a=>({index:a.index,tag:a.purpose.toUpperCase(),budget:{mem:a.unit_mem,steps:a.unit_steps}}));throw l(t)}catch(t){throw l(t)}}async fetchAccountInfo(e){try{const t=e.startsWith("addr")?Dt(e):e,{data:r,status:a}=await this._axiosInstance.get(`wallets/${t}`);if(a===200)return{poolId:r.pool_id,active:r.active,balance:r.controlled_total_stake,rewards:r.rewards_sum,withdrawals:r.withdrawals_sum};throw l(r)}catch(t){throw l(t)}}async fetchAddressUTxOs(e,t){const r=t!==void 0?`/assets/${t}`:"",a=`addresses/${e}${r}/utxos?size=50`,i=async(A="",d=[])=>{var y;const{data:g,status:I}=await this._axiosInstance.get(`${a}&cursor=${A}`);if(I===200)return g.cursor!==null&&((y=g.cursor)==null?void 0:y.length)>0?i(g.cursor,[...d,...g.data.map(u)]):g.data.map(u);throw l(g)},o=(A,d)=>{const g=[{unit:"lovelace",quantity:A.toString()}];return d.forEach(I=>{const y=Q(I.asset_name);g.push({unit:`${I.policy_id}${y}`,quantity:I.quantity.toString()})}),g},c=A=>{if(A){const d=A.type.startsWith("plutus")?{code:A.code,version:A.type.replace("plutus","")}:bt(Qt(A.json));return lt(d).to_hex()}},u=A=>{var d;return{input:{outputIndex:A.index,txHash:A.hash},output:{address:e,amount:o(A.value,A.assets),dataHash:void 0,plutusData:((d=A.inline_datum)==null?void 0:d.value_raw)??void 0,scriptRef:c(A.reference_script)}}};try{return await i()}catch{return[]}}async fetchAssetAddresses(e){const t=a=>({address:a.address,quantity:a.quantity.toString()}),r=async(a="",i=[])=>{var d;const{policyId:o,assetName:c}=tt(e),{data:u,status:A}=await this._axiosInstance.get(`assets/${o}${c}/addresses?size=100&cursor=${a}`);if(A===200)return u.cursor!==null&&((d=u.cursor)==null?void 0:d.length)>0?r(u.cursor,[...i,...u.data.map(t)]):u.data.map(t);throw l(u)};try{return await r()}catch{return[]}}async fetchAssetMetadata(e){var t;try{const{policyId:r,assetName:a}=tt(e),{data:i,status:o}=await this._axiosInstance.get(`assets/${r}${a}`);if(o===200)return{...(t=i.metadata.find(c=>c.label===721))==null?void 0:t.json[r][Ot(a)]};throw l(i)}catch(r){throw l(r)}}async fetchBlockInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`blocks/${e}`);if(r===200)return{confirmations:t.confirmations,epoch:t.epoch_no,epochSlot:t.epoch_slot_no.toString(),fees:t.fees.toString(),hash:t.hash,nextBlock:t.next_block.toString()??"",operationalCertificate:t.op_cert,output:t.out_sum.toString()??"0",previousBlock:t.previous_block.toString(),size:t.size,slot:t.slot_no.toString(),slotLeader:t.slot_leader??"",time:Date.parse(t.time),txCount:t.tx_count,VRFKey:t.vrf_key};throw l(t)}catch(t){throw l(t)}}async fetchCollectionAssets(e,t=""){try{const{data:r,status:a}=await this._axiosInstance.get(`policies/${e}/assets?size=100&cursor=${t}`);if(a===200)return{assets:r.data.map(i=>({unit:`${i.policy_id}${i.asset_name}`,quantity:i.quantity})),next:r.cursor};throw l(r)}catch{return{assets:[],next:null}}}async fetchHandleAddress(e){try{const t=Q(e.replace("$","")),{data:r,status:a}=await this._axiosInstance.get(`assets/${Pt[1]}${t}/addresses`);if(a===200)return r.data[0].address;throw l(r)}catch(t){throw l(t)}}async fetchProtocolParameters(e){try{const{data:t,status:r}=await this._axiosInstance.get(`epochs/${e}/parameters`);if(r===200)return{coinsPerUTxOSize:t.coins_per_utxo_size.toString(),collateralPercent:t.collateral_percent,decentralisation:t.decentralisation,epoch:t.epoch_no,keyDeposit:t.key_deposit.toString(),maxBlockExMem:t.max_block_ex_mem.toString(),maxBlockExSteps:t.max_block_ex_steps.toString(),maxBlockHeaderSize:t.max_block_header_size,maxBlockSize:t.max_block_size,maxCollateralInputs:t.max_collateral_inputs,maxTxExMem:t.max_tx_ex_mem.toString(),maxTxExSteps:t.max_tx_ex_steps.toString(),maxTxSize:t.max_tx_size,maxValSize:t.max_val_size.toString(),minFeeA:t.min_fee_a,minFeeB:t.min_fee_b,minPoolCost:t.min_pool_cost.toString(),poolDeposit:t.pool_deposit.toString(),priceMem:t.price_mem,priceStep:t.price_step};throw l(t)}catch(t){throw l(t)}}async fetchTxInfo(e){try{const{data:t,status:r}=await this._axiosInstance.get(`transactions/${e}`);if(r===200)return{block:t.block.hash,deposit:t.deposit,fees:t.fee,hash:t.hash,index:t.block_index,invalidAfter:t.invalid_hereafter??"",invalidBefore:t.invalid_before??"",slot:t.block.slot_no.toString(),size:t.size};throw l(t)}catch(t){throw l(t)}}onTxConfirmed(e,t,r=100){let a=0;const i=setInterval(()=>{a>=r&&clearInterval(i),this.fetchTxInfo(e).then(o=>{this.fetchBlockInfo(o.block).then(c=>{(c==null?void 0:c.confirmations)>0&&(clearInterval(i),t())}).catch(()=>{a+=1})}).catch(()=>{a+=1})},5e3)}async submitTx(e){try{const t={"Content-Type":"application/json"},{data:r,status:a}=await this._axiosInstance.post("transactions/submit",{tx:e},{headers:t});if(a===200)return r.tx_id;throw l(r)}catch(t){throw l(t)}}}class ur{static withOneSignature(e){const t=P(X(e));return ft(t).to_hex()}static withAtLeastNSignatures(e,t){const r=n.NativeScripts.new();e.forEach(i=>{const o=P(X(i));r.add(ft(o))});const a=n.ScriptNOfK.new(t,r);return n.NativeScript.new_script_any(a).to_hex()}static withAnySignature(e){const t=n.NativeScripts.new();e.forEach(a=>{const i=P(X(a));t.add(ft(i))});const r=n.ScriptAny.new(t);return n.NativeScript.new_script_any(r).to_hex()}static withAllSignatures(e){const t=n.NativeScripts.new();e.forEach(a=>{const i=P(X(a));t.add(ft(i))});const r=n.ScriptAll.new(t);return n.NativeScript.new_script_any(r).to_hex()}static fromNativeScript(e){return vt(e).to_hex()}}function j(s,e,t,r){var a=arguments.length,i=a<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var c=s.length-1;c>=0;c--)(o=s[c])&&(i=(a<3?o(i):a>3?o(e,t,i):o(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i}const Ar=s=>class extends s{__visits=[]},et=()=>function(s,e,t){const r=t.value;t.value=function(...a){const i=r.call(this,...a);return this.__visits&&this.__visits.push(e),i}};exports.Transaction=class{_changeAddress;_txOutputs=new Map;_recipients=new Map;_totalBurns=new Map;_totalMints=new Map;_era;_initiator;_mintBuilder;_protocolParameters;_txBuilder;_txCertificates;_txInputsBuilder;_txWithdrawals;constructor(e={}){this._era=e.era,this._initiator=e.initiator,this._mintBuilder=n.MintBuilder.new(),this._protocolParameters=e.parameters??q,this._txBuilder=qs(e.parameters),this._txCertificates=n.Certificates.new(),this._txInputsBuilder=n.TxInputsBuilder.new(),this._txWithdrawals=n.Withdrawals.new()}static maskMetadata(e,t="BABBAGE"){var i;const r=L(e),a=(i=r.auxiliary_data())==null?void 0:i.metadata();if(a!==void 0){const o=n.GeneralTransactionMetadata.new();for(let u=0;u<a.len();u+=1){const A=a.keys().get(u),d=a.get(A);o.insert(A,n.TransactionMetadatum.from_hex("0".repeat(((d==null?void 0:d.to_hex())??"").length)))}const c=r.auxiliary_data();return c!==void 0&&(c.set_metadata(o),c.set_prefer_alonzo_format(t==="ALONZO")),n.Transaction.new(r.body(),r.witness_set(),c).to_hex()}return e}static readMetadata(e){var r,a;return((a=(r=L(e).auxiliary_data())==null?void 0:r.metadata())==null?void 0:a.to_hex())??""}static writeMetadata(e,t,r="BABBAGE"){const a=L(e),i=a.auxiliary_data()??n.AuxiliaryData.new();return i.set_metadata(n.GeneralTransactionMetadata.from_hex(t)),i.set_prefer_alonzo_format(r==="ALONZO"),n.Transaction.new(a.body(),a.witness_set(),i).to_hex()}get size(){return this._txBuilder.full_size()}async build(){try{return(this._mintBuilder.has_plutus_scripts()||this.notVisited("redeemValue")===!1)&&(await this.addRequiredSignersIfNeeded(),await this.addCollateralIfNeeded()),await this.forgeAssetsIfNeeded(),await this.addTxInputsAsNeeded(),await this.addChangeAddress(),this._txBuilder.build_tx().to_hex()}catch(e){throw new Error(`[Transaction] An error occurred during build: ${e}.`)}}burnAsset(e,t,r){const a=this._totalBurns.has(t.unit)?n.BigNum.from_str(this._totalBurns.get(t.unit)??"0").checked_add(n.BigNum.from_str(t.quantity)).to_str():t.quantity;return this._mintBuilder.add_asset(Ie(e,r),n.AssetName.new(m(t.unit.slice(T))),n.Int.new_negative(n.BigNum.from_str(t.quantity))),this._totalBurns.set(t.unit,a),this}delegateStake(e,t){const r=n.Certificate.new_stake_delegation(n.StakeDelegation.new(n.StakeCredential.from_keyhash(P(rt(e))),n.Ed25519KeyHash.from_bech32(t)));return this._txCertificates.add(r),this}deregisterStake(e){const t=n.Certificate.new_stake_deregistration(n.StakeDeregistration.new(n.StakeCredential.from_keyhash(P(rt(e)))));return this._txCertificates.add(t),this}mintAsset(e,t,r){var A,d;const a=(g,I)=>{const y=typeof g=="string"?Qt(g).hash().to_hex():i(g).hash().to_hex(),S=Q(I.assetName);return{unit:`${y}${S}`,quantity:I.assetQuantity}},i=g=>{if("code"in g)return ot(g.code,g.version);const I=Y(g);if(I.output().has_script_ref()){const y=I.output().script_ref();if(y.is_plutus_script()){const S=Fe(y);return ot(S.code,S.version)}}throw new Error(`No plutus script reference found in UTxO: ${I.input().transaction_id().to_hex()}`)},o=a(e,t),u=n.BigNum.from_str(((A=this._totalMints.get(o.unit))==null?void 0:A.assetQuantity)??"0").checked_add(n.BigNum.from_str(o.quantity));return this._mintBuilder.add_asset(Ie(e,r),n.AssetName.new(m(Q(t.assetName))),n.Int.new(n.BigNum.from_str(o.quantity))),this._recipients.has(t.recipient)?(d=this._recipients.get(t.recipient))==null||d.push(o):this._recipients.set(t.recipient,[o]),this._totalMints.set(o.unit,{...t,assetQuantity:u.to_str()}),this}redeemValue(e){const t={tag:"SPEND",budget:_e,index:this._txInputsBuilder.inputs().len(),data:{alternative:0,fields:[]},...e.redeemer},r=Y(e.value),a=n.PlutusWitness.new_with_ref(Oe(e.script),Ls(e.datum),Te(t));return this._txInputsBuilder.add_plutus_script_input(a,r.input(),r.output().amount()),this}registerStake(e){const t=n.Certificate.new_stake_registration(n.StakeRegistration.new(n.StakeCredential.from_keyhash(P(rt(e)))));return this._txCertificates.add(t),this}registerPool(e){const t=n.Certificate.new_pool_registration(n.PoolRegistration.new(Vs(e)));return this._txCertificates.add(t),this}retirePool(e,t){const r=n.Certificate.new_pool_retirement(n.PoolRetirement.new(n.Ed25519KeyHash.from_bech32(e),t));return this._txCertificates.add(r),this}sendAssets(e,t){const r=Ct(t),a=r.multiasset();if(r.is_zero()||a===void 0)return this;const i=pt(e).next(),o=r.coin().is_zero()?i.with_asset_and_min_required_coin_by_utxo_cost(a,le(this._protocolParameters.coinsPerUTxOSize)).build():i.with_coin_and_asset(r.coin(),a).build();return t.forEach(c=>{this.setTxOutput(c)}),this._txBuilder.add_output(o),this}sendLovelace(e,t){const a=pt(e).next().with_coin(n.BigNum.from_str(t)).build();return this.setTxOutput({unit:"lovelace",quantity:t}),this._txBuilder.add_output(a),this}sendToken(e,t,r){return this.sendAssets(e,[{quantity:r,unit:Ze[t]}]),this}sendValue(e,t){const r=Ct(t.output.amount),i=pt(e).next().with_value(r).build();return t.output.amount.forEach(o=>{this.setTxOutput(o)}),this._txBuilder.add_output(i),this}setChangeAddress(e){return this._changeAddress=F(e),this}setCollateral(e){const t=me(e);return this._txBuilder.set_collateral(t),this}setMetadata(e,t){return this._txBuilder.add_json_metadatum_with_schema(n.BigNum.from_str(e.toString()),JSON.stringify(t),n.MetadataJsonSchema.NoConversions),this}setRequiredSigners(e){return Array.from(new Set(e.map(r=>r.startsWith("addr")?X(r):rt(r)).map(r=>P(r)))).forEach(r=>{this._txBuilder.add_required_signer(r)}),this}setTimeToStart(e){return this._txBuilder.set_validity_start_interval_bignum(n.BigNum.from_str(e)),this}setTimeToExpire(e){return this._txBuilder.set_ttl_bignum(n.BigNum.from_str(e)),this}setTxInputs(e){return e.map(t=>Y(t)).forEach(t=>{this._txInputsBuilder.add_input(t.output().address(),t.input(),t.output().amount())}),this}withdrawRewards(e,t){const r=Pe(e);return r!==void 0&&this._txWithdrawals.insert(r,n.BigNum.from_str(t)),this}async addBurnInputsIfNeeded(){if(this._initiator&&this._totalBurns.size>0&&this.notVisited("setTxInputs")){const e=await this._initiator.getUsedUTxOs();Ce(this._totalBurns,e.map(r=>xt(r))).map(r=>Y(r)).forEach(r=>{this._txInputsBuilder.add_input(r.output().address(),r.input(),r.output().amount())})}}async addChangeAddress(){if(this._initiator&&this._changeAddress===void 0){const e=await this._initiator.getUsedAddress();this._txBuilder.add_change_if_needed(e)}else this._changeAddress!==void 0&&this._txBuilder.add_change_if_needed(this._changeAddress)}async addCollateralIfNeeded(){if(this._initiator&&this.notVisited("setCollateral")){const e=await this._initiator.getUsedCollateral();this._txBuilder.set_collateral(me(e))}}async addRequiredSignersIfNeeded(){if(this._initiator&&this.notVisited("setRequiredSigners")){const e=await this._initiator.getUsedAddress(),t=X(e.to_bech32());this._txBuilder.add_required_signer(P(t))}}async addTxInputsAsNeeded(){if(this.notVisited("setTxInputs")){const e=await this.filterAvailableUTxOs();ye(this._txOutputs,e.map(r=>xt(r))).map(r=>Y(r)).forEach(r=>{this._txInputsBuilder.add_input(r.output().address(),r.input(),r.output().amount())})}if(this._txBuilder.set_inputs(this._txInputsBuilder),(this._mintBuilder.has_native_scripts()||this._mintBuilder.has_plutus_scripts())&&this._txBuilder.set_mint_builder(this._mintBuilder),this._txCertificates.len()>0&&this._txBuilder.set_certs(this._txCertificates),this._txWithdrawals.len()>0&&this._txBuilder.set_withdrawals(this._txWithdrawals),this._txBuilder.get_mint_builder()||this.notVisited("redeemValue")===!1){const e=this._era!==void 0?$t[this._era]:$t.BABBAGE;this._txBuilder.calc_script_data_hash(e)}}async forgeAssetsIfNeeded(){const e=(t,r)=>{const a=t.data.assetName,i=t.data.metadata,o=t.unit.slice(0,T);if(t.data.label==="777")return i;if(r&&r[o]){const{[o]:c,...u}=r,A={[a]:i,...c};return{[o]:{...A},...u}}return r!==void 0?{[o]:{[a]:i},...r}:{[o]:{[a]:i}}};await this.addBurnInputsIfNeeded(),Array.from(this._totalMints,t=>({unit:t[0],data:t[1]})).reduce((t,r)=>t.set(r.data.label,e(r,t.get(r.data.label))),new Map).forEach((t,r)=>{this._txBuilder.add_json_metadatum(n.BigNum.from_str(r),JSON.stringify(t))}),this.addMintOutputs()}async filterAvailableUTxOs(e=[]){return this._initiator===void 0?[]:(await this._initiator.getUsedUTxOs()).filter(r=>e.find(a=>a.input.txHash===r.input().transaction_id().to_hex())===void 0)}addMintOutputs(){this._recipients.forEach((e,t)=>{const a=Ct(e).multiasset();if(a!==void 0){const o=pt(t).next().with_asset_and_min_required_coin_by_utxo_cost(a,le(this._protocolParameters.coinsPerUTxOSize)).build();this._txBuilder.add_output(o)}})}notVisited(e){return this.__visits.includes(e)===!1}setTxOutput(e){const r=n.BigNum.from_str(this._txOutputs.get(e.unit)??"0").checked_add(n.BigNum.from_str(e.quantity)).to_str();this._txOutputs.set(e.unit,r)}};j([et()],exports.Transaction.prototype,"mintAsset",null);j([et()],exports.Transaction.prototype,"redeemValue",null);j([et()],exports.Transaction.prototype,"sendAssets",null);j([et()],exports.Transaction.prototype,"sendValue",null);j([et()],exports.Transaction.prototype,"setCollateral",null);j([et()],exports.Transaction.prototype,"setRequiredSigners",null);j([et()],exports.Transaction.prototype,"setTxInputs",null);exports.Transaction=j([Ar],exports.Transaction);class C{_networkId;_encryptedSecret;constructor(e,t){this._networkId=e,this._encryptedSecret=t}getAccount(e,t){return this.accountContext(e,t,(r,a)=>{const i=de(this._networkId,r.to_public().hash(),a.to_public().hash()).to_address().to_bech32(),o=he(this._networkId,r.to_public().hash()).to_address().to_bech32(),c=Nt(this._networkId,a.to_public().hash()).to_address().to_bech32();return{baseAddress:i,enterpriseAddress:o,rewardAddress:c}})}signData(e,t,r,a){try{return this.accountContext(e,t,(i,o)=>{const c={payload:a},u={address:C.resolveAddress(this._networkId,r,i,o),key:r.startsWith("stake")?o:i},{coseSign1:A,coseKey:d}=is(c,u);return{signature:A,key:d}})}catch(i){throw new Error(`An error occurred during signData: ${i}.`)}}signTx(e,t,r,a,i){try{const o=Ke(Ye(a));return this.accountContext(e,t,(c,u)=>{const A=n.Vkeywitnesses.new();return C.resolveSigners(a,r,c.to_public().hash().to_hex()).forEach(g=>{if(g===c.to_public().hash().to_hex())A.add(n.make_vkey_witness(o,c));else if(g===u.to_public().hash().to_hex())A.add(n.make_vkey_witness(o,u));else if(i===!1)throw new Error(`Missing key witness for: ${g}`)}),A})}catch(o){throw new Error(`An error occurred during signTx: ${o}.`)}}static encryptMnemonic(e,t){const r=Kt.mnemonicToEntropy(e.join(" ")),a=He(r),i=v(a.as_bytes());return a.free(),C.encrypt(i,t)}static encryptPrivateKey(e,t){const r=n.Bip32PrivateKey.from_bech32(e),a=v(r.as_bytes());return r.free(),C.encrypt(a,t)}static encryptSigningKeys(e,t,r){const a=C.encrypt(e.slice(4),r),i=C.encrypt(t.slice(4),r);return[a,i]}static generateMnemonic(e=256){return Kt.generateMnemonic(e).split(" ")}accountContext(e,t,r){const{paymentKey:a,stakeKey:i}=C.resolveKeys(e,t,this._encryptedSecret),o=r(a,i);return a.free(),i.free(),o}static decrypt(e,t){try{return n.decrypt_with_password(Q(t),e)}catch{throw new Error("The password is incorrect.")}}static encrypt(e,t){const r=fe.customAlphabet("0123456789abcdef"),a=r(64),i=r(24);return n.encrypt_with_password(Q(t),a,i,e)}static resolveAddress(e,t,r,a){const i=[de(e,r.to_public().hash(),a.to_public().hash()),he(e,r.to_public().hash()),Nt(e,a.to_public().hash())].find(o=>o.to_address().to_bech32()===t);if(i!==void 0)return i.to_address();throw new Error(`Address: ${t} doesn't belong to this account.`)}static resolveKeys(e,t,r){if(typeof r=="string"){const o=C.decrypt(r,t);return Us(o,e)}const a=C.decrypt(r[0],t),i=C.decrypt(r[1],t);return{paymentKey:n.PrivateKey.from_hex(a),stakeKey:n.PrivateKey.from_hex(i)}}static resolveSigners(e,t,r){const a=c=>{const u=(f,x=[],B=0)=>{var ht,ct,Yt,Lt,qt;if(f===void 0||B>=f.len())return x;const k=f.get(B),U=new Array;switch(k.kind()){case n.CertificateKind.StakeDeregistration:{const w=(ht=k.as_stake_deregistration())==null?void 0:ht.stake_credential(),O=(w==null?void 0:w.kind())===n.StakeCredKind.Key?w.to_keyhash():void 0;O&&U.push(O.to_hex());break}case n.CertificateKind.StakeDelegation:{const w=(ct=k.as_stake_delegation())==null?void 0:ct.stake_credential(),O=(w==null?void 0:w.kind())===n.StakeCredKind.Key?w.to_keyhash():void 0;O&&U.push(O.to_hex());break}case n.CertificateKind.PoolRegistration:{const w=(Yt=k.as_pool_registration())==null?void 0:Yt.pool_params().pool_owners();U.push(...d(w));break}case n.CertificateKind.PoolRetirement:{const w=(Lt=k.as_pool_retirement())==null?void 0:Lt.pool_keyhash();w&&U.push(w.to_hex());break}case n.CertificateKind.MoveInstantaneousRewardsCert:{const w=(qt=k.as_move_instantaneous_rewards_cert())==null?void 0:qt.move_instantaneous_reward().as_to_stake_creds();if(w)for(let O=0;O<w.len();O+=1){const Gt=w.keys().get(O),Rt=Gt.kind()===n.StakeCredKind.Key?Gt.to_keyhash():void 0;Rt&&U.push(Rt.to_hex())}break}}return u(f,[...x,...U],B+1)},A=(f,x=[],B=0)=>{if(f===void 0||B>=f.len())return x;const k=f.get(B).index(),U=f.get(B).transaction_id(),ht=t.find(ct=>ct.input.outputIndex===k&&ct.input.txHash===U.to_hex())!==void 0?r:"OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";return A(f,[...x,ht],B+1)},d=(f,x=[],B=0)=>f===void 0||B>=f.len()?x:d(f,[...x,f.get(B).to_hex()],B+1),g=(f,x=[],B=0)=>{if(f===void 0||B>=f.len())return x;const k=f.keys().get(B).payment_cred(),U=k.kind()===n.StakeCredKind.Key?k.to_keyhash():void 0;return g(f,U?[...x,U.to_hex()]:x,B+1)},I=c.certs(),y=c.collateral(),S=c.inputs(),H=c.required_signers(),R=c.withdrawals();return[...u(I),...A(y),...A(S),...d(H),...g(R)]},i=c=>{const u=(d,g=[])=>{var I,y,S,H;if(d)for(let R=0;R<d.len();R+=1){const f=d.get(R);switch(f.kind()){case n.NativeScriptKind.ScriptPubkey:{const x=(I=f.as_script_pubkey())==null?void 0:I.addr_keyhash().to_hex();return x?[...g,x]:g}case n.NativeScriptKind.ScriptAll:return u((y=f.as_script_all())==null?void 0:y.native_scripts(),g);case n.NativeScriptKind.ScriptAny:return u((S=f.as_script_any())==null?void 0:S.native_scripts(),g);case n.NativeScriptKind.ScriptNOfK:return u((H=f.as_script_n_of_k())==null?void 0:H.native_scripts(),g)}}return g},A=c.native_scripts();return[...u(A)]},o=L(e);return new Set([...a(o.body()),...i(o.witness_set())])}}const K="MARI0TIME";class gr{_fetcher;_submitter;_wallet;constructor(e){switch(this._fetcher=e.fetcher,this._submitter=e.submitter,e.key.type){case"mnemonic":this._wallet=new C(e.networkId,C.encryptMnemonic(e.key.words,K));break;case"root":this._wallet=new C(e.networkId,C.encryptPrivateKey(e.key.bech32,K));break;case"cli":this._wallet=new C(e.networkId,C.encryptSigningKeys(e.key.payment,e.key.stake??"f0".repeat(34),K))}}getPaymentAddress(e=0){return this._wallet.getAccount(e,K).enterpriseAddress}getRewardAddress(e=0){return this._wallet.getAccount(e,K).rewardAddress}getUsedAddress(e=0){const t=this._wallet.getAccount(e,K);return F(t.enterpriseAddress)}getUsedCollateral(e=q.maxCollateralInputs){throw new Error("getUsedCollateral not implemented.")}async getUsedUTxOs(e=0){const t=this._wallet.getAccount(e,K);return(await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map(a=>Y(a))}signData(e,t,r=0){try{return this._wallet.signData(r,K,e,t)}catch(a){throw new Error(`[AppWallet] An error occurred during signData: ${a}.`)}}async signTx(e,t=!1,r=0){try{const a=this._wallet.getAccount(r,K),i=await this._fetcher.fetchAddressUTxOs(a.enterpriseAddress),o=this._wallet.signTx(r,K,i,e,t),c=L(e),u=c.witness_set(),A=Le(u,o);return u.set_vkeys(A),n.Transaction.new(c.body(),u,c.auxiliary_data()).to_hex()}catch(a){throw new Error(`[AppWallet] An error occurred during signTx: ${a}.`)}}submitTx(e){return this._submitter.submitTx(e)}static brew(e=256){return C.generateMnemonic(e)}}class St{_walletInstance;constructor(e){this._walletInstance=e}static getInstalledWallets(){return window.cardano===void 0?[]:zt.filter(e=>window.cardano[e]!==void 0).map(e=>({name:window.cardano[e].name,icon:window.cardano[e].icon,version:window.cardano[e].apiVersion}))}static async enable(e){try{const t=await St.resolveInstance(e);if(t!==void 0)return new St(t);throw new Error(`Couldn't create an instance of wallet: ${e}`)}catch(t){throw new Error(`[BrowserWallet] An error occurred during enable: ${t}.`)}}async getBalance(){const e=await this._walletInstance.getBalance();return Me(Os(e))}async getChangeAddress(){const e=await this._walletInstance.getChangeAddress();return st(e).to_bech32()}async getCollateral(e=q.maxCollateralInputs){return(await this.getUsedCollateral(e)).map(r=>xt(r))}getNetworkId(){return this._walletInstance.getNetworkId()}async getRewardAddresses(){return(await this._walletInstance.getRewardAddresses()).map(t=>st(t).to_bech32())}async getUnusedAddresses(){return(await this._walletInstance.getUnusedAddresses()).map(t=>st(t).to_bech32())}async getUsedAddresses(){return(await this._walletInstance.getUsedAddresses()).map(t=>st(t).to_bech32())}async getUtxos(){return(await this.getUsedUTxOs()).map(t=>xt(t))}signData(e,t){const r=F(e).to_hex();return this._walletInstance.signData(r,Q(t))}async signTx(e,t=!1){try{const r=L(e),a=r.witness_set(),i=await this._walletInstance.signTx(e,t),o=Hs(i).vkeys()??n.Vkeywitnesses.new(),c=Le(a,o);return a.set_vkeys(c),v(n.Transaction.new(r.body(),a,r.auxiliary_data()).to_bytes())}catch(r){throw new Error(`[BrowserWallet] An error occurred during signTx: ${JSON.stringify(r)}.`)}}submitTx(e){return this._walletInstance.submitTx(e)}async getUsedAddress(){const e=await this._walletInstance.getUsedAddresses();return st(e[0])}async getUsedCollateral(e=q.maxCollateralInputs){return(await this._walletInstance.experimental.getCollateral()??[]).map(r=>Ae(r)).slice(0,e)}async getUsedUTxOs(){return(await this._walletInstance.getUtxos()??[]).map(t=>Ae(t))}async getAssets(){return(await this.getBalance()).filter(t=>t.unit!=="lovelace").map(t=>{const r=t.unit.slice(0,T),a=t.unit.slice(T),i=Ve(r,a);return{unit:t.unit,policyId:r,assetName:Ot(a),fingerprint:i,quantity:t.quantity}})}async getLovelace(){const t=(await this.getBalance()).find(r=>r.unit==="lovelace");return t!==void 0?t.quantity:"0"}async getPolicyIdAssets(e){return(await this.getAssets()).filter(r=>r.policyId===e)}async getPolicyIds(){const e=await this.getBalance();return Array.from(new Set(e.map(t=>t.unit.slice(0,T)))).filter(t=>t!=="lovelace")}static resolveInstance(e){if(window.cardano===void 0)return;const t=zt.map(r=>window.cardano[r]).filter(r=>r!==void 0).find(r=>r.name.toLowerCase()===e.toLowerCase());return t==null?void 0:t.enable()}}const qe="http://localhost:4000/",dr="http://localhost:5000/",lr=`${qe}access`,hr=`${qe}transaction/signtx`;class Ir{static getAxiosInstance(){return J.default.create({baseURL:dr,withCredentials:!0})}static getAppId(){return window.location.hostname}static async openMinaFrontend(e){const t=this.getAppId();e.includes("?")?e=`${e}&appId=${t}`:e=`${e}?appId=${t}`;const r="left=100,top=100,width=540,height=540",a=window.open(e,"meshWindow",r);return a||console.error("the window did not open",a),await(async()=>new Promise(i=>{window.addEventListener("message",async o=>{o.data.target=="minaWallet"&&i(o.data)})}))()}static async get(e,t={}){const r=this.getAppId();t={...t,appId:r};try{return(await this.getAxiosInstance().get(e,{params:t})).data}catch{console.error("Not logged in");return}}static async enable(){return await this.get("wallet/getuserwalletsmeta")===void 0?await this.openMinaFrontend(lr):!0}static async getChangeAddress(e=void 0,t=void 0){return await this.get("wallet/getchangeaddress",{walletId:e,accountIndex:t})}static async getUtxos(e=void 0,t=void 0){return await this.get("wallet/getutxo",{walletId:e,accountIndex:t})}static async signTx(e,t=!1){const r=await this.get("wallet/getuserwalletsmeta");if(console.log("userWalletsMeta",r),r){const a=await this.openMinaFrontend(`${hr}?unsignedTx=${e}&partialSign=${t}`);if(a instanceof n.Vkeywitnesses){const i=L(e),o=i.witness_set();o.set_vkeys(a);const c=n.Transaction.new(i.body(),o,i.auxiliary_data()).to_hex();return console.log("signedTx",c),c}}else return}}exports.AppWallet=gr;exports.BlockfrostProvider=ar;exports.BrowserWallet=St;exports.EmbeddedWallet=C;exports.ForgeScript=ur;exports.InfuraProvider=nr;exports.KoiosProvider=ir;exports.MinaWallet=Ir;exports.OgmiosProvider=or;exports.TangoProvider=cr;exports.checkSignature=os;exports.generateNonce=er;exports.isNetwork=pe;exports.keepRelevant=ye;exports.largestFirst=ts;exports.largestFirstMultiAsset=Ce;exports.parseAssetUnit=tt;exports.parseHttpError=l;exports.readPlutusData=sr;exports.readTransaction=rr;exports.resolveDataHash=Gs;exports.resolveEpochNo=Rs;exports.resolveFingerprint=Ve;exports.resolveLanguageView=$s;exports.resolveNativeScriptHash=zs;exports.resolvePaymentKeyHash=X;exports.resolvePlutusScriptAddress=Ws;exports.resolvePlutusScriptHash=Js;exports.resolvePoolId=js;exports.resolvePrivateKey=Xs;exports.resolveRewardAddress=Dt;exports.resolveScriptRef=Zs;exports.resolveSlotNo=tr;exports.resolveStakeKeyHash=rt;exports.resolveTxFees=Vt;exports.resolveTxHash=Ye;
|
package/dist/core.js
CHANGED
|
@@ -37,8 +37,8 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
37
37
|
SPEND: n.RedeemerTag.new_spend()
|
|
38
38
|
}, xt = {
|
|
39
39
|
testnet: ["74", "1598400", "1595967616", "432000"],
|
|
40
|
-
preview: ["
|
|
41
|
-
preprod: ["
|
|
40
|
+
preview: ["183", "15811222", "1682467200", "86400"],
|
|
41
|
+
preprod: ["65", "26438400", "1682121600", "432000"],
|
|
42
42
|
mainnet: ["208", "4492800", "1596059091", "432000"]
|
|
43
43
|
}, Wt = {
|
|
44
44
|
ALONZO: n.TxBuilderConstants.plutus_alonzo_cost_models(),
|
|
@@ -440,6 +440,7 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
440
440
|
"begin",
|
|
441
441
|
"eternl",
|
|
442
442
|
"flint",
|
|
443
|
+
"lace",
|
|
443
444
|
"nami",
|
|
444
445
|
"nufi",
|
|
445
446
|
"gerowallet",
|
|
@@ -1750,7 +1751,7 @@ class Cr {
|
|
|
1750
1751
|
throw l(t);
|
|
1751
1752
|
}
|
|
1752
1753
|
}
|
|
1753
|
-
onTxConfirmed(e, t, r =
|
|
1754
|
+
onTxConfirmed(e, t, r = 100) {
|
|
1754
1755
|
let a = 0;
|
|
1755
1756
|
const i = setInterval(() => {
|
|
1756
1757
|
a >= r && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
@@ -2001,7 +2002,7 @@ class Br {
|
|
|
2001
2002
|
throw l(a);
|
|
2002
2003
|
}
|
|
2003
2004
|
}
|
|
2004
|
-
onTxConfirmed(e, t, r =
|
|
2005
|
+
onTxConfirmed(e, t, r = 100) {
|
|
2005
2006
|
let a = 0;
|
|
2006
2007
|
const i = setInterval(() => {
|
|
2007
2008
|
a >= r && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
@@ -2316,7 +2317,7 @@ class xr {
|
|
|
2316
2317
|
throw l(t);
|
|
2317
2318
|
}
|
|
2318
2319
|
}
|
|
2319
|
-
onTxConfirmed(e, t, r =
|
|
2320
|
+
onTxConfirmed(e, t, r = 100) {
|
|
2320
2321
|
let a = 0;
|
|
2321
2322
|
const i = setInterval(() => {
|
|
2322
2323
|
a >= r && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
@@ -2607,6 +2608,8 @@ let L = class {
|
|
|
2607
2608
|
async forgeAssetsIfNeeded() {
|
|
2608
2609
|
const e = (t, r) => {
|
|
2609
2610
|
const a = t.data.assetName, i = t.data.metadata, o = t.unit.slice(0, P);
|
|
2611
|
+
if (t.data.label === "777")
|
|
2612
|
+
return i;
|
|
2610
2613
|
if (r && r[o]) {
|
|
2611
2614
|
const { [o]: c, ...u } = r, A = {
|
|
2612
2615
|
[a]: i,
|