@meshsdk/common 1.6.0-alpha.21 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/{index.d.mts → index.d.cts} +96 -8
  3. package/dist/index.d.ts +96 -8
  4. package/dist/index.js +1 -1316
  5. package/package.json +28 -9
  6. package/.turbo/turbo-build$colon$docs.log +0 -17
  7. package/.turbo/turbo-build$colon$mesh.log +0 -19
  8. package/.turbo/turbo-build.log +0 -19
  9. package/dist/index.mjs +0 -1189
  10. package/src/constants/cost-models.ts +0 -30
  11. package/src/constants/index.ts +0 -86
  12. package/src/constants/language-views.ts +0 -19
  13. package/src/constants/protocol-parameters.ts +0 -34
  14. package/src/constants/supported-wallets.ts +0 -12
  15. package/src/data/index.ts +0 -5
  16. package/src/data/json/aliases.ts +0 -218
  17. package/src/data/json/constructors.ts +0 -56
  18. package/src/data/json/credentials.ts +0 -77
  19. package/src/data/json/index.ts +0 -33
  20. package/src/data/json/primitives.ts +0 -154
  21. package/src/data/mesh/aliases.ts +0 -85
  22. package/src/data/mesh/constructors.ts +0 -68
  23. package/src/data/mesh/credentials.ts +0 -77
  24. package/src/data/mesh/index.ts +0 -4
  25. package/src/data/mesh/primitives.ts +0 -37
  26. package/src/data/parser.ts +0 -36
  27. package/src/data/time.ts +0 -92
  28. package/src/data/value.ts +0 -70
  29. package/src/index.ts +0 -7
  30. package/src/interfaces/evaluator.ts +0 -5
  31. package/src/interfaces/fetcher.ts +0 -31
  32. package/src/interfaces/index.ts +0 -7
  33. package/src/interfaces/initiator.ts +0 -9
  34. package/src/interfaces/listener.ts +0 -3
  35. package/src/interfaces/serializer.ts +0 -53
  36. package/src/interfaces/signer.ts +0 -12
  37. package/src/interfaces/submitter.ts +0 -3
  38. package/src/types/account-info.ts +0 -7
  39. package/src/types/action.ts +0 -15
  40. package/src/types/asset-extended.ts +0 -9
  41. package/src/types/asset-metadata.ts +0 -102
  42. package/src/types/asset.ts +0 -23
  43. package/src/types/block-info.ts +0 -17
  44. package/src/types/data-signature.ts +0 -4
  45. package/src/types/data.ts +0 -10
  46. package/src/types/deserialized/deserialized-address.ts +0 -6
  47. package/src/types/deserialized/deserialized-script.ts +0 -4
  48. package/src/types/deserialized/index.ts +0 -2
  49. package/src/types/era.ts +0 -1
  50. package/src/types/index.ts +0 -24
  51. package/src/types/message.ts +0 -4
  52. package/src/types/mint.ts +0 -12
  53. package/src/types/native-script.ts +0 -18
  54. package/src/types/network.ts +0 -7
  55. package/src/types/plutus-script.ts +0 -8
  56. package/src/types/pool-params.ts +0 -41
  57. package/src/types/protocol.ts +0 -22
  58. package/src/types/recipient.ts +0 -15
  59. package/src/types/relay.ts +0 -42
  60. package/src/types/token.ts +0 -3
  61. package/src/types/transaction-builder/data.ts +0 -31
  62. package/src/types/transaction-builder/index.ts +0 -73
  63. package/src/types/transaction-builder/mint.ts +0 -11
  64. package/src/types/transaction-builder/output.ts +0 -12
  65. package/src/types/transaction-builder/script.ts +0 -27
  66. package/src/types/transaction-builder/txin.ts +0 -46
  67. package/src/types/transaction-builder/withdrawal.ts +0 -207
  68. package/src/types/transaction-info.ts +0 -11
  69. package/src/types/utxo.ts +0 -16
  70. package/src/types/wallet.ts +0 -6
  71. package/src/utils/asset-fingerprint.ts +0 -11
  72. package/src/utils/bigNum.ts +0 -61
  73. package/src/utils/index.ts +0 -2
  74. package/test/data/json/aliases.test.ts +0 -135
  75. package/test/data/json/constructors.test.ts +0 -38
  76. package/test/data/json/credentials.test.ts +0 -84
  77. package/test/data/json/primitives.test.ts +0 -133
  78. package/test/data/mesh/aliases.test.ts +0 -45
  79. package/test/data/mesh/common.ts +0 -14
  80. package/test/data/mesh/constructors.test.ts +0 -53
  81. package/test/data/mesh/credentials.test.ts +0 -74
  82. package/test/data/mesh/primitives.test.ts +0 -41
  83. package/test/data/value.test.ts +0 -108
  84. package/tsconfig.json +0 -5
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var ge=Object.create;var R=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var be=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var he=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},X=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of xe(t))!Se.call(e,n)&&n!==r&&R(e,n,{get:()=>t[n],enumerable:!(o=ye(t,n))||o.enumerable});return e};var Te=(e,t,r)=>(r=e!=null?ge(be(e)):{},X(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),Ae=e=>X(R({},"__esModule",{value:!0}),e);var kt={};he(kt,{AssetFingerprint:()=>de,BigNum:()=>p,CIP68_100:()=>we,CIP68_222:()=>Ue,DEFAULT_PROTOCOL_PARAMETERS:()=>x,DEFAULT_REDEEMER_BUDGET:()=>Re,DEFAULT_V1_COST_MODEL_LIST:()=>Ce,DEFAULT_V2_COST_MODEL_LIST:()=>ve,HARDENED_KEY_START:()=>He,LANGUAGE_VERSIONS:()=>Ie,POLICY_ID_LENGTH:()=>g,SLOT_CONFIG_NETWORK:()=>j,SUPPORTED_CLOCKS:()=>Be,SUPPORTED_HANDLES:()=>Oe,SUPPORTED_LANGUAGE_VIEWS:()=>J,SUPPORTED_OGMIOS_LINKS:()=>Ke,SUPPORTED_TOKENS:()=>Ne,SUPPORTED_WALLETS:()=>Me,UtxoSelection:()=>Y,assetClass:()=>at,assetName:()=>ne,assocMap:()=>H,bool:()=>rt,builtinByteString:()=>te,byteString:()=>S,bytesToHex:()=>se,certificateToObj:()=>Fe,conStr:()=>I,conStr0:()=>u,conStr1:()=>b,conStr2:()=>tt,currencySymbol:()=>K,dict:()=>ct,emptyTxBuilderBody:()=>Qe,experimentalSelectUtxos:()=>z,fromUTF8:()=>ie,fungibleAssetKeys:()=>Le,generateMnemonic:()=>E.generateMnemonic,hashByteString:()=>Q,hexToBytes:()=>ut,hexToString:()=>mt,integer:()=>C,isNetwork:()=>_e,keepRelevant:()=>G,largestFirst:()=>$,largestFirstMultiAsset:()=>W,list:()=>re,mAssetClass:()=>Ge,mBool:()=>Je,mConStr:()=>je,mConStr0:()=>l,mConStr1:()=>A,mConStr2:()=>ze,mMaybeStakingHash:()=>F,mOutputReference:()=>ee,mPlutusBSArrayToString:()=>et,mPubKeyAddress:()=>Ye,mScriptAddress:()=>Xe,mStringToPlutusBSArray:()=>Ze,mTuple:()=>We,mTxOutRef:()=>$e,maybeStakingHash:()=>q,mergeAssets:()=>Ee,metadataStandardKeys:()=>Pe,metadataToCip68:()=>L,mnemonicToEntropy:()=>E.mnemonicToEntropy,outputReference:()=>ae,parseAssetUnit:()=>yt,parsePlutusValueToAssets:()=>Tt,plutusBSArrayToString:()=>nt,policyId:()=>oe,poolMetadataToObj:()=>Z,poolParamsToObj:()=>_,posixTime:()=>it,pubKeyAddress:()=>dt,pubKeyHash:()=>O,relayToObj:()=>V,resolveEpochNo:()=>St,resolveFingerprint:()=>At,resolveLanguageView:()=>ke,resolveSlotNo:()=>bt,resolveTxFees:()=>M,royaltiesStandardKeys:()=>De,scriptAddress:()=>ft,scriptHash:()=>B,slotToBeginUnixTime:()=>xt,stringToBSArray:()=>ot,stringToHex:()=>lt,toBytes:()=>w,toUTF8:()=>gt,tokenName:()=>N,tuple:()=>pt,txOutRef:()=>st,unixTimeToEnclosingSlot:()=>ce,validityRangeToObj:()=>qe,value:()=>ht});module.exports=Ae(kt);var x={epoch:0,coinsPerUtxoSize:4310,priceMem:.0577,priceStep:721e-7,minFeeA:44,minFeeB:155381,keyDeposit:2e6,maxTxSize:16384,maxValSize:5e3,poolDeposit:5e8,maxCollateralInputs:3,decentralisation:0,maxBlockSize:98304,collateralPercent:150,maxBlockHeaderSize:1100,minPoolCost:"340000000",maxTxExMem:"16000000",maxTxExSteps:"10000000000",maxBlockExMem:"80000000",maxBlockExSteps:"40000000000"},M=(e,t=x.minFeeA,r=x.minFeeB)=>(BigInt(t)*BigInt(e)+BigInt(r)).toString();var Me=["begin","eternl","flint","lace","nami","nufi","gerowallet","typhoncip30","vespr","yoroi"];var Ce=[205665,812,1,1,1e3,571,0,1,1e3,24177,4,1,1e3,32,117366,10475,4,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,100,100,23e3,100,19537,32,175354,32,46417,4,221973,511,0,1,89141,32,497525,14068,4,2,196500,453240,220,0,1,1,1e3,28662,4,2,245e3,216773,62,1,1060367,12586,1,208512,421,1,187e3,1e3,52998,1,80436,32,43249,32,1e3,32,80556,1,57667,4,1e3,10,197145,156,1,197145,156,1,204924,473,1,208896,511,1,52467,32,64832,32,65493,32,22558,32,16563,32,76511,32,196500,453240,220,0,1,1,69522,11687,0,1,60091,32,196500,453240,220,0,1,1,196500,453240,220,0,1,1,806990,30482,4,1927926,82523,4,265318,0,4,0,85931,32,205665,812,1,1,41182,32,212342,32,31220,32,32696,32,43357,32,32247,32,38314,32,57996947,18975,10],ve=[205665,812,1,1,1e3,571,0,1,1e3,24177,4,1,1e3,32,117366,10475,4,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,23e3,100,100,100,23e3,100,19537,32,175354,32,46417,4,221973,511,0,1,89141,32,497525,14068,4,2,196500,453240,220,0,1,1,1e3,28662,4,2,245e3,216773,62,1,1060367,12586,1,208512,421,1,187e3,1e3,52998,1,80436,32,43249,32,1e3,32,80556,1,57667,4,1e3,10,197145,156,1,197145,156,1,204924,473,1,208896,511,1,52467,32,64832,32,65493,32,22558,32,16563,32,76511,32,196500,453240,220,0,1,1,69522,11687,0,1,60091,32,196500,453240,220,0,1,1,196500,453240,220,0,1,1,1159724,392670,0,2,806990,30482,4,1927926,82523,4,265318,0,4,0,85931,32,205665,812,1,1,41182,32,212342,32,31220,32,32696,32,43357,32,32247,32,38314,32,35892428,10,57996947,18975,10,38887044,32947,10];var J={ALONZO:{V1:"a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"},BABBAGE:{V1:"a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",V2:"a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"}},ke=(e,t)=>J[e][t];var Re={mem:7e6,steps:3e9},g=56,Ie={V1:"V1",V2:"V2",V3:"V3"},He=2147483648,Be={testnet:["74","1598400","1595967616","432000"],preview:["183","15811222","1682467200","86400"],preprod:["65","26438400","1682121600","432000"],mainnet:["208","4492800","1596059091","432000"]},Oe={0:"8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",1:"f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"},Ke={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"},Ne={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"},we=e=>`000643b0${e}`,Ue=e=>`000de140${e}`;var Ee=e=>{let t=[];return e.forEach(r=>{let o=t.find(n=>n.unit===r.unit);o?o.quantity=(BigInt(o.quantity)+BigInt(r.quantity)).toString():t.push(r)}),t};var De=["rate","address"],Pe=["name","image","mediaType","description","instagram","twitter","discord","website"],Le=["ticker","decimals"],L=e=>{switch(typeof e){case"object":if(e instanceof Array)return e.map(o=>L(o));let t=new Map;return Object.keys(e).forEach(o=>{t.set(o,L(e[o]))}),{alternative:0,fields:[t,1]};default:return e}};var Ve=["testnet","preview","preprod","mainnet"],_e=e=>Ve.includes(e);var V=e=>{switch(e.type){case"SingleHostAddr":return{singleHostAddr:{ipv4:e.IPV4,ipv6:e.IPV6,port:e.port}};case"SingleHostName":return{singleHostName:{hostname:e.domainName,port:e.port}};case"MultiHostName":return{multiHostName:{dnsName:e.domainName}}}};var _=e=>({vrfKeyHash:e.vrfKeyHash,operator:e.operator,pledge:e.pledge,cost:e.cost,margin:e.margin,relays:e.relays.map(t=>V(t)),owners:e.owners,rewardAddress:e.rewardAddress,metadata:e.metadata?Z(e.metadata):void 0}),Z=e=>({url:e.URL,metadata:e.hash});var Fe=e=>{switch(e.type){case"RegisterPool":return{registerPool:{poolParams:_(e.poolParams)}};case"RegisterStake":return{registerStake:{stakeKeyHash:e.stakeKeyHash}};case"DelegateStake":return{delegateStake:{stakeKeyHash:e.stakeKeyHash,poolId:e.poolId}};case"DeregisterStake":return{deregisterStake:{stakeKeyHash:e.stakeKeyHash}};case"RetirePool":return{retirePool:{poolId:e.poolId,epoch:e.epoch}};case"VoteDelegation":return{voteDelegation:{stakeKeyHash:e.stakeKeyHash,drep:e.drep}};case"StakeAndVoteDelegation":return{stakeAndVoteDelegation:{stakeKeyHash:e.stakeKeyHash,poolKeyHash:e.poolKeyHash,drep:e.drep}};case"StakeRegistrationAndDelegation":return{stakeRegistrationAndDelegation:{stakeKeyHash:e.stakeKeyHash,poolKeyHash:e.poolKeyHash,coin:e.coin}};case"VoteRegistrationAndDelegation":return{voteRegistrationAndDelegation:{stakeKeyHash:e.stakeKeyHash,drep:e.drep,coin:e.coin}};case"StakeVoteRegistrationAndDelegation":return{stakeVoteRegistrationAndDelegation:{stakeKeyHash:e.stakeKeyHash,poolKeyHash:e.poolKeyHash,drep:e.drep,coin:e.coin}};case"CommitteeHotAuth":return{committeeHotAuth:{committeeColdKeyHash:e.committeeColdKeyHash,committeeHotKeyHash:e.committeeHotKeyHash}};case"CommitteeColdResign":return{committeeColdResign:{committeeColdKeyHash:e.committeeColdKeyHash,anchor:e.anchor??null}};case"DRepRegistration":return{dRepRegistration:{votingKeyHash:e.votingKeyHash,coin:e.coin,anchor:e.anchor??null}};case"DRepDeregistration":return{dRepDeregistration:{votingKeyHash:e.votingKeyHash,coin:e.coin}};case"DRepUpdate":return{dRepUpdate:{votingKeyHash:e.votingKeyHash,anchor:e.anchor}}}};var Qe=()=>({inputs:[],outputs:[],extraInputs:[],collaterals:[],requiredSignatures:[],referenceInputs:[],mints:[],changeAddress:"",metadata:[],validityRange:{},certificates:[],withdrawals:[],signingKey:[],selectionConfig:{threshold:"5000000",strategy:"experimental",includeTxFees:!0}}),qe=e=>({invalidBefore:e.invalidBefore??null,invalidHereafter:e.invalidHereafter??null});var je=(e,t)=>({alternative:e,fields:t}),l=e=>({alternative:0,fields:e}),A=e=>({alternative:1,fields:e}),ze=e=>({alternative:2,fields:e});var Ge=(e,t)=>{if(e.length!==56&&e!=="")throw new Error(`Invalid policy id for [${e}] - should be ${g} bytes long or empty string for lovelace`);if(t.length>64)throw new Error(`Invalid asset name for [${t}] - should be less than 32 bytes (64 hex length) long`);return l([e,t])},ee=(e,t)=>{if(e.length!==64)throw new Error("Invalid transaction hash - should be 32 bytes long");return l([l([e]),t])},$e=(e,t)=>ee(e,t),We=(e,t)=>[e,t];var F=(e,t=!1)=>e===""?A([]):t?l([l([A([e])])]):l([l([l([e])])]),Ye=(e,t)=>l([{alternative:0,fields:[e]},F(t||"")]),Xe=(e,t)=>l([{alternative:1,fields:[e]},F(t||"")]);var Je=e=>e?A([]):l([]),Ze=e=>{let t=[];for(let r=0;r<e.length;r+=64){let o=e.substring(r,r+64);t.push(o)}return t},et=e=>e.join("");var I=(e,t)=>{if(!Array.isArray(t))throw new Error("fields of a constructor must be an array");return{constructor:e,fields:t}},u=e=>I(0,e),b=e=>I(1,e),tt=e=>I(2,e);var rt=e=>e?b([]):u([]),te=e=>S(e),S=e=>{if(e.length%2!==0)throw new Error("Invalid hex string - odd length: "+e);if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("Invalid hex string - non-hex string character: "+e);return{bytes:e}},C=e=>({int:e}),re=(e,t=!0)=>(t&&e.forEach(r=>{if(typeof r!="object")throw new Error("List item of JSON Cardano data type must be an object - "+r)}),{list:e}),ot=e=>re((r=>{let o=[];for(let n=0;n<r.length;n+=64){let s=r.substring(n,n+64);o.push(s)}return o})(e).map(te)),nt=e=>e.list.map(t=>t.bytes).join(""),H=(e,t=!0)=>({map:e.map(([r,o])=>{if(t&&(typeof r!="object"||typeof o!="object"))throw new Error(`Map item of JSON Cardano data type must be an object - ${r}, ${o}`);return{k:r,v:o}})});var Q=e=>{if(e.length!==56)throw new Error(`Invalid hash for [${e}] - should be 56 bytes long`);return S(e)},B=e=>Q(e),O=e=>Q(e),oe=e=>{if(e.length!==g&&e!=="")throw new Error(`Invalid policy id for [${e}] - should be ${g} bytes long or empty string for lovelace`);return S(e)},K=e=>oe(e),ne=e=>{if(e.length>64)throw new Error(`Invalid asset name for [${e}] - should be less than 32 bytes (64 hex length) long`);return S(e)},N=e=>ne(e),at=(e,t)=>u([K(e),N(t)]),ae=(e,t)=>{if(e.length!==64)throw new Error("Invalid transaction hash - should be 32 bytes long");return u([u([S(e)]),C(t)])},st=(e,t)=>ae(e,t),it=e=>({int:e}),ct=e=>({map:e.map(([t,r])=>({k:t,v:r}))}),pt=(e,t)=>({list:[e,t]});var q=(e,t=!1)=>e===""?b([]):t?u([u([b([B(e)])])]):u([u([u([O(e)])])]),dt=(e,t,r=!1)=>u([u([O(e)]),q(t||"",r)]),ft=(e,t,r=!1)=>u([b([B(e)]),q(t||"",r)]);var se=e=>Buffer.from(e).toString("hex"),ut=e=>Buffer.from(e,"hex"),lt=e=>Buffer.from(e,"utf8").toString("hex"),mt=e=>Buffer.from(e,"hex").toString("utf8"),w=e=>e.length%2===0&&/^[0-9A-F]*$/i.test(e)?Buffer.from(e,"hex"):Buffer.from(e,"utf-8"),ie=e=>e.length%2===0&&/^[0-9A-F]*$/i.test(e)?e:se(Buffer.from(e,"utf-8")),gt=e=>Buffer.from(e,"hex").toString("utf-8"),yt=e=>{let t=e.slice(0,g),r=e.includes(".")?ie(e.split(".")[1]):e.slice(g);return{policyId:t,assetName:r}};var j={mainnet:{zeroTime:1596059091e3,zeroSlot:4492800,slotLength:1e3,startEpoch:208,epochLength:432e3},preview:{zeroTime:1666656e6,zeroSlot:0,slotLength:1e3,startEpoch:183,epochLength:86400},preprod:{zeroTime:16540416e5+1728e6,zeroSlot:86400,slotLength:1e3,startEpoch:65,epochLength:432e3},testnet:{zeroTime:0,zeroSlot:0,slotLength:0,startEpoch:0,epochLength:0}},xt=(e,t)=>{let r=(e-t.zeroSlot)*t.slotLength;return t.zeroTime+r},ce=(e,t)=>{let r=e-t.zeroTime;return Math.floor(r/t.slotLength)+t.zeroSlot},bt=(e,t=Date.now())=>ce(t,j[e]).toString(),St=(e,t=Date.now())=>{let r=j[e],n=(BigInt(t)/1000n-BigInt(r.zeroTime))/BigInt(r.epochLength)+BigInt(r.startEpoch);return Number(n)};var ht=e=>{let t=[],r={};return e.forEach(o=>{let n=o.unit.replace("lovelace",""),s=n.slice(0,56)||"",d=n.slice(56)||"";r[s]||(r[s]={}),r[s][d]?r[s][d]+=Number(o.quantity):r[s][d]=Number(o.quantity)}),Object.keys(r).forEach(o=>{let n=K(o),s=Object.keys(r[o]).map(i=>[N(i),C(r[o][i])]),d=H(s);t.push([n,d])}),H(t)},Tt=e=>{let t=[];return e.map.forEach(r=>{let o=r.k.bytes;r.v.map.forEach(n=>{let s=n.k.bytes,d=n.v.int.toString(),i=o+s,f=i===""?"lovelace":i;t.push({unit:f,quantity:d})})}),t};var p=class e{value;constructor(t){this.value=BigInt(t)}divFloor(t){return this.value=this.value/t.value,this}checkedMul(t){return this.value*=t.value,this}checkedAdd(t){return this.value+=t.value,this}checkedSub(t){return this.value-=t.value,this}clampedSub(t){let r=this.value-t.value;return this.value=r<0n?0n:r,this}lessThan(t){return this.value<t.value}compare(t){return this.value===t.value?0:this.value<t.value?-1:1}static new=t=>new e(t);toString(){return this.value.toString()}};var pe=Te(require("@emurgo/cip14-js"),1);var de=pe.default,At=(e,t)=>de.default.fromParts(w(e),w(t)).fingerprint();var z=(e,t,r)=>{let o=new Map(e);o.set("lovelace",String(Number(o.get("lovelace")||0)+Number(r)));let n=new Map;for(let a=0;a<t.length;a++)n.set(a,t[a]);let s=new Set,d=new Set,i=new Set,f=new Set,T=new Set;for(let a=0;a<t.length;a++)switch(t[a].output.amount.length){case 1:{d.add(a);break}case 2:{i.add(a);break}case 3:{f.add(a);break}default:{T.add(a);break}}let y=(a,c,m)=>{let D=n.get(a);if(!D)return;let me=Mt(D,c);if(Number(me)>0){s.add(a),m.delete(a);for(let P of D.output.amount)o.set(P.unit,String(Number(o.get(P.unit))-Number(P.quantity)))}};for(let a of o.keys())if(a!="lovelace"){for(let c of i){let m=o.get(a);if(!m||Number(m)<=0)break;y(c,a,i)}for(let c of f){let m=o.get(a);if(!m||Number(m)<=0)break;y(c,a,f)}for(let c of T){let m=o.get(a);if(!m||Number(m)<=0)break;y(c,a,T)}}for(let a of d){let c=o.get("lovelace");if(!c||Number(c)<=0)break;y(a,"lovelace",d)}for(let a of i){let c=o.get("lovelace");if(!c||Number(c)<=0)break;y(a,"lovelace",i)}for(let a of f){let c=o.get("lovelace");if(!c||Number(c)<=0)break;y(a,"lovelace",f)}for(let a of T){let c=o.get("lovelace");if(!c||Number(c)<=0)break;y(a,"lovelace",T)}for(let a of o.keys())if(Number(o.get(a))>0)return console.log("Insufficient funds for",a),console.log("Remaining quantity",Number(o.get(a))),[];let k=[];for(let a of s){let c=n.get(a);c&&k.push(c)}return k},Mt=(e,t)=>{for(let r of e.output.amount)if(r.unit==t)return r.quantity;return"0"};var Ct=(e,t)=>Array.from(t,r=>({unit:r[0],quantity:p.new(r[1])})).every(r=>e.filter(o=>o.output.amount.find(n=>n.unit===r.unit)!==void 0).reduce((o,n)=>{let s=n.output.amount.reduce((d,i)=>d.checkedAdd(p.new(r.unit===i.unit?i.quantity:"0")),p.new("0"));return o.checkedAdd(s)},p.new("0")).lessThan(r.quantity)===!1),v=(e,t)=>{let r=p.new(e.output.amount.find(n=>n.unit==="lovelace")?.quantity??"0");return p.new(t.output.amount.find(n=>n.unit==="lovelace")?.quantity??"0").compare(r)},fe=e=>{let{maxTxSize:t,minFeeA:r,minFeeB:o}=e;return p.new(M(t,r,o))},U=e=>e.output.amount.length>1,ue=e=>e.reduce((t,r)=>{let o=r.output.amount.find(n=>n.unit==="lovelace")?.quantity??"0";return t.checkedAdd(p.new(o))},p.new("0")),le=(e,t)=>{let r=t.sort(v);return h(r,new Map([["lovelace",e]]))},h=(e,t,r=[])=>e.length===0||Ct(r,t)?r:vt(e[0],t)?h(e.slice(1),t,[...r,e[0]]):h(e.slice(1),t,r),vt=(e,t)=>Array.from(t.keys()).some(r=>e.output.amount.find(o=>o.unit===r)!==void 0);var G=(e,t,r="5000000")=>{let o=p.new(e.get("lovelace")??"0").checkedAdd(p.new(r)),n=t.filter(i=>i.output.amount.filter(f=>f.unit!=="lovelace").some(f=>e.has(f.unit))),s=ue(n);return[...s.lessThan(o)?le(o.clampedSub(s).toString(),t.filter(i=>!n.some(f=>f.input.txHash===i.input.txHash&&f.input.outputIndex===i.input.outputIndex))):[],...n]};var $=(e,t,r=!1,{maxTxSize:o,minFeeA:n,minFeeB:s}=x)=>{let d=t.filter(k=>U(k)===!1).sort(v),i=p.new(M(o,n,s)),f=r?p.new(e).checkedAdd(i).toString():e;return h(d,new Map([["lovelace",f]]))};var W=(e,t,r=!1,o=x)=>{let n=t.filter(U).sort(v),s=fe(o),d=e.get("lovelace")??"0",i=r?p.new(d).checkedAdd(s).toString():d;return e.set("lovelace",i),h(n,e)};var Y=class{threshold;includeTxFees;constructor(t="5000000",r=!0){this.threshold=t,this.includeTxFees=r}largestFirst(t,r){let o=t.get("lovelace")??"0",n=BigInt(o)+BigInt(this.threshold);return $(n.toString(),r,this.includeTxFees)}keepRelevant(t,r){return G(t,r,this.threshold)}largestFirstMultiAsset(t,r){let o=t.get("lovelace")??"0";return t.set("lovelace",(BigInt(o)+BigInt(this.threshold)).toString()),W(t,r,this.includeTxFees)}experimental(t,r){return z(t,r,this.threshold)}};var E=require("bip39");0&&(module.exports={AssetFingerprint,BigNum,CIP68_100,CIP68_222,DEFAULT_PROTOCOL_PARAMETERS,DEFAULT_REDEEMER_BUDGET,DEFAULT_V1_COST_MODEL_LIST,DEFAULT_V2_COST_MODEL_LIST,HARDENED_KEY_START,LANGUAGE_VERSIONS,POLICY_ID_LENGTH,SLOT_CONFIG_NETWORK,SUPPORTED_CLOCKS,SUPPORTED_HANDLES,SUPPORTED_LANGUAGE_VIEWS,SUPPORTED_OGMIOS_LINKS,SUPPORTED_TOKENS,SUPPORTED_WALLETS,UtxoSelection,assetClass,assetName,assocMap,bool,builtinByteString,byteString,bytesToHex,certificateToObj,conStr,conStr0,conStr1,conStr2,currencySymbol,dict,emptyTxBuilderBody,experimentalSelectUtxos,fromUTF8,fungibleAssetKeys,generateMnemonic,hashByteString,hexToBytes,hexToString,integer,isNetwork,keepRelevant,largestFirst,largestFirstMultiAsset,list,mAssetClass,mBool,mConStr,mConStr0,mConStr1,mConStr2,mMaybeStakingHash,mOutputReference,mPlutusBSArrayToString,mPubKeyAddress,mScriptAddress,mStringToPlutusBSArray,mTuple,mTxOutRef,maybeStakingHash,mergeAssets,metadataStandardKeys,metadataToCip68,mnemonicToEntropy,outputReference,parseAssetUnit,parsePlutusValueToAssets,plutusBSArrayToString,policyId,poolMetadataToObj,poolParamsToObj,posixTime,pubKeyAddress,pubKeyHash,relayToObj,resolveEpochNo,resolveFingerprint,resolveLanguageView,resolveSlotNo,resolveTxFees,royaltiesStandardKeys,scriptAddress,scriptHash,slotToBeginUnixTime,stringToBSArray,stringToHex,toBytes,toUTF8,tokenName,tuple,txOutRef,unixTimeToEnclosingSlot,validityRangeToObj,value});
@@ -81,6 +81,11 @@ type ImageAssetMetadata = MetadataStandard & Files & {
81
81
  };
82
82
  type SmartAssetMetadata = MetadataStandard & Files;
83
83
  type VideoAssetMetadata = MetadataStandard & Files;
84
+ /**
85
+ * Transform the metadata into the format needed in CIP68 inline datum (in Mesh Data type)
86
+ * @param metadata The metadata body without outer wrapper of policy id & token name
87
+ * @returns The metadata in Mesh Data type, ready to be attached as inline datum
88
+ */
84
89
  declare const metadataToCip68: (metadata: any) => Data;
85
90
 
86
91
  type BlockInfo = {
@@ -247,6 +252,38 @@ type Wallet = {
247
252
  version: string;
248
253
  };
249
254
 
255
+ declare const experimentalSelectUtxos: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity) => UTxO[];
256
+
257
+ declare const keepRelevant: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string) => UTxO[];
258
+
259
+ declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
260
+
261
+ declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
262
+
263
+ /**
264
+ * All UTxO selection algorithms follows below's interface
265
+ *
266
+ * Supported algorithms:
267
+ * - largestFirst - CIP2 suggested algorithm
268
+ * - largestFirstMultiAsset - CIP2 suggested algorithm
269
+ * - keepRelevant - CIP2 suggested algorithm
270
+ * - experimental - The always evolving algorithm according to the latest research
271
+ *
272
+ * @param requestedOutputSet
273
+ * @param initialUTxOSet
274
+ * @returns
275
+ */
276
+ declare class UtxoSelection {
277
+ private threshold;
278
+ private includeTxFees;
279
+ constructor(threshold?: string, includeTxFees?: boolean);
280
+ largestFirst(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
281
+ keepRelevant(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
282
+ largestFirstMultiAsset(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
283
+ experimental(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
284
+ }
285
+ type UtxoSelectionStrategy = keyof UtxoSelection;
286
+
250
287
  type BuilderData = {
251
288
  type: "Mesh";
252
289
  content: Data;
@@ -445,8 +482,6 @@ declare const certificateToObj: (certificate: Certificate) => object;
445
482
  type MeshTxBuilderBody = {
446
483
  inputs: TxIn[];
447
484
  outputs: Output[];
448
- extraInputs: UTxO[];
449
- selectionThreshold: number;
450
485
  collaterals: PubKeyTxIn[];
451
486
  requiredSignatures: string[];
452
487
  referenceInputs: RefTxIn[];
@@ -457,6 +492,12 @@ type MeshTxBuilderBody = {
457
492
  certificates: Certificate[];
458
493
  withdrawals: Withdrawal[];
459
494
  signingKey: string[];
495
+ extraInputs: UTxO[];
496
+ selectionConfig: {
497
+ threshold: string;
498
+ strategy: UtxoSelectionStrategy;
499
+ includeTxFees: boolean;
500
+ };
460
501
  };
461
502
  declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
462
503
  type ValidityRange = {
@@ -541,7 +582,17 @@ declare const SUPPORTED_TOKENS: {
541
582
  WMT: string;
542
583
  COPI: string;
543
584
  };
585
+ /**
586
+ * The utility function to append the bytes for CIP-68 100 token in front of the token hex
587
+ * @param tokenNameHex The hex of the token name
588
+ * @returns The hex of the token name with the CIP-68 100 bytes appended
589
+ */
544
590
  declare const CIP68_100: (tokenNameHex: string) => string;
591
+ /**
592
+ * The utility function to append the bytes for CIP-68 222 token in front of the token hex
593
+ * @param tokenNameHex The hex of the token name
594
+ * @returns The hex of the token name with the CIP-68 222 bytes appended
595
+ */
545
596
  declare const CIP68_222: (tokenNameHex: string) => string;
546
597
 
547
598
  /**
@@ -659,21 +710,18 @@ type MConStr2<T = any> = MConStr<T>;
659
710
  declare const mConStr: <T extends Data[]>(alternative: number, fields: T) => MConStr<T>;
660
711
  /**
661
712
  * The utility function to create a Mesh Data index 0 constructor object, representing custom data type
662
- * @param alternative The constructor index number
663
713
  * @param fields The items in array
664
714
  * @returns The Mesh Data constructor object
665
715
  */
666
716
  declare const mConStr0: <T extends Data[]>(fields: T) => MConStr0<T>;
667
717
  /**
668
718
  * The utility function to create a Mesh Data index 1 constructor object, representing custom data type
669
- * @param alternative The constructor index number
670
719
  * @param fields The items in array
671
720
  * @returns The Mesh Data constructor object
672
721
  */
673
722
  declare const mConStr1: <T extends Data[]>(fields: T) => MConStr1<T>;
674
723
  /**
675
724
  * The utility function to create a Mesh Data index 2 constructor object, representing custom data type
676
- * @param alternative The constructor index number
677
725
  * @param fields The items in array
678
726
  * @returns The Mesh Data constructor object
679
727
  */
@@ -754,7 +802,7 @@ declare const mMaybeStakingHash: (stakeCredential: string, isScriptCredential?:
754
802
  * @param isScriptCredential The flag to indicate if the credential is a script credential
755
803
  * @returns The Mesh Data public key address object
756
804
  */
757
- declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isScriptCredential?: boolean) => Data;
805
+ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string) => Data;
758
806
  /**
759
807
  * The utility function to create a Mesh Data script address
760
808
  * @param bytes The validator hash in hex
@@ -762,7 +810,7 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isScript
762
810
  * @param isScriptCredential The flag to indicate if the credential is a script credential
763
811
  * @returns The Mesh Data script address object
764
812
  */
765
- declare const mScriptAddress: (bytes: string, stakeCredential?: string, isScriptCredential?: boolean) => Data;
813
+ declare const mScriptAddress: (bytes: string, stakeCredential?: string) => Data;
766
814
 
767
815
  /**
768
816
  * The Mesh Data boolean
@@ -1121,13 +1169,53 @@ declare const scriptAddress: (bytes: string, stakeCredential?: string, isScriptC
1121
1169
 
1122
1170
  type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
1123
1171
 
1172
+ /**
1173
+ * Converting bytes to hex string
1174
+ * @param bytes The bytes to be converted
1175
+ * @returns The hex string
1176
+ */
1124
1177
  declare const bytesToHex: (bytes: ArrayBuffer) => string;
1178
+ /**
1179
+ * Converting hex string to bytes
1180
+ * @param hex The hex string to be converted
1181
+ * @returns The bytes
1182
+ */
1125
1183
  declare const hexToBytes: (hex: string) => Buffer;
1184
+ /**
1185
+ * Converting utf8 string to hex string
1186
+ * @param str The utf8 string to be converted
1187
+ * @returns The hex string
1188
+ */
1126
1189
  declare const stringToHex: (str: string) => string;
1190
+ /**
1191
+ * Converting hex string to utf8 string
1192
+ * @param hex The hex string to be converted
1193
+ * @returns The utf8 string
1194
+ */
1127
1195
  declare const hexToString: (hex: string) => string;
1196
+ /**
1197
+ * Converting either hex string or utf8 string to bytes
1198
+ * @param hex The hex or utf8 string to be converted
1199
+ * @returns The bytes
1200
+ */
1128
1201
  declare const toBytes: (hex: string) => Uint8Array;
1202
+ /**
1203
+ * Converting utf8 string to hex string
1204
+ * @param utf8 The utf8 string to be converted
1205
+ * @returns The hex string
1206
+ */
1129
1207
  declare const fromUTF8: (utf8: string) => string;
1208
+ /**
1209
+ * Converting hex string to utf8 string
1210
+ * @param hex The hex string to be converted
1211
+ * @returns The utf8 string
1212
+ */
1130
1213
  declare const toUTF8: (hex: string) => string;
1214
+ /**
1215
+ * Parse asset unit into an object with policyId and assetName
1216
+ * @param unit The asset unit to be parsed
1217
+ * @returns The object with policyId and assetName
1218
+ */
1131
1219
  declare const parseAssetUnit: (unit: string) => {
1132
1220
  policyId: string;
1133
1221
  assetName: string;
@@ -1173,4 +1261,4 @@ declare class BigNum {
1173
1261
  declare const AssetFingerprint: typeof CIP14;
1174
1262
  declare const resolveFingerprint: (policyId: string, assetName: string) => any;
1175
1263
 
1176
- export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type ConStr, type ConStr0, type ConStr1, type ConStr2, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IResolver, type ISigner, type ISubmitter, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MMaybeStakingHash, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, type Message, type Metadata, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SlotConfig, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxOutRef, type UTxO, type Unit, type ValidityRange, type Value, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, certificateToObj, conStr, conStr0, conStr1, conStr2, currencySymbol, dict, emptyTxBuilderBody, fromUTF8, fungibleAssetKeys, hashByteString, hexToBytes, hexToString, integer, isNetwork, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mMaybeStakingHash, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mStringToPlutusBSArray, mTuple, mTxOutRef, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, outputReference, parseAssetUnit, parsePlutusValueToAssets, plutusBSArrayToString, policyId, poolMetadataToObj, poolParamsToObj, posixTime, pubKeyAddress, pubKeyHash, relayToObj, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
1264
+ export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type ConStr, type ConStr0, type ConStr1, type ConStr2, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IResolver, type ISigner, type ISubmitter, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MMaybeStakingHash, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, type Message, type Metadata, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SlotConfig, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxOutRef, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, certificateToObj, conStr, conStr0, conStr1, conStr2, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, hashByteString, hexToBytes, hexToString, integer, isNetwork, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mMaybeStakingHash, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mStringToPlutusBSArray, mTuple, mTxOutRef, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, outputReference, parseAssetUnit, parsePlutusValueToAssets, plutusBSArrayToString, policyId, poolMetadataToObj, poolParamsToObj, posixTime, pubKeyAddress, pubKeyHash, relayToObj, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
package/dist/index.d.ts CHANGED
@@ -81,6 +81,11 @@ type ImageAssetMetadata = MetadataStandard & Files & {
81
81
  };
82
82
  type SmartAssetMetadata = MetadataStandard & Files;
83
83
  type VideoAssetMetadata = MetadataStandard & Files;
84
+ /**
85
+ * Transform the metadata into the format needed in CIP68 inline datum (in Mesh Data type)
86
+ * @param metadata The metadata body without outer wrapper of policy id & token name
87
+ * @returns The metadata in Mesh Data type, ready to be attached as inline datum
88
+ */
84
89
  declare const metadataToCip68: (metadata: any) => Data;
85
90
 
86
91
  type BlockInfo = {
@@ -247,6 +252,38 @@ type Wallet = {
247
252
  version: string;
248
253
  };
249
254
 
255
+ declare const experimentalSelectUtxos: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold: Quantity) => UTxO[];
256
+
257
+ declare const keepRelevant: (requiredAssets: Map<Unit, Quantity>, inputs: UTxO[], threshold?: string) => UTxO[];
258
+
259
+ declare const largestFirst: (lovelace: Quantity, initialUTxOSet: UTxO[], includeTxFees?: boolean, { maxTxSize, minFeeA, minFeeB }?: Protocol) => UTxO[];
260
+
261
+ declare const largestFirstMultiAsset: (requestedOutputSet: Map<Unit, Quantity>, initialUTxOSet: UTxO[], includeTxFees?: boolean, parameters?: Protocol) => UTxO[];
262
+
263
+ /**
264
+ * All UTxO selection algorithms follows below's interface
265
+ *
266
+ * Supported algorithms:
267
+ * - largestFirst - CIP2 suggested algorithm
268
+ * - largestFirstMultiAsset - CIP2 suggested algorithm
269
+ * - keepRelevant - CIP2 suggested algorithm
270
+ * - experimental - The always evolving algorithm according to the latest research
271
+ *
272
+ * @param requestedOutputSet
273
+ * @param initialUTxOSet
274
+ * @returns
275
+ */
276
+ declare class UtxoSelection {
277
+ private threshold;
278
+ private includeTxFees;
279
+ constructor(threshold?: string, includeTxFees?: boolean);
280
+ largestFirst(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
281
+ keepRelevant(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
282
+ largestFirstMultiAsset(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
283
+ experimental(requiredAssets: Map<Unit, Quantity>, inputs: UTxO[]): UTxO[];
284
+ }
285
+ type UtxoSelectionStrategy = keyof UtxoSelection;
286
+
250
287
  type BuilderData = {
251
288
  type: "Mesh";
252
289
  content: Data;
@@ -445,8 +482,6 @@ declare const certificateToObj: (certificate: Certificate) => object;
445
482
  type MeshTxBuilderBody = {
446
483
  inputs: TxIn[];
447
484
  outputs: Output[];
448
- extraInputs: UTxO[];
449
- selectionThreshold: number;
450
485
  collaterals: PubKeyTxIn[];
451
486
  requiredSignatures: string[];
452
487
  referenceInputs: RefTxIn[];
@@ -457,6 +492,12 @@ type MeshTxBuilderBody = {
457
492
  certificates: Certificate[];
458
493
  withdrawals: Withdrawal[];
459
494
  signingKey: string[];
495
+ extraInputs: UTxO[];
496
+ selectionConfig: {
497
+ threshold: string;
498
+ strategy: UtxoSelectionStrategy;
499
+ includeTxFees: boolean;
500
+ };
460
501
  };
461
502
  declare const emptyTxBuilderBody: () => MeshTxBuilderBody;
462
503
  type ValidityRange = {
@@ -541,7 +582,17 @@ declare const SUPPORTED_TOKENS: {
541
582
  WMT: string;
542
583
  COPI: string;
543
584
  };
585
+ /**
586
+ * The utility function to append the bytes for CIP-68 100 token in front of the token hex
587
+ * @param tokenNameHex The hex of the token name
588
+ * @returns The hex of the token name with the CIP-68 100 bytes appended
589
+ */
544
590
  declare const CIP68_100: (tokenNameHex: string) => string;
591
+ /**
592
+ * The utility function to append the bytes for CIP-68 222 token in front of the token hex
593
+ * @param tokenNameHex The hex of the token name
594
+ * @returns The hex of the token name with the CIP-68 222 bytes appended
595
+ */
545
596
  declare const CIP68_222: (tokenNameHex: string) => string;
546
597
 
547
598
  /**
@@ -659,21 +710,18 @@ type MConStr2<T = any> = MConStr<T>;
659
710
  declare const mConStr: <T extends Data[]>(alternative: number, fields: T) => MConStr<T>;
660
711
  /**
661
712
  * The utility function to create a Mesh Data index 0 constructor object, representing custom data type
662
- * @param alternative The constructor index number
663
713
  * @param fields The items in array
664
714
  * @returns The Mesh Data constructor object
665
715
  */
666
716
  declare const mConStr0: <T extends Data[]>(fields: T) => MConStr0<T>;
667
717
  /**
668
718
  * The utility function to create a Mesh Data index 1 constructor object, representing custom data type
669
- * @param alternative The constructor index number
670
719
  * @param fields The items in array
671
720
  * @returns The Mesh Data constructor object
672
721
  */
673
722
  declare const mConStr1: <T extends Data[]>(fields: T) => MConStr1<T>;
674
723
  /**
675
724
  * The utility function to create a Mesh Data index 2 constructor object, representing custom data type
676
- * @param alternative The constructor index number
677
725
  * @param fields The items in array
678
726
  * @returns The Mesh Data constructor object
679
727
  */
@@ -754,7 +802,7 @@ declare const mMaybeStakingHash: (stakeCredential: string, isScriptCredential?:
754
802
  * @param isScriptCredential The flag to indicate if the credential is a script credential
755
803
  * @returns The Mesh Data public key address object
756
804
  */
757
- declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isScriptCredential?: boolean) => Data;
805
+ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string) => Data;
758
806
  /**
759
807
  * The utility function to create a Mesh Data script address
760
808
  * @param bytes The validator hash in hex
@@ -762,7 +810,7 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isScript
762
810
  * @param isScriptCredential The flag to indicate if the credential is a script credential
763
811
  * @returns The Mesh Data script address object
764
812
  */
765
- declare const mScriptAddress: (bytes: string, stakeCredential?: string, isScriptCredential?: boolean) => Data;
813
+ declare const mScriptAddress: (bytes: string, stakeCredential?: string) => Data;
766
814
 
767
815
  /**
768
816
  * The Mesh Data boolean
@@ -1121,13 +1169,53 @@ declare const scriptAddress: (bytes: string, stakeCredential?: string, isScriptC
1121
1169
 
1122
1170
  type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
1123
1171
 
1172
+ /**
1173
+ * Converting bytes to hex string
1174
+ * @param bytes The bytes to be converted
1175
+ * @returns The hex string
1176
+ */
1124
1177
  declare const bytesToHex: (bytes: ArrayBuffer) => string;
1178
+ /**
1179
+ * Converting hex string to bytes
1180
+ * @param hex The hex string to be converted
1181
+ * @returns The bytes
1182
+ */
1125
1183
  declare const hexToBytes: (hex: string) => Buffer;
1184
+ /**
1185
+ * Converting utf8 string to hex string
1186
+ * @param str The utf8 string to be converted
1187
+ * @returns The hex string
1188
+ */
1126
1189
  declare const stringToHex: (str: string) => string;
1190
+ /**
1191
+ * Converting hex string to utf8 string
1192
+ * @param hex The hex string to be converted
1193
+ * @returns The utf8 string
1194
+ */
1127
1195
  declare const hexToString: (hex: string) => string;
1196
+ /**
1197
+ * Converting either hex string or utf8 string to bytes
1198
+ * @param hex The hex or utf8 string to be converted
1199
+ * @returns The bytes
1200
+ */
1128
1201
  declare const toBytes: (hex: string) => Uint8Array;
1202
+ /**
1203
+ * Converting utf8 string to hex string
1204
+ * @param utf8 The utf8 string to be converted
1205
+ * @returns The hex string
1206
+ */
1129
1207
  declare const fromUTF8: (utf8: string) => string;
1208
+ /**
1209
+ * Converting hex string to utf8 string
1210
+ * @param hex The hex string to be converted
1211
+ * @returns The utf8 string
1212
+ */
1130
1213
  declare const toUTF8: (hex: string) => string;
1214
+ /**
1215
+ * Parse asset unit into an object with policyId and assetName
1216
+ * @param unit The asset unit to be parsed
1217
+ * @returns The object with policyId and assetName
1218
+ */
1131
1219
  declare const parseAssetUnit: (unit: string) => {
1132
1220
  policyId: string;
1133
1221
  assetName: string;
@@ -1173,4 +1261,4 @@ declare class BigNum {
1173
1261
  declare const AssetFingerprint: typeof CIP14;
1174
1262
  declare const resolveFingerprint: (policyId: string, assetName: string) => any;
1175
1263
 
1176
- export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type ConStr, type ConStr0, type ConStr1, type ConStr2, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IResolver, type ISigner, type ISubmitter, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MMaybeStakingHash, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, type Message, type Metadata, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SlotConfig, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxOutRef, type UTxO, type Unit, type ValidityRange, type Value, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, certificateToObj, conStr, conStr0, conStr1, conStr2, currencySymbol, dict, emptyTxBuilderBody, fromUTF8, fungibleAssetKeys, hashByteString, hexToBytes, hexToString, integer, isNetwork, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mMaybeStakingHash, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mStringToPlutusBSArray, mTuple, mTxOutRef, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, outputReference, parseAssetUnit, parsePlutusValueToAssets, plutusBSArrayToString, policyId, poolMetadataToObj, poolParamsToObj, posixTime, pubKeyAddress, pubKeyHash, relayToObj, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };
1264
+ export { type AccountInfo, type Action, type Anchor, type Asset, type AssetClass, type AssetExtended, AssetFingerprint, type AssetMetadata, type AssetName, type AssocMap, type AssocMapItem, BigNum, type BlockInfo, type Bool, type Budget, type BuilderData, type BuiltinByteString, type ByteString, CIP68_100, CIP68_222, type Certificate, type ConStr, type ConStr0, type ConStr1, type ConStr2, type CurrencySymbol, DEFAULT_PROTOCOL_PARAMETERS, DEFAULT_REDEEMER_BUDGET, DEFAULT_V1_COST_MODEL_LIST, DEFAULT_V2_COST_MODEL_LIST, type DRep, type Data, type DataSignature, type DatumSource, type DeserializedAddress, type DeserializedScript, type Dict, type DictItem, type Era, type Files, type FungibleAssetMetadata, HARDENED_KEY_START, type IDeserializer, type IEvaluator, type IFetcher, type IInitiator, type IListener, type IMeshTxSerializer, type IResolver, type ISigner, type ISubmitter, type ImageAssetMetadata, type Integer, LANGUAGE_VERSIONS, type LanguageVersion, type List, type MAssetClass, type MBool, type MConStr, type MConStr0, type MConStr1, type MConStr2, type MMaybeStakingHash, type MOutputReference, type MPubKeyAddress, type MScriptAddress, type MTuple, type MTxOutRef, type MValue, type MaybeStakingHash, type MeshTxBuilderBody, type Message, type Metadata, type Mint, type MintItem, type NativeScript, type Network, type NonFungibleAssetMetadata, type Output, type OutputReference, POLICY_ID_LENGTH, type POSIXTime, type PlutusData, type PlutusScript, type PolicyId, type PoolMetadata, type PoolParams, type Protocol, type PubKeyAddress, type PubKeyHash, type PubKeyTxIn, type Quantity, type Recipient, type Redeemer, type RedeemerTagType, type RefTxIn, type Relay, type RequiredWith, type RoyaltiesStandard, SLOT_CONFIG_NETWORK, SUPPORTED_CLOCKS, SUPPORTED_HANDLES, SUPPORTED_LANGUAGE_VIEWS, SUPPORTED_OGMIOS_LINKS, SUPPORTED_TOKENS, SUPPORTED_WALLETS, type ScriptAddress, type ScriptHash, type ScriptSource, type ScriptTxIn, type ScriptTxInParameter, type SimpleScriptSourceInfo, type SimpleScriptTxIn, type SimpleScriptTxInParameter, type SlotConfig, type Token, type TokenName, type TransactionInfo, type Tuple, type TxIn, type TxInParameter, type TxOutRef, type UTxO, type Unit, UtxoSelection, type UtxoSelectionStrategy, type ValidityRange, type Value, type Wallet, type Withdrawal, assetClass, assetName, assocMap, bool, builtinByteString, byteString, bytesToHex, certificateToObj, conStr, conStr0, conStr1, conStr2, currencySymbol, dict, emptyTxBuilderBody, experimentalSelectUtxos, fromUTF8, fungibleAssetKeys, hashByteString, hexToBytes, hexToString, integer, isNetwork, keepRelevant, largestFirst, largestFirstMultiAsset, list, mAssetClass, mBool, mConStr, mConStr0, mConStr1, mConStr2, mMaybeStakingHash, mOutputReference, mPlutusBSArrayToString, mPubKeyAddress, mScriptAddress, mStringToPlutusBSArray, mTuple, mTxOutRef, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, outputReference, parseAssetUnit, parsePlutusValueToAssets, plutusBSArrayToString, policyId, poolMetadataToObj, poolParamsToObj, posixTime, pubKeyAddress, pubKeyHash, relayToObj, resolveEpochNo, resolveFingerprint, resolveLanguageView, resolveSlotNo, resolveTxFees, royaltiesStandardKeys, scriptAddress, scriptHash, slotToBeginUnixTime, stringToBSArray, stringToHex, toBytes, toUTF8, tokenName, tuple, txOutRef, unixTimeToEnclosingSlot, validityRangeToObj, value };