@lucid-evolution/wallet 0.1.5 → 0.1.7

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 CHANGED
@@ -161,8 +161,13 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
161
161
  const rewardAddresses = withdrawals2.keys();
162
162
  for (let i = 0; i < rewardAddresses.len(); i++) {
163
163
  const credential = rewardAddresses.get(i).payment();
164
- if (credential.kind() === 0) {
165
- usedKeyHashes.push(credential.to_cbor_hex());
164
+ switch (credential.kind()) {
165
+ case 0:
166
+ usedKeyHashes.push(credential.as_pub_key()?.to_hex());
167
+ break;
168
+ case 1:
169
+ usedKeyHashes.push(credential.as_script()?.to_hex());
170
+ break;
166
171
  }
167
172
  }
168
173
  }
@@ -244,7 +249,9 @@ var makeWalletFromSeed = (provider, network, seed, options) => {
244
249
  getUtxosCore: async () => {
245
250
  const utxos = await provider.getUtxos((0, import_utils2.paymentCredentialOf)(address));
246
251
  const coreUtxos = [];
247
- utxos.forEach((utxo) => coreUtxos.push((0, import_utils2.utxoToCore)(utxo)));
252
+ for (const utxo of utxos) {
253
+ coreUtxos.push((0, import_utils2.utxoToCore)(utxo));
254
+ }
248
255
  return coreUtxos;
249
256
  },
250
257
  getDelegation: async () => {
@@ -255,15 +262,14 @@ var makeWalletFromSeed = (provider, network, seed, options) => {
255
262
  const ownKeyHashes = [paymentKeyHash, stakeKeyHash];
256
263
  const usedKeyHashes = discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, utxos);
257
264
  const txWitnessSetBuilder = CML2.TransactionWitnessSetBuilder.new();
258
- usedKeyHashes.forEach((keyHash) => {
265
+ for (const keyHash of usedKeyHashes) {
259
266
  const priv = CML2.PrivateKey.from_bech32(privKeyHashMap[keyHash]);
260
267
  const witness = CML2.make_vkey_witness(
261
268
  CML2.hash_transaction(tx.body()),
262
- // toCMLTransactionHash(tx.body()),
263
269
  priv
264
270
  );
265
271
  txWitnessSetBuilder.add_vkey(witness);
266
- });
272
+ }
267
273
  return txWitnessSetBuilder.build();
268
274
  },
269
275
  signMessage: async (address2, payload) => {
package/dist/index.js CHANGED
@@ -121,8 +121,13 @@ function discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, ownUtxos) {
121
121
  const rewardAddresses = withdrawals2.keys();
122
122
  for (let i = 0; i < rewardAddresses.len(); i++) {
123
123
  const credential = rewardAddresses.get(i).payment();
124
- if (credential.kind() === 0) {
125
- usedKeyHashes.push(credential.to_cbor_hex());
124
+ switch (credential.kind()) {
125
+ case 0:
126
+ usedKeyHashes.push(credential.as_pub_key()?.to_hex());
127
+ break;
128
+ case 1:
129
+ usedKeyHashes.push(credential.as_script()?.to_hex());
130
+ break;
126
131
  }
127
132
  }
128
133
  }
@@ -209,7 +214,9 @@ var makeWalletFromSeed = (provider, network, seed, options) => {
209
214
  getUtxosCore: async () => {
210
215
  const utxos = await provider.getUtxos(paymentCredentialOf(address));
211
216
  const coreUtxos = [];
212
- utxos.forEach((utxo) => coreUtxos.push(utxoToCore(utxo)));
217
+ for (const utxo of utxos) {
218
+ coreUtxos.push(utxoToCore(utxo));
219
+ }
213
220
  return coreUtxos;
214
221
  },
215
222
  getDelegation: async () => {
@@ -220,15 +227,14 @@ var makeWalletFromSeed = (provider, network, seed, options) => {
220
227
  const ownKeyHashes = [paymentKeyHash, stakeKeyHash];
221
228
  const usedKeyHashes = discoverOwnUsedTxKeyHashes(tx, ownKeyHashes, utxos);
222
229
  const txWitnessSetBuilder = CML2.TransactionWitnessSetBuilder.new();
223
- usedKeyHashes.forEach((keyHash) => {
230
+ for (const keyHash of usedKeyHashes) {
224
231
  const priv = CML2.PrivateKey.from_bech32(privKeyHashMap[keyHash]);
225
232
  const witness = CML2.make_vkey_witness(
226
233
  CML2.hash_transaction(tx.body()),
227
- // toCMLTransactionHash(tx.body()),
228
234
  priv
229
235
  );
230
236
  txWitnessSetBuilder.add_vkey(witness);
231
- });
237
+ }
232
238
  return txWitnessSetBuilder.build();
233
239
  },
234
240
  signMessage: async (address2, payload) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucid-evolution/wallet",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -22,17 +22,17 @@
22
22
  "author": "",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@dcspark/cardano-multiplatform-lib-nodejs": "^5.2.0",
26
- "@lucid-evolution/bip39": "0.2.4",
27
- "@lucid-evolution/core-types": "0.1.3",
28
- "@lucid-evolution/core-utils": "0.1.3",
29
- "@lucid-evolution/utils": "0.1.5",
30
- "@lucid-evolution/sign_data": "0.1.3"
25
+ "@dcspark/cardano-multiplatform-lib-nodejs": "^5.3.0",
26
+ "@lucid-evolution/bip39": "0.2.6",
27
+ "@lucid-evolution/core-types": "0.1.5",
28
+ "@lucid-evolution/core-utils": "0.1.5",
29
+ "@lucid-evolution/sign_data": "0.1.5",
30
+ "@lucid-evolution/utils": "0.1.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^20.11.24",
33
+ "@types/node": "^20.12.8",
34
34
  "tsup": "^8.0.2",
35
- "typescript": "^5.3.3"
35
+ "typescript": "^5.4.5"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup-node src/index.ts --format esm,cjs --dts --clean",