@meshsdk/core-csl 1.6.1 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +20 -10
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +19 -9
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -75,7 +75,6 @@ __export(src_exports, {
|
|
|
75
75
|
resolveNativeScriptHash: () => resolveNativeScriptHash,
|
|
76
76
|
resolveNativeScriptHex: () => resolveNativeScriptHex,
|
|
77
77
|
resolvePlutusScriptAddress: () => resolvePlutusScriptAddress,
|
|
78
|
-
resolvePoolId: () => resolvePoolId,
|
|
79
78
|
resolvePrivateKey: () => resolvePrivateKey,
|
|
80
79
|
resolveRewardAddress: () => resolveRewardAddress,
|
|
81
80
|
resolveScriptRef: () => resolveScriptRef,
|
|
@@ -84,6 +83,7 @@ __export(src_exports, {
|
|
|
84
83
|
scriptHashToBech32: () => scriptHashToBech32,
|
|
85
84
|
serializeAddressObj: () => serializeAddressObj,
|
|
86
85
|
serializePlutusAddressToBech32: () => serializePlutusAddressToBech32,
|
|
86
|
+
serializePoolId: () => serializePoolId,
|
|
87
87
|
serialzeAddress: () => serialzeAddress,
|
|
88
88
|
signTransaction: () => signTransaction,
|
|
89
89
|
skeyToPubKeyHash: () => skeyToPubKeyHash,
|
|
@@ -335,7 +335,7 @@ var resolveDataHash = (data) => {
|
|
|
335
335
|
var resolveNativeScriptHex = (script) => {
|
|
336
336
|
return toNativeScript(script).to_hex();
|
|
337
337
|
};
|
|
338
|
-
var
|
|
338
|
+
var serializePoolId = (hash) => {
|
|
339
339
|
return csl.Ed25519KeyHash.from_hex(hash).to_bech32("pool1");
|
|
340
340
|
};
|
|
341
341
|
var resolveScriptRef = (script) => {
|
|
@@ -773,15 +773,22 @@ var meshTxBuilderBodyToObj = ({
|
|
|
773
773
|
|
|
774
774
|
// src/core/serializer.ts
|
|
775
775
|
var CSLSerializer = class {
|
|
776
|
+
/**
|
|
777
|
+
* Set to true to enable verbose logging for the txBodyJson prior going into build
|
|
778
|
+
*/
|
|
779
|
+
verbose;
|
|
776
780
|
protocolParams;
|
|
777
781
|
meshTxBuilderBody = (0, import_common4.emptyTxBuilderBody)();
|
|
778
|
-
constructor(protocolParams) {
|
|
782
|
+
constructor(protocolParams, verbose = false) {
|
|
779
783
|
this.protocolParams = protocolParams || import_common4.DEFAULT_PROTOCOL_PARAMETERS;
|
|
784
|
+
this.verbose = verbose;
|
|
780
785
|
}
|
|
781
786
|
serializeTxBody(txBody, protocolParams) {
|
|
782
787
|
const txBodyJson = import_json_bigint2.default.stringify(meshTxBuilderBodyToObj(txBody));
|
|
783
788
|
const params = import_json_bigint2.default.stringify(protocolParams || this.protocolParams);
|
|
784
|
-
|
|
789
|
+
if (this.verbose) {
|
|
790
|
+
console.log("txBodyJson", txBodyJson);
|
|
791
|
+
}
|
|
785
792
|
const txBuildResult = csl.js_serialize_tx_body(txBodyJson, params);
|
|
786
793
|
if (txBuildResult.get_status() !== "success") {
|
|
787
794
|
throw new Error(txBuildResult.get_data());
|
|
@@ -800,6 +807,9 @@ var CSLSerializer = class {
|
|
|
800
807
|
serializeAddress(address, networkId) {
|
|
801
808
|
return serialzeAddress(address, networkId);
|
|
802
809
|
}
|
|
810
|
+
serializePoolId(hash) {
|
|
811
|
+
return serializePoolId(hash);
|
|
812
|
+
}
|
|
803
813
|
deserializer = {
|
|
804
814
|
key: {
|
|
805
815
|
deserializeAddress: function(bech32) {
|
|
@@ -820,6 +830,11 @@ var CSLSerializer = class {
|
|
|
820
830
|
const scriptHash = deserializePlutusScript(script.code, script.version).hash().to_hex();
|
|
821
831
|
return { scriptHash, scriptCbor: script.code };
|
|
822
832
|
}
|
|
833
|
+
},
|
|
834
|
+
cert: {
|
|
835
|
+
deserializePoolId: function(poolId) {
|
|
836
|
+
return resolveEd25519KeyHash(poolId);
|
|
837
|
+
}
|
|
823
838
|
}
|
|
824
839
|
};
|
|
825
840
|
resolver = {
|
|
@@ -851,11 +866,6 @@ var CSLSerializer = class {
|
|
|
851
866
|
resolveScriptRef: function(script) {
|
|
852
867
|
return resolveScriptRef(script);
|
|
853
868
|
}
|
|
854
|
-
},
|
|
855
|
-
pool: {
|
|
856
|
-
resolvePoolId: function(hash) {
|
|
857
|
-
return resolvePoolId(hash);
|
|
858
|
-
}
|
|
859
869
|
}
|
|
860
870
|
};
|
|
861
871
|
};
|
|
@@ -906,7 +916,6 @@ var CSLSerializer = class {
|
|
|
906
916
|
resolveNativeScriptHash,
|
|
907
917
|
resolveNativeScriptHex,
|
|
908
918
|
resolvePlutusScriptAddress,
|
|
909
|
-
resolvePoolId,
|
|
910
919
|
resolvePrivateKey,
|
|
911
920
|
resolveRewardAddress,
|
|
912
921
|
resolveScriptRef,
|
|
@@ -915,6 +924,7 @@ var CSLSerializer = class {
|
|
|
915
924
|
scriptHashToBech32,
|
|
916
925
|
serializeAddressObj,
|
|
917
926
|
serializePlutusAddressToBech32,
|
|
927
|
+
serializePoolId,
|
|
918
928
|
serialzeAddress,
|
|
919
929
|
signTransaction,
|
|
920
930
|
skeyToPubKeyHash,
|
package/dist/index.d.cts
CHANGED
|
@@ -46,13 +46,18 @@ declare const applyParamsToScript: (rawScript: string, params: object[] | Data[]
|
|
|
46
46
|
declare const applyCborEncoding: (rawScript: string) => string;
|
|
47
47
|
|
|
48
48
|
declare class CSLSerializer implements IMeshTxSerializer {
|
|
49
|
+
/**
|
|
50
|
+
* Set to true to enable verbose logging for the txBodyJson prior going into build
|
|
51
|
+
*/
|
|
52
|
+
verbose: boolean;
|
|
49
53
|
protocolParams: Protocol;
|
|
50
54
|
meshTxBuilderBody: MeshTxBuilderBody;
|
|
51
|
-
constructor(protocolParams?: Protocol);
|
|
55
|
+
constructor(protocolParams?: Protocol, verbose?: boolean);
|
|
52
56
|
serializeTxBody(txBody: MeshTxBuilderBody, protocolParams?: Protocol): string;
|
|
53
57
|
addSigningKeys(txHex: string, signingKeys: string[]): string;
|
|
54
58
|
serializeData(data: BuilderData): string;
|
|
55
59
|
serializeAddress(address: Partial<DeserializedAddress>, networkId?: number): string;
|
|
60
|
+
serializePoolId(hash: string): string;
|
|
56
61
|
deserializer: IDeserializer;
|
|
57
62
|
resolver: IResolver;
|
|
58
63
|
}
|
|
@@ -112,8 +117,8 @@ declare const resolveNativeScriptHash: (script: NativeScript) => string;
|
|
|
112
117
|
declare const resolveRewardAddress: (bech32: string) => string;
|
|
113
118
|
declare const resolveDataHash: (data: Data) => string;
|
|
114
119
|
declare const resolveNativeScriptHex: (script: NativeScript) => string;
|
|
115
|
-
declare const
|
|
120
|
+
declare const serializePoolId: (hash: string) => string;
|
|
116
121
|
declare const resolveScriptRef: (script: PlutusScript | NativeScript) => string;
|
|
117
122
|
declare const resolveEd25519KeyHash: (bech32: string) => string;
|
|
118
123
|
|
|
119
|
-
export { CSLSerializer, LANGUAGE_VERSIONS, POLICY_ID_LENGTH, REDEEMER_TAGS, addrBech32ToHex, addrBech32ToObj, applyCborEncoding, applyParamsToScript, baseAddressToStakeAddress, calculateTxHash, castDataToPlutusData, castRawDataToJsonString, deserializeAddress, deserializeBech32Address, deserializeBip32PrivateKey, deserializeDataHash, deserializeEd25519KeyHash, deserializeEd25519Signature, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializePublicKey, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxBody, deserializeTxHash, deserializeTxUnspentOutput, deserializeTxWitnessSet, deserializeValue, fromBytes, fromLovelace, fromUTF8, getV2ScriptHash, parseDatumCbor, parseInlineDatum, poolIdBech32ToHex, poolIdHexToBech32, resolveDataHash, resolveEd25519KeyHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePlutusScriptAddress,
|
|
124
|
+
export { CSLSerializer, LANGUAGE_VERSIONS, POLICY_ID_LENGTH, REDEEMER_TAGS, addrBech32ToHex, addrBech32ToObj, applyCborEncoding, applyParamsToScript, baseAddressToStakeAddress, calculateTxHash, castDataToPlutusData, castRawDataToJsonString, deserializeAddress, deserializeBech32Address, deserializeBip32PrivateKey, deserializeDataHash, deserializeEd25519KeyHash, deserializeEd25519Signature, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializePublicKey, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxBody, deserializeTxHash, deserializeTxUnspentOutput, deserializeTxWitnessSet, deserializeValue, fromBytes, fromLovelace, fromUTF8, getV2ScriptHash, parseDatumCbor, parseInlineDatum, poolIdBech32ToHex, poolIdHexToBech32, resolveDataHash, resolveEd25519KeyHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePlutusScriptAddress, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, rewardAddressToKeyHash, scriptHashToBech32, serializeAddressObj, serializePlutusAddressToBech32, serializePoolId, serialzeAddress, signTransaction, skeyToPubKeyHash, toAddress, toBaseAddress, toBytes, toEnterpriseAddress, toLovelace, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toUTF8, v2ScriptToBech32 };
|
package/dist/index.d.ts
CHANGED
|
@@ -46,13 +46,18 @@ declare const applyParamsToScript: (rawScript: string, params: object[] | Data[]
|
|
|
46
46
|
declare const applyCborEncoding: (rawScript: string) => string;
|
|
47
47
|
|
|
48
48
|
declare class CSLSerializer implements IMeshTxSerializer {
|
|
49
|
+
/**
|
|
50
|
+
* Set to true to enable verbose logging for the txBodyJson prior going into build
|
|
51
|
+
*/
|
|
52
|
+
verbose: boolean;
|
|
49
53
|
protocolParams: Protocol;
|
|
50
54
|
meshTxBuilderBody: MeshTxBuilderBody;
|
|
51
|
-
constructor(protocolParams?: Protocol);
|
|
55
|
+
constructor(protocolParams?: Protocol, verbose?: boolean);
|
|
52
56
|
serializeTxBody(txBody: MeshTxBuilderBody, protocolParams?: Protocol): string;
|
|
53
57
|
addSigningKeys(txHex: string, signingKeys: string[]): string;
|
|
54
58
|
serializeData(data: BuilderData): string;
|
|
55
59
|
serializeAddress(address: Partial<DeserializedAddress>, networkId?: number): string;
|
|
60
|
+
serializePoolId(hash: string): string;
|
|
56
61
|
deserializer: IDeserializer;
|
|
57
62
|
resolver: IResolver;
|
|
58
63
|
}
|
|
@@ -112,8 +117,8 @@ declare const resolveNativeScriptHash: (script: NativeScript) => string;
|
|
|
112
117
|
declare const resolveRewardAddress: (bech32: string) => string;
|
|
113
118
|
declare const resolveDataHash: (data: Data) => string;
|
|
114
119
|
declare const resolveNativeScriptHex: (script: NativeScript) => string;
|
|
115
|
-
declare const
|
|
120
|
+
declare const serializePoolId: (hash: string) => string;
|
|
116
121
|
declare const resolveScriptRef: (script: PlutusScript | NativeScript) => string;
|
|
117
122
|
declare const resolveEd25519KeyHash: (bech32: string) => string;
|
|
118
123
|
|
|
119
|
-
export { CSLSerializer, LANGUAGE_VERSIONS, POLICY_ID_LENGTH, REDEEMER_TAGS, addrBech32ToHex, addrBech32ToObj, applyCborEncoding, applyParamsToScript, baseAddressToStakeAddress, calculateTxHash, castDataToPlutusData, castRawDataToJsonString, deserializeAddress, deserializeBech32Address, deserializeBip32PrivateKey, deserializeDataHash, deserializeEd25519KeyHash, deserializeEd25519Signature, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializePublicKey, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxBody, deserializeTxHash, deserializeTxUnspentOutput, deserializeTxWitnessSet, deserializeValue, fromBytes, fromLovelace, fromUTF8, getV2ScriptHash, parseDatumCbor, parseInlineDatum, poolIdBech32ToHex, poolIdHexToBech32, resolveDataHash, resolveEd25519KeyHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePlutusScriptAddress,
|
|
124
|
+
export { CSLSerializer, LANGUAGE_VERSIONS, POLICY_ID_LENGTH, REDEEMER_TAGS, addrBech32ToHex, addrBech32ToObj, applyCborEncoding, applyParamsToScript, baseAddressToStakeAddress, calculateTxHash, castDataToPlutusData, castRawDataToJsonString, deserializeAddress, deserializeBech32Address, deserializeBip32PrivateKey, deserializeDataHash, deserializeEd25519KeyHash, deserializeEd25519Signature, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializePublicKey, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxBody, deserializeTxHash, deserializeTxUnspentOutput, deserializeTxWitnessSet, deserializeValue, fromBytes, fromLovelace, fromUTF8, getV2ScriptHash, parseDatumCbor, parseInlineDatum, poolIdBech32ToHex, poolIdHexToBech32, resolveDataHash, resolveEd25519KeyHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolveNativeScriptHex, resolvePlutusScriptAddress, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, rewardAddressToKeyHash, scriptHashToBech32, serializeAddressObj, serializePlutusAddressToBech32, serializePoolId, serialzeAddress, signTransaction, skeyToPubKeyHash, toAddress, toBaseAddress, toBytes, toEnterpriseAddress, toLovelace, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toUTF8, v2ScriptToBech32 };
|
package/dist/index.js
CHANGED
|
@@ -237,7 +237,7 @@ var resolveDataHash = (data) => {
|
|
|
237
237
|
var resolveNativeScriptHex = (script) => {
|
|
238
238
|
return toNativeScript(script).to_hex();
|
|
239
239
|
};
|
|
240
|
-
var
|
|
240
|
+
var serializePoolId = (hash) => {
|
|
241
241
|
return csl.Ed25519KeyHash.from_hex(hash).to_bech32("pool1");
|
|
242
242
|
};
|
|
243
243
|
var resolveScriptRef = (script) => {
|
|
@@ -681,15 +681,22 @@ var meshTxBuilderBodyToObj = ({
|
|
|
681
681
|
|
|
682
682
|
// src/core/serializer.ts
|
|
683
683
|
var CSLSerializer = class {
|
|
684
|
+
/**
|
|
685
|
+
* Set to true to enable verbose logging for the txBodyJson prior going into build
|
|
686
|
+
*/
|
|
687
|
+
verbose;
|
|
684
688
|
protocolParams;
|
|
685
689
|
meshTxBuilderBody = emptyTxBuilderBody();
|
|
686
|
-
constructor(protocolParams) {
|
|
690
|
+
constructor(protocolParams, verbose = false) {
|
|
687
691
|
this.protocolParams = protocolParams || DEFAULT_PROTOCOL_PARAMETERS;
|
|
692
|
+
this.verbose = verbose;
|
|
688
693
|
}
|
|
689
694
|
serializeTxBody(txBody, protocolParams) {
|
|
690
695
|
const txBodyJson = JSONbig2.stringify(meshTxBuilderBodyToObj(txBody));
|
|
691
696
|
const params = JSONbig2.stringify(protocolParams || this.protocolParams);
|
|
692
|
-
|
|
697
|
+
if (this.verbose) {
|
|
698
|
+
console.log("txBodyJson", txBodyJson);
|
|
699
|
+
}
|
|
693
700
|
const txBuildResult = csl.js_serialize_tx_body(txBodyJson, params);
|
|
694
701
|
if (txBuildResult.get_status() !== "success") {
|
|
695
702
|
throw new Error(txBuildResult.get_data());
|
|
@@ -708,6 +715,9 @@ var CSLSerializer = class {
|
|
|
708
715
|
serializeAddress(address, networkId) {
|
|
709
716
|
return serialzeAddress(address, networkId);
|
|
710
717
|
}
|
|
718
|
+
serializePoolId(hash) {
|
|
719
|
+
return serializePoolId(hash);
|
|
720
|
+
}
|
|
711
721
|
deserializer = {
|
|
712
722
|
key: {
|
|
713
723
|
deserializeAddress: function(bech32) {
|
|
@@ -728,6 +738,11 @@ var CSLSerializer = class {
|
|
|
728
738
|
const scriptHash = deserializePlutusScript(script.code, script.version).hash().to_hex();
|
|
729
739
|
return { scriptHash, scriptCbor: script.code };
|
|
730
740
|
}
|
|
741
|
+
},
|
|
742
|
+
cert: {
|
|
743
|
+
deserializePoolId: function(poolId) {
|
|
744
|
+
return resolveEd25519KeyHash(poolId);
|
|
745
|
+
}
|
|
731
746
|
}
|
|
732
747
|
};
|
|
733
748
|
resolver = {
|
|
@@ -759,11 +774,6 @@ var CSLSerializer = class {
|
|
|
759
774
|
resolveScriptRef: function(script) {
|
|
760
775
|
return resolveScriptRef(script);
|
|
761
776
|
}
|
|
762
|
-
},
|
|
763
|
-
pool: {
|
|
764
|
-
resolvePoolId: function(hash) {
|
|
765
|
-
return resolvePoolId(hash);
|
|
766
|
-
}
|
|
767
777
|
}
|
|
768
778
|
};
|
|
769
779
|
};
|
|
@@ -813,7 +823,6 @@ export {
|
|
|
813
823
|
resolveNativeScriptHash,
|
|
814
824
|
resolveNativeScriptHex,
|
|
815
825
|
resolvePlutusScriptAddress,
|
|
816
|
-
resolvePoolId,
|
|
817
826
|
resolvePrivateKey,
|
|
818
827
|
resolveRewardAddress,
|
|
819
828
|
resolveScriptRef,
|
|
@@ -822,6 +831,7 @@ export {
|
|
|
822
831
|
scriptHashToBech32,
|
|
823
832
|
serializeAddressObj,
|
|
824
833
|
serializePlutusAddressToBech32,
|
|
834
|
+
serializePoolId,
|
|
825
835
|
serialzeAddress,
|
|
826
836
|
signTransaction,
|
|
827
837
|
skeyToPubKeyHash,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/core-csl",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"build:mesh": "tsup src/index.ts --format esm,cjs --dts",
|
|
21
21
|
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
22
22
|
"lint": "eslint",
|
|
23
|
-
"test": "jest --verbose",
|
|
24
23
|
"clean": "rm -rf .turbo && rm -rf dist && rm -rf node_modules",
|
|
25
24
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
26
|
-
"build:docs": "typedoc src/index.ts --json ../../apps/docs/src/data/mesh-core-csl.json"
|
|
25
|
+
"build:docs": "typedoc src/index.ts --json ../../apps/docs/src/data/mesh-core-csl.json",
|
|
26
|
+
"test": "jest"
|
|
27
27
|
},
|
|
28
28
|
"browser": {
|
|
29
29
|
"@sidan-lab/sidan-csl-rs-nodejs": "@sidan-lab/sidan-csl-rs-browser"
|