@meshsdk/core 1.6.0-alpha.20 → 1.6.0-alpha.21
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/.turbo/turbo-build$colon$mesh.log +19 -0
- package/.turbo/turbo-build.log +19 -0
- package/dist/index.d.mts +129 -0
- package/dist/index.d.ts +129 -0
- package/dist/index.js +149 -0
- package/dist/index.mjs +91 -0
- package/package.json +10 -10
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
> @meshsdk/core@1.6.0-alpha.21 build:mesh
|
|
3
|
+
> tsup src/index.ts --format esm,cjs --dts
|
|
4
|
+
|
|
5
|
+
[1G[0K[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.2.3
|
|
8
|
+
[34mCLI[39m Target: es2020
|
|
9
|
+
[34mESM[39m Build start
|
|
10
|
+
[34mCJS[39m Build start
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m3.30 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 12ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m6.24 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 13ms
|
|
15
|
+
[34mDTS[39m Build start
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 670ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.84 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.84 KB[39m
|
|
19
|
+
[1G[0K⠙[1G[0K
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
> @meshsdk/core@0.0.1 build
|
|
3
|
+
> tsup src/index.ts --format esm,cjs --dts
|
|
4
|
+
|
|
5
|
+
[1G[0K[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.2.3
|
|
8
|
+
[34mCLI[39m Target: es2020
|
|
9
|
+
[34mESM[39m Build start
|
|
10
|
+
[34mCJS[39m Build start
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.38 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 14ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m4.03 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 14ms
|
|
15
|
+
[34mDTS[39m Build start
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 738ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.52 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.52 KB[39m
|
|
19
|
+
[1G[0K⠙[1G[0K
|
package/dist/index.d.mts
ADDED
|
@@ -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
ADDED
|
@@ -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.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
cst: () => cst,
|
|
35
|
+
deserializeAddress: () => deserializeAddress,
|
|
36
|
+
deserializeDatum: () => deserializeDatum,
|
|
37
|
+
resolveDataHash: () => resolveDataHash,
|
|
38
|
+
resolveNativeScriptAddress: () => resolveNativeScriptAddress,
|
|
39
|
+
resolveNativeScriptHash: () => resolveNativeScriptHash,
|
|
40
|
+
resolveNativeScriptHex: () => resolveNativeScriptHex,
|
|
41
|
+
resolvePaymentKeyHash: () => resolvePaymentKeyHash,
|
|
42
|
+
resolvePlutusScriptAddress: () => resolvePlutusScriptAddress,
|
|
43
|
+
resolvePlutusScriptHash: () => resolvePlutusScriptHash,
|
|
44
|
+
resolvePoolId: () => resolvePoolId,
|
|
45
|
+
resolvePrivateKey: () => resolvePrivateKey,
|
|
46
|
+
resolveRewardAddress: () => resolveRewardAddress,
|
|
47
|
+
resolveScriptHash: () => resolveScriptHash,
|
|
48
|
+
resolveScriptRef: () => resolveScriptRef,
|
|
49
|
+
resolveStakeKeyHash: () => resolveStakeKeyHash,
|
|
50
|
+
resolveTxHash: () => resolveTxHash,
|
|
51
|
+
serializeAddressObj: () => serializeAddressObj,
|
|
52
|
+
serializeNativeScript: () => serializeNativeScript,
|
|
53
|
+
serializePlutusScript: () => serializePlutusScript
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(src_exports);
|
|
56
|
+
|
|
57
|
+
// src/utils/resolver.ts
|
|
58
|
+
var import_core_csl = require("@meshsdk/core-csl");
|
|
59
|
+
|
|
60
|
+
// src/core.ts
|
|
61
|
+
var core = __toESM(require("@meshsdk/core-csl"));
|
|
62
|
+
|
|
63
|
+
// src/utils/resolver.ts
|
|
64
|
+
var resolvePrivateKey = (words) => core.resolvePrivateKey(words);
|
|
65
|
+
var resolveTxHash = (txHex) => core.calculateTxHash(txHex);
|
|
66
|
+
var resolveDataHash = (data) => core.resolveDataHash(data);
|
|
67
|
+
var resolveNativeScriptHash = (script) => core.resolveNativeScriptHash(script);
|
|
68
|
+
var resolveScriptHash = (scriptCode, version) => {
|
|
69
|
+
if (!version) {
|
|
70
|
+
return (0, import_core_csl.deserializeNativeScript)(scriptCode).hash().to_hex();
|
|
71
|
+
}
|
|
72
|
+
return (0, import_core_csl.deserializePlutusScript)(scriptCode, version).hash().to_hex();
|
|
73
|
+
};
|
|
74
|
+
var resolvePoolId = (hash) => core.resolvePoolId(hash);
|
|
75
|
+
var resolveRewardAddress = (bech32) => core.resolveRewardAddress(bech32);
|
|
76
|
+
var resolvePlutusScriptAddress = (script, networkId) => core.resolvePlutusScriptAddress(script, networkId);
|
|
77
|
+
var resolveNativeScriptAddress = (script, networkId) => core.resolveNativeScriptAddress(script, networkId);
|
|
78
|
+
var resolveNativeScriptHex = (script) => core.toNativeScript(script).to_hex();
|
|
79
|
+
var resolvePaymentKeyHash = (bech32) => core.deserializeBech32Address(bech32).pubKeyHash;
|
|
80
|
+
var resolvePlutusScriptHash = (bech32) => core.deserializeBech32Address(bech32).scriptHash;
|
|
81
|
+
var resolveStakeKeyHash = (bech32) => core.deserializeBech32Address(bech32).stakeCredentialHash;
|
|
82
|
+
var resolveScriptRef = (script) => core.resolveScriptRef(script);
|
|
83
|
+
|
|
84
|
+
// src/utils/deserializer.ts
|
|
85
|
+
var deserializeAddress = (bech32) => core.deserializeBech32Address(bech32);
|
|
86
|
+
var deserializeDatum = (datumCbor) => core.parseDatumCbor(datumCbor);
|
|
87
|
+
|
|
88
|
+
// src/utils/serializer.ts
|
|
89
|
+
var serializeNativeScript = (script, stakeCredentialHash, networkId = 0, isScriptStakeCredential = false) => {
|
|
90
|
+
const serializer = new core.CSLSerializer();
|
|
91
|
+
const { scriptCbor, scriptHash } = serializer.deserializer.script.deserializeNativeScript(script);
|
|
92
|
+
const deserializedAddress = {
|
|
93
|
+
scriptHash
|
|
94
|
+
};
|
|
95
|
+
if (isScriptStakeCredential) {
|
|
96
|
+
deserializedAddress.stakeScriptCredentialHash = stakeCredentialHash;
|
|
97
|
+
} else {
|
|
98
|
+
deserializedAddress.stakeCredentialHash = stakeCredentialHash;
|
|
99
|
+
}
|
|
100
|
+
const address = serializer.serializeAddress(deserializedAddress, networkId);
|
|
101
|
+
return { address, scriptCbor };
|
|
102
|
+
};
|
|
103
|
+
var serializePlutusScript = (script, stakeCredentialHash, networkId = 0, isScriptStakeCredential = false) => {
|
|
104
|
+
const scriptHash = core.deserializePlutusScript(script.code, script.version).hash().to_hex();
|
|
105
|
+
const address = core.scriptHashToBech32(
|
|
106
|
+
scriptHash,
|
|
107
|
+
stakeCredentialHash,
|
|
108
|
+
networkId,
|
|
109
|
+
isScriptStakeCredential
|
|
110
|
+
);
|
|
111
|
+
return { address };
|
|
112
|
+
};
|
|
113
|
+
var serializeAddressObj = (address) => {
|
|
114
|
+
return core.serializeAddressObj(address);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/index.ts
|
|
118
|
+
__reExport(src_exports, require("@meshsdk/common"), module.exports);
|
|
119
|
+
var cst = __toESM(require("@meshsdk/core-cst"));
|
|
120
|
+
__reExport(src_exports, require("@meshsdk/provider"), module.exports);
|
|
121
|
+
__reExport(src_exports, require("@meshsdk/transaction"), module.exports);
|
|
122
|
+
__reExport(src_exports, require("@meshsdk/wallet"), module.exports);
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
cst,
|
|
126
|
+
deserializeAddress,
|
|
127
|
+
deserializeDatum,
|
|
128
|
+
resolveDataHash,
|
|
129
|
+
resolveNativeScriptAddress,
|
|
130
|
+
resolveNativeScriptHash,
|
|
131
|
+
resolveNativeScriptHex,
|
|
132
|
+
resolvePaymentKeyHash,
|
|
133
|
+
resolvePlutusScriptAddress,
|
|
134
|
+
resolvePlutusScriptHash,
|
|
135
|
+
resolvePoolId,
|
|
136
|
+
resolvePrivateKey,
|
|
137
|
+
resolveRewardAddress,
|
|
138
|
+
resolveScriptHash,
|
|
139
|
+
resolveScriptRef,
|
|
140
|
+
resolveStakeKeyHash,
|
|
141
|
+
resolveTxHash,
|
|
142
|
+
serializeAddressObj,
|
|
143
|
+
serializeNativeScript,
|
|
144
|
+
serializePlutusScript,
|
|
145
|
+
...require("@meshsdk/common"),
|
|
146
|
+
...require("@meshsdk/provider"),
|
|
147
|
+
...require("@meshsdk/transaction"),
|
|
148
|
+
...require("@meshsdk/wallet")
|
|
149
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/utils/resolver.ts
|
|
2
|
+
import {
|
|
3
|
+
deserializeNativeScript,
|
|
4
|
+
deserializePlutusScript
|
|
5
|
+
} from "@meshsdk/core-csl";
|
|
6
|
+
|
|
7
|
+
// src/core.ts
|
|
8
|
+
import * as core from "@meshsdk/core-csl";
|
|
9
|
+
|
|
10
|
+
// src/utils/resolver.ts
|
|
11
|
+
var resolvePrivateKey = (words) => core.resolvePrivateKey(words);
|
|
12
|
+
var resolveTxHash = (txHex) => core.calculateTxHash(txHex);
|
|
13
|
+
var resolveDataHash = (data) => core.resolveDataHash(data);
|
|
14
|
+
var resolveNativeScriptHash = (script) => core.resolveNativeScriptHash(script);
|
|
15
|
+
var resolveScriptHash = (scriptCode, version) => {
|
|
16
|
+
if (!version) {
|
|
17
|
+
return deserializeNativeScript(scriptCode).hash().to_hex();
|
|
18
|
+
}
|
|
19
|
+
return deserializePlutusScript(scriptCode, version).hash().to_hex();
|
|
20
|
+
};
|
|
21
|
+
var resolvePoolId = (hash) => core.resolvePoolId(hash);
|
|
22
|
+
var resolveRewardAddress = (bech32) => core.resolveRewardAddress(bech32);
|
|
23
|
+
var resolvePlutusScriptAddress = (script, networkId) => core.resolvePlutusScriptAddress(script, networkId);
|
|
24
|
+
var resolveNativeScriptAddress = (script, networkId) => core.resolveNativeScriptAddress(script, networkId);
|
|
25
|
+
var resolveNativeScriptHex = (script) => core.toNativeScript(script).to_hex();
|
|
26
|
+
var resolvePaymentKeyHash = (bech32) => core.deserializeBech32Address(bech32).pubKeyHash;
|
|
27
|
+
var resolvePlutusScriptHash = (bech32) => core.deserializeBech32Address(bech32).scriptHash;
|
|
28
|
+
var resolveStakeKeyHash = (bech32) => core.deserializeBech32Address(bech32).stakeCredentialHash;
|
|
29
|
+
var resolveScriptRef = (script) => core.resolveScriptRef(script);
|
|
30
|
+
|
|
31
|
+
// src/utils/deserializer.ts
|
|
32
|
+
var deserializeAddress = (bech32) => core.deserializeBech32Address(bech32);
|
|
33
|
+
var deserializeDatum = (datumCbor) => core.parseDatumCbor(datumCbor);
|
|
34
|
+
|
|
35
|
+
// src/utils/serializer.ts
|
|
36
|
+
var serializeNativeScript = (script, stakeCredentialHash, networkId = 0, isScriptStakeCredential = false) => {
|
|
37
|
+
const serializer = new core.CSLSerializer();
|
|
38
|
+
const { scriptCbor, scriptHash } = serializer.deserializer.script.deserializeNativeScript(script);
|
|
39
|
+
const deserializedAddress = {
|
|
40
|
+
scriptHash
|
|
41
|
+
};
|
|
42
|
+
if (isScriptStakeCredential) {
|
|
43
|
+
deserializedAddress.stakeScriptCredentialHash = stakeCredentialHash;
|
|
44
|
+
} else {
|
|
45
|
+
deserializedAddress.stakeCredentialHash = stakeCredentialHash;
|
|
46
|
+
}
|
|
47
|
+
const address = serializer.serializeAddress(deserializedAddress, networkId);
|
|
48
|
+
return { address, scriptCbor };
|
|
49
|
+
};
|
|
50
|
+
var serializePlutusScript = (script, stakeCredentialHash, networkId = 0, isScriptStakeCredential = false) => {
|
|
51
|
+
const scriptHash = core.deserializePlutusScript(script.code, script.version).hash().to_hex();
|
|
52
|
+
const address = core.scriptHashToBech32(
|
|
53
|
+
scriptHash,
|
|
54
|
+
stakeCredentialHash,
|
|
55
|
+
networkId,
|
|
56
|
+
isScriptStakeCredential
|
|
57
|
+
);
|
|
58
|
+
return { address };
|
|
59
|
+
};
|
|
60
|
+
var serializeAddressObj = (address) => {
|
|
61
|
+
return core.serializeAddressObj(address);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// src/index.ts
|
|
65
|
+
export * from "@meshsdk/common";
|
|
66
|
+
import * as cst from "@meshsdk/core-cst";
|
|
67
|
+
export * from "@meshsdk/provider";
|
|
68
|
+
export * from "@meshsdk/transaction";
|
|
69
|
+
export * from "@meshsdk/wallet";
|
|
70
|
+
export {
|
|
71
|
+
cst,
|
|
72
|
+
deserializeAddress,
|
|
73
|
+
deserializeDatum,
|
|
74
|
+
resolveDataHash,
|
|
75
|
+
resolveNativeScriptAddress,
|
|
76
|
+
resolveNativeScriptHash,
|
|
77
|
+
resolveNativeScriptHex,
|
|
78
|
+
resolvePaymentKeyHash,
|
|
79
|
+
resolvePlutusScriptAddress,
|
|
80
|
+
resolvePlutusScriptHash,
|
|
81
|
+
resolvePoolId,
|
|
82
|
+
resolvePrivateKey,
|
|
83
|
+
resolveRewardAddress,
|
|
84
|
+
resolveScriptHash,
|
|
85
|
+
resolveScriptRef,
|
|
86
|
+
resolveStakeKeyHash,
|
|
87
|
+
resolveTxHash,
|
|
88
|
+
serializeAddressObj,
|
|
89
|
+
serializeNativeScript,
|
|
90
|
+
serializePlutusScript
|
|
91
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/core",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
"format": "prettier --check . --ignore-path ../../.gitignore"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@meshsdk/eslint-config": "
|
|
23
|
-
"@meshsdk/typescript-config": "
|
|
22
|
+
"@meshsdk/eslint-config": "workspace:*",
|
|
23
|
+
"@meshsdk/typescript-config": "workspace:*",
|
|
24
24
|
"eslint": "^8.57.0",
|
|
25
25
|
"tsup": "^8.0.2",
|
|
26
26
|
"typescript": "^5.3.3"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@meshsdk/common": "
|
|
30
|
-
"@meshsdk/core-csl": "
|
|
31
|
-
"@meshsdk/core-cst": "
|
|
32
|
-
"@meshsdk/provider": "
|
|
33
|
-
"@meshsdk/react": "
|
|
34
|
-
"@meshsdk/transaction": "
|
|
35
|
-
"@meshsdk/wallet": "
|
|
29
|
+
"@meshsdk/common": "workspace:*",
|
|
30
|
+
"@meshsdk/core-csl": "workspace:*",
|
|
31
|
+
"@meshsdk/core-cst": "workspace:*",
|
|
32
|
+
"@meshsdk/provider": "workspace:*",
|
|
33
|
+
"@meshsdk/react": "workspace:*",
|
|
34
|
+
"@meshsdk/transaction": "workspace:*",
|
|
35
|
+
"@meshsdk/wallet": "workspace:*"
|
|
36
36
|
},
|
|
37
37
|
"prettier": "@meshsdk/prettier-config"
|
|
38
38
|
}
|