@caatinga/client 2.4.5 → 3.0.0

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/README.md CHANGED
@@ -87,7 +87,7 @@ Primary flow:
87
87
  ```ts
88
88
  import { createCaatingaClient } from "@caatinga/client";
89
89
  import { createStellarWalletsKitAdapter } from "@caatinga/client/stellar-wallets-kit";
90
- import * as Counter from "./contracts/generated/counter/src/index.js";
90
+ import * as Counter from "./contracts/generated/counter";
91
91
  import artifacts from "../caatinga.artifacts.json";
92
92
 
93
93
  const wallet = createStellarWalletsKitAdapter();
package/dist/index.cjs CHANGED
@@ -253,7 +253,7 @@ function createDefaultBindingAdapter(binding) {
253
253
  throw new import_browser3.CaatingaError(
254
254
  "Generated binding does not export Client.",
255
255
  import_browser3.CaatingaErrorCode.BINDING_CLIENT_NOT_FOUND,
256
- "Regenerate bindings with Stellar CLI."
256
+ "Run caatinga generate <contract> --network <network> (uses @stellar/stellar-sdk generate)."
257
257
  );
258
258
  }
259
259
  return new binding.Client({
@@ -481,6 +481,20 @@ ${hint}`;
481
481
  }
482
482
 
483
483
  // src/client/transaction-submit.ts
484
+ function isMultiAuthRequired(error) {
485
+ if (typeof error !== "object" || error === null) return false;
486
+ const name = error.name;
487
+ const message = String(error.message ?? "");
488
+ return name === "NeedsMoreSignaturesError" || /requires signatures from/i.test(message);
489
+ }
490
+ function multiAuthError(contractName, method, cause) {
491
+ return new import_browser7.CaatingaError(
492
+ `"${contractName}.${method}" requires additional non-invoker signatures (delegated AddressV2 credentials).`,
493
+ import_browser7.CaatingaErrorCode.MULTI_AUTH_REQUIRED,
494
+ "The transaction has Soroban auth entries that must be signed by other accounts via signAuthEntry. Serialize, collect each signer's auth-entry signature, then re-submit.",
495
+ cause
496
+ );
497
+ }
484
498
  async function submitTransaction(transaction, signTransaction, contractName, method, rpcUrl) {
485
499
  const candidate = transaction;
486
500
  if (typeof candidate.signAndSend === "function") {
@@ -492,6 +506,9 @@ async function submitTransaction(transaction, signTransaction, contractName, met
492
506
  if (error instanceof import_browser7.CaatingaError) {
493
507
  throw error;
494
508
  }
509
+ if (isMultiAuthRequired(error)) {
510
+ throw multiAuthError(contractName, method, error);
511
+ }
495
512
  const readCallError = enrichReadCallInvokeError(error, contractName, method);
496
513
  if (readCallError) {
497
514
  throw readCallError;
@@ -513,6 +530,9 @@ async function submitTransaction(transaction, signTransaction, contractName, met
513
530
  if (error instanceof import_browser7.CaatingaError) {
514
531
  throw error;
515
532
  }
533
+ if (isMultiAuthRequired(error)) {
534
+ throw multiAuthError(contractName, method, error);
535
+ }
516
536
  const readCallError = enrichReadCallInvokeError(error, contractName, method);
517
537
  if (readCallError) {
518
538
  throw readCallError;
package/dist/index.js CHANGED
@@ -63,7 +63,7 @@ function createDefaultBindingAdapter(binding) {
63
63
  throw new CaatingaError2(
64
64
  "Generated binding does not export Client.",
65
65
  CaatingaErrorCode2.BINDING_CLIENT_NOT_FOUND,
66
- "Regenerate bindings with Stellar CLI."
66
+ "Run caatinga generate <contract> --network <network> (uses @stellar/stellar-sdk generate)."
67
67
  );
68
68
  }
69
69
  return new binding.Client({
@@ -291,6 +291,20 @@ ${hint}`;
291
291
  }
292
292
 
293
293
  // src/client/transaction-submit.ts
294
+ function isMultiAuthRequired(error) {
295
+ if (typeof error !== "object" || error === null) return false;
296
+ const name = error.name;
297
+ const message = String(error.message ?? "");
298
+ return name === "NeedsMoreSignaturesError" || /requires signatures from/i.test(message);
299
+ }
300
+ function multiAuthError(contractName, method, cause) {
301
+ return new CaatingaError6(
302
+ `"${contractName}.${method}" requires additional non-invoker signatures (delegated AddressV2 credentials).`,
303
+ CaatingaErrorCode6.MULTI_AUTH_REQUIRED,
304
+ "The transaction has Soroban auth entries that must be signed by other accounts via signAuthEntry. Serialize, collect each signer's auth-entry signature, then re-submit.",
305
+ cause
306
+ );
307
+ }
294
308
  async function submitTransaction(transaction, signTransaction, contractName, method, rpcUrl) {
295
309
  const candidate = transaction;
296
310
  if (typeof candidate.signAndSend === "function") {
@@ -302,6 +316,9 @@ async function submitTransaction(transaction, signTransaction, contractName, met
302
316
  if (error instanceof CaatingaError6) {
303
317
  throw error;
304
318
  }
319
+ if (isMultiAuthRequired(error)) {
320
+ throw multiAuthError(contractName, method, error);
321
+ }
305
322
  const readCallError = enrichReadCallInvokeError(error, contractName, method);
306
323
  if (readCallError) {
307
324
  throw readCallError;
@@ -323,6 +340,9 @@ async function submitTransaction(transaction, signTransaction, contractName, met
323
340
  if (error instanceof CaatingaError6) {
324
341
  throw error;
325
342
  }
343
+ if (isMultiAuthRequired(error)) {
344
+ throw multiAuthError(contractName, method, error);
345
+ }
326
346
  const readCallError = enrichReadCallInvokeError(error, contractName, method);
327
347
  if (readCallError) {
328
348
  throw readCallError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caatinga/client",
3
- "version": "2.4.5",
3
+ "version": "3.0.0",
4
4
  "description": "Browser and Node client for Soroban smart contracts — connects generated bindings, Caatinga artifacts, and wallet adapters",
5
5
  "keywords": [
6
6
  "stellar",
@@ -22,7 +22,7 @@
22
22
  "author": "Caatinga contributors",
23
23
  "license": "MIT",
24
24
  "engines": {
25
- "node": ">=20"
25
+ "node": ">=22"
26
26
  },
27
27
  "type": "module",
28
28
  "main": "./dist/index.cjs",
@@ -61,7 +61,7 @@
61
61
  "LICENSE"
62
62
  ],
63
63
  "dependencies": {
64
- "@caatinga/core": "^2.4.5"
64
+ "@caatinga/core": "^3.0.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "tsup": "^8.3.5",