@meshsdk/core 1.6.0-alpha.8 → 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 (97) hide show
  1. package/README.md +54 -26
  2. package/dist/index.cjs +1 -0
  3. package/dist/index.d.cts +129 -0
  4. package/dist/index.d.ts +129 -14
  5. package/dist/index.js +1 -0
  6. package/package.json +42 -68
  7. package/dist/common/constants.d.ts +0 -58
  8. package/dist/common/contracts/evaluator.d.ts +0 -4
  9. package/dist/common/contracts/fetcher.d.ts +0 -22
  10. package/dist/common/contracts/index.d.ts +0 -7
  11. package/dist/common/contracts/initiator.d.ts +0 -8
  12. package/dist/common/contracts/listener.d.ts +0 -3
  13. package/dist/common/contracts/signer.d.ts +0 -8
  14. package/dist/common/contracts/submitter.d.ts +0 -3
  15. package/dist/common/contracts/uploader.d.ts +0 -3
  16. package/dist/common/data/index.d.ts +0 -2
  17. package/dist/common/data/mesh.d.ts +0 -8
  18. package/dist/common/data/plutus.d.ts +0 -72
  19. package/dist/common/data/plutus.spec.d.ts +0 -1
  20. package/dist/common/decorators.d.ts +0 -19
  21. package/dist/common/helpers/generateNonce.d.ts +0 -1
  22. package/dist/common/helpers/index.d.ts +0 -2
  23. package/dist/common/helpers/readPlutusData.d.ts +0 -2
  24. package/dist/common/index.d.ts +0 -1
  25. package/dist/common/utils/builder.d.ts +0 -18
  26. package/dist/common/utils/converter.d.ts +0 -27
  27. package/dist/common/utils/deserializer.d.ts +0 -19
  28. package/dist/common/utils/index.d.ts +0 -5
  29. package/dist/common/utils/parser.d.ts +0 -5
  30. package/dist/common/utils/resolver.d.ts +0 -17
  31. package/dist/core/CIP14.d.ts +0 -2
  32. package/dist/core/CIP1852.d.ts +0 -4
  33. package/dist/core/CIP1853.d.ts +0 -1
  34. package/dist/core/CIP1855.d.ts +0 -1
  35. package/dist/core/CIP2.d.ts +0 -4
  36. package/dist/core/CIP25.d.ts +0 -19
  37. package/dist/core/CIP27.d.ts +0 -4
  38. package/dist/core/CIP8.d.ts +0 -15
  39. package/dist/core/CPS0009.d.ts +0 -2
  40. package/dist/core/CSL.d.ts +0 -147
  41. package/dist/core/index.d.ts +0 -10
  42. package/dist/core.cjs +0 -18
  43. package/dist/core.js +0 -22016
  44. package/dist/providers/blockfrost.provider.d.ts +0 -46
  45. package/dist/providers/index.d.ts +0 -6
  46. package/dist/providers/infura.provider.d.ts +0 -12
  47. package/dist/providers/koios.provider.d.ts +0 -27
  48. package/dist/providers/maestro.provider.d.ts +0 -35
  49. package/dist/providers/ogmios.provider.d.ts +0 -12
  50. package/dist/providers/tango.provider.d.ts +0 -25
  51. package/dist/providers/yaci.provider.d.ts +0 -32
  52. package/dist/scripts/forge.script.d.ts +0 -8
  53. package/dist/scripts/index.d.ts +0 -1
  54. package/dist/serializer/index.d.ts +0 -1
  55. package/dist/serializer/serializer.d.ts +0 -42
  56. package/dist/serializer/signatures.d.ts +0 -3
  57. package/dist/transaction/index.d.ts +0 -2
  58. package/dist/transaction/meshTxBuilder/index.d.ts +0 -2
  59. package/dist/transaction/meshTxBuilder/meshTxBuilder.service.d.ts +0 -47
  60. package/dist/transaction/meshTxBuilder/meshTxBuilder.spec.d.ts +0 -1
  61. package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +0 -292
  62. package/dist/transaction/meshTxBuilder/type.d.ts +0 -128
  63. package/dist/transaction/transaction.service.d.ts +0 -150
  64. package/dist/transaction/transaction.service.spec.d.ts +0 -1
  65. package/dist/types/Account.d.ts +0 -5
  66. package/dist/types/AccountInfo.d.ts +0 -7
  67. package/dist/types/Action.d.ts +0 -12
  68. package/dist/types/Asset.d.ts +0 -7
  69. package/dist/types/AssetExtended.d.ts +0 -8
  70. package/dist/types/AssetMetadata.d.ts +0 -24
  71. package/dist/types/BlockInfo.d.ts +0 -17
  72. package/dist/types/Data.d.ts +0 -4
  73. package/dist/types/DataSignature.d.ts +0 -4
  74. package/dist/types/Era.d.ts +0 -1
  75. package/dist/types/Mint.d.ts +0 -10
  76. package/dist/types/NativeScript.d.ts +0 -14
  77. package/dist/types/Network.d.ts +0 -4
  78. package/dist/types/PlutusScript.d.ts +0 -5
  79. package/dist/types/PoolParams.d.ts +0 -16
  80. package/dist/types/Protocol.d.ts +0 -22
  81. package/dist/types/Recipient.d.ts +0 -11
  82. package/dist/types/Relay.d.ts +0 -13
  83. package/dist/types/Token.d.ts +0 -2
  84. package/dist/types/TransactionInfo.d.ts +0 -11
  85. package/dist/types/UTxO.d.ts +0 -15
  86. package/dist/types/Wallet.d.ts +0 -5
  87. package/dist/types/index.d.ts +0 -22
  88. package/dist/wallet/app.service.d.ts +0 -43
  89. package/dist/wallet/app.service.spec.d.ts +0 -1
  90. package/dist/wallet/browser.service.d.ts +0 -205
  91. package/dist/wallet/browser.service.spec.d.ts +0 -1
  92. package/dist/wallet/embedded.service.d.ts +0 -20
  93. package/dist/wallet/embedded.service.spec.d.ts +0 -1
  94. package/dist/wallet/index.d.ts +0 -4
  95. package/dist/wallet/mesh.service.d.ts +0 -188
  96. package/dist/wallet/mina.service.d.ts +0 -11
  97. package/dist/wallet/mina.service.spec.d.ts +0 -1
