@hardkas/accounts 0.11.4-alpha → 0.11.6-alpha

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.
@@ -2,7 +2,7 @@ import {
2
2
  LazyAccountAuthorizer,
3
3
  PrivateKeyAuthorizer,
4
4
  StaticSignatureScriptAuthorizer
5
- } from "./chunk-MRXCDBKH.js";
5
+ } from "./chunk-3XXJ6UUU.js";
6
6
  export {
7
7
  LazyAccountAuthorizer,
8
8
  PrivateKeyAuthorizer,
@@ -38,7 +38,9 @@ var PrivateKeyAuthorizer = class {
38
38
  }
39
39
  const tx = wasmTransaction;
40
40
  try {
41
+ console.log("DEBUG: Calling signTransaction");
41
42
  const signedTx = wasm.signTransaction(tx, [privateKey], false);
43
+ console.log("DEBUG: signTransaction OK");
42
44
  const sigScript = signedTx.inputs[inputIndex].signatureScript;
43
45
  if (!sigScript || sigScript.length === 0) {
44
46
  throw new Error(`UNAUTHORIZED_TRANSACTION_INPUT: Kaspa WASM failed to generate a signature script for input ${inputIndex} using account '${this.accountName}'.`);
@@ -73,7 +75,7 @@ var LazyAccountAuthorizer = class {
73
75
  if (!pkValue && account.keystorePath) {
74
76
  try {
75
77
  const { KeystoreManager } = await import("./keystore-CMWEKGBF.js");
76
- const { DEV_ACCOUNTS_PASSWORD } = await import("./dev-accounts-FU4XTSGF.js");
78
+ const { DEV_ACCOUNTS_PASSWORD } = await import("./dev-accounts-UULCTDJB.js");
77
79
  const keystore = await KeystoreManager.loadEncryptedKeystore(account.keystorePath);
78
80
  const unlock = await KeystoreManager.decryptEncryptedKeystore(keystore, DEV_ACCOUNTS_PASSWORD);
79
81
  if (unlock.success && unlock.payload) {
@@ -28,7 +28,7 @@ function parseWasmTxToRpc(wasmTxStr, signedTx, inputOverrides, plan) {
28
28
  return {
29
29
  version,
30
30
  inputs: (txInner.inputs || []).map((i, idx) => {
31
- const isFlattened = !!txInner.outputs || !!i.previousOutpoint || !!i.transactionId;
31
+ const isFlattened = !!i.previousOutpoint || !!i.transactionId;
32
32
  const prevOut = isFlattened ? i.previousOutpoint || i : i.inner.previousOutpoint.inner;
33
33
  const originalSigScript = isFlattened ? i.signatureScript || "" : toHex(i.inner.signatureScript);
34
34
  const originalSigOpCount = isFlattened ? i.sigOpCount : i.inner.sigOpCount;
@@ -56,9 +56,9 @@ function parseWasmTxToRpc(wasmTxStr, signedTx, inputOverrides, plan) {
56
56
  };
57
57
  }),
58
58
  outputs: (txInner.outputs || []).map((o, idx) => {
59
- const isFlattened = !!txInner.outputs || !!o.scriptPublicKey || !!o.value || !!o.amount;
59
+ const isFlattened = !!o.scriptPublicKey || !!o.script_public_key || !!o.value || !!o.amount;
60
60
  const innerOut = isFlattened ? o : o.inner;
61
- const scriptObj = innerOut.scriptPublicKey;
61
+ const scriptObj = innerOut.scriptPublicKey || innerOut.script_public_key;
62
62
  const ret = {
63
63
  amount: (innerOut.value || innerOut.amount || 0).toString(),
64
64
  scriptPublicKey: {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseWasmTxToRpc
3
- } from "./chunk-WRRHW2WO.js";
3
+ } from "./chunk-R5P3WIWR.js";
4
4
  import {
5
5
  resolveHardkasAccount
6
6
  } from "./chunk-ILASLDZU.js";
@@ -56,7 +56,7 @@ var KaspaWasmPrivateKeySigner = class {
56
56
  if (!pkValue && account.keystorePath) {
57
57
  try {
58
58
  const KeystoreManager2 = (await import("./keystore-CMWEKGBF.js")).KeystoreManager;
59
- const DEV_ACCOUNTS_PASSWORD2 = (await import("./dev-accounts-FU4XTSGF.js")).DEV_ACCOUNTS_PASSWORD;
59
+ const DEV_ACCOUNTS_PASSWORD2 = (await import("./dev-accounts-UULCTDJB.js")).DEV_ACCOUNTS_PASSWORD;
60
60
  const keystore = await KeystoreManager2.loadEncryptedKeystore(account.keystorePath);
61
61
  const unlock = await KeystoreManager2.decryptEncryptedKeystore(keystore, DEV_ACCOUNTS_PASSWORD2);
62
62
  if (unlock.success && unlock.payload) {
@@ -76,7 +76,7 @@ var KaspaWasmPrivateKeySigner = class {
76
76
  throw err;
77
77
  }
78
78
  const expectedAddress = new sdk.PrivateKey(pkValue).toKeypair().toAddress(plan.networkId || "simnet").toString();
79
- const { PrivateKeyAuthorizer } = await import("./authorizers-N2RUAVJV.js");
79
+ const { PrivateKeyAuthorizer } = await import("./authorizers-TYSAH7ZC.js");
80
80
  const sourceInputs = plan.inputs || plan.selectedUtxos || [];
81
81
  for (let i = 0; i < numInputs; i++) {
82
82
  if (!authorizers[i]) {
@@ -184,9 +184,11 @@ var KaspaWasmPrivateKeySigner = class {
184
184
  };
185
185
  });
186
186
  console.log("DEBUG: Calling V0 createTransaction with:", { utxos: utxos.length, wasmOutputs: wasmOutputs.length, priorityFee });
187
+ const dummyChange = plan.change?.address || plan.from.address;
187
188
  unsignedTx = sdk.createTransaction(
188
189
  utxos,
189
190
  wasmOutputs,
191
+ dummyChange,
190
192
  priorityFee
191
193
  );
192
194
  }
@@ -200,7 +202,6 @@ var KaspaWasmPrivateKeySigner = class {
200
202
  inputs[i].sigOpCount = 0;
201
203
  }
202
204
  }
203
- unsignedTx.inputs = inputs;
204
205
  console.log("DEBUG createFreshTx RETURNING:", unsignedTx?.constructor?.name);
205
206
  return unsignedTx;
206
207
  };
@@ -244,6 +245,8 @@ var KaspaWasmPrivateKeySigner = class {
244
245
  const finalTx = createFreshTx();
245
246
  const signedTx = finalTx;
246
247
  const wasmTxStr = typeof signedTx.serializeToJSON === "function" ? signedTx.serializeToJSON() : signedTx.toString();
248
+ console.log("DEBUG wasmTxStr:", wasmTxStr);
249
+ console.log("DEBUG: about to parseWasmTxToRpc");
247
250
  const rpcTx = parseWasmTxToRpc(wasmTxStr, signedTx, inputOverrides, plan);
248
251
  const rawTx = JSON.stringify(rpcTx);
249
252
  return {
@@ -261,6 +264,7 @@ var KaspaWasmPrivateKeySigner = class {
261
264
  };
262
265
  } catch (error) {
263
266
  console.error("DEBUG SIGNING ERROR:", error);
267
+ console.error("DEBUG STACK:", error?.stack || "NO STACK (raw panic)");
264
268
  throw new Error(
265
269
  `Kaspa WASM signing failed: ${error instanceof Error ? error.stack || error.message : JSON.stringify(error, Object.getOwnPropertyNames(error))}`
266
270
  );
@@ -4,8 +4,8 @@ import {
4
4
  ensureDevAccounts,
5
5
  getOrCreateDevAccount,
6
6
  listDevAccountsSync
7
- } from "./chunk-TY5CXPHB.js";
8
- import "./chunk-WRRHW2WO.js";
7
+ } from "./chunk-WXMOC6WN.js";
8
+ import "./chunk-R5P3WIWR.js";
9
9
  import "./chunk-ILASLDZU.js";
10
10
  import "./chunk-6DPO5V3N.js";
11
11
  import "./chunk-YLG2NIAU.js";
package/dist/index.js CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  ensureDevAccounts,
7
7
  getOrCreateDevAccount,
8
8
  listDevAccountsSync
9
- } from "./chunk-TY5CXPHB.js";
10
- import "./chunk-WRRHW2WO.js";
9
+ } from "./chunk-WXMOC6WN.js";
10
+ import "./chunk-R5P3WIWR.js";
11
11
  import {
12
12
  createEmptyRealAccountStore,
13
13
  describeAccount,
@@ -40,7 +40,7 @@ import {
40
40
  LazyAccountAuthorizer,
41
41
  PrivateKeyAuthorizer,
42
42
  StaticSignatureScriptAuthorizer
43
- } from "./chunk-MRXCDBKH.js";
43
+ } from "./chunk-3XXJ6UUU.js";
44
44
 
45
45
  // src/simulated.ts
46
46
  var SimulatedSigner = class {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseWasmTxToRpc
3
- } from "../chunk-WRRHW2WO.js";
3
+ } from "../chunk-R5P3WIWR.js";
4
4
  export {
5
5
  parseWasmTxToRpc
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/accounts",
3
- "version": "0.11.4-alpha",
3
+ "version": "0.11.6-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -24,11 +24,11 @@
24
24
  "dependencies": {
25
25
  "hash-wasm": "^4.12.0",
26
26
  "kaspa-wasm": "0.13.0",
27
- "@hardkas/tx-builder": "0.11.4-alpha",
28
- "@hardkas/artifacts": "0.11.4-alpha",
29
- "@hardkas/config": "0.11.4-alpha",
30
- "@hardkas/core": "0.11.4-alpha",
31
- "@hardkas/localnet": "0.11.4-alpha"
27
+ "@hardkas/artifacts": "0.11.6-alpha",
28
+ "@hardkas/core": "0.11.6-alpha",
29
+ "@hardkas/config": "0.11.6-alpha",
30
+ "@hardkas/tx-builder": "0.11.6-alpha",
31
+ "@hardkas/localnet": "0.11.6-alpha"
32
32
  },
33
33
  "devDependencies": {
34
34
  "tsup": "^8.3.5",