@meshsdk/common 1.6.0-alpha.21 → 1.6.2
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/index.cjs +1 -0
- package/dist/{index.d.mts → index.d.cts} +230 -14
- package/dist/index.d.ts +230 -14
- package/dist/index.js +1 -1316
- package/package.json +28 -9
- package/.turbo/turbo-build$colon$docs.log +0 -17
- package/.turbo/turbo-build$colon$mesh.log +0 -19
- package/.turbo/turbo-build.log +0 -19
- package/dist/index.mjs +0 -1189
- package/src/constants/cost-models.ts +0 -30
- package/src/constants/index.ts +0 -86
- package/src/constants/language-views.ts +0 -19
- package/src/constants/protocol-parameters.ts +0 -34
- package/src/constants/supported-wallets.ts +0 -12
- package/src/data/index.ts +0 -5
- package/src/data/json/aliases.ts +0 -218
- package/src/data/json/constructors.ts +0 -56
- package/src/data/json/credentials.ts +0 -77
- package/src/data/json/index.ts +0 -33
- package/src/data/json/primitives.ts +0 -154
- package/src/data/mesh/aliases.ts +0 -85
- package/src/data/mesh/constructors.ts +0 -68
- package/src/data/mesh/credentials.ts +0 -77
- package/src/data/mesh/index.ts +0 -4
- package/src/data/mesh/primitives.ts +0 -37
- package/src/data/parser.ts +0 -36
- package/src/data/time.ts +0 -92
- package/src/data/value.ts +0 -70
- package/src/index.ts +0 -7
- package/src/interfaces/evaluator.ts +0 -5
- package/src/interfaces/fetcher.ts +0 -31
- package/src/interfaces/index.ts +0 -7
- package/src/interfaces/initiator.ts +0 -9
- package/src/interfaces/listener.ts +0 -3
- package/src/interfaces/serializer.ts +0 -53
- package/src/interfaces/signer.ts +0 -12
- package/src/interfaces/submitter.ts +0 -3
- package/src/types/account-info.ts +0 -7
- package/src/types/action.ts +0 -15
- package/src/types/asset-extended.ts +0 -9
- package/src/types/asset-metadata.ts +0 -102
- package/src/types/asset.ts +0 -23
- package/src/types/block-info.ts +0 -17
- package/src/types/data-signature.ts +0 -4
- package/src/types/data.ts +0 -10
- package/src/types/deserialized/deserialized-address.ts +0 -6
- package/src/types/deserialized/deserialized-script.ts +0 -4
- package/src/types/deserialized/index.ts +0 -2
- package/src/types/era.ts +0 -1
- package/src/types/index.ts +0 -24
- package/src/types/message.ts +0 -4
- package/src/types/mint.ts +0 -12
- package/src/types/native-script.ts +0 -18
- package/src/types/network.ts +0 -7
- package/src/types/plutus-script.ts +0 -8
- package/src/types/pool-params.ts +0 -41
- package/src/types/protocol.ts +0 -22
- package/src/types/recipient.ts +0 -15
- package/src/types/relay.ts +0 -42
- package/src/types/token.ts +0 -3
- package/src/types/transaction-builder/data.ts +0 -31
- package/src/types/transaction-builder/index.ts +0 -73
- package/src/types/transaction-builder/mint.ts +0 -11
- package/src/types/transaction-builder/output.ts +0 -12
- package/src/types/transaction-builder/script.ts +0 -27
- package/src/types/transaction-builder/txin.ts +0 -46
- package/src/types/transaction-builder/withdrawal.ts +0 -207
- package/src/types/transaction-info.ts +0 -11
- package/src/types/utxo.ts +0 -16
- package/src/types/wallet.ts +0 -6
- package/src/utils/asset-fingerprint.ts +0 -11
- package/src/utils/bigNum.ts +0 -61
- package/src/utils/index.ts +0 -2
- package/test/data/json/aliases.test.ts +0 -135
- package/test/data/json/constructors.test.ts +0 -38
- package/test/data/json/credentials.test.ts +0 -84
- package/test/data/json/primitives.test.ts +0 -133
- package/test/data/mesh/aliases.test.ts +0 -45
- package/test/data/mesh/common.ts +0 -14
- package/test/data/mesh/constructors.test.ts +0 -53
- package/test/data/mesh/credentials.test.ts +0 -74
- package/test/data/mesh/primitives.test.ts +0 -41
- package/test/data/value.test.ts +0 -108
- package/tsconfig.json +0 -5
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ye=Object.create;var B=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var Te=(e,t)=>{for(var r in t)B(e,r,{get:t[r],enumerable:!0})},J=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of be(t))!Se.call(e,n)&&n!==r&&B(e,n,{get:()=>t[n],enumerable:!(o=xe(t,n))||o.enumerable});return e};var Ae=(e,t,r)=>(r=e!=null?ye(he(e)):{},J(t||!e||!e.__esModule?B(r,"default",{value:e,enumerable:!0}):r,e)),Me=e=>J(B({},"__esModule",{value:!0}),e);var kt={};Te(kt,{AssetFingerprint:()=>de,BigNum:()=>i,CIP68_100:()=>Ue,CIP68_222:()=>Ee,DEFAULT_PROTOCOL_PARAMETERS:()=>b,DEFAULT_REDEEMER_BUDGET:()=>Be,DEFAULT_V1_COST_MODEL_LIST:()=>Ce,DEFAULT_V2_COST_MODEL_LIST:()=>Ie,HARDENED_KEY_START:()=>Re,LANGUAGE_VERSIONS:()=>Oe,MeshValue:()=>C,POLICY_ID_LENGTH:()=>g,SLOT_CONFIG_NETWORK:()=>z,SUPPORTED_CLOCKS:()=>He,SUPPORTED_HANDLES:()=>Ke,SUPPORTED_LANGUAGE_VIEWS:()=>Z,SUPPORTED_OGMIOS_LINKS:()=>Ne,SUPPORTED_TOKENS:()=>we,SUPPORTED_WALLETS:()=>ve,UtxoSelection:()=>X,assetClass:()=>st,assetName:()=>ae,assocMap:()=>R,bool:()=>ot,builtinByteString:()=>re,byteString:()=>S,bytesToHex:()=>ie,certificateToObj:()=>qe,conStr:()=>O,conStr0:()=>f,conStr1:()=>h,conStr2:()=>rt,currencySymbol:()=>N,dict:()=>pt,emptyTxBuilderBody:()=>Qe,experimentalSelectUtxos:()=>G,fromUTF8:()=>ce,fungibleAssetKeys:()=>Le,generateMnemonic:()=>D.generateMnemonic,hashByteString:()=>Q,hexToBytes:()=>lt,hexToString:()=>gt,integer:()=>v,isNetwork:()=>Fe,keepRelevant:()=>$,largestFirst:()=>W,largestFirstMultiAsset:()=>Y,list:()=>oe,mAssetClass:()=>$e,mBool:()=>Ze,mConStr:()=>ze,mConStr0:()=>l,mConStr1:()=>A,mConStr2:()=>Ge,mMaybeStakingHash:()=>q,mOutputReference:()=>te,mPlutusBSArrayToString:()=>tt,mPubKeyAddress:()=>Xe,mScriptAddress:()=>Je,mStringToPlutusBSArray:()=>et,mTuple:()=>Ye,mTxOutRef:()=>We,mValue:()=>Mt,maybeStakingHash:()=>j,mergeAssets:()=>De,metadataStandardKeys:()=>Ve,metadataToCip68:()=>L,mnemonicToEntropy:()=>D.mnemonicToEntropy,outputReference:()=>se,parseAssetUnit:()=>xt,plutusBSArrayToString:()=>at,policyId:()=>ne,poolMetadataToObj:()=>ee,poolParamsToObj:()=>F,posixTime:()=>ct,pubKeyAddress:()=>dt,pubKeyHash:()=>K,relayToObj:()=>_,resolveEpochNo:()=>St,resolveFingerprint:()=>Tt,resolveLanguageView:()=>ke,resolveSlotNo:()=>ht,resolveTxFees:()=>M,royaltiesStandardKeys:()=>Pe,scriptAddress:()=>ft,scriptHash:()=>H,slotToBeginUnixTime:()=>bt,stringToBSArray:()=>nt,stringToHex:()=>mt,toBytes:()=>U,toUTF8:()=>yt,tokenName:()=>w,tuple:()=>ut,txOutRef:()=>it,unixTimeToEnclosingSlot:()=>pe,validityRangeToObj:()=>je,value:()=>At});module.exports=Me(kt);var b={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=b.minFeeA,r=b.minFeeB)=>(BigInt(t)*BigInt(e)+BigInt(r)).toString();var ve=["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],Ie=[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 Z={ALONZO:{V1:"a141005901d59f1a000302590001011a00060bc719026d00011a000249f01903e800011a000249f018201a0025cea81971f70419744d186419744d186419744d186419744d186419744d186419744d18641864186419744d18641a000249f018201a000249f018201a000249f018201a000249f01903e800011a000249f018201a000249f01903e800081a000242201a00067e2318760001011a000249f01903e800081a000249f01a0001b79818f7011a000249f0192710011a0002155e19052e011903e81a000249f01903e8011a000249f018201a000249f018201a000249f0182001011a000249f0011a000249f0041a000194af18f8011a000194af18f8011a0002377c190556011a0002bdea1901f1011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000242201a00067e23187600010119f04c192bd200011a000249f018201a000242201a00067e2318760001011a000242201a00067e2318760001011a0025cea81971f704001a000141bb041a000249f019138800011a000249f018201a000302590001011a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a000249f018201a00330da70101ff"},BABBAGE:{V1:"a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",V2:"a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"}},ke=(e,t)=>Z[e][t];var Be={mem:7e6,steps:3e9},g=56,Oe={V1:"V1",V2:"V2",V3:"V3"},Re=2147483648,He={testnet:["74","1598400","1595967616","432000"],preview:["183","15811222","1682467200","86400"],preprod:["65","26438400","1682121600","432000"],mainnet:["208","4492800","1596059091","432000"]},Ke={0:"8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",1:"f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"},Ne={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"},we={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"},Ue=e=>`000643b0${e}`,Ee=e=>`000de140${e}`;var De=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 Pe=["rate","address"],Ve=["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 _e=["testnet","preview","preprod","mainnet"],Fe=e=>_e.includes(e);var _=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 F=e=>({vrfKeyHash:e.vrfKeyHash,operator:e.operator,pledge:e.pledge,cost:e.cost,margin:e.margin,relays:e.relays.map(t=>_(t)),owners:e.owners,rewardAddress:e.rewardAddress,metadata:e.metadata?ee(e.metadata):void 0}),ee=e=>({url:e.URL,metadata:e.hash});var qe=e=>{switch(e.type){case"RegisterPool":return{registerPool:{poolParams:F(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}}),je=e=>({invalidBefore:e.invalidBefore??null,invalidHereafter:e.invalidHereafter??null});var ze=(e,t)=>({alternative:e,fields:t}),l=e=>({alternative:0,fields:e}),A=e=>({alternative:1,fields:e}),Ge=e=>({alternative:2,fields:e});var $e=(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])},te=(e,t)=>{if(e.length!==64)throw new Error("Invalid transaction hash - should be 32 bytes long");return l([l([e]),t])},We=(e,t)=>te(e,t),Ye=(e,t)=>[e,t];var q=(e,t=!1)=>e===""?A([]):t?l([l([A([e])])]):l([l([l([e])])]),Xe=(e,t)=>l([{alternative:0,fields:[e]},q(t||"")]),Je=(e,t)=>l([{alternative:1,fields:[e]},q(t||"")]);var Ze=e=>e?A([]):l([]),et=e=>{let t=[];for(let r=0;r<e.length;r+=64){let o=e.substring(r,r+64);t.push(o)}return t},tt=e=>e.join("");var O=(e,t)=>{if(!Array.isArray(t))throw new Error("fields of a constructor must be an array");return{constructor:e,fields:t}},f=e=>O(0,e),h=e=>O(1,e),rt=e=>O(2,e);var ot=e=>e?h([]):f([]),re=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}},v=e=>({int:e}),oe=(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}),nt=e=>oe((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(re)),at=e=>e.list.map(t=>t.bytes).join(""),R=(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)},H=e=>Q(e),K=e=>Q(e),ne=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)},N=e=>ne(e),ae=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)},w=e=>ae(e),st=(e,t)=>f([N(e),w(t)]),se=(e,t)=>{if(e.length!==64)throw new Error("Invalid transaction hash - should be 32 bytes long");return f([f([S(e)]),v(t)])},it=(e,t)=>se(e,t),ct=e=>({int:e}),pt=e=>({map:e.map(([t,r])=>({k:t,v:r}))}),ut=(e,t)=>({list:[e,t]});var j=(e,t=!1)=>e===""?h([]):t?f([f([h([H(e)])])]):f([f([f([K(e)])])]),dt=(e,t,r=!1)=>f([f([K(e)]),j(t||"",r)]),ft=(e,t,r=!1)=>f([h([H(e)]),j(t||"",r)]);var ie=e=>Buffer.from(e).toString("hex"),lt=e=>Buffer.from(e,"hex"),mt=e=>Buffer.from(e,"utf8").toString("hex"),gt=e=>Buffer.from(e,"hex").toString("utf8"),U=e=>e.length%2===0&&/^[0-9A-F]*$/i.test(e)?Buffer.from(e,"hex"):Buffer.from(e,"utf-8"),ce=e=>e.length%2===0&&/^[0-9A-F]*$/i.test(e)?e:ie(Buffer.from(e,"utf-8")),yt=e=>Buffer.from(e,"hex").toString("utf-8"),xt=e=>{let t=e.slice(0,g),r=e.includes(".")?ce(e.split(".")[1]):e.slice(g);return{policyId:t,assetName:r}};var z={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}},bt=(e,t)=>{let r=(e-t.zeroSlot)*t.slotLength;return t.zeroTime+r},pe=(e,t)=>{let r=e-t.zeroTime;return Math.floor(r/t.slotLength)+t.zeroSlot},ht=(e,t=Date.now())=>pe(t,z[e]).toString(),St=(e,t=Date.now())=>{let r=z[e],n=(BigInt(t)/1000n-BigInt(r.zeroTime))/BigInt(r.epochLength)+BigInt(r.startEpoch);return Number(n)};var i=class e{value;constructor(t){if(!t){this.value=BigInt(0);return}this.value=BigInt(t)}static new(t){return t?new e(t):new e(0)}divFloor(t){return this.value=this.value/t.value,this}checkedMul(t){return this.value*=t.value,this}checkedAdd(t){return this.value+=t.value,this}checkedSub(t){return this.value-=t.value,this}clampedSub(t){let r=this.value-t.value;return this.value=r<0n?0n:r,this}lessThan(t){return this.value<t.value}compare(t){return this.value===t.value?0:this.value<t.value?-1:1}toString(){return this.value.toString()}};var ue=Ae(require("@emurgo/cip14-js"),1);var de=ue.default,Tt=(e,t)=>de.default.fromParts(U(e),U(t)).fingerprint();var At=e=>C.fromAssets(e).toJSON(),Mt=e=>C.fromAssets(e).toData(),C=class e{value;constructor(t={}){this.value=t}static fromAssets=t=>{let r=new e;return r.addAssets(t),r};static fromValue=t=>{let r=[];return t.map.forEach(o=>{let n=o.k.bytes;o.v.map.forEach(s=>{let c=s.k.bytes,p=s.v.int.toString(),d=n+c,y=d===""?"lovelace":d;r.push({unit:y,quantity:p})})}),e.fromAssets(r)};addAsset=t=>{let r=BigInt(t.quantity),{unit:o}=t;return this.value[o]?this.value[o]+=r:this.value[o]=r,this};addAssets=t=>(t.forEach(r=>{this.addAsset(r)}),this);negateAsset=t=>{let{unit:r,quantity:o}=t,n=i.new(this.value[r]);return n.clampedSub(i.new(o)),n.value===BigInt(0)?delete this.value[r]:this.value[r]=n.value,this};negateAssets=t=>(t.forEach(r=>{this.negateAsset(r)}),this);get=t=>this.value[t]?BigInt(this.value[t]):BigInt(0);units=()=>Object.keys(this.value);geq=t=>Object.keys(t.value).every(r=>this.geqUnit(r,t));geqUnit=(t,r)=>this.value[t]===void 0||r.value[t]===void 0?!1:BigInt(this.value[t])>=BigInt(r.value[t]);leq=t=>Object.keys(t.value).every(r=>this.leqUnit(r,t));leqUnit=(t,r)=>this.value[t]===void 0||r.value[t]===void 0?!1:BigInt(this.value[t])<=BigInt(r.value[t]);isEmpty=()=>Object.keys(this.value).length===0;merge=t=>((Array.isArray(t)?t:[t]).forEach(o=>{Object.entries(o.value).forEach(([n,s])=>{this.value[n]=(this.value[n]!==void 0?BigInt(this.value[n]):BigInt(0))+BigInt(s)})}),this);toAssets=()=>{let t=[];return Object.entries(this.value).forEach(([r,o])=>{t.push({unit:r,quantity:o.toString()})}),t};toData=()=>{let t=new Map;return this.toAssets().forEach(r=>{let o=r.unit.slice(0,56)||"",n=r.unit.slice(56)||"";t.has(o)||t.set(o,new Map);let s=t.get(o),c=s?.get(n);c?s.set(n,c+BigInt(r.quantity)):s.set(n,BigInt(r.quantity))}),t};toJSON=()=>{let t=[],r={};return this.toAssets().forEach(o=>{let n=o.unit.replace("lovelace",""),s=n.slice(0,56)||"",c=n.slice(56)||"";r[s]||(r[s]={}),r[s][c]?r[s][c]+=Number(o.quantity):r[s][c]=Number(o.quantity)}),Object.keys(r).forEach(o=>{let n=N(o),s=Object.keys(r[o]).map(p=>[w(p),v(r[o][p])]),c=R(s);t.push([n,c])}),R(t)}};var G=(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,c=new Set,p=new Set,d=new Set,y=new Set;for(let a=0;a<t.length;a++)switch(t[a].output.amount.length){case 1:{c.add(a);break}case 2:{p.add(a);break}case 3:{d.add(a);break}default:{y.add(a);break}}let x=(a,u,m)=>{let P=n.get(a);if(!P)return;let ge=vt(P,u);if(Number(ge)>0){s.add(a),m.delete(a);for(let V of P.output.amount)o.set(V.unit,String(Number(o.get(V.unit))-Number(V.quantity)))}};for(let a of o.keys())if(a!="lovelace"){for(let u of p){let m=o.get(a);if(!m||Number(m)<=0)break;x(u,a,p)}for(let u of d){let m=o.get(a);if(!m||Number(m)<=0)break;x(u,a,d)}for(let u of y){let m=o.get(a);if(!m||Number(m)<=0)break;x(u,a,y)}}for(let a of c){let u=o.get("lovelace");if(!u||Number(u)<=0)break;x(a,"lovelace",c)}for(let a of p){let u=o.get("lovelace");if(!u||Number(u)<=0)break;x(a,"lovelace",p)}for(let a of d){let u=o.get("lovelace");if(!u||Number(u)<=0)break;x(a,"lovelace",d)}for(let a of y){let u=o.get("lovelace");if(!u||Number(u)<=0)break;x(a,"lovelace",y)}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 u=n.get(a);u&&k.push(u)}return k},vt=(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:i.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((c,p)=>c.checkedAdd(i.new(r.unit===p.unit?p.quantity:"0")),i.new("0"));return o.checkedAdd(s)},i.new("0")).lessThan(r.quantity)===!1),I=(e,t)=>{let r=i.new(e.output.amount.find(n=>n.unit==="lovelace")?.quantity??"0");return i.new(t.output.amount.find(n=>n.unit==="lovelace")?.quantity??"0").compare(r)},fe=e=>{let{maxTxSize:t,minFeeA:r,minFeeB:o}=e;return i.new(M(t,r,o))},E=e=>e.output.amount.length>1,le=e=>e.reduce((t,r)=>{let o=r.output.amount.find(n=>n.unit==="lovelace")?.quantity??"0";return t.checkedAdd(i.new(o))},i.new("0")),me=(e,t)=>{let r=t.sort(I);return T(r,new Map([["lovelace",e]]))},T=(e,t,r=[])=>e.length===0||Ct(r,t)?r:It(e[0],t)?T(e.slice(1),t,[...r,e[0]]):T(e.slice(1),t,r),It=(e,t)=>Array.from(t.keys()).some(r=>e.output.amount.find(o=>o.unit===r)!==void 0);var $=(e,t,r="5000000")=>{let o=i.new(e.get("lovelace")??"0").checkedAdd(i.new(r)),n=t.filter(p=>p.output.amount.filter(d=>d.unit!=="lovelace").some(d=>e.has(d.unit))),s=le(n);return[...s.lessThan(o)?me(o.clampedSub(s).toString(),t.filter(p=>!n.some(d=>d.input.txHash===p.input.txHash&&d.input.outputIndex===p.input.outputIndex))):[],...n]};var W=(e,t,r=!1,{maxTxSize:o,minFeeA:n,minFeeB:s}=b)=>{let c=t.filter(k=>E(k)===!1).sort(I),p=i.new(M(o,n,s)),d=r?i.new(e).checkedAdd(p).toString():e;return T(c,new Map([["lovelace",d]]))};var Y=(e,t,r=!1,o=b)=>{let n=t.filter(E).sort(I),s=fe(o),c=e.get("lovelace")??"0",p=r?i.new(c).checkedAdd(s).toString():c;return e.set("lovelace",p),T(n,e)};var X=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 W(n.toString(),r,this.includeTxFees)}keepRelevant(t,r){return $(t,r,this.threshold)}largestFirstMultiAsset(t,r){let o=t.get("lovelace")??"0";return t.set("lovelace",(BigInt(o)+BigInt(this.threshold)).toString()),Y(t,r,this.includeTxFees)}experimental(t,r){return G(t,r,this.threshold)}};var D=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,MeshValue,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,mValue,maybeStakingHash,mergeAssets,metadataStandardKeys,metadataToCip68,mnemonicToEntropy,outputReference,parseAssetUnit,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
|
/**
|
|
@@ -589,6 +640,7 @@ interface IMeshTxSerializer {
|
|
|
589
640
|
deserializer: IDeserializer;
|
|
590
641
|
serializeData(data: BuilderData): string;
|
|
591
642
|
serializeAddress(address: DeserializedAddress, networkId?: 0 | 1): string;
|
|
643
|
+
serializePoolId(hash: string): string;
|
|
592
644
|
}
|
|
593
645
|
interface IResolver {
|
|
594
646
|
keys: {
|
|
@@ -606,9 +658,6 @@ interface IResolver {
|
|
|
606
658
|
script: {
|
|
607
659
|
resolveScriptRef(script: NativeScript | PlutusScript): string;
|
|
608
660
|
};
|
|
609
|
-
pool: {
|
|
610
|
-
resolvePoolId(hash: string): string;
|
|
611
|
-
};
|
|
612
661
|
}
|
|
613
662
|
interface IDeserializer {
|
|
614
663
|
key: {
|
|
@@ -618,6 +667,9 @@ interface IDeserializer {
|
|
|
618
667
|
deserializeNativeScript(script: NativeScript): DeserializedScript;
|
|
619
668
|
deserializePlutusScript(script: PlutusScript): DeserializedScript;
|
|
620
669
|
};
|
|
670
|
+
cert: {
|
|
671
|
+
deserializePoolId(poolId: string): string;
|
|
672
|
+
};
|
|
621
673
|
}
|
|
622
674
|
|
|
623
675
|
interface ISigner {
|
|
@@ -659,21 +711,18 @@ type MConStr2<T = any> = MConStr<T>;
|
|
|
659
711
|
declare const mConStr: <T extends Data[]>(alternative: number, fields: T) => MConStr<T>;
|
|
660
712
|
/**
|
|
661
713
|
* The utility function to create a Mesh Data index 0 constructor object, representing custom data type
|
|
662
|
-
* @param alternative The constructor index number
|
|
663
714
|
* @param fields The items in array
|
|
664
715
|
* @returns The Mesh Data constructor object
|
|
665
716
|
*/
|
|
666
717
|
declare const mConStr0: <T extends Data[]>(fields: T) => MConStr0<T>;
|
|
667
718
|
/**
|
|
668
719
|
* The utility function to create a Mesh Data index 1 constructor object, representing custom data type
|
|
669
|
-
* @param alternative The constructor index number
|
|
670
720
|
* @param fields The items in array
|
|
671
721
|
* @returns The Mesh Data constructor object
|
|
672
722
|
*/
|
|
673
723
|
declare const mConStr1: <T extends Data[]>(fields: T) => MConStr1<T>;
|
|
674
724
|
/**
|
|
675
725
|
* The utility function to create a Mesh Data index 2 constructor object, representing custom data type
|
|
676
|
-
* @param alternative The constructor index number
|
|
677
726
|
* @param fields The items in array
|
|
678
727
|
* @returns The Mesh Data constructor object
|
|
679
728
|
*/
|
|
@@ -754,7 +803,7 @@ declare const mMaybeStakingHash: (stakeCredential: string, isScriptCredential?:
|
|
|
754
803
|
* @param isScriptCredential The flag to indicate if the credential is a script credential
|
|
755
804
|
* @returns The Mesh Data public key address object
|
|
756
805
|
*/
|
|
757
|
-
declare const mPubKeyAddress: (bytes: string, stakeCredential?: string
|
|
806
|
+
declare const mPubKeyAddress: (bytes: string, stakeCredential?: string) => Data;
|
|
758
807
|
/**
|
|
759
808
|
* The utility function to create a Mesh Data script address
|
|
760
809
|
* @param bytes The validator hash in hex
|
|
@@ -762,7 +811,7 @@ declare const mPubKeyAddress: (bytes: string, stakeCredential?: string, isScript
|
|
|
762
811
|
* @param isScriptCredential The flag to indicate if the credential is a script credential
|
|
763
812
|
* @returns The Mesh Data script address object
|
|
764
813
|
*/
|
|
765
|
-
declare const mScriptAddress: (bytes: string, stakeCredential?: string
|
|
814
|
+
declare const mScriptAddress: (bytes: string, stakeCredential?: string) => Data;
|
|
766
815
|
|
|
767
816
|
/**
|
|
768
817
|
* The Mesh Data boolean
|
|
@@ -1121,13 +1170,53 @@ declare const scriptAddress: (bytes: string, stakeCredential?: string, isScriptC
|
|
|
1121
1170
|
|
|
1122
1171
|
type PlutusData = ConStr | Bool | ByteString | Integer | List | AssocMap | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | OutputReference | PubKeyHash | POSIXTime | Dict<any> | Tuple<any, any>;
|
|
1123
1172
|
|
|
1173
|
+
/**
|
|
1174
|
+
* Converting bytes to hex string
|
|
1175
|
+
* @param bytes The bytes to be converted
|
|
1176
|
+
* @returns The hex string
|
|
1177
|
+
*/
|
|
1124
1178
|
declare const bytesToHex: (bytes: ArrayBuffer) => string;
|
|
1179
|
+
/**
|
|
1180
|
+
* Converting hex string to bytes
|
|
1181
|
+
* @param hex The hex string to be converted
|
|
1182
|
+
* @returns The bytes
|
|
1183
|
+
*/
|
|
1125
1184
|
declare const hexToBytes: (hex: string) => Buffer;
|
|
1185
|
+
/**
|
|
1186
|
+
* Converting utf8 string to hex string
|
|
1187
|
+
* @param str The utf8 string to be converted
|
|
1188
|
+
* @returns The hex string
|
|
1189
|
+
*/
|
|
1126
1190
|
declare const stringToHex: (str: string) => string;
|
|
1191
|
+
/**
|
|
1192
|
+
* Converting hex string to utf8 string
|
|
1193
|
+
* @param hex The hex string to be converted
|
|
1194
|
+
* @returns The utf8 string
|
|
1195
|
+
*/
|
|
1127
1196
|
declare const hexToString: (hex: string) => string;
|
|
1197
|
+
/**
|
|
1198
|
+
* Converting either hex string or utf8 string to bytes
|
|
1199
|
+
* @param hex The hex or utf8 string to be converted
|
|
1200
|
+
* @returns The bytes
|
|
1201
|
+
*/
|
|
1128
1202
|
declare const toBytes: (hex: string) => Uint8Array;
|
|
1203
|
+
/**
|
|
1204
|
+
* Converting utf8 string to hex string
|
|
1205
|
+
* @param utf8 The utf8 string to be converted
|
|
1206
|
+
* @returns The hex string
|
|
1207
|
+
*/
|
|
1129
1208
|
declare const fromUTF8: (utf8: string) => string;
|
|
1209
|
+
/**
|
|
1210
|
+
* Converting hex string to utf8 string
|
|
1211
|
+
* @param hex The hex string to be converted
|
|
1212
|
+
* @returns The utf8 string
|
|
1213
|
+
*/
|
|
1130
1214
|
declare const toUTF8: (hex: string) => string;
|
|
1215
|
+
/**
|
|
1216
|
+
* Parse asset unit into an object with policyId and assetName
|
|
1217
|
+
* @param unit The asset unit to be parsed
|
|
1218
|
+
* @returns The object with policyId and assetName
|
|
1219
|
+
*/
|
|
1131
1220
|
declare const parseAssetUnit: (unit: string) => {
|
|
1132
1221
|
policyId: string;
|
|
1133
1222
|
assetName: string;
|
|
@@ -1151,14 +1240,142 @@ declare const resolveEpochNo: (network: Network, milliseconds?: number) => numbe
|
|
|
1151
1240
|
* where first key as policy id, second key as asset name, and final value as quantity.
|
|
1152
1241
|
*/
|
|
1153
1242
|
|
|
1243
|
+
/**
|
|
1244
|
+
* Aiken alias
|
|
1245
|
+
* Value is the JSON representation of Cardano data Value
|
|
1246
|
+
*/
|
|
1154
1247
|
type Value = AssocMap<CurrencySymbol, AssocMap<TokenName, Integer>>;
|
|
1248
|
+
/**
|
|
1249
|
+
* Aiken alias
|
|
1250
|
+
* MValue is the Cardano data Value in Mesh Data type
|
|
1251
|
+
*/
|
|
1155
1252
|
type MValue = Map<string, Map<string, bigint>>;
|
|
1253
|
+
/**
|
|
1254
|
+
* The utility function to convert assets into Cardano data Value in JSON
|
|
1255
|
+
* @param assets The assets to convert
|
|
1256
|
+
* @returns The Cardano data Value in JSON
|
|
1257
|
+
*/
|
|
1156
1258
|
declare const value: (assets: Asset[]) => Value;
|
|
1157
|
-
|
|
1259
|
+
/**
|
|
1260
|
+
* The utility function to convert assets into Cardano data Value in Mesh Data type
|
|
1261
|
+
* @param assets The assets to convert
|
|
1262
|
+
* @returns The Cardano data Value in Mesh Data type
|
|
1263
|
+
*/
|
|
1264
|
+
declare const mValue: (assets: Asset[]) => MValue;
|
|
1265
|
+
/**
|
|
1266
|
+
* MeshValue provide utility to handle the Cardano value manipulation. It offers certain axioms:
|
|
1267
|
+
* 1. No duplication of asset - adding assets with same asset name will increase the quantity of the asset in the same record.
|
|
1268
|
+
* 2. No zero and negative entry - the quantity of the asset should not be zero or negative.
|
|
1269
|
+
* 3. Sanitization of lovelace asset name - the class handle back and forth conversion of lovelace asset name to empty string.
|
|
1270
|
+
* 4. Easy convertion to Cardano data - offer utility to convert into either Mesh Data type and JSON type for its Cardano data representation.
|
|
1271
|
+
*/
|
|
1272
|
+
declare class MeshValue {
|
|
1273
|
+
value: Record<string, bigint>;
|
|
1274
|
+
constructor(value?: Record<string, bigint>);
|
|
1275
|
+
/**
|
|
1276
|
+
* Converting assets into MeshValue
|
|
1277
|
+
* @param assets The assets to convert
|
|
1278
|
+
* @returns MeshValue
|
|
1279
|
+
*/
|
|
1280
|
+
static fromAssets: (assets: Asset[]) => MeshValue;
|
|
1281
|
+
/**
|
|
1282
|
+
* Converting Value (the JSON representation of Cardano data Value) into MeshValue
|
|
1283
|
+
* @param plutusValue The Value to convert
|
|
1284
|
+
* @returns MeshValue
|
|
1285
|
+
*/
|
|
1286
|
+
static fromValue: (plutusValue: Value) => MeshValue;
|
|
1287
|
+
/**
|
|
1288
|
+
* Add an asset to the Value class's value record.
|
|
1289
|
+
* @param asset The asset to add
|
|
1290
|
+
* @returns The updated MeshValue object
|
|
1291
|
+
*/
|
|
1292
|
+
addAsset: (asset: Asset) => this;
|
|
1293
|
+
/**
|
|
1294
|
+
* Add an array of assets to the Value class's value record.
|
|
1295
|
+
* @param assets The assets to add
|
|
1296
|
+
* @returns The updated MeshValue object
|
|
1297
|
+
*/
|
|
1298
|
+
addAssets: (assets: Asset[]) => this;
|
|
1299
|
+
/**
|
|
1300
|
+
* Substract an asset from the Value class's value record.
|
|
1301
|
+
* @param asset The asset to subtract
|
|
1302
|
+
* @returns The updated MeshValue object
|
|
1303
|
+
*/
|
|
1304
|
+
negateAsset: (asset: Asset) => this;
|
|
1305
|
+
/**
|
|
1306
|
+
* Subtract an array of assets from the Value class's value record.
|
|
1307
|
+
* @param assets The assets to subtract
|
|
1308
|
+
* @returns The updated MeshValue object
|
|
1309
|
+
*/
|
|
1310
|
+
negateAssets: (assets: Asset[]) => this;
|
|
1311
|
+
/**
|
|
1312
|
+
* Get the quantity of asset object per unit
|
|
1313
|
+
* @param unit The unit to get the quantity of
|
|
1314
|
+
* @returns The quantity of the asset
|
|
1315
|
+
*/
|
|
1316
|
+
get: (unit: string) => bigint;
|
|
1317
|
+
/**
|
|
1318
|
+
* Get all asset units
|
|
1319
|
+
* @returns The asset units
|
|
1320
|
+
*/
|
|
1321
|
+
units: () => string[];
|
|
1322
|
+
/**
|
|
1323
|
+
* Check if the value is greater than or equal to another value
|
|
1324
|
+
* @param other - The value to compare against
|
|
1325
|
+
* @returns boolean
|
|
1326
|
+
*/
|
|
1327
|
+
geq: (other: MeshValue) => boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* Check if the specific unit of value is greater than or equal to that unit of another value
|
|
1330
|
+
* @param unit - The unit to compare
|
|
1331
|
+
* @param other - The value to compare against
|
|
1332
|
+
* @returns boolean
|
|
1333
|
+
*/
|
|
1334
|
+
geqUnit: (unit: string, other: MeshValue) => boolean;
|
|
1335
|
+
/**
|
|
1336
|
+
* Check if the value is less than or equal to another value
|
|
1337
|
+
* @param other - The value to compare against
|
|
1338
|
+
* @returns boolean
|
|
1339
|
+
*/
|
|
1340
|
+
leq: (other: MeshValue) => boolean;
|
|
1341
|
+
/**
|
|
1342
|
+
* Check if the specific unit of value is less than or equal to that unit of another value
|
|
1343
|
+
* @param unit - The unit to compare
|
|
1344
|
+
* @param other - The value to compare against
|
|
1345
|
+
* @returns boolean
|
|
1346
|
+
*/
|
|
1347
|
+
leqUnit: (unit: string, other: MeshValue) => boolean;
|
|
1348
|
+
/**
|
|
1349
|
+
* Check if the value is empty
|
|
1350
|
+
* @returns boolean
|
|
1351
|
+
*/
|
|
1352
|
+
isEmpty: () => boolean;
|
|
1353
|
+
/**
|
|
1354
|
+
* Merge the given values
|
|
1355
|
+
* @param values The other values to merge
|
|
1356
|
+
* @returns this
|
|
1357
|
+
*/
|
|
1358
|
+
merge: (values: MeshValue | MeshValue[]) => this;
|
|
1359
|
+
/**
|
|
1360
|
+
* Convert the MeshValue object into an array of Asset
|
|
1361
|
+
* @returns The array of Asset
|
|
1362
|
+
*/
|
|
1363
|
+
toAssets: () => Asset[];
|
|
1364
|
+
/**
|
|
1365
|
+
* Convert the MeshValue object into Cardano data Value in Mesh Data type
|
|
1366
|
+
*/
|
|
1367
|
+
toData: () => MValue;
|
|
1368
|
+
/**
|
|
1369
|
+
* Convert the MeshValue object into a JSON representation of Cardano data Value
|
|
1370
|
+
* @returns Cardano data Value in JSON
|
|
1371
|
+
*/
|
|
1372
|
+
toJSON: () => Value;
|
|
1373
|
+
}
|
|
1158
1374
|
|
|
1159
1375
|
declare class BigNum {
|
|
1160
1376
|
value: bigint;
|
|
1161
|
-
constructor(value
|
|
1377
|
+
constructor(value?: bigint | number | string);
|
|
1378
|
+
static new(value: number | string | bigint | undefined): BigNum;
|
|
1162
1379
|
divFloor(other: BigNum): BigNum;
|
|
1163
1380
|
checkedMul(other: BigNum): BigNum;
|
|
1164
1381
|
checkedAdd(other: BigNum): BigNum;
|
|
@@ -1166,11 +1383,10 @@ declare class BigNum {
|
|
|
1166
1383
|
clampedSub(other: BigNum): BigNum;
|
|
1167
1384
|
lessThan(other: BigNum): boolean;
|
|
1168
1385
|
compare(other: BigNum): -1 | 0 | 1;
|
|
1169
|
-
static new: (value: number | string) => BigNum;
|
|
1170
1386
|
toString(): string;
|
|
1171
1387
|
}
|
|
1172
1388
|
|
|
1173
1389
|
declare const AssetFingerprint: typeof CIP14;
|
|
1174
1390
|
declare const resolveFingerprint: (policyId: string, assetName: string) => any;
|
|
1175
1391
|
|
|
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,
|
|
1392
|
+
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, MeshValue, 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, mValue, maybeStakingHash, mergeAssets, metadataStandardKeys, metadataToCip68, outputReference, parseAssetUnit, 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 };
|