@meshsdk/core 1.5.4 → 1.5.6

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.
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:["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+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAA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FQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/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;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const pe=require("nanoid"),Ge=require("@emurgo/cardano-serialization-lib-nodejs"),Re=require("axios"),Kt=require("bip39"),f=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"],fe=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()},F=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","vespr"],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.some(u=>u.input.txHash===c.input.txHash&&u.input.outputIndex===c.input.outputIndex))):[],...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=f.COSEKey.from_bytes(m(t)),i=f.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(f.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(f.Label.new_int(f.Int.new_negative(f.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=f.COSEKey.new(f.Label.from_key_type(f.KeyType.OKP));return e.set_algorithm_id(f.Label.from_algorithm_id(f.AlgorithmId.EdDSA)),e.set_header(f.Label.new_int(f.Int.new_negative(f.BigNum.from_str("1"))),f.CBORValue.new_int(f.Int.new_i32(6))),e.set_header(f.Label.new_int(f.Int.new_negative(f.BigNum.from_str("2"))),f.CBORValue.new_bytes(s.key.to_public().as_bytes())),e},As=(s,e)=>{const t=f.HeaderMap.new(),r=f.HeaderMap.new();t.set_algorithm_id(f.Label.from_algorithm_id(f.AlgorithmId.EdDSA)),t.set_header(f.Label.new_text("address"),f.CBORValue.new_bytes(e.address.to_bytes()));const a=f.Headers.new(f.ProtectedHeaderMap.new(t),r),i=f.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 H={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+CX8gAEGA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Bx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/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(ps)):new(hs("buffer")).Buffer(s,"base64")}function ps(s){return s.charCodeAt(0)}var N=Ee,_=Is(),Y=64,_t=[];H.exports=D;var Jt=H.exports.BYTES_MIN=16,jt=H.exports.BYTES_MAX=64;H.exports.BYTES=32;var Xt=H.exports.KEYBYTES_MIN=16,Zt=H.exports.KEYBYTES_MAX=64;H.exports.KEYBYTES=32;var te=H.exports.SALTBYTES=16,ee=H.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(Y),Y+=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,Y,Y+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"),Y+s.length>_.memory.length&&_.realloc(Y+s.length),_.memory.set(s,Y),_.exports.blake2b_update(this.pointer,Y,Y+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=fs),!_)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 fs(){}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=H.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 O=0;O<I.length;++O){const R=I.charAt(O),p=De[R];if(p===void 0)return"Unknown character "+R;y=at(y)^p,!(O+6>=I.length)&&S.push(p)}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)),T=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)),M=s=>n.Address.from_bech32(s),Ht=s=>n.BaseAddress.from_address(M(s)),Ne=s=>n.EnterpriseAddress.from_address(M(s)),Pe=s=>n.RewardAddress.from_address(M(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(T(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}}},P=s=>{const e=n.TransactionInput.new(Ke(s.input.txHash),s.input.outputIndex),t=n.TransactionOutput.new(M(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,F)))),r=n.MultiAsset.new();t.forEach(i=>{const o=n.Assets.new();s.filter(c=>c.unit.slice(0,F)===i).forEach(c=>{o.insert(n.AssetName.new(m(c.unit.slice(F))),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=P(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=P(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()}`)},pt=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:P(t)).forEach(t=>{e.add_input(t.output().address(),t.input(),t.output().amount())}),e},ft=s=>{if(typeof s=="string")return n.TransactionOutputBuilder.new().with_address(M(s));let e=n.TransactionOutputBuilder.new().with_address(M(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,F),t=s.includes(".")?Q(s.split(".")[1]):s.slice(F);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=M(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=pe.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=fe(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=T(X(e));return pt(t).to_hex()}static withAtLeastNSignatures(e,t){const r=n.NativeScripts.new();e.forEach(i=>{const o=T(X(i));r.add(pt(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=T(X(a));t.add(pt(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=T(X(a));t.add(pt(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(F))),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(T(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(T(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=P(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=P(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(T(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=ft(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=ft(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=ft(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=M(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=>T(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=>P(t)).forEach(t=>{this._txInputsBuilder.add_input(t.output().address(),t.input(),t.output().amount())}),this}setTxRefInputs(e){return e.map(t=>P(t)).forEach(t=>{this._txBuilder.add_reference_input(t.input())}),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=>P(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(T(t))}}async addTxInputsAsNeeded(){if(this.notVisited("setTxInputs")){const e=await this.filterAvailableUTxOs();ye(this._txOutputs,e.map(r=>xt(r))).map(r=>P(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,F);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=ft(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=pe.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=(p,x=[],B=0)=>{var ht,ct,Yt,Lt,qt;if(p===void 0||B>=p.len())return x;const k=p.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(),V=(w==null?void 0:w.kind())===n.StakeCredKind.Key?w.to_keyhash():void 0;V&&U.push(V.to_hex());break}case n.CertificateKind.StakeDelegation:{const w=(ct=k.as_stake_delegation())==null?void 0:ct.stake_credential(),V=(w==null?void 0:w.kind())===n.StakeCredKind.Key?w.to_keyhash():void 0;V&&U.push(V.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 V=0;V<w.len();V+=1){const Gt=w.keys().get(V),Rt=Gt.kind()===n.StakeCredKind.Key?Gt.to_keyhash():void 0;Rt&&U.push(Rt.to_hex())}break}}return u(p,[...x,...U],B+1)},A=(p,x=[],B=0)=>{if(p===void 0||B>=p.len())return x;const k=p.get(B).index(),U=p.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(p,[...x,ht],B+1)},d=(p,x=[],B=0)=>p===void 0||B>=p.len()?x:d(p,[...x,p.get(B).to_hex()],B+1),g=(p,x=[],B=0)=>{if(p===void 0||B>=p.len())return x;const k=p.keys().get(B).payment_cred(),U=k.kind()===n.StakeCredKind.Key?k.to_keyhash():void 0;return g(p,U?[...x,U.to_hex()]:x,B+1)},I=c.certs(),y=c.collateral(),S=c.inputs(),O=c.required_signers(),R=c.withdrawals();return[...u(I),...A(y),...A(S),...d(O),...g(R)]},i=c=>{const u=(d,g=[])=>{var I,y,S,O;if(d)for(let R=0;R<d.len();R+=1){const p=d.get(R);switch(p.kind()){case n.NativeScriptKind.ScriptPubkey:{const x=(I=p.as_script_pubkey())==null?void 0:I.addr_keyhash().to_hex();return x?[...g,x]:g}case n.NativeScriptKind.ScriptAll:return u((y=p.as_script_all())==null?void 0:y.native_scripts(),g);case n.NativeScriptKind.ScriptAny:return u((S=p.as_script_any())==null?void 0:S.native_scripts(),g);case n.NativeScriptKind.ScriptNOfK:return u((O=p.as_script_n_of_k())==null?void 0:O.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))}}getBaseAddress(e=0){return this._wallet.getAccount(e,K).baseAddress}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 M(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=>P(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=M(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,F),a=t.unit.slice(F),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,F)))).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=fe;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
@@ -30,7 +30,7 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
30
30
  }, kt = 2147483648, Et = {
31
31
  V1: n.Language.new_plutus_v1(),
32
32
  V2: n.Language.new_plutus_v2()
33
- }, P = 56, es = {
33
+ }, F = 56, es = {
34
34
  CERT: n.RedeemerTag.new_cert(),
35
35
  MINT: n.RedeemerTag.new_mint(),
36
36
  REWARD: n.RedeemerTag.new_reward(),
@@ -444,11 +444,12 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
444
444
  "nami",
445
445
  "nufi",
446
446
  "gerowallet",
447
- "typhoncip30"
447
+ "typhoncip30",
448
+ "vespr"
448
449
  ], ns = (s, e, t = "5000000") => {
449
450
  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 = us(a);
450
451
  return [
451
- ...i.less_than(r) ? As(r.clamped_sub(i).to_str(), e.filter((c) => !a.map((u) => u.input.txHash).includes(c.input.txHash))) : [],
452
+ ...i.less_than(r) ? As(r.clamped_sub(i).to_str(), e.filter((c) => !a.some((u) => u.input.txHash === c.input.txHash && u.input.outputIndex === c.input.outputIndex))) : [],
452
453
  ...a
453
454
  ];
454
455
  }, ir = (s, e, t = !1, { maxTxSize: r, minFeeA: a, minFeeB: i } = q) => {
@@ -526,25 +527,25 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
526
527
  return i.build(c.to_bytes());
527
528
  };
528
529
  var Xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Se = {}, Q = { exports: {} };
529
- G.notEqual = fs;
530
- G.notOk = ps;
530
+ G.notEqual = ps;
531
+ G.notOk = fs;
531
532
  G.equal = ms;
532
533
  G.ok = G;
533
534
  var Qe = G;
534
535
  function ms(s, e, t) {
535
536
  G(s == e, t);
536
537
  }
537
- function fs(s, e, t) {
538
+ function ps(s, e, t) {
538
539
  G(s != e, t);
539
540
  }
540
- function ps(s, e) {
541
+ function fs(s, e) {
541
542
  G(!s, e);
542
543
  }
543
544
  function G(s, e) {
544
545
  if (!s)
545
546
  throw new Error(e || "AssertionError");
546
547
  }
547
- var T = { exports: {} };
548
+ var M = { exports: {} };
548
549
  function _s(s) {
549
550
  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.');
550
551
  }
@@ -591,41 +592,41 @@ function Cs(s) {
591
592
  function ws(s) {
592
593
  return s.charCodeAt(0);
593
594
  }
594
- var K = Qe, p = ys(), O = 64, Ct = [];
595
- T.exports = D;
596
- var Zt = T.exports.BYTES_MIN = 16, te = T.exports.BYTES_MAX = 64;
597
- T.exports.BYTES = 32;
598
- var ee = T.exports.KEYBYTES_MIN = 16, se = T.exports.KEYBYTES_MAX = 64;
599
- T.exports.KEYBYTES = 32;
600
- var re = T.exports.SALTBYTES = 16, ae = T.exports.PERSONALBYTES = 16;
595
+ var K = Qe, f = ys(), V = 64, Ct = [];
596
+ M.exports = D;
597
+ var Zt = M.exports.BYTES_MIN = 16, te = M.exports.BYTES_MAX = 64;
598
+ M.exports.BYTES = 32;
599
+ var ee = M.exports.KEYBYTES_MIN = 16, se = M.exports.KEYBYTES_MAX = 64;
600
+ M.exports.KEYBYTES = 32;
601
+ var re = M.exports.SALTBYTES = 16, ae = M.exports.PERSONALBYTES = 16;
601
602
  function D(s, e, t, r, a) {
602
603
  if (!(this instanceof D))
603
604
  return new D(s, e, t, r, a);
604
- if (!(p && p.exports))
605
+ if (!(f && f.exports))
605
606
  throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");
606
- s || (s = 32), a !== !0 && (K(s >= Zt, "digestLength must be at least " + Zt + ", was given " + s), K(s <= te, "digestLength must be at most " + te + ", was given " + s), e != null && K(e.length >= ee, "key must be at least " + ee + ", was given " + e.length), e != null && K(e.length <= se, "key must be at least " + se + ", was given " + e.length), t != null && K(t.length === re, "salt must be exactly " + re + ", was given " + t.length), r != null && K(r.length === ae, "personal must be exactly " + ae + ", was given " + r.length)), Ct.length || (Ct.push(O), O += 216), this.digestLength = s, this.finalized = !1, this.pointer = Ct.pop(), p.memory.fill(0, 0, 64), p.memory[0] = this.digestLength, p.memory[1] = e ? e.length : 0, p.memory[2] = 1, p.memory[3] = 1, t && p.memory.set(t, 32), r && p.memory.set(r, 48), this.pointer + 216 > p.memory.length && p.realloc(this.pointer + 216), p.exports.blake2b_init(this.pointer, this.digestLength), e && (this.update(e), p.memory.fill(0, O, O + e.length), p.memory[this.pointer + 200] = 128);
607
+ s || (s = 32), a !== !0 && (K(s >= Zt, "digestLength must be at least " + Zt + ", was given " + s), K(s <= te, "digestLength must be at most " + te + ", was given " + s), e != null && K(e.length >= ee, "key must be at least " + ee + ", was given " + e.length), e != null && K(e.length <= se, "key must be at least " + se + ", was given " + e.length), t != null && K(t.length === re, "salt must be exactly " + re + ", was given " + t.length), r != null && K(r.length === ae, "personal must be exactly " + ae + ", was given " + r.length)), Ct.length || (Ct.push(V), V += 216), this.digestLength = s, this.finalized = !1, this.pointer = Ct.pop(), f.memory.fill(0, 0, 64), f.memory[0] = this.digestLength, f.memory[1] = e ? e.length : 0, f.memory[2] = 1, f.memory[3] = 1, t && f.memory.set(t, 32), r && f.memory.set(r, 48), this.pointer + 216 > f.memory.length && f.realloc(this.pointer + 216), f.exports.blake2b_init(this.pointer, this.digestLength), e && (this.update(e), f.memory.fill(0, V, V + e.length), f.memory[this.pointer + 200] = 128);
607
608
  }
608
609
  D.prototype.update = function(s) {
609
- return K(this.finalized === !1, "Hash instance finalized"), K(s, "input must be TypedArray or Buffer"), O + s.length > p.memory.length && p.realloc(O + s.length), p.memory.set(s, O), p.exports.blake2b_update(this.pointer, O, O + s.length), this;
610
+ return K(this.finalized === !1, "Hash instance finalized"), K(s, "input must be TypedArray or Buffer"), V + s.length > f.memory.length && f.realloc(V + s.length), f.memory.set(s, V), f.exports.blake2b_update(this.pointer, V, V + s.length), this;
610
611
  };
611
612
  D.prototype.digest = function(s) {
612
- if (K(this.finalized === !1, "Hash instance finalized"), this.finalized = !0, Ct.push(this.pointer), p.exports.blake2b_final(this.pointer), !s || s === "binary")
613
- return p.memory.slice(this.pointer + 128, this.pointer + 128 + this.digestLength);
613
+ if (K(this.finalized === !1, "Hash instance finalized"), this.finalized = !0, Ct.push(this.pointer), f.exports.blake2b_final(this.pointer), !s || s === "binary")
614
+ return f.memory.slice(this.pointer + 128, this.pointer + 128 + this.digestLength);
614
615
  if (s === "hex")
615
- return Es(p.memory, this.pointer + 128, this.digestLength);
616
+ return Es(f.memory, this.pointer + 128, this.digestLength);
616
617
  K(s.length >= this.digestLength, "input must be TypedArray or Buffer");
617
618
  for (var e = 0; e < this.digestLength; e++)
618
- s[e] = p.memory[this.pointer + 128 + e];
619
+ s[e] = f.memory[this.pointer + 128 + e];
619
620
  return s;
620
621
  };
621
622
  D.prototype.final = D.prototype.digest;
622
- D.WASM = p && p.buffer;
623
+ D.WASM = f && f.buffer;
623
624
  D.SUPPORTED = typeof WebAssembly < "u";
624
625
  D.ready = function(s) {
625
- if (s || (s = Bs), !p)
626
+ if (s || (s = Bs), !f)
626
627
  return s(new Error("WebAssembly not supported"));
627
628
  var e = new Promise(function(t, r) {
628
- p.onload(function(a) {
629
+ f.onload(function(a) {
629
630
  a ? r() : t(), s(a);
630
631
  });
631
632
  });
@@ -642,7 +643,7 @@ function Es(s, e, t) {
642
643
  function xs(s) {
643
644
  return s < 16 ? "0" + s.toString(16) : s.toString(16);
644
645
  }
645
- var J = Qe, lt = T.exports;
646
+ var J = Qe, lt = M.exports;
646
647
  function mt(s, e, t) {
647
648
  var r = s[e] + s[t], a = s[e + 1] + s[t + 1];
648
649
  r >= 4294967296 && a++, s[e] = r, s[e + 1] = a;
@@ -1114,11 +1115,11 @@ function Ne(s) {
1114
1115
  if (typeof _ == "string")
1115
1116
  return _;
1116
1117
  const x = [];
1117
- for (let M = 0; M < I.length; ++M) {
1118
- const R = I.charAt(M), f = Ke[R];
1119
- if (f === void 0)
1118
+ for (let H = 0; H < I.length; ++H) {
1119
+ const R = I.charAt(H), p = Ke[R];
1120
+ if (p === void 0)
1120
1121
  return "Unknown character " + R;
1121
- _ = rt(_) ^ f, !(M + 6 >= I.length) && x.push(f);
1122
+ _ = rt(_) ^ p, !(H + 6 >= I.length) && x.push(p);
1122
1123
  }
1123
1124
  return _ !== e ? "Invalid checksum for " + o : { prefix: g, words: x };
1124
1125
  }
@@ -1148,7 +1149,7 @@ var Ks = Xt && Xt.__importDefault || function(s) {
1148
1149
  return s && s.__esModule ? s : { default: s };
1149
1150
  };
1150
1151
  Object.defineProperty(Se, "__esModule", { value: !0 });
1151
- const Ns = Ks(Q.exports), ft = nt, Ut = "asset";
1152
+ const Ns = Ks(Q.exports), pt = nt, Ut = "asset";
1152
1153
  class gt {
1153
1154
  constructor(e) {
1154
1155
  this.hashBuf = e;
@@ -1161,15 +1162,15 @@ class gt {
1161
1162
  return gt.fromHash(r);
1162
1163
  }
1163
1164
  static fromBech32(e) {
1164
- const { prefix: t, words: r } = ft.bech32.decode(e);
1165
+ const { prefix: t, words: r } = pt.bech32.decode(e);
1165
1166
  if (t !== Ut)
1166
1167
  throw new Error("Invalid asset fingerprint");
1167
- const a = Buffer.from(ft.bech32.fromWords(r));
1168
+ const a = Buffer.from(pt.bech32.fromWords(r));
1168
1169
  return gt.fromHash(a);
1169
1170
  }
1170
1171
  fingerprint() {
1171
- const e = ft.bech32.toWords(this.hashBuf);
1172
- return ft.bech32.encode(Ut, e);
1172
+ const e = pt.bech32.toWords(this.hashBuf);
1173
+ return pt.bech32.encode(Ut, e);
1173
1174
  }
1174
1175
  hash() {
1175
1176
  return Buffer.from(this.hashBuf).toString("hex");
@@ -1185,7 +1186,7 @@ var Ps = Se.default = gt;
1185
1186
  const Fs = Ps, Ts = (s, e) => {
1186
1187
  const t = Ms(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();
1187
1188
  return r.free(), t.free(), { paymentKey: a, stakeKey: i };
1188
- }, et = (s) => n.Address.from_bytes(m(s)), Ms = (s) => n.Bip32PrivateKey.from_bytes(m(s)), Hs = (s) => n.DataHash.from_bytes(m(s)), N = (s) => n.Ed25519KeyHash.from_bytes(m(s)), Os = (s) => n.Ed25519Signature.from_bytes(m(s)), bt = (s) => n.NativeScript.from_bytes(m(s)), Vs = (s) => n.PublicKey.from_bytes(m(s)), Pe = (s) => n.PlutusData.from_bytes(m(s)), it = (s, e) => n.PlutusScript.from_bytes_with_version(m(s), Et[e]), Ys = (s) => n.ScriptRef.from_bytes(m(s)), qs = (s) => n.ScriptHash.from_bytes(m(s)), Y = (s) => n.Transaction.from_bytes(m(s)), Fe = (s) => n.TransactionHash.from_bytes(m(s)), le = (s) => n.TransactionUnspentOutput.from_bytes(m(s)), Gs = (s) => n.TransactionWitnessSet.from_bytes(m(s)), Ls = (s) => n.Value.from_bytes(m(s)), F = (s) => n.Address.from_bech32(s), Vt = (s) => n.BaseAddress.from_address(F(s)), Te = (s) => n.EnterpriseAddress.from_address(F(s)), Me = (s) => n.RewardAddress.from_address(F(s)), b = (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"), Dt = (s) => {
1189
+ }, et = (s) => n.Address.from_bytes(m(s)), Ms = (s) => n.Bip32PrivateKey.from_bytes(m(s)), Hs = (s) => n.DataHash.from_bytes(m(s)), P = (s) => n.Ed25519KeyHash.from_bytes(m(s)), Os = (s) => n.Ed25519Signature.from_bytes(m(s)), bt = (s) => n.NativeScript.from_bytes(m(s)), Vs = (s) => n.PublicKey.from_bytes(m(s)), Pe = (s) => n.PlutusData.from_bytes(m(s)), it = (s, e) => n.PlutusScript.from_bytes_with_version(m(s), Et[e]), Ys = (s) => n.ScriptRef.from_bytes(m(s)), qs = (s) => n.ScriptHash.from_bytes(m(s)), Y = (s) => n.Transaction.from_bytes(m(s)), Fe = (s) => n.TransactionHash.from_bytes(m(s)), le = (s) => n.TransactionUnspentOutput.from_bytes(m(s)), Gs = (s) => n.TransactionWitnessSet.from_bytes(m(s)), Ls = (s) => n.Value.from_bytes(m(s)), T = (s) => n.Address.from_bech32(s), Vt = (s) => n.BaseAddress.from_address(T(s)), Te = (s) => n.EnterpriseAddress.from_address(T(s)), Me = (s) => n.RewardAddress.from_address(T(s)), b = (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"), Dt = (s) => {
1189
1190
  const e = (t) => {
1190
1191
  const r = new Array();
1191
1192
  for (let a = 0; a < t.len(); a += 1)
@@ -1258,7 +1259,7 @@ const Fs = Ps, Ts = (s, e) => {
1258
1259
  case "before":
1259
1260
  return n.NativeScript.new_timelock_expiry(n.TimelockExpiry.new_timelockexpiry(n.BigNum.from_str(s.slot)));
1260
1261
  case "sig":
1261
- return n.NativeScript.new_script_pubkey(n.ScriptPubkey.new(N(s.keyHash)));
1262
+ return n.NativeScript.new_script_pubkey(n.ScriptPubkey.new(P(s.keyHash)));
1262
1263
  }
1263
1264
  }, wt = (s) => {
1264
1265
  var r, a, i;
@@ -1367,8 +1368,8 @@ const Fs = Ps, Ts = (s, e) => {
1367
1368
  scriptRef: r
1368
1369
  }
1369
1370
  };
1370
- }, V = (s) => {
1371
- const e = n.TransactionInput.new(Fe(s.input.txHash), s.input.outputIndex), t = n.TransactionOutput.new(F(s.output.address), Bt(s.output.amount));
1371
+ }, N = (s) => {
1372
+ const e = n.TransactionInput.new(Fe(s.input.txHash), s.input.outputIndex), t = n.TransactionOutput.new(T(s.output.address), Bt(s.output.amount));
1372
1373
  return s.output.dataHash !== void 0 && t.set_data_hash(Hs(s.output.dataHash)), s.output.plutusData !== void 0 && t.set_plutus_data(Pe(s.output.plutusData)), s.output.scriptRef !== void 0 && t.set_script_ref(Ys(s.output.scriptRef)), n.TransactionUnspentOutput.new(e, t);
1373
1374
  }, he = (s) => {
1374
1375
  const e = s.split(".")[1] ?? "0", t = `${parseInt(e, 10)}`, r = "1" + "0".repeat(e.length);
@@ -1392,11 +1393,11 @@ const Fs = Ps, Ts = (s, e) => {
1392
1393
  }
1393
1394
  return e;
1394
1395
  }, Bt = (s) => {
1395
- 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, P)))), r = n.MultiAsset.new();
1396
+ 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, F)))), r = n.MultiAsset.new();
1396
1397
  t.forEach((i) => {
1397
1398
  const o = n.Assets.new();
1398
- s.filter((c) => c.unit.slice(0, P) === i).forEach((c) => {
1399
- o.insert(n.AssetName.new(m(c.unit.slice(P))), n.BigNum.from_str(c.quantity));
1399
+ s.filter((c) => c.unit.slice(0, F) === i).forEach((c) => {
1400
+ o.insert(n.AssetName.new(m(c.unit.slice(F))), n.BigNum.from_str(c.quantity));
1400
1401
  }), r.insert(qs(i), o);
1401
1402
  });
1402
1403
  const a = n.Value.new(n.BigNum.from_str(e ? e.quantity : "0"));
@@ -1404,11 +1405,11 @@ const Fs = Ps, Ts = (s, e) => {
1404
1405
  }, Ie = (s, e, t) => n.BaseAddress.new(s, n.StakeCredential.from_keyhash(e), n.StakeCredential.from_keyhash(t)), Ye = (s, e = "") => n.Bip32PrivateKey.from_bip39_entropy(m(s), m(S(e))), me = (s) => n.DataCost.new_coins_per_byte(n.BigNum.from_str(s)), zs = (s) => {
1405
1406
  if (typeof s != "object" || !("input" in s))
1406
1407
  return n.DatumSource.new(Z(s));
1407
- const e = V(s);
1408
+ const e = N(s);
1408
1409
  if (e.output().has_plutus_data())
1409
1410
  return n.DatumSource.new_ref_input(e.input());
1410
1411
  throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`);
1411
- }, fe = (s, e) => n.EnterpriseAddress.new(s, n.StakeCredential.from_keyhash(e)), pe = (s, e) => {
1412
+ }, pe = (s, e) => n.EnterpriseAddress.new(s, n.StakeCredential.from_keyhash(e)), fe = (s, e) => {
1412
1413
  if (typeof s == "string")
1413
1414
  return n.MintWitness.new_native_script(bt(s));
1414
1415
  if (e === void 0)
@@ -1428,7 +1429,7 @@ const Fs = Ps, Ts = (s, e) => {
1428
1429
  }, Pt = (s, e) => n.RewardAddress.new(s, n.StakeCredential.from_keyhash(e)), qe = (s) => {
1429
1430
  if ("code" in s)
1430
1431
  return n.PlutusScriptSource.new(it(s.code, s.version));
1431
- const e = V(s);
1432
+ const e = N(s);
1432
1433
  if (e.output().has_script_ref()) {
1433
1434
  const t = e.output().script_ref();
1434
1435
  if (t.is_plutus_script()) {
@@ -1437,7 +1438,7 @@ const Fs = Ps, Ts = (s, e) => {
1437
1438
  }
1438
1439
  }
1439
1440
  throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`);
1440
- }, pt = (s) => {
1441
+ }, ft = (s) => {
1441
1442
  const e = n.ScriptPubkey.new(s);
1442
1443
  return n.NativeScript.new_script_pubkey(e);
1443
1444
  }, Js = (s = q) => {
@@ -1445,13 +1446,13 @@ const Fs = Ps, Ts = (s, e) => {
1445
1446
  return n.TransactionBuilder.new(e);
1446
1447
  }, _e = (s) => {
1447
1448
  const e = n.TxInputsBuilder.new();
1448
- return s.map((t) => t instanceof n.TransactionUnspentOutput ? t : V(t)).forEach((t) => {
1449
+ return s.map((t) => t instanceof n.TransactionUnspentOutput ? t : N(t)).forEach((t) => {
1449
1450
  e.add_input(t.output().address(), t.input(), t.output().amount());
1450
1451
  }), e;
1451
1452
  }, _t = (s) => {
1452
1453
  if (typeof s == "string")
1453
- return n.TransactionOutputBuilder.new().with_address(F(s));
1454
- let e = n.TransactionOutputBuilder.new().with_address(F(s.address));
1454
+ return n.TransactionOutputBuilder.new().with_address(T(s));
1455
+ let e = n.TransactionOutputBuilder.new().with_address(T(s.address));
1455
1456
  if (s.datum) {
1456
1457
  const { value: t, inline: r } = s.datum, a = Z(t);
1457
1458
  e = e.with_data_hash(n.hash_plutus_data(a)), r && (e = e.with_plutus_data(a));
@@ -1462,7 +1463,7 @@ const Fs = Ps, Ts = (s, e) => {
1462
1463
  }
1463
1464
  return e;
1464
1465
  }, ot = (s) => {
1465
- const e = s.slice(0, P), t = s.includes(".") ? S(s.split(".")[1]) : s.slice(P);
1466
+ const e = s.slice(0, F), t = s.includes(".") ? S(s.split(".")[1]) : s.slice(F);
1466
1467
  return { policyId: e, assetName: t };
1467
1468
  }, l = (s) => j.isAxiosError(s) ? s.response ? JSON.stringify({
1468
1469
  data: s.response.data,
@@ -1505,7 +1506,7 @@ const Fs = Ps, Ts = (s, e) => {
1505
1506
  }, hr = (s) => n.Ed25519KeyHash.from_hex(s).to_bech32("pool1"), Ir = (s) => {
1506
1507
  const e = Ce(s.join(" ")), t = Ye(e), r = t.to_bech32();
1507
1508
  return t.free(), r;
1508
- }, mr = (s) => ht(s).to_hex(), fr = (s, e = Date.now()) => {
1509
+ }, mr = (s) => ht(s).to_hex(), pr = (s, e = Date.now()) => {
1509
1510
  if (xt[s]) {
1510
1511
  const [t, r, a] = xt[s];
1511
1512
  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();
@@ -1513,7 +1514,7 @@ const Fs = Ps, Ts = (s, e) => {
1513
1514
  throw new Error(`Couldn't resolve SlotNo for network: ${s}`);
1514
1515
  }, qt = (s) => {
1515
1516
  try {
1516
- const e = F(s), t = Vt(s), r = t == null ? void 0 : t.stake_cred().to_keyhash();
1517
+ const e = T(s), t = Vt(s), r = t == null ? void 0 : t.stake_cred().to_keyhash();
1517
1518
  if (r !== void 0)
1518
1519
  return Pt(e.network_id(), r).to_address().to_bech32();
1519
1520
  throw new Error(`Couldn't resolve reward address from address: ${s}`);
@@ -1536,7 +1537,7 @@ const Fs = Ps, Ts = (s, e) => {
1536
1537
  }, Ge = (s, e = q.minFeeA, t = q.minFeeB) => (BigInt(e) * BigInt(s) + BigInt(t)).toString(), js = (s) => {
1537
1538
  const e = Y(s).body();
1538
1539
  return n.hash_transaction(e).to_hex();
1539
- }, pr = (s = "", e = 32) => {
1540
+ }, fr = (s = "", e = 32) => {
1540
1541
  if (e <= 0 || e > 2048)
1541
1542
  throw new Error("Length must be bewteen 1 and 2048");
1542
1543
  const r = ye("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);
@@ -2344,14 +2345,14 @@ class xr {
2344
2345
  }
2345
2346
  class Sr {
2346
2347
  static withOneSignature(e) {
2347
- const t = N(st(e));
2348
- return pt(t).to_hex();
2348
+ const t = P(st(e));
2349
+ return ft(t).to_hex();
2349
2350
  }
2350
2351
  static withAtLeastNSignatures(e, t) {
2351
2352
  const r = n.NativeScripts.new();
2352
2353
  e.forEach((i) => {
2353
- const o = N(st(i));
2354
- r.add(pt(o));
2354
+ const o = P(st(i));
2355
+ r.add(ft(o));
2355
2356
  });
2356
2357
  const a = n.ScriptNOfK.new(t, r);
2357
2358
  return n.NativeScript.new_script_any(a).to_hex();
@@ -2359,8 +2360,8 @@ class Sr {
2359
2360
  static withAnySignature(e) {
2360
2361
  const t = n.NativeScripts.new();
2361
2362
  e.forEach((a) => {
2362
- const i = N(st(a));
2363
- t.add(pt(i));
2363
+ const i = P(st(a));
2364
+ t.add(ft(i));
2364
2365
  });
2365
2366
  const r = n.ScriptAny.new(t);
2366
2367
  return n.NativeScript.new_script_any(r).to_hex();
@@ -2368,8 +2369,8 @@ class Sr {
2368
2369
  static withAllSignatures(e) {
2369
2370
  const t = n.NativeScripts.new();
2370
2371
  e.forEach((a) => {
2371
- const i = N(st(a));
2372
- t.add(pt(i));
2372
+ const i = P(st(a));
2373
+ t.add(ft(i));
2373
2374
  });
2374
2375
  const r = n.ScriptAll.new(t);
2375
2376
  return n.NativeScript.new_script_any(r).to_hex();
@@ -2447,14 +2448,14 @@ let L = class {
2447
2448
  }
2448
2449
  burnAsset(e, t, r) {
2449
2450
  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;
2450
- return this._mintBuilder.add_asset(pe(e, r), n.AssetName.new(m(t.unit.slice(P))), n.Int.new_negative(n.BigNum.from_str(t.quantity))), this._totalBurns.set(t.unit, a), this;
2451
+ return this._mintBuilder.add_asset(fe(e, r), n.AssetName.new(m(t.unit.slice(F))), n.Int.new_negative(n.BigNum.from_str(t.quantity))), this._totalBurns.set(t.unit, a), this;
2451
2452
  }
2452
2453
  delegateStake(e, t) {
2453
- const r = n.Certificate.new_stake_delegation(n.StakeDelegation.new(n.StakeCredential.from_keyhash(N(At(e))), n.Ed25519KeyHash.from_bech32(t)));
2454
+ const r = n.Certificate.new_stake_delegation(n.StakeDelegation.new(n.StakeCredential.from_keyhash(P(At(e))), n.Ed25519KeyHash.from_bech32(t)));
2454
2455
  return this._txCertificates.add(r), this;
2455
2456
  }
2456
2457
  deregisterStake(e) {
2457
- const t = n.Certificate.new_stake_deregistration(n.StakeDeregistration.new(n.StakeCredential.from_keyhash(N(At(e)))));
2458
+ const t = n.Certificate.new_stake_deregistration(n.StakeDeregistration.new(n.StakeCredential.from_keyhash(P(At(e)))));
2458
2459
  return this._txCertificates.add(t), this;
2459
2460
  }
2460
2461
  mintAsset(e, t, r) {
@@ -2468,7 +2469,7 @@ let L = class {
2468
2469
  }, i = (g) => {
2469
2470
  if ("code" in g)
2470
2471
  return it(g.code, g.version);
2471
- const I = V(g);
2472
+ const I = N(g);
2472
2473
  if (I.output().has_script_ref()) {
2473
2474
  const _ = I.output().script_ref();
2474
2475
  if (_.is_plutus_script()) {
@@ -2478,7 +2479,7 @@ let L = class {
2478
2479
  }
2479
2480
  throw new Error(`No plutus script reference found in UTxO: ${I.input().transaction_id().to_hex()}`);
2480
2481
  }, 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));
2481
- return this._mintBuilder.add_asset(pe(e, r), n.AssetName.new(m(S(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, {
2482
+ return this._mintBuilder.add_asset(fe(e, r), n.AssetName.new(m(S(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, {
2482
2483
  ...t,
2483
2484
  assetQuantity: u.to_str()
2484
2485
  }), this;
@@ -2493,11 +2494,11 @@ let L = class {
2493
2494
  fields: []
2494
2495
  },
2495
2496
  ...e.redeemer
2496
- }, r = V(e.value), a = n.PlutusWitness.new_with_ref(qe(e.script), zs(e.datum), He(t));
2497
+ }, r = N(e.value), a = n.PlutusWitness.new_with_ref(qe(e.script), zs(e.datum), He(t));
2497
2498
  return this._txInputsBuilder.add_plutus_script_input(a, r.input(), r.output().amount()), this;
2498
2499
  }
2499
2500
  registerStake(e) {
2500
- const t = n.Certificate.new_stake_registration(n.StakeRegistration.new(n.StakeCredential.from_keyhash(N(At(e)))));
2501
+ const t = n.Certificate.new_stake_registration(n.StakeRegistration.new(n.StakeCredential.from_keyhash(P(At(e)))));
2501
2502
  return this._txCertificates.add(t), this;
2502
2503
  }
2503
2504
  registerPool(e) {
@@ -2537,7 +2538,7 @@ let L = class {
2537
2538
  }), this._txBuilder.add_output(i), this;
2538
2539
  }
2539
2540
  setChangeAddress(e) {
2540
- return this._changeAddress = F(e), this;
2541
+ return this._changeAddress = T(e), this;
2541
2542
  }
2542
2543
  setCollateral(e) {
2543
2544
  const t = _e(e);
@@ -2547,7 +2548,7 @@ let L = class {
2547
2548
  return this._txBuilder.add_json_metadatum_with_schema(n.BigNum.from_str(e.toString()), JSON.stringify(t), n.MetadataJsonSchema.NoConversions), this;
2548
2549
  }
2549
2550
  setRequiredSigners(e) {
2550
- return Array.from(new Set(e.map((r) => r.startsWith("addr") ? st(r) : At(r)).map((r) => N(r)))).forEach((r) => {
2551
+ return Array.from(new Set(e.map((r) => r.startsWith("addr") ? st(r) : At(r)).map((r) => P(r)))).forEach((r) => {
2551
2552
  this._txBuilder.add_required_signer(r);
2552
2553
  }), this;
2553
2554
  }
@@ -2558,10 +2559,15 @@ let L = class {
2558
2559
  return this._txBuilder.set_ttl_bignum(n.BigNum.from_str(e)), this;
2559
2560
  }
2560
2561
  setTxInputs(e) {
2561
- return e.map((t) => V(t)).forEach((t) => {
2562
+ return e.map((t) => N(t)).forEach((t) => {
2562
2563
  this._txInputsBuilder.add_input(t.output().address(), t.input(), t.output().amount());
2563
2564
  }), this;
2564
2565
  }
2566
+ setTxRefInputs(e) {
2567
+ return e.map((t) => N(t)).forEach((t) => {
2568
+ this._txBuilder.add_reference_input(t.input());
2569
+ }), this;
2570
+ }
2565
2571
  withdrawRewards(e, t) {
2566
2572
  const r = Me(e);
2567
2573
  return r !== void 0 && this._txWithdrawals.insert(r, n.BigNum.from_str(t)), this;
@@ -2569,7 +2575,7 @@ let L = class {
2569
2575
  async addBurnInputsIfNeeded() {
2570
2576
  if (this._initiator && this._totalBurns.size > 0 && this.notVisited("setTxInputs")) {
2571
2577
  const e = await this._initiator.getUsedUTxOs();
2572
- is(this._totalBurns, e.map((r) => Qt(r))).map((r) => V(r)).forEach((r) => {
2578
+ is(this._totalBurns, e.map((r) => Qt(r))).map((r) => N(r)).forEach((r) => {
2573
2579
  this._txInputsBuilder.add_input(r.output().address(), r.input(), r.output().amount());
2574
2580
  });
2575
2581
  }
@@ -2590,13 +2596,13 @@ let L = class {
2590
2596
  async addRequiredSignersIfNeeded() {
2591
2597
  if (this._initiator && this.notVisited("setRequiredSigners")) {
2592
2598
  const e = await this._initiator.getUsedAddress(), t = st(e.to_bech32());
2593
- this._txBuilder.add_required_signer(N(t));
2599
+ this._txBuilder.add_required_signer(P(t));
2594
2600
  }
2595
2601
  }
2596
2602
  async addTxInputsAsNeeded() {
2597
2603
  if (this.notVisited("setTxInputs")) {
2598
2604
  const e = await this.filterAvailableUTxOs();
2599
- ns(this._txOutputs, e.map((r) => Qt(r))).map((r) => V(r)).forEach((r) => {
2605
+ ns(this._txOutputs, e.map((r) => Qt(r))).map((r) => N(r)).forEach((r) => {
2600
2606
  this._txInputsBuilder.add_input(r.output().address(), r.input(), r.output().amount());
2601
2607
  });
2602
2608
  }
@@ -2607,7 +2613,7 @@ let L = class {
2607
2613
  }
2608
2614
  async forgeAssetsIfNeeded() {
2609
2615
  const e = (t, r) => {
2610
- const a = t.data.assetName, i = t.data.metadata, o = t.unit.slice(0, P);
2616
+ const a = t.data.assetName, i = t.data.metadata, o = t.unit.slice(0, F);
2611
2617
  if (t.data.label === "777")
2612
2618
  return i;
2613
2619
  if (r && r[o]) {
@@ -2690,7 +2696,7 @@ class C {
2690
2696
  }
2691
2697
  getAccount(e, t) {
2692
2698
  return this.accountContext(e, t, (r, a) => {
2693
- const i = Ie(this._networkId, r.to_public().hash(), a.to_public().hash()).to_address().to_bech32(), o = fe(this._networkId, r.to_public().hash()).to_address().to_bech32(), c = Pt(this._networkId, a.to_public().hash()).to_address().to_bech32();
2699
+ const i = Ie(this._networkId, r.to_public().hash(), a.to_public().hash()).to_address().to_bech32(), o = pe(this._networkId, r.to_public().hash()).to_address().to_bech32(), c = Pt(this._networkId, a.to_public().hash()).to_address().to_bech32();
2694
2700
  return {
2695
2701
  baseAddress: i,
2696
2702
  enterpriseAddress: o,
@@ -2762,7 +2768,7 @@ class C {
2762
2768
  static resolveAddress(e, t, r, a) {
2763
2769
  const i = [
2764
2770
  Ie(e, r.to_public().hash(), a.to_public().hash()),
2765
- fe(e, r.to_public().hash()),
2771
+ pe(e, r.to_public().hash()),
2766
2772
  Pt(e, a.to_public().hash())
2767
2773
  ].find((o) => o.to_address().to_bech32() === t);
2768
2774
  if (i !== void 0)
@@ -2782,20 +2788,20 @@ class C {
2782
2788
  }
2783
2789
  static resolveSigners(e, t, r) {
2784
2790
  const a = (c) => {
2785
- const u = (f, E = [], w = 0) => {
2791
+ const u = (p, E = [], w = 0) => {
2786
2792
  var It, ct, Gt, Lt, Rt;
2787
- if (f === void 0 || w >= f.len())
2793
+ if (p === void 0 || w >= p.len())
2788
2794
  return E;
2789
- const v = f.get(w), k = new Array();
2795
+ const v = p.get(w), k = new Array();
2790
2796
  switch (v.kind()) {
2791
2797
  case n.CertificateKind.StakeDeregistration: {
2792
- const y = (It = v.as_stake_deregistration()) == null ? void 0 : It.stake_credential(), H = (y == null ? void 0 : y.kind()) === n.StakeCredKind.Key ? y.to_keyhash() : void 0;
2793
- H && k.push(H.to_hex());
2798
+ const y = (It = v.as_stake_deregistration()) == null ? void 0 : It.stake_credential(), O = (y == null ? void 0 : y.kind()) === n.StakeCredKind.Key ? y.to_keyhash() : void 0;
2799
+ O && k.push(O.to_hex());
2794
2800
  break;
2795
2801
  }
2796
2802
  case n.CertificateKind.StakeDelegation: {
2797
- const y = (ct = v.as_stake_delegation()) == null ? void 0 : ct.stake_credential(), H = (y == null ? void 0 : y.kind()) === n.StakeCredKind.Key ? y.to_keyhash() : void 0;
2798
- H && k.push(H.to_hex());
2803
+ const y = (ct = v.as_stake_delegation()) == null ? void 0 : ct.stake_credential(), O = (y == null ? void 0 : y.kind()) === n.StakeCredKind.Key ? y.to_keyhash() : void 0;
2804
+ O && k.push(O.to_hex());
2799
2805
  break;
2800
2806
  }
2801
2807
  case n.CertificateKind.PoolRegistration: {
@@ -2811,49 +2817,49 @@ class C {
2811
2817
  case n.CertificateKind.MoveInstantaneousRewardsCert: {
2812
2818
  const y = (Rt = v.as_move_instantaneous_rewards_cert()) == null ? void 0 : Rt.move_instantaneous_reward().as_to_stake_creds();
2813
2819
  if (y)
2814
- for (let H = 0; H < y.len(); H += 1) {
2815
- const $t = y.keys().get(H), zt = $t.kind() === n.StakeCredKind.Key ? $t.to_keyhash() : void 0;
2820
+ for (let O = 0; O < y.len(); O += 1) {
2821
+ const $t = y.keys().get(O), zt = $t.kind() === n.StakeCredKind.Key ? $t.to_keyhash() : void 0;
2816
2822
  zt && k.push(zt.to_hex());
2817
2823
  }
2818
2824
  break;
2819
2825
  }
2820
2826
  }
2821
- return u(f, [...E, ...k], w + 1);
2822
- }, A = (f, E = [], w = 0) => {
2823
- if (f === void 0 || w >= f.len())
2827
+ return u(p, [...E, ...k], w + 1);
2828
+ }, A = (p, E = [], w = 0) => {
2829
+ if (p === void 0 || w >= p.len())
2824
2830
  return E;
2825
- const v = f.get(w).index(), k = f.get(w).transaction_id(), It = t.find((ct) => ct.input.outputIndex === v && ct.input.txHash === k.to_hex()) !== void 0 ? r : "OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";
2826
- return A(f, [...E, It], w + 1);
2827
- }, d = (f, E = [], w = 0) => f === void 0 || w >= f.len() ? E : d(f, [...E, f.get(w).to_hex()], w + 1), g = (f, E = [], w = 0) => {
2828
- if (f === void 0 || w >= f.len())
2831
+ const v = p.get(w).index(), k = p.get(w).transaction_id(), It = t.find((ct) => ct.input.outputIndex === v && ct.input.txHash === k.to_hex()) !== void 0 ? r : "OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";
2832
+ return A(p, [...E, It], w + 1);
2833
+ }, d = (p, E = [], w = 0) => p === void 0 || w >= p.len() ? E : d(p, [...E, p.get(w).to_hex()], w + 1), g = (p, E = [], w = 0) => {
2834
+ if (p === void 0 || w >= p.len())
2829
2835
  return E;
2830
- const v = f.keys().get(w).payment_cred(), k = v.kind() === n.StakeCredKind.Key ? v.to_keyhash() : void 0;
2831
- return g(f, k ? [...E, k.to_hex()] : E, w + 1);
2832
- }, I = c.certs(), _ = c.collateral(), x = c.inputs(), M = c.required_signers(), R = c.withdrawals();
2836
+ const v = p.keys().get(w).payment_cred(), k = v.kind() === n.StakeCredKind.Key ? v.to_keyhash() : void 0;
2837
+ return g(p, k ? [...E, k.to_hex()] : E, w + 1);
2838
+ }, I = c.certs(), _ = c.collateral(), x = c.inputs(), H = c.required_signers(), R = c.withdrawals();
2833
2839
  return [
2834
2840
  ...u(I),
2835
2841
  ...A(_),
2836
2842
  ...A(x),
2837
- ...d(M),
2843
+ ...d(H),
2838
2844
  ...g(R)
2839
2845
  ];
2840
2846
  }, i = (c) => {
2841
2847
  const u = (d, g = []) => {
2842
- var I, _, x, M;
2848
+ var I, _, x, H;
2843
2849
  if (d)
2844
2850
  for (let R = 0; R < d.len(); R += 1) {
2845
- const f = d.get(R);
2846
- switch (f.kind()) {
2851
+ const p = d.get(R);
2852
+ switch (p.kind()) {
2847
2853
  case n.NativeScriptKind.ScriptPubkey: {
2848
- const E = (I = f.as_script_pubkey()) == null ? void 0 : I.addr_keyhash().to_hex();
2854
+ const E = (I = p.as_script_pubkey()) == null ? void 0 : I.addr_keyhash().to_hex();
2849
2855
  return E ? [...g, E] : g;
2850
2856
  }
2851
2857
  case n.NativeScriptKind.ScriptAll:
2852
- return u((_ = f.as_script_all()) == null ? void 0 : _.native_scripts(), g);
2858
+ return u((_ = p.as_script_all()) == null ? void 0 : _.native_scripts(), g);
2853
2859
  case n.NativeScriptKind.ScriptAny:
2854
- return u((x = f.as_script_any()) == null ? void 0 : x.native_scripts(), g);
2860
+ return u((x = p.as_script_any()) == null ? void 0 : x.native_scripts(), g);
2855
2861
  case n.NativeScriptKind.ScriptNOfK:
2856
- return u((M = f.as_script_n_of_k()) == null ? void 0 : M.native_scripts(), g);
2862
+ return u((H = p.as_script_n_of_k()) == null ? void 0 : H.native_scripts(), g);
2857
2863
  }
2858
2864
  }
2859
2865
  return g;
@@ -2885,6 +2891,9 @@ class br {
2885
2891
  this._wallet = new C(e.networkId, C.encryptSigningKeys(e.key.payment, e.key.stake ?? "f0".repeat(34), U));
2886
2892
  }
2887
2893
  }
2894
+ getBaseAddress(e = 0) {
2895
+ return this._wallet.getAccount(e, U).baseAddress;
2896
+ }
2888
2897
  getPaymentAddress(e = 0) {
2889
2898
  return this._wallet.getAccount(e, U).enterpriseAddress;
2890
2899
  }
@@ -2893,14 +2902,14 @@ class br {
2893
2902
  }
2894
2903
  getUsedAddress(e = 0) {
2895
2904
  const t = this._wallet.getAccount(e, U);
2896
- return F(t.enterpriseAddress);
2905
+ return T(t.enterpriseAddress);
2897
2906
  }
2898
2907
  getUsedCollateral(e = q.maxCollateralInputs) {
2899
2908
  throw new Error("getUsedCollateral not implemented.");
2900
2909
  }
2901
2910
  async getUsedUTxOs(e = 0) {
2902
2911
  const t = this._wallet.getAccount(e, U);
2903
- return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((a) => V(a));
2912
+ return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((a) => N(a));
2904
2913
  }
2905
2914
  signData(e, t, r = 0) {
2906
2915
  try {
@@ -2973,7 +2982,7 @@ class Ft {
2973
2982
  return (await this.getUsedUTxOs()).map((t) => Qt(t));
2974
2983
  }
2975
2984
  signData(e, t) {
2976
- const r = F(e).to_hex();
2985
+ const r = T(e).to_hex();
2977
2986
  return this._walletInstance.signData(r, S(t));
2978
2987
  }
2979
2988
  async signTx(e, t = !1) {
@@ -2999,7 +3008,7 @@ class Ft {
2999
3008
  }
3000
3009
  async getAssets() {
3001
3010
  return (await this.getBalance()).filter((t) => t.unit !== "lovelace").map((t) => {
3002
- const r = t.unit.slice(0, P), a = t.unit.slice(P), i = Ws(r, a);
3011
+ const r = t.unit.slice(0, F), a = t.unit.slice(F), i = Ws(r, a);
3003
3012
  return {
3004
3013
  unit: t.unit,
3005
3014
  policyId: r,
@@ -3018,7 +3027,7 @@ class Ft {
3018
3027
  }
3019
3028
  async getPolicyIds() {
3020
3029
  const e = await this.getBalance();
3021
- return Array.from(new Set(e.map((t) => t.unit.slice(0, P)))).filter((t) => t !== "lovelace");
3030
+ return Array.from(new Set(e.map((t) => t.unit.slice(0, F)))).filter((t) => t !== "lovelace");
3022
3031
  }
3023
3032
  static resolveInstance(e) {
3024
3033
  if (window.cardano === void 0)
@@ -3105,7 +3114,7 @@ export {
3105
3114
  xr as TangoProvider,
3106
3115
  L as Transaction,
3107
3116
  or as checkSignature,
3108
- pr as generateNonce,
3117
+ fr as generateNonce,
3109
3118
  ts as isNetwork,
3110
3119
  ns as keepRelevant,
3111
3120
  ir as largestFirst,
@@ -3126,7 +3135,7 @@ export {
3126
3135
  Ir as resolvePrivateKey,
3127
3136
  qt as resolveRewardAddress,
3128
3137
  mr as resolveScriptRef,
3129
- fr as resolveSlotNo,
3138
+ pr as resolveSlotNo,
3130
3139
  At as resolveStakeKeyHash,
3131
3140
  Ge as resolveTxFees,
3132
3141
  js as resolveTxHash
@@ -121,6 +121,13 @@ export declare class Transaction {
121
121
  * @returns {Transaction} The transaction.
122
122
  */
123
123
  setTxInputs(inputs: UTxO[]): Transaction;
124
+ /**
125
+ * Sets the reference inputs for the transaction.
126
+ *
127
+ * @param {UTxO[]} inputs The reference inputs to set.
128
+ * @returns {Transaction} The transaction.
129
+ */
130
+ setTxRefInputs(inputs: UTxO[]): Transaction;
124
131
  withdrawRewards(rewardAddress: string, lovelace: string): Transaction;
125
132
  private addBurnInputsIfNeeded;
126
133
  private addChangeAddress;
@@ -22,6 +22,7 @@ export declare class AppWallet implements IInitiator, ISigner, ISubmitter {
22
22
  private readonly _submitter;
23
23
  private readonly _wallet;
24
24
  constructor(options: CreateAppWalletOptions);
25
+ getBaseAddress(accountIndex?: number): string;
25
26
  getPaymentAddress(accountIndex?: number): string;
26
27
  getRewardAddress(accountIndex?: number): string;
27
28
  getUsedAddress(accountIndex?: number): Address;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Rapidly build Web3 apps on the Cardano Blockchain.",
4
4
  "homepage": "https://meshjs.dev",
5
5
  "author": "MeshJS",
6
- "version": "1.5.4",
6
+ "version": "1.5.6",
7
7
  "license": "Apache-2.0",
8
8
  "type": "module",
9
9
  "repository": {
@@ -48,7 +48,8 @@
48
48
  "exports": {
49
49
  ".": {
50
50
  "import": "./dist/core.js",
51
- "require": "./dist/core.cjs"
51
+ "require": "./dist/core.cjs",
52
+ "types": "./dist/index.d.ts"
52
53
  }
53
54
  },
54
55
  "devDependencies": {
@@ -74,4 +75,4 @@
74
75
  "nanoid": "3.3.4",
75
76
  "zod": "3.19.1"
76
77
  }
77
- }
78
+ }