@hardkas/sdk 0.7.11-alpha → 0.7.12-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.
Files changed (2) hide show
  1. package/dist/index.js +28 -1
  2. package/package.json +13 -13
package/dist/index.js CHANGED
@@ -596,7 +596,34 @@ var HardkasTx = class {
596
596
  if (isSimulated) {
597
597
  const persistOpt = typeof urlOrOptions === "object" ? urlOrOptions.persist : true;
598
598
  const simOpts = persistOpt !== void 0 ? { persist: persistOpt } : {};
599
- const simResult = await this.simulate(signedArtifact, simOpts);
599
+ let simResult;
600
+ try {
601
+ simResult = await this.simulate(signedArtifact, simOpts);
602
+ } catch (e) {
603
+ if (e.message && e.message.includes("invalid simulated input")) {
604
+ try {
605
+ const { loadSimulatedReceipt, getReceiptPath } = await import("@hardkas/localnet");
606
+ const txIdToLoad = signedArtifact.txId || `simulated-${signedArtifact.sourcePlanId}-tx`;
607
+ const existingReceipt = await loadSimulatedReceipt(txIdToLoad, { cwd: this.sdk.workspace.root });
608
+ if (existingReceipt) {
609
+ if (existingReceipt.schema === ARTIFACT_SCHEMAS.TX_RECEIPT && (existingReceipt.status === "confirmed" || existingReceipt.status === "accepted")) {
610
+ return {
611
+ mode: "simulated",
612
+ simulated: true,
613
+ submitted: false,
614
+ txId: existingReceipt.txId,
615
+ artifactId: existingReceipt.txId,
616
+ // simulated receipts use txId as artifactId
617
+ receipt: existingReceipt,
618
+ receiptPath: getReceiptPath(existingReceipt.txId, this.sdk.workspace.root)
619
+ };
620
+ }
621
+ }
622
+ } catch (err) {
623
+ }
624
+ }
625
+ throw e;
626
+ }
600
627
  const result2 = {
601
628
  mode: "simulated",
602
629
  simulated: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/sdk",
3
- "version": "0.7.11-alpha",
3
+ "version": "0.7.12-alpha",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -23,18 +23,18 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@hardkas/accounts": "0.7.11-alpha",
27
- "@hardkas/artifacts": "0.7.11-alpha",
28
- "@hardkas/core": "0.7.11-alpha",
29
- "@hardkas/config": "0.7.11-alpha",
30
- "@hardkas/kaspa-rpc": "0.7.11-alpha",
31
- "@hardkas/localnet": "0.7.11-alpha",
32
- "@hardkas/l2": "0.7.11-alpha",
33
- "@hardkas/simulator": "0.7.11-alpha",
34
- "@hardkas/query": "0.7.11-alpha",
35
- "@hardkas/tx-builder": "0.7.11-alpha",
36
- "@hardkas/wallet-adapter": "0.7.11-alpha",
37
- "@hardkas/query-store": "0.7.11-alpha"
26
+ "@hardkas/accounts": "0.7.12-alpha",
27
+ "@hardkas/config": "0.7.12-alpha",
28
+ "@hardkas/core": "0.7.12-alpha",
29
+ "@hardkas/artifacts": "0.7.12-alpha",
30
+ "@hardkas/l2": "0.7.12-alpha",
31
+ "@hardkas/kaspa-rpc": "0.7.12-alpha",
32
+ "@hardkas/localnet": "0.7.12-alpha",
33
+ "@hardkas/query": "0.7.12-alpha",
34
+ "@hardkas/simulator": "0.7.12-alpha",
35
+ "@hardkas/tx-builder": "0.7.12-alpha",
36
+ "@hardkas/wallet-adapter": "0.7.12-alpha",
37
+ "@hardkas/query-store": "0.7.12-alpha"
38
38
  },
39
39
  "devDependencies": {
40
40
  "tsup": "^8.3.5",