package/README.md CHANGED
@@ -4,29 +4,57 @@ Mesh is an open-source library designed to make building dApps accessible. Wheth
4
4
 
5
5
  Explore the features on [Mesh Playground](https://meshjs.dev/).
6
6
 
7
- ## Guides and documentations
8
-
9
- - [Starter Templates](https://meshjs.dev/starter-templates)
10
- - [Guides](https://meshjs.dev/guides)
11
- - [Install Mesh into existing project](https://meshjs.dev/migration-manual-installation)
12
- - [App Wallet (Building transactions on applications)](https://meshjs.dev/apis/appwallet)
13
- - [Browser Wallet (CIP30 wallets intergration)](https://meshjs.dev/apis/browserwallet)
14
- - [Transaction - Building, minting, burning, smart contracts, stake pool and more](https://meshjs.dev/apis/transaction)
15
- - [React Components](https://meshjs.dev/react)
16
- - [Service Providers](https://meshjs.dev/providers)
17
- - [Resolvers](https://meshjs.dev/apis/resolvers)
18
-
19
- ## Why use Mesh
20
- - Start a new project with one of out [Starter Templates](https://meshjs.dev/starter-templates) with CLI command
21
- - Always up to date - Vasil-ready, developed promptly as the network updates so your app always works
22
- - Simple to use - Check out our [guides](https://meshjs.dev/guides) - you'll get started in less than 10 mins!
23
- - Adopts best practices - implements various CIPs and package is well build (no hacking and tweaking needed to get it to work)
24
- - Thoroughly tested - Mesh is used by both developers and learners, and is being built by developers with solid software engineering backgrounds
25
- - Integrates with Cardano projects - Koios, Blockfrost, ADA Handle (and more), you can pick and choose freely what you want to use for your app
26
- - Well documented - we focus on documentation so you can use it with ease, and our [Playground](https://meshjs.dev/) is built so you can see how it works
27
-
28
- ## How can you contribute?
29
-
30
- - [Support us](https://meshjs.dev/about/support-us)
31
- - Build something - try Mesh by implementing your Web 3.0 project (recommended [starter guide](https://meshjs.dev/guides/nextjs))
32
- - Inform others - Tell others about Mesh, and star the [Github repo](https://github.com/MeshJS/mesh) :star:
7
+ ## What's inside?
8
+
9
+ This Turborepo includes the following packages/apps:
10
+
11
+ ### Packages
12
+
13
+ - `@meshsdk/common`: Contains constants, types and interfaces used across the SDK and different serialization libraries
14
+ - `@meshsdk/contracts`: A collection of smart contracts and its transactions - [meshjs.dev/smart-contracts](https://meshjs.dev/smart-contracts)
15
+ - `@meshsdk/core`: Exports all the functionalities including wallets, transactions, and providers
16
+ - `@meshsdk/core-csl`: Types and utilities functions between Mesh and [cardano-serialization-lib](https://github.com/Emurgo/cardano-serialization-lib)
17
+ - `@meshsdk/core-cst`: Types and utilities functions between Mesh and [cardano-js-sdk](https://github.com/input-output-hk/cardano-js-sdk)
18
+ - `@meshsdk/provider`: Blockchain data providers - [meshjs.dev/providers](https://meshjs.dev/providers)
19
+ - `@meshsdk/react`: React component library - [meshjs.dev/react](https://meshjs.dev/react)
20
+ - `@meshsdk/transaction`: Transactions - [meshjs.dev/apis/transaction](https://meshjs.dev/apis/transaction)
21
+ - `@meshsdk/wallet`: Wallets - [meshjs.dev/apis/wallets](https://meshjs.dev/apis/wallets)
22
+
23
+ ### Apps
24
+
25
+ - `apps/docs`: Mesh technical docs - [docs.meshjs.dev](https://docs.meshjs.dev/)
26
+ - `apps/playground`: Mesh homepage - [meshjs.dev](https://meshjs.dev/)
27
+
28
+ ## Getting Started
29
+
30
+ ### Usage
31
+
32
+ To use Mesh in your project, run the following command to install the core package:
33
+
34
+ ```
35
+ npm install @meshsdk/core
36
+ ```
37
+
38
+ ### Install
39
+
40
+ To install all dependencies, run the following command:
41
+
42
+ ```
43
+ npm install
44
+ ```
45
+
46
+ ### Build
47
+
48
+ To build all apps and packages, run the following command:
49
+
50
+ ```
51
+ npm run build
52
+ ```
53
+
54
+ ### Develop
55
+
56
+ To develop all apps and packages, run the following command:
57
+
58
+ ```
59
+ npm run dev
60
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";var x=Object.create;var p=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},c=(e,t,o,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of h(t))!z.call(e,a)&&a!==o&&p(e,a,{get:()=>t[a],enumerable:!(d=S(t,a))||d.enumerable});return e},s=(e,t,o)=>(c(e,t,"default"),o&&c(o,t,"default")),v=(e,t,o)=>(o=e!=null?x(m(e)):{},c(t||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),f=e=>c(p({},"__esModule",{value:!0}),e);var r={};A(r,{cst:()=>V,deserializeAddress:()=>w,deserializeDatum:()=>L,resolveDataHash:()=>g,resolveNativeScriptAddress:()=>B,resolveNativeScriptHash:()=>N,resolveNativeScriptHex:()=>T,resolvePaymentKeyHash:()=>C,resolvePlutusScriptAddress:()=>K,resolvePlutusScriptHash:()=>R,resolvePoolId:()=>b,resolvePrivateKey:()=>H,resolveRewardAddress:()=>y,resolveScriptHash:()=>D,resolveScriptRef:()=>k,resolveStakeKeyHash:()=>_,resolveTxHash:()=>P,serializeAddressObj:()=>O,serializeNativeScript:()=>j,serializePlutusScript:()=>I});module.exports=f(r);var i=v(require("@meshsdk/core-csl"),1);var H=e=>i.resolvePrivateKey(e),P=e=>i.calculateTxHash(e),g=e=>i.resolveDataHash(e),N=e=>i.resolveNativeScriptHash(e),D=(e,t)=>t?i.deserializePlutusScript(e,t).hash().to_hex():i.deserializeNativeScript(e).hash().to_hex(),b=e=>i.resolvePoolId(e),y=e=>i.resolveRewardAddress(e),K=(e,t)=>i.resolvePlutusScriptAddress(e,t),B=(e,t)=>i.resolveNativeScriptAddress(e,t),T=e=>i.toNativeScript(e).to_hex(),C=e=>i.deserializeBech32Address(e).pubKeyHash,R=e=>i.deserializeBech32Address(e).scriptHash,_=e=>i.deserializeBech32Address(e).stakeCredentialHash,k=e=>i.resolveScriptRef(e);var w=e=>i.deserializeBech32Address(e),L=e=>i.parseDatumCbor(e);var j=(e,t,o=0,d=!1)=>{let a=new i.CSLSerializer,{scriptCbor:n,scriptHash:u}=a.deserializer.script.deserializeNativeScript(e),l={scriptHash:u};return d?l.stakeScriptCredentialHash=t:l.stakeCredentialHash=t,{address:a.serializeAddress(l,o),scriptCbor:n}},I=(e,t,o=0,d=!1)=>{let a=i.deserializePlutusScript(e.code,e.version).hash().to_hex();return{address:i.scriptHashToBech32(a,t,o,d)}},O=e=>i.serializeAddressObj(e);s(r,require("@meshsdk/common"),module.exports);var V=v(require("@meshsdk/core-cst"),1);s(r,require("@meshsdk/provider"),module.exports);s(r,require("@meshsdk/transaction"),module.exports);s(r,require("@meshsdk/wallet"),module.exports);0&&(module.exports={cst,deserializeAddress,deserializeDatum,resolveDataHash,resolveNativeScriptAddress,resolveNativeScriptHash,resolveNativeScriptHex,resolvePaymentKeyHash,resolvePlutusScriptAddress,resolvePlutusScriptHash,resolvePoolId,resolvePrivateKey,resolveRewardAddress,resolveScriptHash,resolveScriptRef,resolveStakeKeyHash,resolveTxHash,serializeAddressObj,serializeNativeScript,serializePlutusScript,...require("@meshsdk/common"),...require("@meshsdk/provider"),...require("@meshsdk/transaction"),...require("@meshsdk/wallet")});
@@ -0,0 +1,129 @@
1
+ import { Data, NativeScript, LanguageVersion, PlutusScript, DeserializedAddress, PubKeyAddress, ScriptAddress } from '@meshsdk/common';
2
+ export * from '@meshsdk/common';
3
+ import * as coreCst from '@meshsdk/core-cst';
4
+ export { coreCst as cst };
5
+ export * from '@meshsdk/provider';
6
+ export * from '@meshsdk/transaction';
7
+ export * from '@meshsdk/wallet';
8
+
9
+ /**
10
+ * Resolve the private key from mnemonic words
11
+ *
12
+ * Update pending to support resolving a tree of private key
13
+ *
14
+ * @param words The mnemonic words
15
+ * @returns The private key
16
+ */
17
+ declare const resolvePrivateKey: (words: string[]) => string;
18
+ /**
19
+ * Resolve the transaction hash from transaction hex
20
+ * @param txHex The transaction hex
21
+ * @returns The transaction hash
22
+ */
23
+ declare const resolveTxHash: (txHex: string) => string;
24
+ /**
25
+ * Hash Cardano data
26
+ * @param data Cardano data in Mesh Data type
27
+ * @returns Cardano data hash
28
+ */
29
+ declare const resolveDataHash: (data: Data) => string;
30
+ /**
31
+ * Hash Cardano native script
32
+ * @param script Cardano native script in Mesh NativeScript type
33
+ * @returns Cardano native script hash
34
+ */
35
+ declare const resolveNativeScriptHash: (script: NativeScript) => string;
36
+ /**
37
+ * Converting script cbor hex to script hash
38
+ * @param scriptCode The script cbor hex
39
+ * @param version The language version of the plutus script, without providing indicates it is a native script
40
+ * @returns The script hash
41
+ */
42
+ declare const resolveScriptHash: (scriptCode: string, version?: LanguageVersion) => string;
43
+ /**
44
+ * Resolve the pool id from hash
45
+ * @param hash The pool hash
46
+ * @returns The pool id
47
+ */
48
+ declare const resolvePoolId: (hash: string) => string;
49
+ /**
50
+ * Resolve the Ed25519 key hash from bech32 address
51
+ * @param bech32 The bech32 address
52
+ * @returns The Ed25519 key hash
53
+ */
54
+ declare const resolveRewardAddress: (bech32: string) => string;
55
+ /**
56
+ * Deprecated - use `serializePlutusScript` instead
57
+ */
58
+ declare const resolvePlutusScriptAddress: (script: PlutusScript, networkId?: number) => string;
59
+ /**
60
+ * Deprecated - use `serializeNativeScript` instead
61
+ */
62
+ declare const resolveNativeScriptAddress: (script: NativeScript, networkId?: number) => string;
63
+ /**
64
+ * Deprecated - use `serializeNativeScript` instead
65
+ */
66
+ declare const resolveNativeScriptHex: (script: NativeScript) => string;
67
+ /**
68
+ * Deprecated - use `deserializeAddress` instead
69
+ */
70
+ declare const resolvePaymentKeyHash: (bech32: string) => string;
71
+ /**
72
+ * Deprecated - use `deserializeAddress` instead
73
+ */
74
+ declare const resolvePlutusScriptHash: (bech32: string) => string;
75
+ /**
76
+ * Deprecated - use `deserializeAddress` instead
77
+ */
78
+ declare const resolveStakeKeyHash: (bech32: string) => string;
79
+ /**
80
+ * Deprecated - this is more used with the low level process inside Mesh
81
+ *
82
+ * If you need this, please import @meshsdk/core-csl or @meshsdk/core-cst instead
83
+ */
84
+ declare const resolveScriptRef: (script: NativeScript | PlutusScript) => string;
85
+
86
+ /**
87
+ * Deserialize bech32 address into payment and staking parts, with visibility of whether they are script or key hash
88
+ * @param bech32 The bech32 address
89
+ * @returns The deserialized address object:
90
+ *
91
+ * ```ts
92
+ * const { pubKeyHash, scriptHash, stakeCredentialHash, stakeScriptCredentialHash } = deserializeAddress(bech32Address);
93
+ * ```
94
+ */
95
+ declare const deserializeAddress: (bech32: string) => DeserializedAddress;
96
+ /**
97
+ * Deserialize a datum from a CBOR string to JSON object
98
+ * @param datumCbor The CBOR string
99
+ * @returns The deserialized JSON object
100
+ */
101
+ declare const deserializeDatum: <T = any>(datumCbor: string) => T;
102
+
103
+ /**
104
+ * Serialize Native script into bech32 address
105
+ * @param script The native script object
106
+ * @param networkId 0 (testnet) or 1 (mainnet). Default to be 0 (testnet).
107
+ * @returns Bech32 address
108
+ */
109
+ declare const serializeNativeScript: (script: NativeScript, stakeCredentialHash?: string, networkId?: number, isScriptStakeCredential?: boolean) => {
110
+ address: string;
111
+ scriptCbor: string | undefined;
112
+ };
113
+ /**
114
+ * Serialize Native script into bech32 address
115
+ * @param script The native script object
116
+ * @param networkId 0 (testnet) or 1 (mainnet). Default to be 0 (testnet).
117
+ * @returns Bech32 address
118
+ */
119
+ declare const serializePlutusScript: (script: PlutusScript, stakeCredentialHash?: string, networkId?: number, isScriptStakeCredential?: boolean) => {
120
+ address: string;
121
+ };
122
+ /**
123
+ * Serialize address in Cardano data JSON format into bech32 address
124
+ * @param address The Cardano address in data JSON format
125
+ * @returns Bech32 address
126
+ */
127
+ declare const serializeAddressObj: (address: PubKeyAddress | ScriptAddress) => string;
128
+
129
+ export { deserializeAddress, deserializeDatum, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptHash, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, serializeAddressObj, serializeNativeScript, serializePlutusScript };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,129 @@
1
- export * from './common/contracts';
2
- export * from './common/data';
3
- export { generateNonce, readPlutusData } from './common/helpers';
4
- export * from './common/utils/resolver';
5
- export * from './common/utils/parser';
6
- export * from './common/constants';
7
- export * from './core/CIP2';
8
- export * from './core/CPS0009';
9
- export { checkSignature } from './core/CIP8';
10
- export * from './providers';
11
- export * from './scripts';
12
- export * from './transaction';
13
- export * from './wallet';
14
- export * from './types';
1
+ import { Data, NativeScript, LanguageVersion, PlutusScript, DeserializedAddress, PubKeyAddress, ScriptAddress } from '@meshsdk/common';
2
+ export * from '@meshsdk/common';
3
+ import * as coreCst from '@meshsdk/core-cst';
4
+ export { coreCst as cst };
5
+ export * from '@meshsdk/provider';
6
+ export * from '@meshsdk/transaction';
7
+ export * from '@meshsdk/wallet';
8
+
9
+ /**
10
+ * Resolve the private key from mnemonic words
11
+ *
12
+ * Update pending to support resolving a tree of private key
13
+ *
14
+ * @param words The mnemonic words
15
+ * @returns The private key
16
+ */
17
+ declare const resolvePrivateKey: (words: string[]) => string;
18
+ /**
19
+ * Resolve the transaction hash from transaction hex
20
+ * @param txHex The transaction hex
21
+ * @returns The transaction hash
22
+ */
23
+ declare const resolveTxHash: (txHex: string) => string;
24
+ /**
25
+ * Hash Cardano data
26
+ * @param data Cardano data in Mesh Data type
27
+ * @returns Cardano data hash
28
+ */
29
+ declare const resolveDataHash: (data: Data) => string;
30
+ /**
31
+ * Hash Cardano native script
32
+ * @param script Cardano native script in Mesh NativeScript type
33
+ * @returns Cardano native script hash
34
+ */
35
+ declare const resolveNativeScriptHash: (script: NativeScript) => string;
36
+ /**
37
+ * Converting script cbor hex to script hash
38
+ * @param scriptCode The script cbor hex
39
+ * @param version The language version of the plutus script, without providing indicates it is a native script
40
+ * @returns The script hash
41
+ */
42
+ declare const resolveScriptHash: (scriptCode: string, version?: LanguageVersion) => string;
43
+ /**
44
+ * Resolve the pool id from hash
45
+ * @param hash The pool hash
46
+ * @returns The pool id
47
+ */
48
+ declare const resolvePoolId: (hash: string) => string;
49
+ /**
50
+ * Resolve the Ed25519 key hash from bech32 address
51
+ * @param bech32 The bech32 address
52
+ * @returns The Ed25519 key hash
53
+ */
54
+ declare const resolveRewardAddress: (bech32: string) => string;
55
+ /**
56
+ * Deprecated - use `serializePlutusScript` instead
57
+ */
58
+ declare const resolvePlutusScriptAddress: (script: PlutusScript, networkId?: number) => string;
59
+ /**
60
+ * Deprecated - use `serializeNativeScript` instead
61
+ */
62
+ declare const resolveNativeScriptAddress: (script: NativeScript, networkId?: number) => string;
63
+ /**
64
+ * Deprecated - use `serializeNativeScript` instead
65
+ */
66
+ declare const resolveNativeScriptHex: (script: NativeScript) => string;
67
+ /**
68
+ * Deprecated - use `deserializeAddress` instead
69
+ */
70
+ declare const resolvePaymentKeyHash: (bech32: string) => string;
71
+ /**
72
+ * Deprecated - use `deserializeAddress` instead
73
+ */
74
+ declare const resolvePlutusScriptHash: (bech32: string) => string;
75
+ /**
76
+ * Deprecated - use `deserializeAddress` instead
77
+ */
78
+ declare const resolveStakeKeyHash: (bech32: string) => string;
79
+ /**
80
+ * Deprecated - this is more used with the low level process inside Mesh
81
+ *
82
+ * If you need this, please import @meshsdk/core-csl or @meshsdk/core-cst instead
83
+ */
84
+ declare const resolveScriptRef: (script: NativeScript | PlutusScript) => string;
85
+
86
+ /**
87
+ * Deserialize bech32 address into payment and staking parts, with visibility of whether they are script or key hash
88
+ * @param bech32 The bech32 address
89
+ * @returns The deserialized address object:
90
+ *
91
+ * ```ts
92
+ * const { pubKeyHash, scriptHash, stakeCredentialHash, stakeScriptCredentialHash } = deserializeAddress(bech32Address);
93
+ * ```
94
+ */
95
+ declare const deserializeAddress: (bech32: string) => DeserializedAddress;
96
+ /**
97
+ * Deserialize a datum from a CBOR string to JSON object
98
+ * @param datumCbor The CBOR string
99
+ * @returns The deserialized JSON object
100
+ */
101
+ declare const deserializeDatum: <T = any>(datumCbor: string) => T;
102
+
103
+ /**
104
+ * Serialize Native script into bech32 address
105
+ * @param script The native script object
106
+ * @param networkId 0 (testnet) or 1 (mainnet). Default to be 0 (testnet).
107
+ * @returns Bech32 address
108
+ */
109
+ declare const serializeNativeScript: (script: NativeScript, stakeCredentialHash?: string, networkId?: number, isScriptStakeCredential?: boolean) => {
110
+ address: string;
111
+ scriptCbor: string | undefined;
112
+ };
113
+ /**
114
+ * Serialize Native script into bech32 address
115
+ * @param script The native script object
116
+ * @param networkId 0 (testnet) or 1 (mainnet). Default to be 0 (testnet).
117
+ * @returns Bech32 address
118
+ */
119
+ declare const serializePlutusScript: (script: PlutusScript, stakeCredentialHash?: string, networkId?: number, isScriptStakeCredential?: boolean) => {
120
+ address: string;
121
+ };
122
+ /**
123
+ * Serialize address in Cardano data JSON format into bech32 address
124
+ * @param address The Cardano address in data JSON format
125
+ * @returns Bech32 address
126
+ */
127
+ declare const serializeAddressObj: (address: PubKeyAddress | ScriptAddress) => string;
128
+
129
+ export { deserializeAddress, deserializeDatum, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptHash, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, serializeAddressObj, serializeNativeScript, serializePlutusScript };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import*as r from"@meshsdk/core-csl";var v=e=>r.resolvePrivateKey(e),u=e=>r.calculateTxHash(e),x=e=>r.resolveDataHash(e),S=e=>r.resolveNativeScriptHash(e),h=(e,s)=>s?r.deserializePlutusScript(e,s).hash().to_hex():r.deserializeNativeScript(e).hash().to_hex(),m=e=>r.resolvePoolId(e),z=e=>r.resolveRewardAddress(e),A=(e,s)=>r.resolvePlutusScriptAddress(e,s),f=(e,s)=>r.resolveNativeScriptAddress(e,s),H=e=>r.toNativeScript(e).to_hex(),P=e=>r.deserializeBech32Address(e).pubKeyHash,g=e=>r.deserializeBech32Address(e).scriptHash,N=e=>r.deserializeBech32Address(e).stakeCredentialHash,D=e=>r.resolveScriptRef(e);var K=e=>r.deserializeBech32Address(e),B=e=>r.parseDatumCbor(e);var R=(e,s,i=0,o=!1)=>{let t=new r.CSLSerializer,{scriptCbor:d,scriptHash:c}=t.deserializer.script.deserializeNativeScript(e),a={scriptHash:c};return o?a.stakeScriptCredentialHash=s:a.stakeCredentialHash=s,{address:t.serializeAddress(a,i),scriptCbor:d}},_=(e,s,i=0,o=!1)=>{let t=r.deserializePlutusScript(e.code,e.version).hash().to_hex();return{address:r.scriptHashToBech32(t,s,i,o)}},k=e=>r.serializeAddressObj(e);export*from"@meshsdk/common";import*as F from"@meshsdk/core-cst";export*from"@meshsdk/provider";export*from"@meshsdk/transaction";export*from"@meshsdk/wallet";export{F as cst,K as deserializeAddress,B as deserializeDatum,x as resolveDataHash,f as resolveNativeScriptAddress,S as resolveNativeScriptHash,H as resolveNativeScriptHex,P as resolvePaymentKeyHash,A as resolvePlutusScriptAddress,g as resolvePlutusScriptHash,m as resolvePoolId,v as resolvePrivateKey,z as resolveRewardAddress,h as resolveScriptHash,D as resolveScriptRef,N as resolveStakeKeyHash,u as resolveTxHash,k as serializeAddressObj,R as serializeNativeScript,_ as serializePlutusScript};
package/package.json CHANGED
@@ -1,80 +1,54 @@
1
1
  {
2
2
  "name": "@meshsdk/core",
3
- "description": "Rapidly build Web3 apps on the Cardano Blockchain.",
4
- "homepage": "https://meshjs.dev",
5
- "author": "MeshJS",
6
- "version": "1.6.0-alpha.8",
7
- "license": "Apache-2.0",
3
+ "version": "1.6.1",
4
+ "description": "",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "type": "module",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/MeshJS/mesh.git"
12
- },
13
- "bugs": {
14
- "url": "https://github.com/MeshJS/mesh/issues"
15
- },
16
- "keywords": [
17
- "blockchain",
18
- "cardano",
19
- "plutus"
20
- ],
21
- "main": "dist/core.cjs",
22
- "module": "dist/core.js",
23
- "typings": "dist/index.d.ts",
24
- "files": [
25
- "dist"
26
- ],
27
- "engines": {
28
- "node": ">=16"
29
- },
30
- "scripts": {
31
- "lint": "eslint --ext .ts .",
32
- "test": "vitest --run",
33
- "test:watch": "vitest",
34
- "test:coverage": "vitest run --coverage",
35
- "build": "vite build && yarn docs",
36
- "prepare": "yarn lint && yarn test && yarn build",
37
- "dev": "vite build --watch",
38
- "docs": "typedoc src/index.ts --json ../docs/src/data/api.json",
39
- "docs2": "typedoc src/index.ts --out ../docs/tmp"
40
- },
41
- "husky": {
42
- "hooks": {
43
- "pre-commit": "yarn lint"
44
- }
45
- },
46
- "browser": {
47
- "@emurgo/cardano-message-signing-nodejs": "@emurgo/cardano-message-signing-browser"
48
- },
49
9
  "exports": {
50
10
  ".": {
51
- "import": "./dist/core.js",
52
- "require": "./dist/core.cjs",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs",
53
13
  "types": "./dist/index.d.ts"
54
14
  }
55
15
  },
16
+ "files": [
17
+ "dist/**"
18
+ ],
19
+ "scripts": {
20
+ "build:mesh": "tsup src/index.ts --format esm,cjs --dts --minify",
21
+ "dev": "tsup src/index.ts --format esm,cjs --watch --dts",
22
+ "lint": "eslint",
23
+ "clean": "rm -rf .turbo && rm -rf dist && rm -rf node_modules",
24
+ "format": "prettier --check . --ignore-path ../../.gitignore"
25
+ },
56
26
  "devDependencies": {
57
- "@rollup/plugin-typescript": "8.4.0",
58
- "@typescript-eslint/eslint-plugin": "5.36.1",
59
- "@typescript-eslint/parser": "5.36.1",
60
- "husky": "8.0.1",
61
- "rollup": "2.79.0",
62
- "tslib": "2.4.0",
63
- "typedoc": "^0.25.8",
64
- "vite": "3.1.4",
65
- "vite-plugin-eslint": "1.8.1",
66
- "vite-plugin-wasm": "2.1.0",
67
- "vitest": "0.22.1"
27
+ "@meshsdk/eslint-config": "*",
28
+ "@meshsdk/typescript-config": "*",
29
+ "eslint": "^8.57.0",
30
+ "tsup": "^8.0.2",
31
+ "typescript": "^5.3.3"
68
32
  },
69
33
  "dependencies": {
70
- "@emurgo/cardano-message-signing-browser": "1.0.1",
71
- "@emurgo/cardano-message-signing-nodejs": "1.0.1",
72
- "@emurgo/cip14-js": "3.0.1",
73
- "@meshsdk/mesh-csl": "^0.0.5",
74
- "axios": "1.6.3",
75
- "bip39": "3.0.4",
76
- "json-bigint": "^1.0.0",
77
- "nanoid": "3.3.4",
78
- "zod": "3.22.4"
79
- }
34
+ "@meshsdk/common": "*",
35
+ "@meshsdk/core-csl": "*",
36
+ "@meshsdk/core-cst": "*",
37
+ "@meshsdk/provider": "*",
38
+ "@meshsdk/react": "*",
39
+ "@meshsdk/transaction": "*",
40
+ "@meshsdk/wallet": "*"
41
+ },
42
+ "prettier": "@meshsdk/prettier-config",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "license": "Apache-2.0",
47
+ "keywords": [
48
+ "cardano",
49
+ "ada",
50
+ "web3",
51
+ "blockchain",
52
+ "sdk"
53
+ ]
80
54
  }
@@ -1,58 +0,0 @@
1
- import { csl } from '@mesh/core';
2
- import type { Costmdls } from '@mesh/core';
3
- import type { Budget, Era, Network, Protocol } from '../types';
4
- export declare const DEFAULT_REDEEMER_BUDGET: Budget;
5
- export declare const DEFAULT_PROTOCOL_PARAMETERS: Protocol;
6
- export declare const HARDENED_KEY_START = 2147483648;
7
- export declare const LANGUAGE_VERSIONS: {
8
- V1: csl.Language;
9
- V2: csl.Language;
10
- };
11
- export declare const POLICY_ID_LENGTH = 56;
12
- export declare const REDEEMER_TAGS: {
13
- CERT: csl.RedeemerTag;
14
- MINT: csl.RedeemerTag;
15
- REWARD: csl.RedeemerTag;
16
- SPEND: csl.RedeemerTag;
17
- };
18
- export declare const SUPPORTED_CLOCKS: Record<Network, [
19
- epoch: string,
20
- slot: string,
21
- systemStart: string,
22
- epochLength: string
23
- ]>;
24
- export declare const SUPPORTED_COST_MODELS: Record<Era, Costmdls>;
25
- export declare const SUPPORTED_LANGUAGE_VIEWS: Record<Era, Partial<Record<keyof typeof LANGUAGE_VERSIONS, string>>>;
26
- export declare const SUPPORTED_HANDLES: Record<number, string>;
27
- export declare const SUPPORTED_OGMIOS_LINKS: Record<Network, string>;
28
- export declare const SUPPORTED_TOKENS: {
29
- LQ: string;
30
- MIN: string;
31
- NTX: string;
32
- iBTC: string;
33
- iETH: string;
34
- iUSD: string;
35
- MILK: string;
36
- AGIX: string;
37
- MELD: string;
38
- INDY: string;
39
- CLAY: string;
40
- MCOS: string;
41
- DING: string;
42
- GERO: string;
43
- NMKR: string;
44
- PAVIA: string;
45
- HOSKY: string;
46
- YUMMI: string;
47
- C3: string;
48
- GIMBAL: string;
49
- SUNDAE: string;
50
- GREENS: string;
51
- GENS: string;
52
- SOCIETY: string;
53
- DJED: string;
54
- SHEN: string;
55
- WMT: string;
56
- COPI: string;
57
- };
58
- export declare const SUPPORTED_WALLETS: string[];
@@ -1,4 +0,0 @@
1
- import { Action } from '@mesh/types';
2
- export interface IEvaluator {
3
- evaluateTx(tx: string): Promise<Omit<Action, 'data'>[]>;
4
- }
@@ -1,22 +0,0 @@
1
- import type { AccountInfo, Asset, AssetMetadata, BlockInfo, Protocol, TransactionInfo, UTxO } from '@mesh/types';
2
- /**
3
- * Fetcher interface defines end points to query blockchain data.
4
- */
5
- export interface IFetcher {
6
- fetchAccountInfo(address: string): Promise<AccountInfo>;
7
- fetchAddressUTxOs(address: string, asset?: string): Promise<UTxO[]>;
8
- fetchAssetAddresses(asset: string): Promise<{
9
- address: string;
10
- quantity: string;
11
- }[]>;
12
- fetchAssetMetadata(asset: string): Promise<AssetMetadata>;
13
- fetchBlockInfo(hash: string): Promise<BlockInfo>;
14
- fetchCollectionAssets(policyId: string, cursor?: number | string): Promise<{
15
- assets: Asset[];
16
- next: string | number | null;
17
- }>;
18
- fetchHandleAddress(handle: string): Promise<string>;
19
- fetchProtocolParameters(epoch: number): Promise<Protocol>;
20
- fetchTxInfo(hash: string): Promise<TransactionInfo>;
21
- fetchUTxOs(hash: string): Promise<UTxO[]>;
22
- }
@@ -1,7 +0,0 @@
1
- export * from './evaluator';
2
- export * from './fetcher';
3
- export * from './initiator';
4
- export * from './listener';
5
- export * from './signer';
6
- export * from './submitter';
7
- export * from './uploader';
@@ -1,8 +0,0 @@
1
- import type { Address, TransactionUnspentOutput } from '@mesh/core';
2
- export interface IInitiator {
3
- getUsedAddress(): SometimesPromise<Address>;
4
- getUsedCollateral(limit?: number): SometimesPromise<TransactionUnspentOutput[]>;
5
- getUsedUTxOs(): SometimesPromise<TransactionUnspentOutput[]>;
6
- }
7
- declare type SometimesPromise<T> = Promise<T> | T;
8
- export {};
@@ -1,3 +0,0 @@
1
- export interface IListener {
2
- onTxConfirmed(txHash: string, callback: () => void, limit?: number): void;
3
- }
@@ -1,8 +0,0 @@
1
- import { DataSignature } from '@mesh/types';
2
- export interface ISigner {
3
- signData(address: string, payload: string): SometimesPromise<DataSignature>;
4
- signTx(unsignedTx: string, partialSign: boolean): SometimesPromise<string>;
5
- signTxs(unsignedTxs: string[], partialSign: boolean): SometimesPromise<string[]>;
6
- }
7
- declare type SometimesPromise<T> = Promise<T> | T;
8
- export {};
@@ -1,3 +0,0 @@
1
- export interface ISubmitter {
2
- submitTx(tx: string): Promise<string>;
3
- }
@@ -1,3 +0,0 @@
1
- export interface IUploader {
2
- uploadContent(content: FormData, recursive: boolean): Promise<string>;
3
- }
@@ -1,2 +0,0 @@
1
- export * from './mesh';
2
- export * from './plutus';
@@ -1,8 +0,0 @@
1
- import { Data } from '@mesh/types';
2
- export declare const mConStr: <T extends Data[]>(alternative: number, fields: T) => Data;
3
- export declare const mConStr0: <T extends Data[]>(fields: T) => Data;
4
- export declare const mConStr1: <T extends Data[]>(fields: T) => Data;
5
- export declare const mConStr2: <T extends Data[]>(fields: T) => Data;
6
- export declare const mMaybeStakingHash: (stakeCredential: string) => Data;
7
- export declare const mPubKeyAddress: (bytes: string, stakeCredential?: string) => Data;
8
- export declare const mScriptAddress: (bytes: string, stakeCredential?: string) => Data;