@entros/pulse-sdk 1.4.0 → 1.4.1

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.d.mts CHANGED
@@ -102,9 +102,9 @@ interface SubmissionResult {
102
102
  }
103
103
  /**
104
104
  * Validator-signed receipt binding (wallet, commitment, validated_at) for the
105
- * upcoming `mint_anchor` transaction (master-list #146 Phase 4). Returned in
106
- * the `/validate-features` response when the request includes
107
- * `commitment_new_hex` and the validator has a signing key configured.
105
+ * upcoming `mint_anchor` transaction. Returned in the `/validate-features`
106
+ * response when the request includes `commitment_new_hex` and the validator
107
+ * has a signing key configured.
108
108
  *
109
109
  * Wire fields are byte-identical to `entros_validation::SignedReceiptDto` and
110
110
  * the executor's local mirror at `executor-node::validation::SignedReceiptDto`.
@@ -492,12 +492,12 @@ declare function submitViaWallet(proof: SolanaProof, commitment: Uint8Array, opt
492
492
  relayerUrl?: string;
493
493
  relayerApiKey?: string;
494
494
  /**
495
- * Validator-signed mint receipt (master-list #146 Phase 4). Consumed
496
- * only on the first-verification path: when present, the SDK prepends
497
- * an `Ed25519Program::verify` instruction so on-chain `mint_anchor`
498
- * can confirm the commitment was endorsed by the configured validator.
499
- * Re-verification ignores the field entirely — `update_anchor` enforces
500
- * binding via the VerificationResult PDA instead.
495
+ * Validator-signed mint receipt. Consumed only on the first-verification
496
+ * path: when present, the SDK prepends an `Ed25519Program::verify`
497
+ * instruction so on-chain `mint_anchor` can confirm the commitment was
498
+ * endorsed by the configured validator. Re-verification ignores the
499
+ * field entirely — `update_anchor` enforces binding via the
500
+ * VerificationResult PDA instead.
501
501
  */
502
502
  signedReceipt?: SignedReceiptDto;
503
503
  }): Promise<SubmissionResult>;
package/dist/index.d.ts CHANGED
@@ -102,9 +102,9 @@ interface SubmissionResult {
102
102
  }
103
103
  /**
104
104
  * Validator-signed receipt binding (wallet, commitment, validated_at) for the
105
- * upcoming `mint_anchor` transaction (master-list #146 Phase 4). Returned in
106
- * the `/validate-features` response when the request includes
107
- * `commitment_new_hex` and the validator has a signing key configured.
105
+ * upcoming `mint_anchor` transaction. Returned in the `/validate-features`
106
+ * response when the request includes `commitment_new_hex` and the validator
107
+ * has a signing key configured.
108
108
  *
109
109
  * Wire fields are byte-identical to `entros_validation::SignedReceiptDto` and
110
110
  * the executor's local mirror at `executor-node::validation::SignedReceiptDto`.
@@ -492,12 +492,12 @@ declare function submitViaWallet(proof: SolanaProof, commitment: Uint8Array, opt
492
492
  relayerUrl?: string;
493
493
  relayerApiKey?: string;
494
494
  /**
495
- * Validator-signed mint receipt (master-list #146 Phase 4). Consumed
496
- * only on the first-verification path: when present, the SDK prepends
497
- * an `Ed25519Program::verify` instruction so on-chain `mint_anchor`
498
- * can confirm the commitment was endorsed by the configured validator.
499
- * Re-verification ignores the field entirely — `update_anchor` enforces
500
- * binding via the VerificationResult PDA instead.
495
+ * Validator-signed mint receipt. Consumed only on the first-verification
496
+ * path: when present, the SDK prepends an `Ed25519Program::verify`
497
+ * instruction so on-chain `mint_anchor` can confirm the commitment was
498
+ * endorsed by the configured validator. Re-verification ignores the
499
+ * field entirely — `update_anchor` enforces binding via the
500
+ * VerificationResult PDA instead.
501
501
  */
502
502
  signedReceipt?: SignedReceiptDto;
503
503
  }): Promise<SubmissionResult>;
package/dist/index.js CHANGED
@@ -1378,7 +1378,7 @@ function bytesToHex(bytes) {
1378
1378
  function hexToBytes(hex, expectedLen) {
1379
1379
  const trimmed = hex.startsWith("0x") || hex.startsWith("0X") ? hex.slice(2) : hex;
1380
1380
  if (trimmed.length !== expectedLen * 2) return null;
1381
- if (!/^[0-9a-fA-F]+$/.test(trimmed)) return null;
1381
+ if (!/^[0-9a-f]+$/.test(trimmed)) return null;
1382
1382
  const out = new Uint8Array(expectedLen);
1383
1383
  for (let i = 0; i < expectedLen; i += 1) {
1384
1384
  out[i] = parseInt(trimmed.substr(i * 2, 2), 16);
@@ -1646,21 +1646,22 @@ async function submitViaWallet(proof, commitment, options) {
1646
1646
  let ed25519Ix = null;
1647
1647
  if (options.signedReceipt) {
1648
1648
  ed25519Ix = await buildEd25519ReceiptIx(options.signedReceipt);
1649
- if (ed25519Ix) {
1650
- sdkLog(
1651
- "[Entros SDK] Bundling validator-signed mint receipt before mint_anchor"
1652
- );
1653
- } else {
1654
- sdkWarn(
1655
- "[Entros SDK] signedReceipt provided but failed to decode; minting without binding"
1656
- );
1649
+ if (!ed25519Ix) {
1650
+ return {
1651
+ success: false,
1652
+ error: "Validator returned a signed receipt that failed to decode (malformed hex or wrong byte length). Refusing to mint without a valid binding. The validator service may be misconfigured \u2014 check the validation-service logs."
1653
+ };
1657
1654
  }
1655
+ sdkLog(
1656
+ "[Entros SDK] Bundling validator-signed mint receipt before mint_anchor"
1657
+ );
1658
1658
  } else {
1659
1659
  sdkLog(
1660
- "[Entros SDK] No validator receipt available; minting without binding (Phase 3 log-only)"
1660
+ "[Entros SDK] No validator receipt available; minting without binding (on-chain check is log-only today)"
1661
1661
  );
1662
1662
  }
1663
1663
  const tx = new Transaction();
1664
+ tx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 2e5 }));
1664
1665
  if (ed25519Ix) tx.add(ed25519Ix);
1665
1666
  tx.add(mintAnchorIx);
1666
1667
  tx.feePayer = provider.wallet.publicKey;
@@ -2125,7 +2126,11 @@ async function extractFingerprintAndValidate(sensorData, config, walletAddress,
2125
2126
  if (successBody.signed_receipt) {
2126
2127
  signedReceipt = successBody.signed_receipt;
2127
2128
  }
2128
- } catch {
2129
+ } catch (err) {
2130
+ const msg = err instanceof Error ? err.message : String(err);
2131
+ sdkWarn(
2132
+ `[Entros SDK] /validate-features returned 200 but body was not parseable JSON; proceeding without receipt: ${msg}`
2133
+ );
2129
2134
  }
2130
2135
  } catch (err) {
2131
2136
  const msg = err instanceof Error ? err.message : String(err);