@meshsdk/core-cst 1.6.4 → 1.6.6
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 +55 -59
- package/dist/index.d.cts +26 -20
- package/dist/index.d.ts +26 -20
- package/dist/index.js +49 -59
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -918,6 +918,7 @@ __export(src_exports, {
|
|
|
918
918
|
Credential: () => Credential,
|
|
919
919
|
CredentialType: () => CredentialType,
|
|
920
920
|
Crypto: () => Crypto3,
|
|
921
|
+
DRep: () => DRep,
|
|
921
922
|
DRepID: () => DRepID,
|
|
922
923
|
Datum: () => Datum,
|
|
923
924
|
DatumHash: () => DatumHash,
|
|
@@ -964,14 +965,19 @@ __export(src_exports, {
|
|
|
964
965
|
ScriptPubkey: () => ScriptPubkey,
|
|
965
966
|
Serialization: () => import_core7.Serialization,
|
|
966
967
|
Slot: () => Slot,
|
|
968
|
+
StakeCredentialStatus: () => StakeCredentialStatus,
|
|
967
969
|
StakeDelegation: () => StakeDelegation,
|
|
968
970
|
StakeRegistration: () => StakeRegistration,
|
|
969
|
-
StricaBip32PrivateKey: () =>
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
971
|
+
StricaBip32PrivateKey: () => StricaBip32PrivateKey,
|
|
972
|
+
StricaBip32PrivateKeyType: () => StricaBip32PrivateKey,
|
|
973
|
+
StricaBip32PublicKey: () => StricaBip32PublicKey,
|
|
974
|
+
StricaBip32PublicKeyType: () => StricaBip32PublicKey,
|
|
975
|
+
StricaDecoder: () => StricaDecoder,
|
|
976
|
+
StricaEncoder: () => StricaEncoder,
|
|
977
|
+
StricaPrivateKey: () => StricaPrivateKey,
|
|
978
|
+
StricaPrivateKeyType: () => StricaPrivateKey,
|
|
979
|
+
StricaPublicKey: () => StricaPublicKey,
|
|
980
|
+
StricaPublicKeyType: () => StricaPublicKey,
|
|
975
981
|
Transaction: () => Transaction,
|
|
976
982
|
TransactionBody: () => TransactionBody,
|
|
977
983
|
TransactionId: () => TransactionId,
|
|
@@ -1120,38 +1126,24 @@ var RequireTimeBefore = import_core.Cardano.NativeScriptKind.RequireTimeBefore;
|
|
|
1120
1126
|
var VrfVkBech32 = import_core.Cardano.VrfVkBech32;
|
|
1121
1127
|
var ScriptPubkey = import_core.Serialization.ScriptPubkey;
|
|
1122
1128
|
var DRepID = import_core.Cardano.DRepID;
|
|
1129
|
+
var DRep = import_core.Serialization.DRep;
|
|
1130
|
+
var StakeCredentialStatus = import_core.Cardano.StakeCredentialStatus;
|
|
1123
1131
|
|
|
1124
1132
|
// src/message-signing/cose-sign1.ts
|
|
1125
1133
|
var import_buffer = require("buffer");
|
|
1126
1134
|
var import_blakejs = __toESM(require_blakejs(), 1);
|
|
1127
1135
|
|
|
1128
|
-
// src/stricahq/bip32ed25519/
|
|
1129
|
-
var
|
|
1136
|
+
// src/stricahq/bip32ed25519/wrapper.ts
|
|
1137
|
+
var cjsBip32ed25519 = __toESM(require("@stricahq/bip32ed25519"), 1);
|
|
1138
|
+
var StricaPrivateKey = cjsBip32ed25519.PrivateKey;
|
|
1139
|
+
var StricaPublicKey = cjsBip32ed25519.PublicKey;
|
|
1140
|
+
var StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
|
|
1141
|
+
var StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
|
|
1130
1142
|
|
|
1131
|
-
// src/stricahq/
|
|
1132
|
-
var
|
|
1133
|
-
var
|
|
1134
|
-
var
|
|
1135
|
-
constructor(privKey, extended = true) {
|
|
1136
|
-
if (!extended) {
|
|
1137
|
-
let extendedSecret = import_hash.default.sha512().update(privKey).digest();
|
|
1138
|
-
if (extendedSecret[0] && extendedSecret[31]) {
|
|
1139
|
-
extendedSecret[0] &= 248;
|
|
1140
|
-
extendedSecret[31] &= 63;
|
|
1141
|
-
extendedSecret[31] |= 64;
|
|
1142
|
-
}
|
|
1143
|
-
privKey = Buffer.from(extendedSecret);
|
|
1144
|
-
}
|
|
1145
|
-
super(privKey);
|
|
1146
|
-
}
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
|
-
// src/stricahq/bip32ed25519/index.ts
|
|
1150
|
-
var { PublicKey, Bip32PrivateKey: Bip32PrivateKey3, Bip32PublicKey } = import_bip32ed255192.default;
|
|
1151
|
-
|
|
1152
|
-
// src/stricahq/cbors/index.ts
|
|
1153
|
-
var import_cbors = __toESM(require("@stricahq/cbors"), 1);
|
|
1154
|
-
var { Encoder, Decoder } = import_cbors.default;
|
|
1143
|
+
// src/stricahq/cbors/wrapper.ts
|
|
1144
|
+
var cjsCbors = __toESM(require("@stricahq/cbors"), 1);
|
|
1145
|
+
var StricaEncoder = cjsCbors.Encoder;
|
|
1146
|
+
var StricaDecoder = cjsCbors.Decoder;
|
|
1155
1147
|
|
|
1156
1148
|
// src/message-signing/cose-sign1.ts
|
|
1157
1149
|
var CoseSign1 = class _CoseSign1 {
|
|
@@ -1169,13 +1161,13 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1169
1161
|
this.signature = payload.signature;
|
|
1170
1162
|
}
|
|
1171
1163
|
static fromCbor(cbor) {
|
|
1172
|
-
const decoded =
|
|
1164
|
+
const decoded = StricaDecoder.decode(import_buffer.Buffer.from(cbor, "hex"));
|
|
1173
1165
|
if (!(decoded.value instanceof Array)) throw Error("Invalid CBOR");
|
|
1174
1166
|
if (decoded.value.length !== 4) throw Error("Invalid COSE_SIGN1");
|
|
1175
1167
|
let protectedMap;
|
|
1176
1168
|
const protectedSerialized = decoded.value[0];
|
|
1177
1169
|
try {
|
|
1178
|
-
protectedMap =
|
|
1170
|
+
protectedMap = StricaDecoder.decode(protectedSerialized).value;
|
|
1179
1171
|
if (!(protectedMap instanceof Map)) {
|
|
1180
1172
|
throw Error();
|
|
1181
1173
|
}
|
|
@@ -1196,7 +1188,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1196
1188
|
createSigStructure(externalAad = import_buffer.Buffer.alloc(0)) {
|
|
1197
1189
|
let protectedSerialized = import_buffer.Buffer.alloc(0);
|
|
1198
1190
|
if (this.protectedMap.size !== 0) {
|
|
1199
|
-
protectedSerialized =
|
|
1191
|
+
protectedSerialized = StricaEncoder.encode(this.protectedMap);
|
|
1200
1192
|
}
|
|
1201
1193
|
const structure = [
|
|
1202
1194
|
"Signature1",
|
|
@@ -1204,13 +1196,13 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1204
1196
|
externalAad,
|
|
1205
1197
|
this.payload
|
|
1206
1198
|
];
|
|
1207
|
-
return
|
|
1199
|
+
return StricaEncoder.encode(structure);
|
|
1208
1200
|
}
|
|
1209
1201
|
buildMessage(signature) {
|
|
1210
1202
|
this.signature = signature;
|
|
1211
1203
|
let protectedSerialized = import_buffer.Buffer.alloc(0);
|
|
1212
1204
|
if (this.protectedMap.size !== 0) {
|
|
1213
|
-
protectedSerialized =
|
|
1205
|
+
protectedSerialized = StricaEncoder.encode(this.protectedMap);
|
|
1214
1206
|
}
|
|
1215
1207
|
const coseSign1 = [
|
|
1216
1208
|
protectedSerialized,
|
|
@@ -1218,7 +1210,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1218
1210
|
this.payload,
|
|
1219
1211
|
this.signature
|
|
1220
1212
|
];
|
|
1221
|
-
return
|
|
1213
|
+
return StricaEncoder.encode(coseSign1);
|
|
1222
1214
|
}
|
|
1223
1215
|
verifySignature({
|
|
1224
1216
|
externalAad = import_buffer.Buffer.alloc(0),
|
|
@@ -1229,7 +1221,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1229
1221
|
}
|
|
1230
1222
|
if (!publicKeyBuffer) throw Error("Public key not found");
|
|
1231
1223
|
if (!this.signature) throw Error("Signature not found");
|
|
1232
|
-
const publicKey = new
|
|
1224
|
+
const publicKey = new StricaPublicKey(publicKeyBuffer);
|
|
1233
1225
|
return publicKey.verify(
|
|
1234
1226
|
this.signature,
|
|
1235
1227
|
this.createSigStructure(externalAad)
|
|
@@ -1243,8 +1235,8 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1243
1235
|
if (this.unProtectedMap.get("hashed") != false)
|
|
1244
1236
|
throw Error("Invalid unprotected map");
|
|
1245
1237
|
this.unProtectedMap.set("hashed", true);
|
|
1246
|
-
const
|
|
1247
|
-
this.payload = import_buffer.Buffer.from(
|
|
1238
|
+
const hash = (0, import_blakejs.blake2b)(this.payload, void 0, 24);
|
|
1239
|
+
this.payload = import_buffer.Buffer.from(hash);
|
|
1248
1240
|
}
|
|
1249
1241
|
getAddress() {
|
|
1250
1242
|
return this.protectedMap.get("address");
|
|
@@ -1260,7 +1252,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1260
1252
|
}
|
|
1261
1253
|
};
|
|
1262
1254
|
var getPublicKeyFromCoseKey = (cbor) => {
|
|
1263
|
-
const decodedCoseKey =
|
|
1255
|
+
const decodedCoseKey = StricaDecoder.decode(import_buffer.Buffer.from(cbor, "hex"));
|
|
1264
1256
|
const publicKeyBuffer = decodedCoseKey.value.get(-2);
|
|
1265
1257
|
if (publicKeyBuffer) {
|
|
1266
1258
|
return publicKeyBuffer;
|
|
@@ -1273,7 +1265,7 @@ var getCoseKeyFromPublicKey = (cbor) => {
|
|
|
1273
1265
|
coseKeyMap.set(3, -8);
|
|
1274
1266
|
coseKeyMap.set(6, -2);
|
|
1275
1267
|
coseKeyMap.set(-2, import_buffer.Buffer.from(cbor, "hex"));
|
|
1276
|
-
return
|
|
1268
|
+
return StricaEncoder.encode(coseKeyMap);
|
|
1277
1269
|
};
|
|
1278
1270
|
|
|
1279
1271
|
// src/message-signing/check-signature.ts
|
|
@@ -1423,19 +1415,18 @@ var buildRewardAddress = (networkId, stakeKeyHash) => {
|
|
|
1423
1415
|
};
|
|
1424
1416
|
var buildKeys = (entropy, accountIndex, keyIndex = 0) => {
|
|
1425
1417
|
if (typeof entropy === "string") {
|
|
1426
|
-
const rootKey = new
|
|
1418
|
+
const rootKey = new StricaBip32PrivateKey(Buffer.from(entropy, "hex"));
|
|
1427
1419
|
const accountKey = rootKey.derive(import_common2.HARDENED_KEY_START + 1852).derive(import_common2.HARDENED_KEY_START + 1815).derive(import_common2.HARDENED_KEY_START + accountIndex);
|
|
1428
1420
|
const paymentKey = accountKey.derive(0).derive(keyIndex).toPrivateKey();
|
|
1429
1421
|
const stakeKey = accountKey.derive(2).derive(0).toPrivateKey();
|
|
1430
|
-
|
|
1422
|
+
const dRepKey = accountKey.derive(3).derive(keyIndex).toPrivateKey();
|
|
1423
|
+
return { paymentKey, stakeKey, dRepKey };
|
|
1431
1424
|
} else {
|
|
1432
|
-
const paymentKey =
|
|
1433
|
-
Buffer.from(entropy[0], "hex")
|
|
1434
|
-
false
|
|
1425
|
+
const paymentKey = StricaPrivateKey.fromSecretKey(
|
|
1426
|
+
Buffer.from(entropy[0], "hex")
|
|
1435
1427
|
);
|
|
1436
|
-
const stakeKey =
|
|
1437
|
-
Buffer.from(entropy[1], "hex")
|
|
1438
|
-
false
|
|
1428
|
+
const stakeKey = StricaPrivateKey.fromSecretKey(
|
|
1429
|
+
Buffer.from(entropy[1], "hex")
|
|
1439
1430
|
);
|
|
1440
1431
|
return { paymentKey, stakeKey };
|
|
1441
1432
|
}
|
|
@@ -1876,8 +1867,8 @@ var resolvePlutusScriptHash = (bech32) => {
|
|
|
1876
1867
|
throw new Error(`An error occurred during resolveScriptHash: ${error}.`);
|
|
1877
1868
|
}
|
|
1878
1869
|
};
|
|
1879
|
-
var resolvePoolId = (
|
|
1880
|
-
return Ed25519KeyHashHex2(
|
|
1870
|
+
var resolvePoolId = (hash) => {
|
|
1871
|
+
return Ed25519KeyHashHex2(hash).toString();
|
|
1881
1872
|
};
|
|
1882
1873
|
var resolvePrivateKey = (words) => {
|
|
1883
1874
|
return "not implemented";
|
|
@@ -1911,8 +1902,8 @@ var resolveStakeKeyHash = (bech32) => {
|
|
|
1911
1902
|
};
|
|
1912
1903
|
var resolveTxHash = (txHex) => {
|
|
1913
1904
|
const txBody = deserializeTx(txHex).body();
|
|
1914
|
-
const
|
|
1915
|
-
return import_core4.Cardano.TransactionId.fromHexBlob(import_util5.HexBlob.fromBytes(
|
|
1905
|
+
const hash = (0, import_crypto5.blake2b)(import_crypto5.blake2b.BYTES).update(hexToBytes(txBody.toCbor())).digest();
|
|
1906
|
+
return import_core4.Cardano.TransactionId.fromHexBlob(import_util5.HexBlob.fromBytes(hash));
|
|
1916
1907
|
};
|
|
1917
1908
|
|
|
1918
1909
|
// src/serializer/index.ts
|
|
@@ -1982,7 +1973,7 @@ var CardanoSDKSerializer = class {
|
|
|
1982
1973
|
serializeRewardAddress(stakeKeyHash, isScriptHash, network_id) {
|
|
1983
1974
|
throw new Error("Method not implemented.");
|
|
1984
1975
|
}
|
|
1985
|
-
serializePoolId(
|
|
1976
|
+
serializePoolId(hash) {
|
|
1986
1977
|
throw new Error("Method not implemented.");
|
|
1987
1978
|
}
|
|
1988
1979
|
serializeAddress(address, networkId) {
|
|
@@ -2109,9 +2100,8 @@ var CardanoSDKSerializer = class {
|
|
|
2109
2100
|
if (keyHex.length === 68 && keyHex.substring(0, 4) === "5820") {
|
|
2110
2101
|
keyHex = keyHex.substring(4);
|
|
2111
2102
|
}
|
|
2112
|
-
const cardanoSigner =
|
|
2113
|
-
Buffer.from(keyHex, "hex")
|
|
2114
|
-
false
|
|
2103
|
+
const cardanoSigner = StricaPrivateKey.fromSecretKey(
|
|
2104
|
+
Buffer.from(keyHex, "hex")
|
|
2115
2105
|
);
|
|
2116
2106
|
const signature = cardanoSigner.sign(
|
|
2117
2107
|
Buffer.from(cardanoTx.getId(), "hex")
|
|
@@ -2716,6 +2706,7 @@ var CardanoSDK = __toESM(require("@cardano-sdk/core"), 1);
|
|
|
2716
2706
|
Credential,
|
|
2717
2707
|
CredentialType,
|
|
2718
2708
|
Crypto,
|
|
2709
|
+
DRep,
|
|
2719
2710
|
DRepID,
|
|
2720
2711
|
Datum,
|
|
2721
2712
|
DatumHash,
|
|
@@ -2762,14 +2753,19 @@ var CardanoSDK = __toESM(require("@cardano-sdk/core"), 1);
|
|
|
2762
2753
|
ScriptPubkey,
|
|
2763
2754
|
Serialization,
|
|
2764
2755
|
Slot,
|
|
2756
|
+
StakeCredentialStatus,
|
|
2765
2757
|
StakeDelegation,
|
|
2766
2758
|
StakeRegistration,
|
|
2767
2759
|
StricaBip32PrivateKey,
|
|
2760
|
+
StricaBip32PrivateKeyType,
|
|
2768
2761
|
StricaBip32PublicKey,
|
|
2762
|
+
StricaBip32PublicKeyType,
|
|
2769
2763
|
StricaDecoder,
|
|
2770
2764
|
StricaEncoder,
|
|
2771
2765
|
StricaPrivateKey,
|
|
2766
|
+
StricaPrivateKeyType,
|
|
2772
2767
|
StricaPublicKey,
|
|
2768
|
+
StricaPublicKeyType,
|
|
2773
2769
|
Transaction,
|
|
2774
2770
|
TransactionBody,
|
|
2775
2771
|
TransactionId,
|
package/dist/index.d.cts
CHANGED
|
@@ -7,11 +7,10 @@ import { OpaqueString } from '@cardano-sdk/util';
|
|
|
7
7
|
export { _cardano_sdk_util as CardanoSDKUtil };
|
|
8
8
|
import * as Crypto from '@cardano-sdk/crypto';
|
|
9
9
|
export { Crypto };
|
|
10
|
-
import
|
|
10
|
+
import * as cjsBip32ed25519 from '@stricahq/bip32ed25519';
|
|
11
11
|
import { DataSignature, Data, NativeScript as NativeScript$1, PlutusScript, IMeshTxSerializer, DeserializedAddress, BuilderData, IDeserializer, IResolver, MeshTxBuilderBody, Protocol, UTxO, Asset, LanguageVersion } from '@meshsdk/common';
|
|
12
12
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
13
|
-
import
|
|
14
|
-
import * as _cardano_sdk_core_dist_cjs_Cardano from '@cardano-sdk/core/dist/cjs/Cardano';
|
|
13
|
+
import * as cjsCbors from '@stricahq/cbors';
|
|
15
14
|
|
|
16
15
|
declare const Slot: (value: number) => Cardano.Slot;
|
|
17
16
|
type Slot = Cardano.Slot;
|
|
@@ -139,8 +138,8 @@ declare const Ed25519PublicKey: typeof Crypto.Ed25519PublicKey;
|
|
|
139
138
|
type Ed25519PublicKey = Crypto.Ed25519PublicKey;
|
|
140
139
|
declare const Ed25519Signature: typeof Crypto.Ed25519Signature;
|
|
141
140
|
type Ed25519Signature = Crypto.Ed25519Signature;
|
|
142
|
-
declare const Bip32PrivateKey
|
|
143
|
-
type Bip32PrivateKey
|
|
141
|
+
declare const Bip32PrivateKey: typeof Crypto.Bip32PrivateKey;
|
|
142
|
+
type Bip32PrivateKey = Crypto.Bip32PrivateKey;
|
|
144
143
|
declare const Bip32PrivateKeyHex: (key: string) => Crypto.Bip32PrivateKeyHex;
|
|
145
144
|
type Bip32PrivateKeyHex = Crypto.Bip32PrivateKeyHex;
|
|
146
145
|
declare const PlutusLanguageVersion: typeof Cardano.PlutusLanguageVersion;
|
|
@@ -211,10 +210,14 @@ declare const DRepID: {
|
|
|
211
210
|
isValid(value: string): boolean;
|
|
212
211
|
canSign(value: string): boolean;
|
|
213
212
|
};
|
|
213
|
+
type DRep = Serialization.DRep;
|
|
214
|
+
declare const DRep: typeof Serialization.DRep;
|
|
215
|
+
type StakeCredentialStatus = Cardano.StakeCredentialStatus;
|
|
216
|
+
declare const StakeCredentialStatus: typeof Cardano.StakeCredentialStatus;
|
|
214
217
|
|
|
215
218
|
type Signer = {
|
|
216
219
|
address: Address;
|
|
217
|
-
key:
|
|
220
|
+
key: StricaPrivateKey;
|
|
218
221
|
};
|
|
219
222
|
|
|
220
223
|
declare const checkSignature: (data: string, { key, signature }: DataSignature) => boolean;
|
|
@@ -298,31 +301,34 @@ declare class CardanoSDKSerializer implements IMeshTxSerializer {
|
|
|
298
301
|
private createDummyTx;
|
|
299
302
|
}
|
|
300
303
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
declare const
|
|
307
|
-
|
|
304
|
+
type StricaPrivateKey = cjsBip32ed25519.PrivateKey;
|
|
305
|
+
declare const StricaPrivateKey: typeof cjsBip32ed25519.PrivateKey;
|
|
306
|
+
type StricaPublicKey = cjsBip32ed25519.PublicKey;
|
|
307
|
+
declare const StricaPublicKey: typeof cjsBip32ed25519.PublicKey;
|
|
308
|
+
type StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
|
|
309
|
+
declare const StricaBip32PrivateKey: typeof cjsBip32ed25519.Bip32PrivateKey;
|
|
310
|
+
type StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
|
|
311
|
+
declare const StricaBip32PublicKey: typeof cjsBip32ed25519.Bip32PublicKey;
|
|
308
312
|
|
|
309
|
-
declare const
|
|
313
|
+
declare const StricaEncoder: {
|
|
310
314
|
encode: (input: any, options?: {
|
|
311
315
|
collapseBigNumber: Boolean;
|
|
312
316
|
}) => Buffer;
|
|
313
317
|
};
|
|
314
|
-
declare const
|
|
318
|
+
declare const StricaDecoder: typeof cjsCbors.Decoder;
|
|
319
|
+
type StricaDecoder = cjsCbors.Decoder;
|
|
315
320
|
|
|
316
321
|
declare const buildBaseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16, stakeKeyHash: Hash28ByteBase16) => BaseAddress;
|
|
317
322
|
declare const buildEnterpriseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16) => EnterpriseAddress;
|
|
318
|
-
declare const buildBip32PrivateKey: (entropy: string, password?: string) => Bip32PrivateKey
|
|
323
|
+
declare const buildBip32PrivateKey: (entropy: string, password?: string) => Bip32PrivateKey;
|
|
319
324
|
declare const buildRewardAddress: (networkId: number, stakeKeyHash: Hash28ByteBase16) => RewardAddress;
|
|
320
325
|
declare const buildKeys: (entropy: string | [string, string], accountIndex: number, keyIndex?: number) => {
|
|
321
|
-
paymentKey:
|
|
322
|
-
stakeKey:
|
|
326
|
+
paymentKey: StricaPrivateKey;
|
|
327
|
+
stakeKey: StricaPrivateKey;
|
|
328
|
+
dRepKey?: StricaPrivateKey;
|
|
323
329
|
};
|
|
324
330
|
declare const buildScriptPubkey: (keyHash: Ed25519KeyHash) => NativeScript;
|
|
325
|
-
declare const buildDRepID: (dRepKey: Ed25519PublicKeyHex, networkId?: NetworkId, addressType?: AddressType) =>
|
|
331
|
+
declare const buildDRepID: (dRepKey: Ed25519PublicKeyHex, networkId?: NetworkId, addressType?: AddressType) => DRepID;
|
|
326
332
|
|
|
327
333
|
declare const toAddress: (bech32: string) => Address;
|
|
328
334
|
declare const toBaseAddress: (bech32: string) => BaseAddress | undefined;
|
|
@@ -359,4 +365,4 @@ declare function negatives(v: Value): Value;
|
|
|
359
365
|
declare function assetTypes(v: Value): number;
|
|
360
366
|
declare function empty(v: Value): boolean;
|
|
361
367
|
|
|
362
|
-
export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey
|
|
368
|
+
export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey, Bip32PrivateKeyHex, CardanoSDKSerializer, CborSet, CborWriter, Certificate, CertificateType, ConstrPlutusData, CoseSign1, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, DRep, DRepID, Datum, DatumHash, DatumKind, Ed25519KeyHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, EnterpriseAddress, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusList, PlutusMap, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PoolId, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RequireAllOf, RequireAnyOf, RequireNOf, RequireSignature, RequireTimeAfter, RequireTimeBefore, RewardAccount, RewardAddress, Script, ScriptHash, ScriptPubkey, type Signatures, type Signer, Slot, StakeCredentialStatus, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, StricaBip32PrivateKey, StricaBip32PrivateKey as StricaBip32PrivateKeyType, StricaBip32PublicKey, StricaBip32PublicKey as StricaBip32PublicKeyType, StricaDecoder, StricaEncoder, StricaPrivateKey, StricaPrivateKey as StricaPrivateKeyType, StricaPublicKey, StricaPublicKey as StricaPublicKeyType, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, VrfVkBech32, type Witness, addressToBech32, assetTypes, buildBaseAddress, buildBip32PrivateKey, buildDRepID, buildEnterpriseAddress, buildKeys, buildRewardAddress, buildScriptPubkey, checkSignature, deserializeAddress, deserializeDataHash, deserializeEd25519KeyHash, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxHash, deserializeTxUnspentOutput, deserializeValue, empty, fromNativeScript, fromScriptRef, fromTxUnspentOutput, fromValue, generateNonce, getCoseKeyFromPublicKey, getPublicKeyFromCoseKey, mergeValue, negateValue, negatives, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, signData, subValue, toAddress, toBaseAddress, toEnterpriseAddress, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toTxUnspentOutput, toValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,11 +7,10 @@ import { OpaqueString } from '@cardano-sdk/util';
|
|
|
7
7
|
export { _cardano_sdk_util as CardanoSDKUtil };
|
|
8
8
|
import * as Crypto from '@cardano-sdk/crypto';
|
|
9
9
|
export { Crypto };
|
|
10
|
-
import
|
|
10
|
+
import * as cjsBip32ed25519 from '@stricahq/bip32ed25519';
|
|
11
11
|
import { DataSignature, Data, NativeScript as NativeScript$1, PlutusScript, IMeshTxSerializer, DeserializedAddress, BuilderData, IDeserializer, IResolver, MeshTxBuilderBody, Protocol, UTxO, Asset, LanguageVersion } from '@meshsdk/common';
|
|
12
12
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
13
|
-
import
|
|
14
|
-
import * as _cardano_sdk_core_dist_cjs_Cardano from '@cardano-sdk/core/dist/cjs/Cardano';
|
|
13
|
+
import * as cjsCbors from '@stricahq/cbors';
|
|
15
14
|
|
|
16
15
|
declare const Slot: (value: number) => Cardano.Slot;
|
|
17
16
|
type Slot = Cardano.Slot;
|
|
@@ -139,8 +138,8 @@ declare const Ed25519PublicKey: typeof Crypto.Ed25519PublicKey;
|
|
|
139
138
|
type Ed25519PublicKey = Crypto.Ed25519PublicKey;
|
|
140
139
|
declare const Ed25519Signature: typeof Crypto.Ed25519Signature;
|
|
141
140
|
type Ed25519Signature = Crypto.Ed25519Signature;
|
|
142
|
-
declare const Bip32PrivateKey
|
|
143
|
-
type Bip32PrivateKey
|
|
141
|
+
declare const Bip32PrivateKey: typeof Crypto.Bip32PrivateKey;
|
|
142
|
+
type Bip32PrivateKey = Crypto.Bip32PrivateKey;
|
|
144
143
|
declare const Bip32PrivateKeyHex: (key: string) => Crypto.Bip32PrivateKeyHex;
|
|
145
144
|
type Bip32PrivateKeyHex = Crypto.Bip32PrivateKeyHex;
|
|
146
145
|
declare const PlutusLanguageVersion: typeof Cardano.PlutusLanguageVersion;
|
|
@@ -211,10 +210,14 @@ declare const DRepID: {
|
|
|
211
210
|
isValid(value: string): boolean;
|
|
212
211
|
canSign(value: string): boolean;
|
|
213
212
|
};
|
|
213
|
+
type DRep = Serialization.DRep;
|
|
214
|
+
declare const DRep: typeof Serialization.DRep;
|
|
215
|
+
type StakeCredentialStatus = Cardano.StakeCredentialStatus;
|
|
216
|
+
declare const StakeCredentialStatus: typeof Cardano.StakeCredentialStatus;
|
|
214
217
|
|
|
215
218
|
type Signer = {
|
|
216
219
|
address: Address;
|
|
217
|
-
key:
|
|
220
|
+
key: StricaPrivateKey;
|
|
218
221
|
};
|
|
219
222
|
|
|
220
223
|
declare const checkSignature: (data: string, { key, signature }: DataSignature) => boolean;
|
|
@@ -298,31 +301,34 @@ declare class CardanoSDKSerializer implements IMeshTxSerializer {
|
|
|
298
301
|
private createDummyTx;
|
|
299
302
|
}
|
|
300
303
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
declare const
|
|
307
|
-
|
|
304
|
+
type StricaPrivateKey = cjsBip32ed25519.PrivateKey;
|
|
305
|
+
declare const StricaPrivateKey: typeof cjsBip32ed25519.PrivateKey;
|
|
306
|
+
type StricaPublicKey = cjsBip32ed25519.PublicKey;
|
|
307
|
+
declare const StricaPublicKey: typeof cjsBip32ed25519.PublicKey;
|
|
308
|
+
type StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
|
|
309
|
+
declare const StricaBip32PrivateKey: typeof cjsBip32ed25519.Bip32PrivateKey;
|
|
310
|
+
type StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
|
|
311
|
+
declare const StricaBip32PublicKey: typeof cjsBip32ed25519.Bip32PublicKey;
|
|
308
312
|
|
|
309
|
-
declare const
|
|
313
|
+
declare const StricaEncoder: {
|
|
310
314
|
encode: (input: any, options?: {
|
|
311
315
|
collapseBigNumber: Boolean;
|
|
312
316
|
}) => Buffer;
|
|
313
317
|
};
|
|
314
|
-
declare const
|
|
318
|
+
declare const StricaDecoder: typeof cjsCbors.Decoder;
|
|
319
|
+
type StricaDecoder = cjsCbors.Decoder;
|
|
315
320
|
|
|
316
321
|
declare const buildBaseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16, stakeKeyHash: Hash28ByteBase16) => BaseAddress;
|
|
317
322
|
declare const buildEnterpriseAddress: (networkId: number, paymentKeyHash: Hash28ByteBase16) => EnterpriseAddress;
|
|
318
|
-
declare const buildBip32PrivateKey: (entropy: string, password?: string) => Bip32PrivateKey
|
|
323
|
+
declare const buildBip32PrivateKey: (entropy: string, password?: string) => Bip32PrivateKey;
|
|
319
324
|
declare const buildRewardAddress: (networkId: number, stakeKeyHash: Hash28ByteBase16) => RewardAddress;
|
|
320
325
|
declare const buildKeys: (entropy: string | [string, string], accountIndex: number, keyIndex?: number) => {
|
|
321
|
-
paymentKey:
|
|
322
|
-
stakeKey:
|
|
326
|
+
paymentKey: StricaPrivateKey;
|
|
327
|
+
stakeKey: StricaPrivateKey;
|
|
328
|
+
dRepKey?: StricaPrivateKey;
|
|
323
329
|
};
|
|
324
330
|
declare const buildScriptPubkey: (keyHash: Ed25519KeyHash) => NativeScript;
|
|
325
|
-
declare const buildDRepID: (dRepKey: Ed25519PublicKeyHex, networkId?: NetworkId, addressType?: AddressType) =>
|
|
331
|
+
declare const buildDRepID: (dRepKey: Ed25519PublicKeyHex, networkId?: NetworkId, addressType?: AddressType) => DRepID;
|
|
326
332
|
|
|
327
333
|
declare const toAddress: (bech32: string) => Address;
|
|
328
334
|
declare const toBaseAddress: (bech32: string) => BaseAddress | undefined;
|
|
@@ -359,4 +365,4 @@ declare function negatives(v: Value): Value;
|
|
|
359
365
|
declare function assetTypes(v: Value): number;
|
|
360
366
|
declare function empty(v: Value): boolean;
|
|
361
367
|
|
|
362
|
-
export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey
|
|
368
|
+
export { Address, AddressType, AssetFingerprint, AssetId, AssetName, BaseAddress, Bip32PrivateKey, Bip32PrivateKeyHex, CardanoSDKSerializer, CborSet, CborWriter, Certificate, CertificateType, ConstrPlutusData, CoseSign1, CostModel, type CostModels, Costmdls, Credential, type CredentialCore, CredentialType, DRep, DRepID, Datum, DatumHash, DatumKind, Ed25519KeyHash, Ed25519KeyHashHex, Ed25519PrivateExtendedKeyHex, Ed25519PrivateNormalKeyHex, Ed25519PublicKey, Ed25519PublicKeyHex, Ed25519Signature, Ed25519SignatureHex, EnterpriseAddress, ExUnits, Hash, Hash28ByteBase16, Hash32ByteBase16, NativeScript, NetworkId, PaymentAddress, PlutusData, PlutusLanguageVersion, PlutusList, PlutusMap, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PoolId, Redeemer, RedeemerPurpose, RedeemerTag, Redeemers, RequireAllOf, RequireAnyOf, RequireNOf, RequireSignature, RequireTimeAfter, RequireTimeBefore, RewardAccount, RewardAddress, Script, ScriptHash, ScriptPubkey, type Signatures, type Signer, Slot, StakeCredentialStatus, StakeDelegation, type StakeDelegationCertificate, StakeRegistration, StricaBip32PrivateKey, StricaBip32PrivateKey as StricaBip32PrivateKeyType, StricaBip32PublicKey, StricaBip32PublicKey as StricaBip32PublicKeyType, StricaDecoder, StricaEncoder, StricaPrivateKey, StricaPrivateKey as StricaPrivateKeyType, StricaPublicKey, StricaPublicKey as StricaPublicKeyType, type TokenMap, Transaction, TransactionBody, TransactionId, TransactionInput, type TransactionInputSet, TransactionOutput, TransactionUnspentOutput, type TransactionWitnessPlutusData, TransactionWitnessSet, Value, VkeyWitness, VrfVkBech32, type Witness, addressToBech32, assetTypes, buildBaseAddress, buildBip32PrivateKey, buildDRepID, buildEnterpriseAddress, buildKeys, buildRewardAddress, buildScriptPubkey, checkSignature, deserializeAddress, deserializeDataHash, deserializeEd25519KeyHash, deserializeNativeScript, deserializePlutusData, deserializePlutusScript, deserializeScriptHash, deserializeScriptRef, deserializeTx, deserializeTxHash, deserializeTxUnspentOutput, deserializeValue, empty, fromNativeScript, fromScriptRef, fromTxUnspentOutput, fromValue, generateNonce, getCoseKeyFromPublicKey, getPublicKeyFromCoseKey, mergeValue, negateValue, negatives, resolveDataHash, resolveNativeScriptAddress, resolveNativeScriptHash, resolvePaymentKeyHash, resolvePlutusScriptAddress, resolvePlutusScriptHash, resolvePoolId, resolvePrivateKey, resolveRewardAddress, resolveScriptRef, resolveStakeKeyHash, resolveTxHash, signData, subValue, toAddress, toBaseAddress, toEnterpriseAddress, toNativeScript, toPlutusData, toRewardAddress, toScriptRef, toTxUnspentOutput, toValue };
|
package/dist/index.js
CHANGED
|
@@ -967,38 +967,24 @@ var RequireTimeBefore = Cardano.NativeScriptKind.RequireTimeBefore;
|
|
|
967
967
|
var VrfVkBech32 = Cardano.VrfVkBech32;
|
|
968
968
|
var ScriptPubkey = Serialization.ScriptPubkey;
|
|
969
969
|
var DRepID = Cardano.DRepID;
|
|
970
|
+
var DRep = Serialization.DRep;
|
|
971
|
+
var StakeCredentialStatus = Cardano.StakeCredentialStatus;
|
|
970
972
|
|
|
971
973
|
// src/message-signing/cose-sign1.ts
|
|
972
974
|
var import_blakejs = __toESM(require_blakejs(), 1);
|
|
973
975
|
import { Buffer as Buffer2 } from "buffer";
|
|
974
976
|
|
|
975
|
-
// src/stricahq/bip32ed25519/
|
|
976
|
-
import
|
|
977
|
+
// src/stricahq/bip32ed25519/wrapper.ts
|
|
978
|
+
import * as cjsBip32ed25519 from "@stricahq/bip32ed25519";
|
|
979
|
+
var StricaPrivateKey = cjsBip32ed25519.PrivateKey;
|
|
980
|
+
var StricaPublicKey = cjsBip32ed25519.PublicKey;
|
|
981
|
+
var StricaBip32PrivateKey = cjsBip32ed25519.Bip32PrivateKey;
|
|
982
|
+
var StricaBip32PublicKey = cjsBip32ed25519.Bip32PublicKey;
|
|
977
983
|
|
|
978
|
-
// src/stricahq/
|
|
979
|
-
import
|
|
980
|
-
|
|
981
|
-
var
|
|
982
|
-
constructor(privKey, extended = true) {
|
|
983
|
-
if (!extended) {
|
|
984
|
-
let extendedSecret = hash.sha512().update(privKey).digest();
|
|
985
|
-
if (extendedSecret[0] && extendedSecret[31]) {
|
|
986
|
-
extendedSecret[0] &= 248;
|
|
987
|
-
extendedSecret[31] &= 63;
|
|
988
|
-
extendedSecret[31] |= 64;
|
|
989
|
-
}
|
|
990
|
-
privKey = Buffer.from(extendedSecret);
|
|
991
|
-
}
|
|
992
|
-
super(privKey);
|
|
993
|
-
}
|
|
994
|
-
};
|
|
995
|
-
|
|
996
|
-
// src/stricahq/bip32ed25519/index.ts
|
|
997
|
-
var { PublicKey, Bip32PrivateKey: Bip32PrivateKey3, Bip32PublicKey } = strica2;
|
|
998
|
-
|
|
999
|
-
// src/stricahq/cbors/index.ts
|
|
1000
|
-
import strica3 from "@stricahq/cbors";
|
|
1001
|
-
var { Encoder, Decoder } = strica3;
|
|
984
|
+
// src/stricahq/cbors/wrapper.ts
|
|
985
|
+
import * as cjsCbors from "@stricahq/cbors";
|
|
986
|
+
var StricaEncoder = cjsCbors.Encoder;
|
|
987
|
+
var StricaDecoder = cjsCbors.Decoder;
|
|
1002
988
|
|
|
1003
989
|
// src/message-signing/cose-sign1.ts
|
|
1004
990
|
var CoseSign1 = class _CoseSign1 {
|
|
@@ -1016,13 +1002,13 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1016
1002
|
this.signature = payload.signature;
|
|
1017
1003
|
}
|
|
1018
1004
|
static fromCbor(cbor) {
|
|
1019
|
-
const decoded =
|
|
1005
|
+
const decoded = StricaDecoder.decode(Buffer2.from(cbor, "hex"));
|
|
1020
1006
|
if (!(decoded.value instanceof Array)) throw Error("Invalid CBOR");
|
|
1021
1007
|
if (decoded.value.length !== 4) throw Error("Invalid COSE_SIGN1");
|
|
1022
1008
|
let protectedMap;
|
|
1023
1009
|
const protectedSerialized = decoded.value[0];
|
|
1024
1010
|
try {
|
|
1025
|
-
protectedMap =
|
|
1011
|
+
protectedMap = StricaDecoder.decode(protectedSerialized).value;
|
|
1026
1012
|
if (!(protectedMap instanceof Map)) {
|
|
1027
1013
|
throw Error();
|
|
1028
1014
|
}
|
|
@@ -1043,7 +1029,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1043
1029
|
createSigStructure(externalAad = Buffer2.alloc(0)) {
|
|
1044
1030
|
let protectedSerialized = Buffer2.alloc(0);
|
|
1045
1031
|
if (this.protectedMap.size !== 0) {
|
|
1046
|
-
protectedSerialized =
|
|
1032
|
+
protectedSerialized = StricaEncoder.encode(this.protectedMap);
|
|
1047
1033
|
}
|
|
1048
1034
|
const structure = [
|
|
1049
1035
|
"Signature1",
|
|
@@ -1051,13 +1037,13 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1051
1037
|
externalAad,
|
|
1052
1038
|
this.payload
|
|
1053
1039
|
];
|
|
1054
|
-
return
|
|
1040
|
+
return StricaEncoder.encode(structure);
|
|
1055
1041
|
}
|
|
1056
1042
|
buildMessage(signature) {
|
|
1057
1043
|
this.signature = signature;
|
|
1058
1044
|
let protectedSerialized = Buffer2.alloc(0);
|
|
1059
1045
|
if (this.protectedMap.size !== 0) {
|
|
1060
|
-
protectedSerialized =
|
|
1046
|
+
protectedSerialized = StricaEncoder.encode(this.protectedMap);
|
|
1061
1047
|
}
|
|
1062
1048
|
const coseSign1 = [
|
|
1063
1049
|
protectedSerialized,
|
|
@@ -1065,7 +1051,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1065
1051
|
this.payload,
|
|
1066
1052
|
this.signature
|
|
1067
1053
|
];
|
|
1068
|
-
return
|
|
1054
|
+
return StricaEncoder.encode(coseSign1);
|
|
1069
1055
|
}
|
|
1070
1056
|
verifySignature({
|
|
1071
1057
|
externalAad = Buffer2.alloc(0),
|
|
@@ -1076,7 +1062,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1076
1062
|
}
|
|
1077
1063
|
if (!publicKeyBuffer) throw Error("Public key not found");
|
|
1078
1064
|
if (!this.signature) throw Error("Signature not found");
|
|
1079
|
-
const publicKey = new
|
|
1065
|
+
const publicKey = new StricaPublicKey(publicKeyBuffer);
|
|
1080
1066
|
return publicKey.verify(
|
|
1081
1067
|
this.signature,
|
|
1082
1068
|
this.createSigStructure(externalAad)
|
|
@@ -1090,8 +1076,8 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1090
1076
|
if (this.unProtectedMap.get("hashed") != false)
|
|
1091
1077
|
throw Error("Invalid unprotected map");
|
|
1092
1078
|
this.unProtectedMap.set("hashed", true);
|
|
1093
|
-
const
|
|
1094
|
-
this.payload = Buffer2.from(
|
|
1079
|
+
const hash = (0, import_blakejs.blake2b)(this.payload, void 0, 24);
|
|
1080
|
+
this.payload = Buffer2.from(hash);
|
|
1095
1081
|
}
|
|
1096
1082
|
getAddress() {
|
|
1097
1083
|
return this.protectedMap.get("address");
|
|
@@ -1107,7 +1093,7 @@ var CoseSign1 = class _CoseSign1 {
|
|
|
1107
1093
|
}
|
|
1108
1094
|
};
|
|
1109
1095
|
var getPublicKeyFromCoseKey = (cbor) => {
|
|
1110
|
-
const decodedCoseKey =
|
|
1096
|
+
const decodedCoseKey = StricaDecoder.decode(Buffer2.from(cbor, "hex"));
|
|
1111
1097
|
const publicKeyBuffer = decodedCoseKey.value.get(-2);
|
|
1112
1098
|
if (publicKeyBuffer) {
|
|
1113
1099
|
return publicKeyBuffer;
|
|
@@ -1120,7 +1106,7 @@ var getCoseKeyFromPublicKey = (cbor) => {
|
|
|
1120
1106
|
coseKeyMap.set(3, -8);
|
|
1121
1107
|
coseKeyMap.set(6, -2);
|
|
1122
1108
|
coseKeyMap.set(-2, Buffer2.from(cbor, "hex"));
|
|
1123
|
-
return
|
|
1109
|
+
return StricaEncoder.encode(coseKeyMap);
|
|
1124
1110
|
};
|
|
1125
1111
|
|
|
1126
1112
|
// src/message-signing/check-signature.ts
|
|
@@ -1270,19 +1256,18 @@ var buildRewardAddress = (networkId, stakeKeyHash) => {
|
|
|
1270
1256
|
};
|
|
1271
1257
|
var buildKeys = (entropy, accountIndex, keyIndex = 0) => {
|
|
1272
1258
|
if (typeof entropy === "string") {
|
|
1273
|
-
const rootKey = new
|
|
1259
|
+
const rootKey = new StricaBip32PrivateKey(Buffer.from(entropy, "hex"));
|
|
1274
1260
|
const accountKey = rootKey.derive(HARDENED_KEY_START + 1852).derive(HARDENED_KEY_START + 1815).derive(HARDENED_KEY_START + accountIndex);
|
|
1275
1261
|
const paymentKey = accountKey.derive(0).derive(keyIndex).toPrivateKey();
|
|
1276
1262
|
const stakeKey = accountKey.derive(2).derive(0).toPrivateKey();
|
|
1277
|
-
|
|
1263
|
+
const dRepKey = accountKey.derive(3).derive(keyIndex).toPrivateKey();
|
|
1264
|
+
return { paymentKey, stakeKey, dRepKey };
|
|
1278
1265
|
} else {
|
|
1279
|
-
const paymentKey =
|
|
1280
|
-
Buffer.from(entropy[0], "hex")
|
|
1281
|
-
false
|
|
1266
|
+
const paymentKey = StricaPrivateKey.fromSecretKey(
|
|
1267
|
+
Buffer.from(entropy[0], "hex")
|
|
1282
1268
|
);
|
|
1283
|
-
const stakeKey =
|
|
1284
|
-
Buffer.from(entropy[1], "hex")
|
|
1285
|
-
false
|
|
1269
|
+
const stakeKey = StricaPrivateKey.fromSecretKey(
|
|
1270
|
+
Buffer.from(entropy[1], "hex")
|
|
1286
1271
|
);
|
|
1287
1272
|
return { paymentKey, stakeKey };
|
|
1288
1273
|
}
|
|
@@ -1725,8 +1710,8 @@ var resolvePlutusScriptHash = (bech32) => {
|
|
|
1725
1710
|
throw new Error(`An error occurred during resolveScriptHash: ${error}.`);
|
|
1726
1711
|
}
|
|
1727
1712
|
};
|
|
1728
|
-
var resolvePoolId = (
|
|
1729
|
-
return Ed25519KeyHashHex2(
|
|
1713
|
+
var resolvePoolId = (hash) => {
|
|
1714
|
+
return Ed25519KeyHashHex2(hash).toString();
|
|
1730
1715
|
};
|
|
1731
1716
|
var resolvePrivateKey = (words) => {
|
|
1732
1717
|
return "not implemented";
|
|
@@ -1760,8 +1745,8 @@ var resolveStakeKeyHash = (bech32) => {
|
|
|
1760
1745
|
};
|
|
1761
1746
|
var resolveTxHash = (txHex) => {
|
|
1762
1747
|
const txBody = deserializeTx(txHex).body();
|
|
1763
|
-
const
|
|
1764
|
-
return Cardano2.TransactionId.fromHexBlob(HexBlob4.fromBytes(
|
|
1748
|
+
const hash = blake2b3(blake2b3.BYTES).update(hexToBytes(txBody.toCbor())).digest();
|
|
1749
|
+
return Cardano2.TransactionId.fromHexBlob(HexBlob4.fromBytes(hash));
|
|
1765
1750
|
};
|
|
1766
1751
|
|
|
1767
1752
|
// src/serializer/index.ts
|
|
@@ -1834,7 +1819,7 @@ var CardanoSDKSerializer = class {
|
|
|
1834
1819
|
serializeRewardAddress(stakeKeyHash, isScriptHash, network_id) {
|
|
1835
1820
|
throw new Error("Method not implemented.");
|
|
1836
1821
|
}
|
|
1837
|
-
serializePoolId(
|
|
1822
|
+
serializePoolId(hash) {
|
|
1838
1823
|
throw new Error("Method not implemented.");
|
|
1839
1824
|
}
|
|
1840
1825
|
serializeAddress(address, networkId) {
|
|
@@ -1961,9 +1946,8 @@ var CardanoSDKSerializer = class {
|
|
|
1961
1946
|
if (keyHex.length === 68 && keyHex.substring(0, 4) === "5820") {
|
|
1962
1947
|
keyHex = keyHex.substring(4);
|
|
1963
1948
|
}
|
|
1964
|
-
const cardanoSigner =
|
|
1965
|
-
Buffer.from(keyHex, "hex")
|
|
1966
|
-
false
|
|
1949
|
+
const cardanoSigner = StricaPrivateKey.fromSecretKey(
|
|
1950
|
+
Buffer.from(keyHex, "hex")
|
|
1967
1951
|
);
|
|
1968
1952
|
const signature = cardanoSigner.sign(
|
|
1969
1953
|
Buffer.from(cardanoTx.getId(), "hex")
|
|
@@ -2567,6 +2551,7 @@ export {
|
|
|
2567
2551
|
Credential,
|
|
2568
2552
|
CredentialType,
|
|
2569
2553
|
Crypto3 as Crypto,
|
|
2554
|
+
DRep,
|
|
2570
2555
|
DRepID,
|
|
2571
2556
|
Datum,
|
|
2572
2557
|
DatumHash,
|
|
@@ -2613,14 +2598,19 @@ export {
|
|
|
2613
2598
|
ScriptPubkey,
|
|
2614
2599
|
Serialization5 as Serialization,
|
|
2615
2600
|
Slot,
|
|
2601
|
+
StakeCredentialStatus,
|
|
2616
2602
|
StakeDelegation,
|
|
2617
2603
|
StakeRegistration,
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2604
|
+
StricaBip32PrivateKey,
|
|
2605
|
+
StricaBip32PrivateKey as StricaBip32PrivateKeyType,
|
|
2606
|
+
StricaBip32PublicKey,
|
|
2607
|
+
StricaBip32PublicKey as StricaBip32PublicKeyType,
|
|
2608
|
+
StricaDecoder,
|
|
2609
|
+
StricaEncoder,
|
|
2610
|
+
StricaPrivateKey,
|
|
2611
|
+
StricaPrivateKey as StricaPrivateKeyType,
|
|
2612
|
+
StricaPublicKey,
|
|
2613
|
+
StricaPublicKey as StricaPublicKeyType,
|
|
2624
2614
|
Transaction,
|
|
2625
2615
|
TransactionBody,
|
|
2626
2616
|
TransactionId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/core-cst",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -38,10 +38,12 @@
|
|
|
38
38
|
"@cardano-sdk/core": "^0.35.4",
|
|
39
39
|
"@cardano-sdk/crypto": "^0.1.28",
|
|
40
40
|
"@cardano-sdk/util": "^0.15.4",
|
|
41
|
+
"@harmoniclabs/cbor": "^1.3.0",
|
|
42
|
+
"@harmoniclabs/plutus-data": "^1.2.4",
|
|
43
|
+
"@harmoniclabs/uplc": "^1.2.4",
|
|
41
44
|
"@meshsdk/common": "*",
|
|
42
45
|
"@stricahq/bip32ed25519": "^1.1.0",
|
|
43
46
|
"@stricahq/cbors": "^1.0.0",
|
|
44
|
-
"hash.js": "^1.1.7",
|
|
45
47
|
"pbkdf2": "^3.1.2"
|
|
46
48
|
},
|
|
47
49
|
"prettier": "@meshsdk/configs/prettier",
|