@caatinga/client 0.2.1 → 0.2.3

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
@@ -19,6 +19,16 @@ import { freighterWalletAdapter } from "@caatinga/client/freighter";
19
19
 
20
20
  The `@caatinga/client/freighter` subpath is optional and only needed when you want the bundled Freighter adapter.
21
21
 
22
+ For multi-wallet support, add Stellar Wallets Kit:
23
+
24
+ ```bash
25
+ pnpm add github:Creit-Tech/Stellar-Wallets-Kit#v0.0.7
26
+ ```
27
+
28
+ ```ts
29
+ import { createStellarWalletsKitAdapter } from "@caatinga/client/stellar-wallets-kit";
30
+ ```
31
+
22
32
  ## What It Solves
23
33
 
24
34
  `@caatinga/client` is the supported browser and Node integration layer for invoking generated Soroban bindings with Caatinga artifacts, network configuration, and a wallet adapter.
@@ -49,16 +59,21 @@ Supported type-only root exports:
49
59
  - `CaatingaInvokeResult`
50
60
  - `CaatingaInvokeStatus`
51
61
  - `CaatingaNetwork`
62
+ - `CaatingaReadOptions`
63
+ - `CaatingaReadResult`
52
64
  - `CaatingaWalletAdapter`
53
65
  - `CaatingaXdrBuildResult`
54
66
 
55
67
  Supported subpath export:
56
68
 
57
69
  - `@caatinga/client/freighter` -> `freighterWalletAdapter` (optional)
70
+ - `@caatinga/client/stellar-wallets-kit` -> `createStellarWalletsKitAdapter` (optional)
58
71
 
59
72
  Primary flow:
60
73
 
61
74
  - `createCaatingaClient(...)`
75
+ - `client.contract(name).read(method, args?)`
76
+ - `client.contract(name).simulate(method, args?)`
62
77
  - `client.contract(name).invoke(method, args?)`
63
78
  - `client.contract(name).buildXdr(method, args?)`
64
79
 
@@ -66,10 +81,12 @@ Primary flow:
66
81
 
67
82
  ```ts
68
83
  import { createCaatingaClient } from "@caatinga/client";
69
- import { freighterWalletAdapter } from "@caatinga/client/freighter";
84
+ import { createStellarWalletsKitAdapter } from "@caatinga/client/stellar-wallets-kit";
70
85
  import * as Counter from "./contracts/generated/counter";
71
86
  import artifacts from "../caatinga.artifacts.json";
72
87
 
88
+ const wallet = createStellarWalletsKitAdapter();
89
+
73
90
  const client = createCaatingaClient({
74
91
  network: {
75
92
  name: "testnet",
@@ -77,7 +94,7 @@ const client = createCaatingaClient({
77
94
  networkPassphrase: "Test SDF Network ; September 2015"
78
95
  },
79
96
  artifacts,
80
- wallet: freighterWalletAdapter,
97
+ wallet,
81
98
  contracts: {
82
99
  counter: {
83
100
  binding: Counter
@@ -85,7 +102,9 @@ const client = createCaatingaClient({
85
102
  }
86
103
  });
87
104
 
88
- const result = await client.contract("counter").invoke("increment");
105
+ const before = await client.contract("counter").read<number>("get");
106
+ const increment = await client.contract("counter").invoke<number>("increment");
107
+ const after = increment.result ?? await client.contract("counter").read<number>("get");
89
108
  ```
90
109
 
91
110
  ## Wallet Adapter Contract
@@ -1,5 +1,5 @@
1
- import { C as CaatingaWalletAdapter } from './types-CiM5FkDn.cjs';
2
- import '@caatinga/core';
1
+ import { C as CaatingaWalletAdapter } from './types-D4XEyX4J.cjs';
2
+ import '@caatinga/core/browser';
3
3
 
4
4
  declare const freighterWalletAdapter: CaatingaWalletAdapter;
5
5
 
