@meshsdk/common 1.0.0-alpha.8 → 1.6.0-alpha.11
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/README.md +5 -0
- package/package.json +22 -33
- package/src/constants/cost-models.ts +30 -0
- package/src/constants/index.ts +86 -0
- package/src/constants/language-views.ts +19 -0
- package/src/constants/protocol-parameters.ts +34 -0
- package/src/constants/supported-wallets.ts +12 -0
- package/src/data/index.ts +5 -0
- package/src/data/json/aliases.ts +218 -0
- package/src/data/json/constructors.ts +56 -0
- package/src/data/json/credentials.ts +77 -0
- package/src/data/json/index.ts +33 -0
- package/src/data/json/primitives.ts +154 -0
- package/src/data/mesh/aliases.ts +85 -0
- package/src/data/mesh/constructors.ts +68 -0
- package/src/data/mesh/credentials.ts +77 -0
- package/src/data/mesh/index.ts +4 -0
- package/src/data/mesh/primitives.ts +37 -0
- package/src/data/parser.ts +36 -0
- package/src/data/time.ts +92 -0
- package/src/data/value.ts +70 -0
- package/src/index.ts +7 -0
- package/src/interfaces/evaluator.ts +5 -0
- package/src/interfaces/fetcher.ts +31 -0
- package/src/interfaces/index.ts +7 -0
- package/src/interfaces/initiator.ts +9 -0
- package/src/interfaces/listener.ts +3 -0
- package/src/interfaces/serializer.ts +53 -0
- package/src/interfaces/signer.ts +12 -0
- package/src/interfaces/submitter.ts +3 -0
- package/src/types/account-info.ts +7 -0
- package/src/types/action.ts +15 -0
- package/src/types/asset-extended.ts +9 -0
- package/src/types/asset-metadata.ts +102 -0
- package/src/types/asset.ts +23 -0
- package/src/types/block-info.ts +17 -0
- package/src/types/data-signature.ts +4 -0
- package/src/types/data.ts +10 -0
- package/src/types/deserialized/deserialized-address.ts +6 -0
- package/src/types/deserialized/deserialized-script.ts +4 -0
- package/src/types/deserialized/index.ts +2 -0
- package/src/types/era.ts +1 -0
- package/src/types/index.ts +24 -0
- package/src/types/message.ts +4 -0
- package/src/types/mint.ts +12 -0
- package/src/types/native-script.ts +18 -0
- package/src/types/network.ts +7 -0
- package/src/types/plutus-script.ts +8 -0
- package/src/types/pool-params.ts +41 -0
- package/src/types/protocol.ts +22 -0
- package/src/types/recipient.ts +15 -0
- package/src/types/relay.ts +42 -0
- package/{dist/cjs/types/Token.d.ts → src/types/token.ts} +2 -1
- package/src/types/transaction-builder/data.ts +31 -0
- package/src/types/transaction-builder/index.ts +73 -0
- package/src/types/transaction-builder/mint.ts +11 -0
- package/src/types/transaction-builder/output.ts +12 -0
- package/src/types/transaction-builder/script.ts +27 -0
- package/src/types/transaction-builder/txin.ts +46 -0
- package/src/types/transaction-builder/withdrawal.ts +207 -0
- package/src/types/transaction-info.ts +11 -0
- package/src/types/utxo.ts +16 -0
- package/src/types/wallet.ts +6 -0
- package/src/utils/asset-fingerprint.ts +11 -0
- package/src/utils/bigNum.ts +61 -0
- package/src/utils/index.ts +2 -0
- package/test/data/json/aliases.test.ts +135 -0
- package/test/data/json/constructors.test.ts +38 -0
- package/test/data/json/credentials.test.ts +84 -0
- package/test/data/json/primitives.test.ts +133 -0
- package/test/data/mesh/aliases.test.ts +45 -0
- package/test/data/mesh/common.ts +14 -0
- package/test/data/mesh/constructors.test.ts +53 -0
- package/test/data/mesh/credentials.test.ts +74 -0
- package/test/data/mesh/primitives.test.ts +41 -0
- package/test/data/value.test.ts +108 -0
- package/tsconfig.json +5 -0
- package/dist/cjs/builder/data/index.d.ts +0 -4
- package/dist/cjs/builder/data/index.js +0 -20
- package/dist/cjs/builder/data/mesh.d.ts +0 -8
- package/dist/cjs/builder/data/mesh.js +0 -34
- package/dist/cjs/builder/data/parser.d.ts +0 -5
- package/dist/cjs/builder/data/parser.js +0 -11
- package/dist/cjs/builder/data/plutus.d.ts +0 -69
- package/dist/cjs/builder/data/plutus.js +0 -105
- package/dist/cjs/builder/data/plutus.spec.d.ts +0 -1
- package/dist/cjs/builder/data/plutus.spec.js +0 -98
- package/dist/cjs/builder/data/time.d.ts +0 -11
- package/dist/cjs/builder/data/time.js +0 -32
- package/dist/cjs/builder/index.d.ts +0 -3
- package/dist/cjs/builder/index.js +0 -19
- package/dist/cjs/builder/serializer.d.ts +0 -7
- package/dist/cjs/builder/serializer.js +0 -19
- package/dist/cjs/builder/types.d.ts +0 -128
- package/dist/cjs/builder/types.js +0 -2
- package/dist/cjs/cip/CIP25.d.ts +0 -19
- package/dist/cjs/cip/CIP25.js +0 -2
- package/dist/cjs/cip/CIP27.d.ts +0 -4
- package/dist/cjs/cip/CIP27.js +0 -2
- package/dist/cjs/cip/CPS9.d.ts +0 -2
- package/dist/cjs/cip/CPS9.js +0 -115
- package/dist/cjs/cip/index.d.ts +0 -3
- package/dist/cjs/cip/index.js +0 -19
- package/dist/cjs/constants.d.ts +0 -43
- package/dist/cjs/constants.js +0 -93
- package/dist/cjs/index.d.ts +0 -4
- package/dist/cjs/index.js +0 -20
- package/dist/cjs/types/Account.d.ts +0 -5
- package/dist/cjs/types/Account.js +0 -2
- package/dist/cjs/types/AccountInfo.d.ts +0 -7
- package/dist/cjs/types/AccountInfo.js +0 -2
- package/dist/cjs/types/Action.d.ts +0 -12
- package/dist/cjs/types/Action.js +0 -2
- package/dist/cjs/types/Asset.d.ts +0 -7
- package/dist/cjs/types/Asset.js +0 -17
- package/dist/cjs/types/AssetExtended.d.ts +0 -8
- package/dist/cjs/types/AssetExtended.js +0 -2
- package/dist/cjs/types/AssetMetadata.d.ts +0 -24
- package/dist/cjs/types/AssetMetadata.js +0 -2
- package/dist/cjs/types/BlockInfo.d.ts +0 -17
- package/dist/cjs/types/BlockInfo.js +0 -2
- package/dist/cjs/types/Data.d.ts +0 -4
- package/dist/cjs/types/Data.js +0 -2
- package/dist/cjs/types/DataSignature.d.ts +0 -4
- package/dist/cjs/types/DataSignature.js +0 -2
- package/dist/cjs/types/Era.d.ts +0 -1
- package/dist/cjs/types/Era.js +0 -2
- package/dist/cjs/types/Mint.d.ts +0 -10
- package/dist/cjs/types/Mint.js +0 -2
- package/dist/cjs/types/NativeScript.d.ts +0 -14
- package/dist/cjs/types/NativeScript.js +0 -2
- package/dist/cjs/types/Network.d.ts +0 -4
- package/dist/cjs/types/Network.js +0 -8
- package/dist/cjs/types/PlutusScript.d.ts +0 -5
- package/dist/cjs/types/PlutusScript.js +0 -2
- package/dist/cjs/types/PoolParams.d.ts +0 -16
- package/dist/cjs/types/PoolParams.js +0 -2
- package/dist/cjs/types/Protocol.d.ts +0 -22
- package/dist/cjs/types/Protocol.js +0 -2
- package/dist/cjs/types/Recipient.d.ts +0 -11
- package/dist/cjs/types/Recipient.js +0 -2
- package/dist/cjs/types/Relay.d.ts +0 -13
- package/dist/cjs/types/Relay.js +0 -2
- package/dist/cjs/types/Token.js +0 -2
- package/dist/cjs/types/TransactionInfo.d.ts +0 -11
- package/dist/cjs/types/TransactionInfo.js +0 -2
- package/dist/cjs/types/UTxO.d.ts +0 -15
- package/dist/cjs/types/UTxO.js +0 -2
- package/dist/cjs/types/Wallet.d.ts +0 -5
- package/dist/cjs/types/Wallet.js +0 -2
- package/dist/cjs/types/index.d.ts +0 -22
- package/dist/cjs/types/index.js +0 -38
- package/dist/mjs/builder/data/index.d.ts +0 -4
- package/dist/mjs/builder/data/index.js +0 -4
- package/dist/mjs/builder/data/mesh.d.ts +0 -8
- package/dist/mjs/builder/data/mesh.js +0 -24
- package/dist/mjs/builder/data/parser.d.ts +0 -5
- package/dist/mjs/builder/data/parser.js +0 -4
- package/dist/mjs/builder/data/plutus.d.ts +0 -69
- package/dist/mjs/builder/data/plutus.js +0 -79
- package/dist/mjs/builder/data/plutus.spec.d.ts +0 -1
- package/dist/mjs/builder/data/plutus.spec.js +0 -96
- package/dist/mjs/builder/data/time.d.ts +0 -11
- package/dist/mjs/builder/data/time.js +0 -27
- package/dist/mjs/builder/index.d.ts +0 -3
- package/dist/mjs/builder/index.js +0 -3
- package/dist/mjs/builder/serializer.d.ts +0 -7
- package/dist/mjs/builder/serializer.js +0 -15
- package/dist/mjs/builder/types.d.ts +0 -128
- package/dist/mjs/builder/types.js +0 -1
- package/dist/mjs/cip/CIP25.d.ts +0 -19
- package/dist/mjs/cip/CIP25.js +0 -1
- package/dist/mjs/cip/CIP27.d.ts +0 -4
- package/dist/mjs/cip/CIP27.js +0 -1
- package/dist/mjs/cip/CPS9.d.ts +0 -2
- package/dist/mjs/cip/CPS9.js +0 -111
- package/dist/mjs/cip/index.d.ts +0 -3
- package/dist/mjs/cip/index.js +0 -3
- package/dist/mjs/constants.d.ts +0 -43
- package/dist/mjs/constants.js +0 -90
- package/dist/mjs/index.d.ts +0 -4
- package/dist/mjs/index.js +0 -4
- package/dist/mjs/types/Account.d.ts +0 -5
- package/dist/mjs/types/Account.js +0 -1
- package/dist/mjs/types/AccountInfo.d.ts +0 -7
- package/dist/mjs/types/AccountInfo.js +0 -1
- package/dist/mjs/types/Action.d.ts +0 -12
- package/dist/mjs/types/Action.js +0 -1
- package/dist/mjs/types/Asset.d.ts +0 -7
- package/dist/mjs/types/Asset.js +0 -13
- package/dist/mjs/types/AssetExtended.d.ts +0 -8
- package/dist/mjs/types/AssetExtended.js +0 -1
- package/dist/mjs/types/AssetMetadata.d.ts +0 -24
- package/dist/mjs/types/AssetMetadata.js +0 -1
- package/dist/mjs/types/BlockInfo.d.ts +0 -17
- package/dist/mjs/types/BlockInfo.js +0 -1
- package/dist/mjs/types/Data.d.ts +0 -4
- package/dist/mjs/types/Data.js +0 -1
- package/dist/mjs/types/DataSignature.d.ts +0 -4
- package/dist/mjs/types/DataSignature.js +0 -1
- package/dist/mjs/types/Era.d.ts +0 -1
- package/dist/mjs/types/Era.js +0 -1
- package/dist/mjs/types/Mint.d.ts +0 -10
- package/dist/mjs/types/Mint.js +0 -1
- package/dist/mjs/types/NativeScript.d.ts +0 -14
- package/dist/mjs/types/NativeScript.js +0 -1
- package/dist/mjs/types/Network.d.ts +0 -4
- package/dist/mjs/types/Network.js +0 -4
- package/dist/mjs/types/PlutusScript.d.ts +0 -5
- package/dist/mjs/types/PlutusScript.js +0 -1
- package/dist/mjs/types/PoolParams.d.ts +0 -16
- package/dist/mjs/types/PoolParams.js +0 -1
- package/dist/mjs/types/Protocol.d.ts +0 -22
- package/dist/mjs/types/Protocol.js +0 -1
- package/dist/mjs/types/Recipient.d.ts +0 -11
- package/dist/mjs/types/Recipient.js +0 -1
- package/dist/mjs/types/Relay.d.ts +0 -13
- package/dist/mjs/types/Relay.js +0 -1
- package/dist/mjs/types/Token.d.ts +0 -2
- package/dist/mjs/types/Token.js +0 -1
- package/dist/mjs/types/TransactionInfo.d.ts +0 -11
- package/dist/mjs/types/TransactionInfo.js +0 -1
- package/dist/mjs/types/UTxO.d.ts +0 -15
- package/dist/mjs/types/UTxO.js +0 -1
- package/dist/mjs/types/Wallet.d.ts +0 -5
- package/dist/mjs/types/Wallet.js +0 -1
- package/dist/mjs/types/index.d.ts +0 -22
- package/dist/mjs/types/index.js +0 -22
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import JSONBig from "json-bigint";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
assocMap,
|
|
5
|
+
bool,
|
|
6
|
+
ByteString,
|
|
7
|
+
byteString,
|
|
8
|
+
integer,
|
|
9
|
+
List,
|
|
10
|
+
list,
|
|
11
|
+
plutusBSArrayToString,
|
|
12
|
+
stringToPlutusBSArray,
|
|
13
|
+
} from "../../../src";
|
|
14
|
+
|
|
15
|
+
const testByteString = { bytes: "abcd" };
|
|
16
|
+
|
|
17
|
+
describe("Plutus data type", () => {
|
|
18
|
+
describe("bool", () => {
|
|
19
|
+
test("bool - true", () => {
|
|
20
|
+
const result = bool(true);
|
|
21
|
+
expect(JSON.stringify(result)).toBe(
|
|
22
|
+
JSON.stringify({ constructor: 1, fields: [] }),
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
test("bool - false", () => {
|
|
26
|
+
const result = bool(false);
|
|
27
|
+
expect(JSON.stringify(result)).toBe(
|
|
28
|
+
JSON.stringify({ constructor: 0, fields: [] }),
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("byteString", () => {
|
|
34
|
+
test("byteString - valid hex", () => {
|
|
35
|
+
const hexString = "00112233445566aabbccddeeff";
|
|
36
|
+
const result = byteString(hexString);
|
|
37
|
+
expect(JSON.stringify(result)).toBe(JSON.stringify({ bytes: hexString }));
|
|
38
|
+
});
|
|
39
|
+
test("byteString - invalid hex - odd length", () => {
|
|
40
|
+
const hexString = "00112233445566aabbccddeef";
|
|
41
|
+
expect(() => byteString(hexString)).toThrow();
|
|
42
|
+
});
|
|
43
|
+
test("byteString - invalid hex - non hex string", () => {
|
|
44
|
+
const hexString = "00112233445566aabbccddeeffgg";
|
|
45
|
+
expect(() => byteString(hexString)).toThrow();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe("integer", () => {
|
|
50
|
+
test("integer - number", () => {
|
|
51
|
+
const testNumber = 1234567890;
|
|
52
|
+
const result = integer(testNumber);
|
|
53
|
+
expect(JSON.stringify(result)).toBe(JSON.stringify({ int: testNumber }));
|
|
54
|
+
});
|
|
55
|
+
test("integer - bigint", () => {
|
|
56
|
+
const testBigInt = 1234567890123456789012345678901234567890n;
|
|
57
|
+
const result = integer(testBigInt);
|
|
58
|
+
expect(JSONBig.stringify(result)).toBe(
|
|
59
|
+
JSONBig.stringify({ int: testBigInt }),
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe("list", () => {
|
|
65
|
+
test("list - valid", () => {
|
|
66
|
+
const result = list([testByteString, testByteString, testByteString]);
|
|
67
|
+
expect(JSON.stringify(result)).toBe(
|
|
68
|
+
JSON.stringify({
|
|
69
|
+
list: [testByteString, testByteString, testByteString],
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
});
|
|
73
|
+
test("list - invalid non-JSON items", () => {
|
|
74
|
+
expect(() =>
|
|
75
|
+
list([testByteString, testByteString, testByteString.bytes]),
|
|
76
|
+
).toThrow();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe("assocMap", () => {
|
|
81
|
+
test("assocMap", () => {
|
|
82
|
+
const result = assocMap([
|
|
83
|
+
["key1", "value1"],
|
|
84
|
+
["key2", "value2"],
|
|
85
|
+
]);
|
|
86
|
+
expect(JSON.stringify(result)).toBe(
|
|
87
|
+
JSON.stringify({
|
|
88
|
+
map: [
|
|
89
|
+
{ k: "key1", v: "value1" },
|
|
90
|
+
{ k: "key2", v: "value2" },
|
|
91
|
+
],
|
|
92
|
+
}),
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe("String List of byte array conversion", () => {
|
|
99
|
+
const testString =
|
|
100
|
+
"baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461";
|
|
101
|
+
const testList: List<ByteString> = {
|
|
102
|
+
list: [
|
|
103
|
+
{
|
|
104
|
+
bytes:
|
|
105
|
+
"baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
bytes:
|
|
109
|
+
"696e676e657777616c2e616461baefdc6c5b191be372a794cd8d40d839ec0dbd",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
bytes:
|
|
113
|
+
"d3c28957267dc8170074657374696e676e657777616c2e616461baefdc6c5b19",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
bytes:
|
|
117
|
+
"1be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e6577",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
bytes: "77616c2e616461",
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
test("stringToPlutusBSArray", () => {
|
|
126
|
+
const result = stringToPlutusBSArray(testString);
|
|
127
|
+
expect(JSON.stringify(testList)).toBe(JSON.stringify(result));
|
|
128
|
+
});
|
|
129
|
+
test("plutusBSArrayToString", () => {
|
|
130
|
+
const result = plutusBSArrayToString(testList);
|
|
131
|
+
expect(result).toBe(testString);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assetClass,
|
|
3
|
+
mAssetClass,
|
|
4
|
+
mOutputReference,
|
|
5
|
+
mTxOutRef,
|
|
6
|
+
outputReference,
|
|
7
|
+
txOutRef,
|
|
8
|
+
} from "../../../src";
|
|
9
|
+
import { serializeData } from "./common";
|
|
10
|
+
|
|
11
|
+
const testHash = "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700";
|
|
12
|
+
const testTxHash =
|
|
13
|
+
"a0bd47e8938e7c41d4c1d7c22033892319d28f86fdace791d45c51946553791b";
|
|
14
|
+
describe("Plutus data type", () => {
|
|
15
|
+
describe("assetClass", () => {
|
|
16
|
+
test("assetClass", () => {
|
|
17
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
18
|
+
mAssetClass(testHash, "abcd"),
|
|
19
|
+
assetClass(testHash, "abcd"),
|
|
20
|
+
);
|
|
21
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("outputReference", () => {
|
|
25
|
+
test("outputReference", () => {
|
|
26
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
27
|
+
mOutputReference(testTxHash, 1),
|
|
28
|
+
outputReference(testTxHash, 1),
|
|
29
|
+
);
|
|
30
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
31
|
+
});
|
|
32
|
+
test("outputReference - invalid length", () => {
|
|
33
|
+
expect(() => mOutputReference(testHash, 1)).toThrow;
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("txOutRef", () => {
|
|
37
|
+
test("txOutRef", () => {
|
|
38
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
39
|
+
mTxOutRef(testTxHash, 1),
|
|
40
|
+
txOutRef(testTxHash, 1),
|
|
41
|
+
);
|
|
42
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { castDataToPlutusData } from "../../../../mesh-core-csl";
|
|
2
|
+
import { Data } from "../../../src";
|
|
3
|
+
|
|
4
|
+
export const serializeData = (mesh: Data, json: any) => {
|
|
5
|
+
const meshData = castDataToPlutusData({
|
|
6
|
+
type: "Mesh",
|
|
7
|
+
content: mesh,
|
|
8
|
+
}).to_hex();
|
|
9
|
+
const jsonData = castDataToPlutusData({
|
|
10
|
+
type: "JSON",
|
|
11
|
+
content: JSON.stringify(json),
|
|
12
|
+
}).to_hex();
|
|
13
|
+
return [meshData, jsonData];
|
|
14
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
byteString,
|
|
3
|
+
conStr,
|
|
4
|
+
conStr0,
|
|
5
|
+
conStr1,
|
|
6
|
+
conStr2,
|
|
7
|
+
Data,
|
|
8
|
+
mConStr,
|
|
9
|
+
mConStr0,
|
|
10
|
+
mConStr1,
|
|
11
|
+
mConStr2,
|
|
12
|
+
} from "../../../src";
|
|
13
|
+
import { serializeData } from "./common";
|
|
14
|
+
|
|
15
|
+
const testByteString = "abcd";
|
|
16
|
+
|
|
17
|
+
describe("Plutus data type", () => {
|
|
18
|
+
describe("constructor", () => {
|
|
19
|
+
test("mConStr", () => {
|
|
20
|
+
const mesh = mConStr(0, [testByteString]);
|
|
21
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
22
|
+
mesh,
|
|
23
|
+
conStr(0, [byteString(testByteString)]),
|
|
24
|
+
);
|
|
25
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("mConStr0", () => {
|
|
29
|
+
const mesh = mConStr0([testByteString]);
|
|
30
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
31
|
+
mesh,
|
|
32
|
+
conStr0([byteString(testByteString)]),
|
|
33
|
+
);
|
|
34
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
35
|
+
});
|
|
36
|
+
test("mConStr1", () => {
|
|
37
|
+
const mesh = mConStr1([testByteString]);
|
|
38
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
39
|
+
mesh,
|
|
40
|
+
conStr1([byteString(testByteString)]),
|
|
41
|
+
);
|
|
42
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
43
|
+
});
|
|
44
|
+
test("mConStr2", () => {
|
|
45
|
+
const mesh = mConStr2([testByteString]);
|
|
46
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
47
|
+
mesh,
|
|
48
|
+
conStr2([byteString(testByteString)]),
|
|
49
|
+
);
|
|
50
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {
|
|
2
|
+
conStr0,
|
|
3
|
+
conStr1,
|
|
4
|
+
maybeStakingHash,
|
|
5
|
+
mMaybeStakingHash,
|
|
6
|
+
mPubKeyAddress,
|
|
7
|
+
mScriptAddress,
|
|
8
|
+
pubKeyAddress,
|
|
9
|
+
pubKeyHash,
|
|
10
|
+
scriptAddress,
|
|
11
|
+
scriptHash,
|
|
12
|
+
} from "../../../src";
|
|
13
|
+
import { serializeData } from "./common";
|
|
14
|
+
|
|
15
|
+
const testKeyHash1 = "1e4eb194e3335a0dcc4f5c5d009318167c583bb3b0879d9f718cd9e0";
|
|
16
|
+
const testKeyHash2 = "d63a93470bd4d8bb986c02ff8a6043796b91cc397ceb29058f5c9ac0";
|
|
17
|
+
|
|
18
|
+
describe("Plutus data type", () => {
|
|
19
|
+
describe("maybeStakingHash", () => {
|
|
20
|
+
test("maybeStakingHash - no staking hash", () => {
|
|
21
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
22
|
+
mMaybeStakingHash(""),
|
|
23
|
+
maybeStakingHash(""),
|
|
24
|
+
);
|
|
25
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
26
|
+
});
|
|
27
|
+
test("maybeStakingHash - pub key staking hash", () => {
|
|
28
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
29
|
+
mMaybeStakingHash(testKeyHash1),
|
|
30
|
+
maybeStakingHash(testKeyHash1),
|
|
31
|
+
);
|
|
32
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
33
|
+
});
|
|
34
|
+
test("maybeStakingHash - script staking hash", () => {
|
|
35
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
36
|
+
mMaybeStakingHash(testKeyHash1, true),
|
|
37
|
+
maybeStakingHash(testKeyHash1, true),
|
|
38
|
+
);
|
|
39
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
describe("pubKeyAddress", () => {
|
|
43
|
+
test("pubKeyAddress", () => {
|
|
44
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
45
|
+
mPubKeyAddress(testKeyHash1),
|
|
46
|
+
pubKeyAddress(testKeyHash1),
|
|
47
|
+
);
|
|
48
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
49
|
+
});
|
|
50
|
+
test("pubKeyAddress - full base address", () => {
|
|
51
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
52
|
+
mPubKeyAddress(testKeyHash1, testKeyHash2),
|
|
53
|
+
pubKeyAddress(testKeyHash1, testKeyHash2),
|
|
54
|
+
);
|
|
55
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe("scriptAddress", () => {
|
|
59
|
+
test("scriptAddress", () => {
|
|
60
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
61
|
+
mScriptAddress(testKeyHash1),
|
|
62
|
+
scriptAddress(testKeyHash1),
|
|
63
|
+
);
|
|
64
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
65
|
+
});
|
|
66
|
+
test("scriptAddress - full base address", () => {
|
|
67
|
+
const [meshCbor, jsonCbor] = serializeData(
|
|
68
|
+
mScriptAddress(testKeyHash1, testKeyHash2),
|
|
69
|
+
scriptAddress(testKeyHash1, testKeyHash2),
|
|
70
|
+
);
|
|
71
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bool,
|
|
3
|
+
mBool,
|
|
4
|
+
mPlutusBSArrayToString,
|
|
5
|
+
mStringToPlutusBSArray,
|
|
6
|
+
} from "../../../src";
|
|
7
|
+
import { serializeData } from "./common";
|
|
8
|
+
|
|
9
|
+
describe("Plutus data type", () => {
|
|
10
|
+
describe("bool", () => {
|
|
11
|
+
test("bool - true", () => {
|
|
12
|
+
const [meshCbor, jsonCbor] = serializeData(mBool(true), bool(true));
|
|
13
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
14
|
+
});
|
|
15
|
+
test("bool - false", () => {
|
|
16
|
+
const [meshCbor, jsonCbor] = serializeData(mBool(false), bool(false));
|
|
17
|
+
expect(meshCbor).toBe(jsonCbor);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("String List of byte array conversion", () => {
|
|
23
|
+
const testString =
|
|
24
|
+
"baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461";
|
|
25
|
+
const testList: string[] = [
|
|
26
|
+
"baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374",
|
|
27
|
+
"696e676e657777616c2e616461baefdc6c5b191be372a794cd8d40d839ec0dbd",
|
|
28
|
+
"d3c28957267dc8170074657374696e676e657777616c2e616461baefdc6c5b19",
|
|
29
|
+
"1be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e6577",
|
|
30
|
+
"77616c2e616461",
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
test("stringToPlutusBSArray", () => {
|
|
34
|
+
const result = mStringToPlutusBSArray(testString);
|
|
35
|
+
expect(JSON.stringify(testList)).toBe(JSON.stringify(result));
|
|
36
|
+
});
|
|
37
|
+
test("plutusBSArrayToString", () => {
|
|
38
|
+
const result = mPlutusBSArrayToString(testList);
|
|
39
|
+
expect(result).toBe(testString);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Asset,
|
|
3
|
+
byteString,
|
|
4
|
+
ByteString,
|
|
5
|
+
dict,
|
|
6
|
+
Dict,
|
|
7
|
+
Integer,
|
|
8
|
+
integer,
|
|
9
|
+
parsePlutusValueToAssets,
|
|
10
|
+
Value,
|
|
11
|
+
value,
|
|
12
|
+
} from "../../src";
|
|
13
|
+
|
|
14
|
+
describe("value", () => {
|
|
15
|
+
test("Simple ADA Value", () => {
|
|
16
|
+
const val: Asset[] = [{ unit: "lovelace", quantity: "1000000" }];
|
|
17
|
+
const datum: Value = value(val);
|
|
18
|
+
|
|
19
|
+
const nameMap = dict<Integer>([[byteString(""), integer(1000000)]]);
|
|
20
|
+
const valMap = dict<Dict<Integer>>([[byteString(""), nameMap]]);
|
|
21
|
+
expect(JSON.stringify(datum)).toBe(JSON.stringify(valMap));
|
|
22
|
+
});
|
|
23
|
+
test("Simple token Value", () => {
|
|
24
|
+
const val: Asset[] = [
|
|
25
|
+
{
|
|
26
|
+
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461",
|
|
27
|
+
quantity: "345",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
const datum: Value = value(val);
|
|
31
|
+
|
|
32
|
+
const nameMap = dict<Integer>([
|
|
33
|
+
[byteString("74657374696e676e657777616c2e616461"), integer(345)],
|
|
34
|
+
]);
|
|
35
|
+
const valMap = dict<Dict<Integer>>([
|
|
36
|
+
[
|
|
37
|
+
byteString("baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700"),
|
|
38
|
+
nameMap,
|
|
39
|
+
],
|
|
40
|
+
]);
|
|
41
|
+
expect(JSON.stringify(datum)).toBe(JSON.stringify(valMap));
|
|
42
|
+
});
|
|
43
|
+
test("Complex Value", () => {
|
|
44
|
+
const val: Asset[] = [
|
|
45
|
+
{ unit: "lovelace", quantity: "1000000" },
|
|
46
|
+
{
|
|
47
|
+
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461",
|
|
48
|
+
quantity: "345",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234",
|
|
52
|
+
quantity: "567",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
const datum: Value = value(val);
|
|
56
|
+
|
|
57
|
+
const nameMap = dict<Integer>([
|
|
58
|
+
[byteString("1234"), integer(567)],
|
|
59
|
+
[byteString("74657374696e676e657777616c2e616461"), integer(345)],
|
|
60
|
+
]);
|
|
61
|
+
const valMap = dict<Dict<Integer>>([
|
|
62
|
+
[byteString(""), dict([[byteString(""), integer(1000000)]])],
|
|
63
|
+
[
|
|
64
|
+
byteString("baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc81700"),
|
|
65
|
+
nameMap,
|
|
66
|
+
],
|
|
67
|
+
]);
|
|
68
|
+
expect(JSON.stringify(datum)).toBe(JSON.stringify(valMap));
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe("Value", () => {
|
|
73
|
+
test("Simple ADA Value", () => {
|
|
74
|
+
const val: Asset[] = [{ unit: "lovelace", quantity: "1000000" }];
|
|
75
|
+
const plutusValue: Value = value(val);
|
|
76
|
+
const assets: Asset[] = parsePlutusValueToAssets(plutusValue);
|
|
77
|
+
|
|
78
|
+
expect(JSON.stringify(val)).toBe(JSON.stringify(assets));
|
|
79
|
+
});
|
|
80
|
+
test("Simple token Value", () => {
|
|
81
|
+
const val: Asset[] = [
|
|
82
|
+
{
|
|
83
|
+
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461",
|
|
84
|
+
quantity: "345",
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
const plutusValue: Value = value(val);
|
|
88
|
+
const assets: Asset[] = parsePlutusValueToAssets(plutusValue);
|
|
89
|
+
|
|
90
|
+
expect(JSON.stringify(val)).toBe(JSON.stringify(assets));
|
|
91
|
+
});
|
|
92
|
+
test("Complex Value", () => {
|
|
93
|
+
const val: Asset[] = [
|
|
94
|
+
{ unit: "lovelace", quantity: "1000000" },
|
|
95
|
+
{
|
|
96
|
+
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc817001234",
|
|
97
|
+
quantity: "567",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
unit: "baefdc6c5b191be372a794cd8d40d839ec0dbdd3c28957267dc8170074657374696e676e657777616c2e616461",
|
|
101
|
+
quantity: "345",
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
const plutusValue: Value = value(val);
|
|
105
|
+
const assets: Asset[] = parsePlutusValueToAssets(plutusValue);
|
|
106
|
+
expect(JSON.stringify(val)).toBe(JSON.stringify(assets));
|
|
107
|
+
});
|
|
108
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./mesh"), exports);
|
|
18
|
-
__exportStar(require("./plutus"), exports);
|
|
19
|
-
__exportStar(require("./parser"), exports);
|
|
20
|
-
__exportStar(require("./time"), exports);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Data } from '../../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;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mScriptAddress = exports.mPubKeyAddress = exports.mMaybeStakingHash = exports.mConStr2 = exports.mConStr1 = exports.mConStr0 = exports.mConStr = void 0;
|
|
4
|
-
const mConStr = (alternative, fields) => ({
|
|
5
|
-
alternative,
|
|
6
|
-
fields,
|
|
7
|
-
});
|
|
8
|
-
exports.mConStr = mConStr;
|
|
9
|
-
const mConStr0 = (fields) => ({
|
|
10
|
-
alternative: 0,
|
|
11
|
-
fields,
|
|
12
|
-
});
|
|
13
|
-
exports.mConStr0 = mConStr0;
|
|
14
|
-
const mConStr1 = (fields) => ({
|
|
15
|
-
alternative: 1,
|
|
16
|
-
fields,
|
|
17
|
-
});
|
|
18
|
-
exports.mConStr1 = mConStr1;
|
|
19
|
-
const mConStr2 = (fields) => ({
|
|
20
|
-
alternative: 2,
|
|
21
|
-
fields,
|
|
22
|
-
});
|
|
23
|
-
exports.mConStr2 = mConStr2;
|
|
24
|
-
const mMaybeStakingHash = (stakeCredential) => {
|
|
25
|
-
if (stakeCredential === '') {
|
|
26
|
-
return (0, exports.mConStr1)([]);
|
|
27
|
-
}
|
|
28
|
-
return (0, exports.mConStr0)([(0, exports.mConStr0)([(0, exports.mConStr0)([stakeCredential])])]);
|
|
29
|
-
};
|
|
30
|
-
exports.mMaybeStakingHash = mMaybeStakingHash;
|
|
31
|
-
const mPubKeyAddress = (bytes, stakeCredential) => (0, exports.mConStr0)([{ alternative: 0, fields: [bytes] }, (0, exports.mMaybeStakingHash)(stakeCredential || '')]);
|
|
32
|
-
exports.mPubKeyAddress = mPubKeyAddress;
|
|
33
|
-
const mScriptAddress = (bytes, stakeCredential) => (0, exports.mConStr0)([{ alternative: 1, fields: [bytes] }, (0, exports.mMaybeStakingHash)(stakeCredential || '')]);
|
|
34
|
-
exports.mScriptAddress = mScriptAddress;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare const bytesToHex: (bytes: ArrayBuffer) => string;
|
|
3
|
-
export declare const hexToBytes: (hex: string) => Buffer;
|
|
4
|
-
export declare const stringToHex: (str: string) => string;
|
|
5
|
-
export declare const hexToString: (hex: string) => string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hexToString = exports.stringToHex = exports.hexToBytes = exports.bytesToHex = void 0;
|
|
4
|
-
const bytesToHex = (bytes) => Buffer.from(bytes).toString('hex');
|
|
5
|
-
exports.bytesToHex = bytesToHex;
|
|
6
|
-
const hexToBytes = (hex) => Buffer.from(hex, 'hex');
|
|
7
|
-
exports.hexToBytes = hexToBytes;
|
|
8
|
-
const stringToHex = (str) => Buffer.from(str, 'utf8').toString('hex');
|
|
9
|
-
exports.stringToHex = stringToHex;
|
|
10
|
-
const hexToString = (hex) => Buffer.from(hex, 'hex').toString('utf8');
|
|
11
|
-
exports.hexToString = hexToString;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Asset } from '../../types';
|
|
2
|
-
export type ConStr<N = any, T = any> = {
|
|
3
|
-
constructor: N;
|
|
4
|
-
fields: T;
|
|
5
|
-
};
|
|
6
|
-
export type ConStr0<T = any> = ConStr<0, T>;
|
|
7
|
-
export type ConStr1<T = any> = ConStr<1, T>;
|
|
8
|
-
export type ConStr2<T = any> = ConStr<2, T>;
|
|
9
|
-
export type Bool = ConStr0<[]> | ConStr1<[]>;
|
|
10
|
-
export type BuiltinByteString = {
|
|
11
|
-
bytes: string;
|
|
12
|
-
};
|
|
13
|
-
export type Integer = {
|
|
14
|
-
int: number;
|
|
15
|
-
};
|
|
16
|
-
export type List = {
|
|
17
|
-
list: PlutusData[];
|
|
18
|
-
};
|
|
19
|
-
export type ValidatorHash = BuiltinByteString;
|
|
20
|
-
export type PaymentPubKeyHash = BuiltinByteString;
|
|
21
|
-
export type PubKeyHash = PaymentPubKeyHash;
|
|
22
|
-
export type POSIXTime = Integer;
|
|
23
|
-
export type CurrencySymbol = BuiltinByteString;
|
|
24
|
-
export type TokenName = BuiltinByteString;
|
|
25
|
-
export type MaybeStakingHash = ConStr1<[]> | ConStr0<[ConStr0<[ConStr0<[BuiltinByteString]>]>]>;
|
|
26
|
-
export type PubKeyAddress = ConStr0<[ConStr0<[PubKeyHash]>, MaybeStakingHash]>;
|
|
27
|
-
export type ScriptAddress = ConStr0<[ConStr1<[ValidatorHash]>, MaybeStakingHash]>;
|
|
28
|
-
export type AssetClass = ConStr0<[CurrencySymbol, TokenName]>;
|
|
29
|
-
export type TxOutRef = ConStr0<[ConStr0<[BuiltinByteString]>, Integer]>;
|
|
30
|
-
export type AssocMapItem<K, V> = {
|
|
31
|
-
k: K;
|
|
32
|
-
v: V;
|
|
33
|
-
};
|
|
34
|
-
export type DictItem<K, V> = {
|
|
35
|
-
k: K;
|
|
36
|
-
v: V;
|
|
37
|
-
};
|
|
38
|
-
export type AssocMap<K, V> = {
|
|
39
|
-
map: AssocMapItem<K, V>[];
|
|
40
|
-
};
|
|
41
|
-
export type Dict<K, V> = {
|
|
42
|
-
map: DictItem<K, V>[];
|
|
43
|
-
};
|
|
44
|
-
export type Tuple<K, V> = ConStr0<[K, V]>;
|
|
45
|
-
export type Value = AssocMap<CurrencySymbol, AssocMap<TokenName, Integer>>;
|
|
46
|
-
export type PlutusData = BuiltinByteString | Integer | MaybeStakingHash | PubKeyAddress | ScriptAddress | AssetClass | PaymentPubKeyHash | PubKeyHash | POSIXTime | TxOutRef;
|
|
47
|
-
export declare const conStr: <N, T>(constructor: N, fields: T) => ConStr<N, T>;
|
|
48
|
-
export declare const conStr0: <T>(fields: T) => ConStr0<T>;
|
|
49
|
-
export declare const conStr1: <T>(fields: T) => ConStr1<T>;
|
|
50
|
-
export declare const conStr2: <T>(fields: T) => ConStr2<T>;
|
|
51
|
-
export declare const bool: (b: boolean) => Bool;
|
|
52
|
-
export declare const builtinByteString: (bytes: string) => BuiltinByteString;
|
|
53
|
-
export declare const integer: (int: number) => Integer;
|
|
54
|
-
export declare const list: (pList: PlutusData[]) => List;
|
|
55
|
-
export declare const currencySymbol: (bytes: string) => CurrencySymbol;
|
|
56
|
-
export declare const tokenName: (bytes: string) => TokenName;
|
|
57
|
-
export declare const maybeStakingHash: (stakeCredential: string) => MaybeStakingHash;
|
|
58
|
-
export declare const pubKeyAddress: (bytes: string, stakeCredential?: string) => PubKeyAddress;
|
|
59
|
-
export declare const scriptAddress: (bytes: string, stakeCredential?: string) => ScriptAddress;
|
|
60
|
-
export declare const assetClass: (policyId: string, assetName: string) => AssetClass;
|
|
61
|
-
export declare const txOutRef: (txHash: string, index: number) => TxOutRef;
|
|
62
|
-
export declare const paymentPubKeyHash: (bytes: string) => PaymentPubKeyHash;
|
|
63
|
-
export declare const pubKeyHash: (bytes: string) => PubKeyHash;
|
|
64
|
-
export declare const posixTime: (int: number) => POSIXTime;
|
|
65
|
-
export declare const assocMap: <K, V>(itemsMap: [K, V][]) => AssocMap<K, V>;
|
|
66
|
-
export declare const dict: <K, V>(itemsMap: [K, V][]) => AssocMap<K, V>;
|
|
67
|
-
export declare const tuple: <K, V>(key: K, value: V) => Tuple<K, V>;
|
|
68
|
-
export declare const value: (assets: Asset[]) => Value;
|
|
69
|
-
export declare const parsePlutusValueToAssets: (plutusValue: Value) => Asset[];
|