@@ -1,5 +1,5 @@
1
- import { C as CaatingaWalletAdapter } from './types-CiM5FkDn.js';
2
- import '@caatinga/core';
1
+ import { C as CaatingaWalletAdapter } from './types-D4XEyX4J.js';
2
+ import '@caatinga/core/browser';
3
3
 
4
4
  declare const freighterWalletAdapter: CaatingaWalletAdapter;
5
5
 
package/dist/index.cjs CHANGED
@@ -29,7 +29,7 @@ __export(index_exports, {
29
29
  module.exports = __toCommonJS(index_exports);
30
30
 
31
31
  // src/artifacts/resolve-contract-id.ts
32
- var import_core = require("@caatinga/core");
32
+ var import_browser = require("@caatinga/core/browser");
33
33
  function resolveContractId(input) {
34
34
  if (input.explicitContractId) {
35
35
  return input.explicitContractId;
@@ -38,22 +38,22 @@ function resolveContractId(input) {
38
38
  if (contractId) {
39
39
  return contractId;
40
40
  }
41
- throw new import_core.CaatingaError(
41
+ throw new import_browser.CaatingaError(
42
42
  `No contract artifact found for "${input.contract}" on "${input.network}".`,
43
- import_core.CaatingaErrorCode.CONTRACT_ARTIFACT_NOT_FOUND,
43
+ import_browser.CaatingaErrorCode.CONTRACT_ARTIFACT_NOT_FOUND,
44
44
  "Deploy the contract first or pass contractId explicitly."
45
45
  );
46
46
  }
47
47
 
48
48
  // src/bindings/default-binding-adapter.ts
49
- var import_core2 = require("@caatinga/core");
49
+ var import_browser2 = require("@caatinga/core/browser");
50
50
  function createDefaultBindingAdapter(binding) {
51
51
  return {
52
52
  createClient({ contractId, publicKey, rpcUrl, networkPassphrase }) {
53
53
  if (!binding.Client) {
54
- throw new import_core2.CaatingaError(
54
+ throw new import_browser2.CaatingaError(
55
55
  "Generated binding does not export Client.",
56
- import_core2.CaatingaErrorCode.BINDING_CLIENT_NOT_FOUND,
56
+ import_browser2.CaatingaErrorCode.BINDING_CLIENT_NOT_FOUND,
57
57
  "Regenerate bindings with Stellar CLI."
58
58
  );
59
59
  }
@@ -68,9 +68,9 @@ function createDefaultBindingAdapter(binding) {
68
68
  const candidate = client;
69
69
  const fn = candidate[method];
70
70
  if (typeof fn !== "function") {
71
- throw new import_core2.CaatingaError(
71
+ throw new import_browser2.CaatingaError(
72
72
  `Binding method "${method}" was not found.`,
73
- import_core2.CaatingaErrorCode.BINDING_METHOD_NOT_FOUND,
73
+ import_browser2.CaatingaErrorCode.BINDING_METHOD_NOT_FOUND,
74
74
  "Check the contract method name or regenerate bindings."
75
75
  );
76
76
  }
@@ -80,13 +80,13 @@ function createDefaultBindingAdapter(binding) {
80
80
  }
81
81
 
82
82
  // src/client/create-caatinga-client.ts
83
- var import_core5 = require("@caatinga/core");
83
+ var import_browser5 = require("@caatinga/core/browser");
84
84
 
85
85
  // src/client/caatinga-contract-client.ts
86
- var import_core4 = require("@caatinga/core");
86
+ var import_browser4 = require("@caatinga/core/browser");
87
87
 
88
88
  // src/xdr/build-xdr.ts
89
- var import_core3 = require("@caatinga/core");
89
+ var import_browser3 = require("@caatinga/core/browser");
90
90
  async function buildXdr(input) {
91
91
  try {
92
92
  const transaction = input.transaction;
@@ -96,13 +96,13 @@ async function buildXdr(input) {
96
96
  try {
97
97
  preparedTransaction = await transaction.prepare();
98
98
  } catch (error) {
99
- if (error instanceof import_core3.CaatingaError) {
99
+ if (error instanceof import_browser3.CaatingaError) {
100
100
  throw error;
101
101
  }
102
- throw new import_core3.CaatingaError(
102
+ throw new import_browser3.CaatingaError(
103
103
  `Failed to prepare XDR for "${input.contractName}.${input.method}".`,
104
- import_core3.CaatingaErrorCode.XDR_PREPARE_FAILED,
105
- "Check RPC connectivity, simulation errors, and binding compatibility.",
104
+ import_browser3.CaatingaErrorCode.XDR_PREPARE_FAILED,
105
+ `RPC: ${input.rpcUrl}. Check connectivity, simulation errors, and binding compatibility.`,
106
106
  error
107
107
  );
108
108
  }
@@ -119,12 +119,12 @@ async function buildXdr(input) {
119
119
  ...input.debug ? { raw: preparedTransaction } : {}
120
120
  };
121
121
  } catch (error) {
122
- if (error instanceof import_core3.CaatingaError) {
122
+ if (error instanceof import_browser3.CaatingaError) {
123
123
  throw error;
124
124
  }
125
- throw new import_core3.CaatingaError(
125
+ throw new import_browser3.CaatingaError(
126
126
  `Failed to build XDR for "${input.contractName}.${input.method}".`,
127
- import_core3.CaatingaErrorCode.XDR_BUILD_FAILED,
127
+ import_browser3.CaatingaErrorCode.XDR_BUILD_FAILED,
128
128
  "Check the generated binding transaction object.",
129
129
  error
130
130
  );
@@ -133,9 +133,9 @@ async function buildXdr(input) {
133
133
  function readXdr(transaction) {
134
134
  const candidate = transaction;
135
135
  if (typeof candidate.toXDR !== "function") {
136
- throw new import_core3.CaatingaError(
136
+ throw new import_browser3.CaatingaError(
137
137
  "Binding transaction object does not expose toXDR().",
138
- import_core3.CaatingaErrorCode.XDR_BUILD_FAILED,
138
+ import_browser3.CaatingaErrorCode.XDR_BUILD_FAILED,
139
139
  "Regenerate bindings or provide a compatible binding adapter."
140
140
  );
141
141
  }
@@ -164,6 +164,7 @@ var CaatingaContractClient = class {
164
164
  method,
165
165
  contractId,
166
166
  transaction,
167
+ rpcUrl: this.config.network.rpcUrl,
167
168
  debug: debugRaw
168
169
  });
169
170
  }
@@ -175,23 +176,54 @@ var CaatingaContractClient = class {
175
176
  method,
176
177
  contractId,
177
178
  transaction,
179
+ rpcUrl: this.config.network.rpcUrl,
178
180
  debug: debugRaw
179
181
  });
180
182
  let signedXdr;
181
- try {
182
- signedXdr = await this.config.wallet.signTransaction({
183
- xdr: xdr.preparedXdr,
184
- networkPassphrase: this.config.network.networkPassphrase
185
- });
186
- } catch (error) {
187
- throw new import_core4.CaatingaError(
183
+ const signTransaction = async (xdr2) => {
184
+ try {
185
+ signedXdr = await this.withWalletTimeout(
186
+ "signTransaction",
187
+ () => this.config.wallet.signTransaction({
188
+ xdr: xdr2,
189
+ networkPassphrase: this.config.network.networkPassphrase
190
+ })
191
+ );
192
+ } catch (error) {
193
+ if (error instanceof import_browser4.CaatingaError) {
194
+ throw error;
195
+ }
196
+ throw new import_browser4.CaatingaError(
197
+ `Failed to sign XDR for "${this.contractName}.${method}".`,
198
+ import_browser4.CaatingaErrorCode.XDR_SIGN_FAILED,
199
+ "Connect a wallet and approve the transaction.",
200
+ error
201
+ );
202
+ }
203
+ if (typeof signedXdr !== "string" || signedXdr.trim().length === 0) {
204
+ throw new import_browser4.CaatingaError(
205
+ `Failed to sign XDR for "${this.contractName}.${method}".`,
206
+ import_browser4.CaatingaErrorCode.XDR_SIGN_FAILED,
207
+ "Wallet returned an empty or invalid signed XDR. The user may have dismissed the signing prompt.",
208
+ signedXdr
209
+ );
210
+ }
211
+ return { signedTxXdr: signedXdr };
212
+ };
213
+ const raw = await submitTransaction(
214
+ transaction,
215
+ signTransaction,
216
+ this.contractName,
217
+ method,
218
+ this.config.network.rpcUrl
219
+ );
220
+ if (typeof transaction.signAndSend === "function" && signedXdr === void 0) {
221
+ throw new import_browser4.CaatingaError(
188
222
  `Failed to sign XDR for "${this.contractName}.${method}".`,
189
- import_core4.CaatingaErrorCode.XDR_SIGN_FAILED,
190
- "Connect a wallet and approve the transaction.",
191
- error
223
+ import_browser4.CaatingaErrorCode.XDR_SIGN_FAILED,
224
+ "Wallet returned an empty or invalid signed XDR. The generated transaction did not request a wallet signature."
192
225
  );
193
226
  }
194
- const raw = await submitTransaction(transaction, signedXdr, this.contractName, method);
195
227
  const normalized = normalizeSubmitResult(raw);
196
228
  return {
197
229
  status: "confirmed",
@@ -204,12 +236,35 @@ var CaatingaContractClient = class {
204
236
  xdr: {
205
237
  unsigned: xdr.unsignedXdr,
206
238
  prepared: xdr.preparedXdr,
207
- signed: signedXdr
239
+ ...signedXdr ? { signed: signedXdr } : {}
208
240
  }
209
241
  } : {},
210
242
  ...debugRaw ? { raw } : {}
211
243
  };
212
244
  }
245
+ async simulate(method, argsOrOptions, maybeOptions) {
246
+ const { args, debugRaw } = splitReadArgsAndOptions(argsOrOptions, maybeOptions);
247
+ const { contractId, transaction } = await this.createTransaction(method, args);
248
+ const raw = await prepareReadTransaction(
249
+ transaction,
250
+ this.contractName,
251
+ method,
252
+ this.config.network.rpcUrl
253
+ );
254
+ const result = readSimulationResult(raw, this.contractName, method);
255
+ return {
256
+ status: "simulated",
257
+ contract: this.contractName,
258
+ method,
259
+ contractId,
260
+ result,
261
+ ...debugRaw ? { raw } : {}
262
+ };
263
+ }
264
+ async read(method, argsOrOptions, maybeOptions) {
265
+ const result = await this.simulate(method, argsOrOptions, maybeOptions);
266
+ return result.result;
267
+ }
213
268
  async createTransaction(method, args) {
214
269
  const contractId = resolveContractId({
215
270
  artifacts: this.config.artifacts,
@@ -219,14 +274,17 @@ var CaatingaContractClient = class {
219
274
  });
220
275
  let publicKey;
221
276
  try {
222
- publicKey = await this.config.wallet.getPublicKey();
277
+ publicKey = await this.withWalletTimeout(
278
+ "getPublicKey",
279
+ () => this.config.wallet.getPublicKey()
280
+ );
223
281
  } catch (error) {
224
- if (error instanceof import_core4.CaatingaError) {
282
+ if (error instanceof import_browser4.CaatingaError) {
225
283
  throw error;
226
284
  }
227
- throw new import_core4.CaatingaError(
285
+ throw new import_browser4.CaatingaError(
228
286
  `Wallet is not connected or the public key is unavailable for "${this.contractName}".`,
229
- import_core4.CaatingaErrorCode.WALLET_NOT_CONNECTED,
287
+ import_browser4.CaatingaErrorCode.WALLET_NOT_CONNECTED,
230
288
  "Connect the wallet and grant account access, then retry.",
231
289
  error
232
290
  );
@@ -240,6 +298,41 @@ var CaatingaContractClient = class {
240
298
  const transaction = await this.bindingAdapter.callMethod({ client, method, args });
241
299
  return { contractId, transaction };
242
300
  }
301
+ withWalletTimeout(label, fn) {
302
+ const timeoutMs = this.config.walletTimeout;
303
+ if (timeoutMs === void 0 || timeoutMs <= 0) {
304
+ return fn();
305
+ }
306
+ let timedOut = false;
307
+ return new Promise((resolve, reject) => {
308
+ const timer = setTimeout(() => {
309
+ timedOut = true;
310
+ reject(
311
+ new import_browser4.CaatingaError(
312
+ `Wallet "${label}" timed out after ${timeoutMs}ms.`,
313
+ import_browser4.CaatingaErrorCode.WALLET_TIMEOUT,
314
+ "Ensure the wallet adapter rejects on user dismissal, or increase walletTimeout."
315
+ )
316
+ );
317
+ }, timeoutMs);
318
+ fn().then(
319
+ (value) => {
320
+ if (timedOut) {
321
+ return;
322
+ }
323
+ clearTimeout(timer);
324
+ resolve(value);
325
+ },
326
+ (error) => {
327
+ if (timedOut) {
328
+ return;
329
+ }
330
+ clearTimeout(timer);
331
+ reject(error);
332
+ }
333
+ );
334
+ });
335
+ }
243
336
  };
244
337
  function splitArgsAndOptions(argsOrOptions, maybeOptions) {
245
338
  return {
@@ -263,52 +356,118 @@ function splitInvokeArgsAndOptions(argsOrOptions, maybeOptions) {
263
356
  debugRaw: maybeOptions?.debugRaw ?? false
264
357
  };
265
358
  }
266
- async function submitTransaction(transaction, signedXdr, contractName, method) {
359
+ function splitReadArgsAndOptions(argsOrOptions, maybeOptions) {
360
+ const looksLikeOptions = argsOrOptions !== void 0 && "debugRaw" in argsOrOptions && maybeOptions === void 0;
361
+ if (looksLikeOptions) {
362
+ const options = argsOrOptions;
363
+ return {
364
+ args: void 0,
365
+ debugRaw: options.debugRaw ?? false
366
+ };
367
+ }
368
+ return {
369
+ args: argsOrOptions,
370
+ debugRaw: maybeOptions?.debugRaw ?? false
371
+ };
372
+ }
373
+ async function submitTransaction(transaction, signTransaction, contractName, method, rpcUrl) {
267
374
  const candidate = transaction;
268
- const submit = candidate.signAndSend ?? candidate.send;
269
- if (typeof submit !== "function") {
270
- throw new import_core4.CaatingaError(
271
- `Binding transaction for "${contractName}.${method}" cannot be submitted.`,
272
- import_core4.CaatingaErrorCode.XDR_SUBMIT_FAILED,
273
- "Regenerate bindings or provide a compatible binding adapter."
274
- );
375
+ if (typeof candidate.signAndSend === "function") {
376
+ try {
377
+ const raw = await candidate.signAndSend.call(transaction, { signTransaction });
378
+ assertSubmitResultRecognized(raw, contractName, method);
379
+ return raw;
380
+ } catch (error) {
381
+ if (error instanceof import_browser4.CaatingaError) {
382
+ throw error;
383
+ }
384
+ throw new import_browser4.CaatingaError(
385
+ `Failed to submit XDR for "${contractName}.${method}".`,
386
+ import_browser4.CaatingaErrorCode.XDR_SUBMIT_FAILED,
387
+ `RPC: ${rpcUrl}. Check wallet signature and RPC connectivity.`,
388
+ error
389
+ );
390
+ }
391
+ }
392
+ if (typeof candidate.send === "function") {
393
+ try {
394
+ const raw = await candidate.send.call(transaction);
395
+ assertSubmitResultRecognized(raw, contractName, method);
396
+ return raw;
397
+ } catch (error) {
398
+ if (error instanceof import_browser4.CaatingaError) {
399
+ throw error;
400
+ }
401
+ throw new import_browser4.CaatingaError(
402
+ `Failed to submit XDR for "${contractName}.${method}".`,
403
+ import_browser4.CaatingaErrorCode.XDR_SUBMIT_FAILED,
404
+ `RPC: ${rpcUrl}. Check wallet signature and RPC connectivity.`,
405
+ error
406
+ );
407
+ }
408
+ }
409
+ throw new import_browser4.CaatingaError(
410
+ `Binding transaction for "${contractName}.${method}" cannot be submitted.`,
411
+ import_browser4.CaatingaErrorCode.XDR_SUBMIT_FAILED,
412
+ "Regenerate bindings or provide a compatible binding adapter."
413
+ );
414
+ }
415
+ async function prepareReadTransaction(transaction, contractName, method, rpcUrl) {
416
+ const candidate = transaction;
417
+ if (typeof candidate.prepare !== "function") {
418
+ return transaction;
275
419
  }
276
420
  try {
277
- const raw = await submit.call(transaction, { signedXdr });
278
- assertSubmitResultRecognized(raw, contractName, method);
279
- return raw;
421
+ return await candidate.prepare.call(transaction);
280
422
  } catch (error) {
281
- if (error instanceof import_core4.CaatingaError) {
423
+ if (error instanceof import_browser4.CaatingaError) {
282
424
  throw error;
283
425
  }
284
- throw new import_core4.CaatingaError(
285
- `Failed to submit XDR for "${contractName}.${method}".`,
286
- import_core4.CaatingaErrorCode.XDR_SUBMIT_FAILED,
287
- "Check wallet signature and RPC connectivity.",
426
+ throw new import_browser4.CaatingaError(
427
+ `Failed to prepare XDR for "${contractName}.${method}".`,
428
+ import_browser4.CaatingaErrorCode.XDR_PREPARE_FAILED,
429
+ `RPC: ${rpcUrl}. Check connectivity, simulation errors, and binding compatibility.`,
288
430
  error
289
431
  );
290
432
  }
291
433
  }
434
+ function readSimulationResult(raw, contractName, method) {
435
+ if (raw !== null && typeof raw === "object" && "result" in raw) {
436
+ const result = raw.result;
437
+ if (result !== void 0) {
438
+ return result;
439
+ }
440
+ }
441
+ throw new import_browser4.CaatingaError(
442
+ `Simulation for "${contractName}.${method}" did not return a result.`,
443
+ import_browser4.CaatingaErrorCode.READ_RESULT_MISSING,
444
+ `Expected "${contractName}.${method}" to expose a simulation result. Use debugRaw to inspect the generated binding output.`
445
+ );
446
+ }
292
447
  function assertSubmitResultRecognized(raw, contractName, method) {
293
448
  if (raw === null || typeof raw !== "object") {
294
449
  return;
295
450
  }
296
451
  const record = raw;
297
- const hasTransactionId = "txHash" in record || "transactionHash" in record || "hash" in record;
452
+ const hasTransactionId = "txHash" in record || "transactionHash" in record || "hash" in record || hasNestedSendTransactionResponseHash(record);
298
453
  const hasResult = "result" in record;
299
454
  if (hasTransactionId || hasResult) {
300
455
  return;
301
456
  }
302
- throw new import_core4.CaatingaError(
457
+ throw new import_browser4.CaatingaError(
303
458
  `Submit returned an unrecognized payload for "${contractName}.${method}".`,
304
- import_core4.CaatingaErrorCode.XDR_RESULT_FAILED,
305
- "Expected txHash, transactionHash, hash, or result on the submit response. Use debugRaw to inspect the binding output."
459
+ import_browser4.CaatingaErrorCode.XDR_RESULT_FAILED,
460
+ "Expected txHash, transactionHash, hash, sendTransactionResponse.hash, or result on the submit response. Use debugRaw to inspect the binding output."
306
461
  );
307
462
  }
463
+ function hasNestedSendTransactionResponseHash(record) {
464
+ const response = record.sendTransactionResponse;
465
+ return response !== null && typeof response === "object" && "hash" in response;
466
+ }
308
467
  function normalizeSubmitResult(raw) {
309
468
  const candidate = raw;
310
469
  return {
311
- transactionHash: candidate.txHash ?? candidate.transactionHash ?? candidate.hash,
470
+ transactionHash: candidate.txHash ?? candidate.transactionHash ?? candidate.hash ?? candidate.sendTransactionResponse?.hash,
312
471
  result: candidate.result
313
472
  };
314
473
  }
@@ -319,9 +478,9 @@ function createCaatingaClient(config) {
319
478
  contract(contractName) {
320
479
  const registration = config.contracts[contractName];
321
480
  if (!registration) {
322
- throw new import_core5.CaatingaError(
481
+ throw new import_browser5.CaatingaError(
323
482
  `Contract "${contractName}" is not registered.`,
324
- import_core5.CaatingaErrorCode.CONTRACT_NOT_FOUND,
483
+ import_browser5.CaatingaErrorCode.CONTRACT_NOT_FOUND,
325
484
  "Add the contract binding to createCaatingaClient()."
326
485
  );
327
486
  }
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as CaatingaBindingAdapter, b as CaatingaClientConfig, c as CaatingaContractRegistration, d as CaatingaXdrBuildResult, e as CaatingaInvokeOptions, f as CaatingaInvokeResult } from './types-CiM5FkDn.cjs';
2
- export { g as CaatingaInvokeStatus, h as CaatingaNetwork, C as CaatingaWalletAdapter } from './types-CiM5FkDn.cjs';
3
- import { CaatingaArtifacts } from '@caatinga/core';
1
+ import { a as CaatingaBindingAdapter, b as CaatingaClientConfig, c as CaatingaContractRegistration, d as CaatingaXdrBuildResult, e as CaatingaInvokeOptions, f as CaatingaInvokeResult, g as CaatingaReadOptions, h as CaatingaReadResult } from './types-D4XEyX4J.cjs';
2
+ export { i as CaatingaInvokeStatus, j as CaatingaNetwork, C as CaatingaWalletAdapter } from './types-D4XEyX4J.cjs';
3
+ import { CaatingaArtifacts } from '@caatinga/core/browser';
4
4
 
5
5
  declare function resolveContractId(input: {
6
6
  artifacts: CaatingaArtifacts;
@@ -29,7 +29,10 @@ declare class CaatingaContractClient {
29
29
  debugRaw?: boolean;
30
30
  }): Promise<CaatingaXdrBuildResult>;
31
31
  invoke<T = unknown>(method: string, argsOrOptions?: Record<string, unknown> | CaatingaInvokeOptions, maybeOptions?: CaatingaInvokeOptions): Promise<CaatingaInvokeResult<T>>;
32
+ simulate<T = unknown>(method: string, argsOrOptions?: Record<string, unknown> | CaatingaReadOptions, maybeOptions?: CaatingaReadOptions): Promise<CaatingaReadResult<T>>;
33
+ read<T = unknown>(method: string, argsOrOptions?: Record<string, unknown> | CaatingaReadOptions, maybeOptions?: CaatingaReadOptions): Promise<T>;
32
34
  private createTransaction;
35
+ private withWalletTimeout;
33
36
  }
34
37
 
35
38
  declare function createCaatingaClient(config: CaatingaClientConfig): {
@@ -41,7 +44,8 @@ declare function buildXdr(input: {
41
44
  method: string;
42
45
  contractId: string;
43
46
  transaction: unknown;
47
+ rpcUrl: string;
44
48
  debug?: boolean;
45
49
  }): Promise<CaatingaXdrBuildResult>;
46
50
 
47
- export { CaatingaBindingAdapter, CaatingaClientConfig, CaatingaContractClient, CaatingaContractRegistration, CaatingaInvokeOptions, CaatingaInvokeResult, CaatingaXdrBuildResult, buildXdr, createCaatingaClient, createDefaultBindingAdapter, resolveContractId };
51
+ export { CaatingaBindingAdapter, CaatingaClientConfig, CaatingaContractClient, CaatingaContractRegistration, CaatingaInvokeOptions, CaatingaInvokeResult, CaatingaReadOptions, CaatingaReadResult, CaatingaXdrBuildResult, buildXdr, createCaatingaClient, createDefaultBindingAdapter, resolveContractId };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as CaatingaBindingAdapter, b as CaatingaClientConfig, c as CaatingaContractRegistration, d as CaatingaXdrBuildResult, e as CaatingaInvokeOptions, f as CaatingaInvokeResult } from './types-CiM5FkDn.js';
2
- export { g as CaatingaInvokeStatus, h as CaatingaNetwork, C as CaatingaWalletAdapter } from './types-CiM5FkDn.js';
3
- import { CaatingaArtifacts } from '@caatinga/core';
1
+ import { a as CaatingaBindingAdapter, b as CaatingaClientConfig, c as CaatingaContractRegistration, d as CaatingaXdrBuildResult, e as CaatingaInvokeOptions, f as CaatingaInvokeResult, g as CaatingaReadOptions, h as CaatingaReadResult } from './types-D4XEyX4J.js';
2
+ export { i as CaatingaInvokeStatus, j as CaatingaNetwork, C as CaatingaWalletAdapter } from './types-D4XEyX4J.js';
3
+ import { CaatingaArtifacts } from '@caatinga/core/browser';
4
4
 
5
5
  declare function resolveContractId(input: {
6
6
  artifacts: CaatingaArtifacts;
@@ -29,7 +29,10 @@ declare class CaatingaContractClient {
29
29
  debugRaw?: boolean;
30
30
  }): Promise<CaatingaXdrBuildResult>;
31
31
  invoke<T = unknown>(method: string, argsOrOptions?: Record<string, unknown> | CaatingaInvokeOptions, maybeOptions?: CaatingaInvokeOptions): Promise<CaatingaInvokeResult<T>>;
32
+ simulate<T = unknown>(method: string, argsOrOptions?: Record<string, unknown> | CaatingaReadOptions, maybeOptions?: CaatingaReadOptions): Promise<CaatingaReadResult<T>>;
33
+ read<T = unknown>(method: string, argsOrOptions?: Record<string, unknown> | CaatingaReadOptions, maybeOptions?: CaatingaReadOptions): Promise<T>;
32
34
  private createTransaction;
35
+ private withWalletTimeout;
33
36
  }
34
37
 
35
38
  declare function createCaatingaClient(config: CaatingaClientConfig): {
@@ -41,7 +44,8 @@ declare function buildXdr(input: {
41
44
  method: string;
42
45
  contractId: string;
43
46
  transaction: unknown;
47
+ rpcUrl: string;
44
48
  debug?: boolean;
45
49
  }): Promise<CaatingaXdrBuildResult>;
46
50
 
47
- export { CaatingaBindingAdapter, CaatingaClientConfig, CaatingaContractClient, CaatingaContractRegistration, CaatingaInvokeOptions, CaatingaInvokeResult, CaatingaXdrBuildResult, buildXdr, createCaatingaClient, createDefaultBindingAdapter, resolveContractId };
51
+ export { CaatingaBindingAdapter, CaatingaClientConfig, CaatingaContractClient, CaatingaContractRegistration, CaatingaInvokeOptions, CaatingaInvokeResult, CaatingaReadOptions, CaatingaReadResult, CaatingaXdrBuildResult, buildXdr, createCaatingaClient, createDefaultBindingAdapter, resolveContractId };