@caatinga/client 2.3.1 → 2.4.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/dist/index.cjs +63 -24
- package/dist/index.js +63 -24
- package/dist/vite.cjs +93 -0
- package/dist/vite.d.cts +8 -0
- package/dist/vite.d.ts +8 -0
- package/dist/vite.js +54 -0
- package/package.json +8 -3
package/dist/index.cjs
CHANGED
|
@@ -279,10 +279,10 @@ function createDefaultBindingAdapter(binding) {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
// src/client/create-caatinga-client.ts
|
|
282
|
-
var
|
|
282
|
+
var import_browser9 = require("@caatinga/core/browser");
|
|
283
283
|
|
|
284
284
|
// src/client/caatinga-contract-client.ts
|
|
285
|
-
var
|
|
285
|
+
var import_browser8 = require("@caatinga/core/browser");
|
|
286
286
|
|
|
287
287
|
// src/xdr/build-xdr.ts
|
|
288
288
|
var import_browser4 = require("@caatinga/core/browser");
|
|
@@ -449,7 +449,38 @@ function readSimulationResult(raw, contractName, method) {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
// src/client/transaction-submit.ts
|
|
452
|
+
var import_browser7 = require("@caatinga/core/browser");
|
|
453
|
+
|
|
454
|
+
// src/client/read-call-error.ts
|
|
452
455
|
var import_browser6 = require("@caatinga/core/browser");
|
|
456
|
+
|
|
457
|
+
// src/client/read-call-pattern.ts
|
|
458
|
+
var READ_CALL_FAILURE_REGEX = /this is a read call|read-only/i;
|
|
459
|
+
|
|
460
|
+
// src/client/read-call-error.ts
|
|
461
|
+
function enrichReadCallInvokeError(error, contractName, method) {
|
|
462
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
463
|
+
const hint = error instanceof import_browser6.CaatingaError ? error.hint ?? "" : "";
|
|
464
|
+
const haystack = `${message}
|
|
465
|
+
${hint}`;
|
|
466
|
+
if (!READ_CALL_FAILURE_REGEX.test(haystack)) {
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
return new import_browser6.CaatingaError(
|
|
470
|
+
`Failed to submit XDR for "${contractName}.${method}".`,
|
|
471
|
+
import_browser6.CaatingaErrorCode.XDR_SUBMIT_FAILED,
|
|
472
|
+
[
|
|
473
|
+
`"${contractName}.${method}" is a read-only contract method.`,
|
|
474
|
+
"Use read() or simulate() instead of invoke():",
|
|
475
|
+
` client.contract("${contractName}").read("${method}")`,
|
|
476
|
+
` client.contract("${contractName}").simulate("${method}")`,
|
|
477
|
+
"Pass method args as the second argument to read() when the contract method takes parameters."
|
|
478
|
+
].join("\n"),
|
|
479
|
+
error
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/client/transaction-submit.ts
|
|
453
484
|
async function submitTransaction(transaction, signTransaction, contractName, method, rpcUrl) {
|
|
454
485
|
const candidate = transaction;
|
|
455
486
|
if (typeof candidate.signAndSend === "function") {
|
|
@@ -458,12 +489,16 @@ async function submitTransaction(transaction, signTransaction, contractName, met
|
|
|
458
489
|
assertSubmitResultRecognized(raw, contractName, method);
|
|
459
490
|
return raw;
|
|
460
491
|
} catch (error) {
|
|
461
|
-
if (error instanceof
|
|
492
|
+
if (error instanceof import_browser7.CaatingaError) {
|
|
462
493
|
throw error;
|
|
463
494
|
}
|
|
464
|
-
|
|
495
|
+
const readCallError = enrichReadCallInvokeError(error, contractName, method);
|
|
496
|
+
if (readCallError) {
|
|
497
|
+
throw readCallError;
|
|
498
|
+
}
|
|
499
|
+
throw new import_browser7.CaatingaError(
|
|
465
500
|
`Failed to submit XDR for "${contractName}.${method}".`,
|
|
466
|
-
|
|
501
|
+
import_browser7.CaatingaErrorCode.XDR_SUBMIT_FAILED,
|
|
467
502
|
`RPC: ${rpcUrl}. Check wallet signature and RPC connectivity.`,
|
|
468
503
|
error
|
|
469
504
|
);
|
|
@@ -475,20 +510,24 @@ async function submitTransaction(transaction, signTransaction, contractName, met
|
|
|
475
510
|
assertSubmitResultRecognized(raw, contractName, method);
|
|
476
511
|
return raw;
|
|
477
512
|
} catch (error) {
|
|
478
|
-
if (error instanceof
|
|
513
|
+
if (error instanceof import_browser7.CaatingaError) {
|
|
479
514
|
throw error;
|
|
480
515
|
}
|
|
481
|
-
|
|
516
|
+
const readCallError = enrichReadCallInvokeError(error, contractName, method);
|
|
517
|
+
if (readCallError) {
|
|
518
|
+
throw readCallError;
|
|
519
|
+
}
|
|
520
|
+
throw new import_browser7.CaatingaError(
|
|
482
521
|
`Failed to submit XDR for "${contractName}.${method}".`,
|
|
483
|
-
|
|
522
|
+
import_browser7.CaatingaErrorCode.XDR_SUBMIT_FAILED,
|
|
484
523
|
`RPC: ${rpcUrl}. Check wallet signature and RPC connectivity.`,
|
|
485
524
|
error
|
|
486
525
|
);
|
|
487
526
|
}
|
|
488
527
|
}
|
|
489
|
-
throw new
|
|
528
|
+
throw new import_browser7.CaatingaError(
|
|
490
529
|
`Binding transaction for "${contractName}.${method}" cannot be submitted.`,
|
|
491
|
-
|
|
530
|
+
import_browser7.CaatingaErrorCode.XDR_SUBMIT_FAILED,
|
|
492
531
|
"Regenerate bindings or provide a compatible binding adapter."
|
|
493
532
|
);
|
|
494
533
|
}
|
|
@@ -502,9 +541,9 @@ function assertSubmitResultRecognized(raw, contractName, method) {
|
|
|
502
541
|
if (hasTransactionId || hasResult) {
|
|
503
542
|
return;
|
|
504
543
|
}
|
|
505
|
-
throw new
|
|
544
|
+
throw new import_browser7.CaatingaError(
|
|
506
545
|
`Submit returned an unrecognized payload for "${contractName}.${method}".`,
|
|
507
|
-
|
|
546
|
+
import_browser7.CaatingaErrorCode.XDR_RESULT_FAILED,
|
|
508
547
|
"Expected txHash, transactionHash, hash, sendTransactionResponse.hash, or result on the submit response. Use debugRaw to inspect the binding output."
|
|
509
548
|
);
|
|
510
549
|
}
|
|
@@ -569,20 +608,20 @@ var CaatingaContractClient = class {
|
|
|
569
608
|
})
|
|
570
609
|
);
|
|
571
610
|
} catch (error) {
|
|
572
|
-
if (error instanceof
|
|
611
|
+
if (error instanceof import_browser8.CaatingaError) {
|
|
573
612
|
throw error;
|
|
574
613
|
}
|
|
575
|
-
throw new
|
|
614
|
+
throw new import_browser8.CaatingaError(
|
|
576
615
|
`Failed to sign XDR for "${this.contractName}.${method}".`,
|
|
577
|
-
|
|
616
|
+
import_browser8.CaatingaErrorCode.XDR_SIGN_FAILED,
|
|
578
617
|
"Connect a wallet and approve the transaction.",
|
|
579
618
|
error
|
|
580
619
|
);
|
|
581
620
|
}
|
|
582
621
|
if (typeof signedXdr !== "string" || signedXdr.trim().length === 0) {
|
|
583
|
-
throw new
|
|
622
|
+
throw new import_browser8.CaatingaError(
|
|
584
623
|
`Failed to sign XDR for "${this.contractName}.${method}".`,
|
|
585
|
-
|
|
624
|
+
import_browser8.CaatingaErrorCode.XDR_SIGN_FAILED,
|
|
586
625
|
"Wallet returned an empty or invalid signed XDR. The user may have dismissed the signing prompt.",
|
|
587
626
|
signedXdr
|
|
588
627
|
);
|
|
@@ -597,9 +636,9 @@ var CaatingaContractClient = class {
|
|
|
597
636
|
this.config.network.rpcUrl
|
|
598
637
|
);
|
|
599
638
|
if (typeof transaction.signAndSend === "function" && signedXdr === void 0) {
|
|
600
|
-
throw new
|
|
639
|
+
throw new import_browser8.CaatingaError(
|
|
601
640
|
`Failed to sign XDR for "${this.contractName}.${method}".`,
|
|
602
|
-
|
|
641
|
+
import_browser8.CaatingaErrorCode.XDR_SIGN_FAILED,
|
|
603
642
|
"Wallet returned an empty or invalid signed XDR. The generated transaction did not request a wallet signature."
|
|
604
643
|
);
|
|
605
644
|
}
|
|
@@ -659,12 +698,12 @@ var CaatingaContractClient = class {
|
|
|
659
698
|
() => this.config.wallet.getPublicKey()
|
|
660
699
|
);
|
|
661
700
|
} catch (error) {
|
|
662
|
-
if (error instanceof
|
|
701
|
+
if (error instanceof import_browser8.CaatingaError) {
|
|
663
702
|
throw error;
|
|
664
703
|
}
|
|
665
|
-
throw new
|
|
704
|
+
throw new import_browser8.CaatingaError(
|
|
666
705
|
`Wallet is not connected or the public key is unavailable for "${this.contractName}".`,
|
|
667
|
-
|
|
706
|
+
import_browser8.CaatingaErrorCode.WALLET_NOT_CONNECTED,
|
|
668
707
|
"Connect the wallet and grant account access, then retry.",
|
|
669
708
|
error
|
|
670
709
|
);
|
|
@@ -686,9 +725,9 @@ function createCaatingaClient(config) {
|
|
|
686
725
|
contract(contractName) {
|
|
687
726
|
const registration = config.contracts[contractName];
|
|
688
727
|
if (!registration) {
|
|
689
|
-
throw new
|
|
728
|
+
throw new import_browser9.CaatingaError(
|
|
690
729
|
`Contract "${contractName}" is not registered.`,
|
|
691
|
-
|
|
730
|
+
import_browser9.CaatingaErrorCode.CONTRACT_NOT_FOUND,
|
|
692
731
|
"Add the contract binding to createCaatingaClient()."
|
|
693
732
|
);
|
|
694
733
|
}
|
package/dist/index.js
CHANGED
|
@@ -89,10 +89,10 @@ function createDefaultBindingAdapter(binding) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// src/client/create-caatinga-client.ts
|
|
92
|
-
import { CaatingaError as
|
|
92
|
+
import { CaatingaError as CaatingaError8, CaatingaErrorCode as CaatingaErrorCode8 } from "@caatinga/core/browser";
|
|
93
93
|
|
|
94
94
|
// src/client/caatinga-contract-client.ts
|
|
95
|
-
import { CaatingaError as
|
|
95
|
+
import { CaatingaError as CaatingaError7, CaatingaErrorCode as CaatingaErrorCode7 } from "@caatinga/core/browser";
|
|
96
96
|
|
|
97
97
|
// src/xdr/build-xdr.ts
|
|
98
98
|
import { CaatingaError as CaatingaError3, CaatingaErrorCode as CaatingaErrorCode3 } from "@caatinga/core/browser";
|
|
@@ -259,7 +259,38 @@ function readSimulationResult(raw, contractName, method) {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
// src/client/transaction-submit.ts
|
|
262
|
+
import { CaatingaError as CaatingaError6, CaatingaErrorCode as CaatingaErrorCode6 } from "@caatinga/core/browser";
|
|
263
|
+
|
|
264
|
+
// src/client/read-call-error.ts
|
|
262
265
|
import { CaatingaError as CaatingaError5, CaatingaErrorCode as CaatingaErrorCode5 } from "@caatinga/core/browser";
|
|
266
|
+
|
|
267
|
+
// src/client/read-call-pattern.ts
|
|
268
|
+
var READ_CALL_FAILURE_REGEX = /this is a read call|read-only/i;
|
|
269
|
+
|
|
270
|
+
// src/client/read-call-error.ts
|
|
271
|
+
function enrichReadCallInvokeError(error, contractName, method) {
|
|
272
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
273
|
+
const hint = error instanceof CaatingaError5 ? error.hint ?? "" : "";
|
|
274
|
+
const haystack = `${message}
|
|
275
|
+
${hint}`;
|
|
276
|
+
if (!READ_CALL_FAILURE_REGEX.test(haystack)) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
return new CaatingaError5(
|
|
280
|
+
`Failed to submit XDR for "${contractName}.${method}".`,
|
|
281
|
+
CaatingaErrorCode5.XDR_SUBMIT_FAILED,
|
|
282
|
+
[
|
|
283
|
+
`"${contractName}.${method}" is a read-only contract method.`,
|
|
284
|
+
"Use read() or simulate() instead of invoke():",
|
|
285
|
+
` client.contract("${contractName}").read("${method}")`,
|
|
286
|
+
` client.contract("${contractName}").simulate("${method}")`,
|
|
287
|
+
"Pass method args as the second argument to read() when the contract method takes parameters."
|
|
288
|
+
].join("\n"),
|
|
289
|
+
error
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// src/client/transaction-submit.ts
|
|
263
294
|
async function submitTransaction(transaction, signTransaction, contractName, method, rpcUrl) {
|
|
264
295
|
const candidate = transaction;
|
|
265
296
|
if (typeof candidate.signAndSend === "function") {
|
|
@@ -268,12 +299,16 @@ async function submitTransaction(transaction, signTransaction, contractName, met
|
|
|
268
299
|
assertSubmitResultRecognized(raw, contractName, method);
|
|
269
300
|
return raw;
|
|
270
301
|
} catch (error) {
|
|
271
|
-
if (error instanceof
|
|
302
|
+
if (error instanceof CaatingaError6) {
|
|
272
303
|
throw error;
|
|
273
304
|
}
|
|
274
|
-
|
|
305
|
+
const readCallError = enrichReadCallInvokeError(error, contractName, method);
|
|
306
|
+
if (readCallError) {
|
|
307
|
+
throw readCallError;
|
|
308
|
+
}
|
|
309
|
+
throw new CaatingaError6(
|
|
275
310
|
`Failed to submit XDR for "${contractName}.${method}".`,
|
|
276
|
-
|
|
311
|
+
CaatingaErrorCode6.XDR_SUBMIT_FAILED,
|
|
277
312
|
`RPC: ${rpcUrl}. Check wallet signature and RPC connectivity.`,
|
|
278
313
|
error
|
|
279
314
|
);
|
|
@@ -285,20 +320,24 @@ async function submitTransaction(transaction, signTransaction, contractName, met
|
|
|
285
320
|
assertSubmitResultRecognized(raw, contractName, method);
|
|
286
321
|
return raw;
|
|
287
322
|
} catch (error) {
|
|
288
|
-
if (error instanceof
|
|
323
|
+
if (error instanceof CaatingaError6) {
|
|
289
324
|
throw error;
|
|
290
325
|
}
|
|
291
|
-
|
|
326
|
+
const readCallError = enrichReadCallInvokeError(error, contractName, method);
|
|
327
|
+
if (readCallError) {
|
|
328
|
+
throw readCallError;
|
|
329
|
+
}
|
|
330
|
+
throw new CaatingaError6(
|
|
292
331
|
`Failed to submit XDR for "${contractName}.${method}".`,
|
|
293
|
-
|
|
332
|
+
CaatingaErrorCode6.XDR_SUBMIT_FAILED,
|
|
294
333
|
`RPC: ${rpcUrl}. Check wallet signature and RPC connectivity.`,
|
|
295
334
|
error
|
|
296
335
|
);
|
|
297
336
|
}
|
|
298
337
|
}
|
|
299
|
-
throw new
|
|
338
|
+
throw new CaatingaError6(
|
|
300
339
|
`Binding transaction for "${contractName}.${method}" cannot be submitted.`,
|
|
301
|
-
|
|
340
|
+
CaatingaErrorCode6.XDR_SUBMIT_FAILED,
|
|
302
341
|
"Regenerate bindings or provide a compatible binding adapter."
|
|
303
342
|
);
|
|
304
343
|
}
|
|
@@ -312,9 +351,9 @@ function assertSubmitResultRecognized(raw, contractName, method) {
|
|
|
312
351
|
if (hasTransactionId || hasResult) {
|
|
313
352
|
return;
|
|
314
353
|
}
|
|
315
|
-
throw new
|
|
354
|
+
throw new CaatingaError6(
|
|
316
355
|
`Submit returned an unrecognized payload for "${contractName}.${method}".`,
|
|
317
|
-
|
|
356
|
+
CaatingaErrorCode6.XDR_RESULT_FAILED,
|
|
318
357
|
"Expected txHash, transactionHash, hash, sendTransactionResponse.hash, or result on the submit response. Use debugRaw to inspect the binding output."
|
|
319
358
|
);
|
|
320
359
|
}
|
|
@@ -379,20 +418,20 @@ var CaatingaContractClient = class {
|
|
|
379
418
|
})
|
|
380
419
|
);
|
|
381
420
|
} catch (error) {
|
|
382
|
-
if (error instanceof
|
|
421
|
+
if (error instanceof CaatingaError7) {
|
|
383
422
|
throw error;
|
|
384
423
|
}
|
|
385
|
-
throw new
|
|
424
|
+
throw new CaatingaError7(
|
|
386
425
|
`Failed to sign XDR for "${this.contractName}.${method}".`,
|
|
387
|
-
|
|
426
|
+
CaatingaErrorCode7.XDR_SIGN_FAILED,
|
|
388
427
|
"Connect a wallet and approve the transaction.",
|
|
389
428
|
error
|
|
390
429
|
);
|
|
391
430
|
}
|
|
392
431
|
if (typeof signedXdr !== "string" || signedXdr.trim().length === 0) {
|
|
393
|
-
throw new
|
|
432
|
+
throw new CaatingaError7(
|
|
394
433
|
`Failed to sign XDR for "${this.contractName}.${method}".`,
|
|
395
|
-
|
|
434
|
+
CaatingaErrorCode7.XDR_SIGN_FAILED,
|
|
396
435
|
"Wallet returned an empty or invalid signed XDR. The user may have dismissed the signing prompt.",
|
|
397
436
|
signedXdr
|
|
398
437
|
);
|
|
@@ -407,9 +446,9 @@ var CaatingaContractClient = class {
|
|
|
407
446
|
this.config.network.rpcUrl
|
|
408
447
|
);
|
|
409
448
|
if (typeof transaction.signAndSend === "function" && signedXdr === void 0) {
|
|
410
|
-
throw new
|
|
449
|
+
throw new CaatingaError7(
|
|
411
450
|
`Failed to sign XDR for "${this.contractName}.${method}".`,
|
|
412
|
-
|
|
451
|
+
CaatingaErrorCode7.XDR_SIGN_FAILED,
|
|
413
452
|
"Wallet returned an empty or invalid signed XDR. The generated transaction did not request a wallet signature."
|
|
414
453
|
);
|
|
415
454
|
}
|
|
@@ -469,12 +508,12 @@ var CaatingaContractClient = class {
|
|
|
469
508
|
() => this.config.wallet.getPublicKey()
|
|
470
509
|
);
|
|
471
510
|
} catch (error) {
|
|
472
|
-
if (error instanceof
|
|
511
|
+
if (error instanceof CaatingaError7) {
|
|
473
512
|
throw error;
|
|
474
513
|
}
|
|
475
|
-
throw new
|
|
514
|
+
throw new CaatingaError7(
|
|
476
515
|
`Wallet is not connected or the public key is unavailable for "${this.contractName}".`,
|
|
477
|
-
|
|
516
|
+
CaatingaErrorCode7.WALLET_NOT_CONNECTED,
|
|
478
517
|
"Connect the wallet and grant account access, then retry.",
|
|
479
518
|
error
|
|
480
519
|
);
|
|
@@ -496,9 +535,9 @@ function createCaatingaClient(config) {
|
|
|
496
535
|
contract(contractName) {
|
|
497
536
|
const registration = config.contracts[contractName];
|
|
498
537
|
if (!registration) {
|
|
499
|
-
throw new
|
|
538
|
+
throw new CaatingaError8(
|
|
500
539
|
`Contract "${contractName}" is not registered.`,
|
|
501
|
-
|
|
540
|
+
CaatingaErrorCode8.CONTRACT_NOT_FOUND,
|
|
502
541
|
"Add the contract binding to createCaatingaClient()."
|
|
503
542
|
);
|
|
504
543
|
}
|
package/dist/vite.cjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/vite.ts
|
|
31
|
+
var vite_exports = {};
|
|
32
|
+
__export(vite_exports, {
|
|
33
|
+
walletStubOverrides: () => walletStubOverrides,
|
|
34
|
+
walletStubPnpmWorkspaceYaml: () => walletStubPnpmWorkspaceYaml,
|
|
35
|
+
walletStubViteAliases: () => walletStubViteAliases
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(vite_exports);
|
|
38
|
+
|
|
39
|
+
// src/vite/wallet-stubs.ts
|
|
40
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
41
|
+
function walletStubOverrides(stubsDir = "./src/stubs") {
|
|
42
|
+
const posixStubsDir = stubsDir.split(import_node_path.default.sep).join("/");
|
|
43
|
+
return {
|
|
44
|
+
uuid: "^14.0.0",
|
|
45
|
+
"@creit.tech/stellar-wallets-kit": {
|
|
46
|
+
"@trezor/connect-web": `file:${posixStubsDir}/empty-wallet-dep`,
|
|
47
|
+
"@trezor/connect-plugin-stellar": `file:${posixStubsDir}/empty-wallet-dep`,
|
|
48
|
+
"@hot-wallet/sdk": `file:${posixStubsDir}/hot-wallet-sdk`
|
|
49
|
+
},
|
|
50
|
+
"@reown/appkit-utils": {
|
|
51
|
+
"@safe-global/safe-apps-sdk": "-",
|
|
52
|
+
"@safe-global/safe-apps-provider": "-"
|
|
53
|
+
},
|
|
54
|
+
"@safe-global/safe-apps-sdk": {
|
|
55
|
+
"@safe-global/safe-gateway-typescript-sdk": "-"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function walletStubViteAliases(stubsDir) {
|
|
60
|
+
const emptyStub = import_node_path.default.join(stubsDir, "empty-wallet-dep", "index.cjs");
|
|
61
|
+
return {
|
|
62
|
+
"@hot-wallet/sdk": import_node_path.default.join(stubsDir, "hot-wallet.ts"),
|
|
63
|
+
"@trezor/connect-web": emptyStub,
|
|
64
|
+
"@trezor/connect-plugin-stellar": emptyStub,
|
|
65
|
+
"@safe-global/safe-apps-sdk": emptyStub,
|
|
66
|
+
"@safe-global/safe-apps-provider": emptyStub,
|
|
67
|
+
"@safe-global/safe-gateway-typescript-sdk": emptyStub
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function walletStubPnpmWorkspaceYaml() {
|
|
71
|
+
return `allowBuilds:
|
|
72
|
+
esbuild: true
|
|
73
|
+
|
|
74
|
+
ignoredOptionalDependencies:
|
|
75
|
+
- "@safe-global/safe-apps-provider"
|
|
76
|
+
- "@safe-global/safe-apps-sdk"
|
|
77
|
+
|
|
78
|
+
overrides:
|
|
79
|
+
uuid: "^14.0.0"
|
|
80
|
+
"@creit.tech/stellar-wallets-kit>@trezor/connect-web": "-"
|
|
81
|
+
"@creit.tech/stellar-wallets-kit>@trezor/connect-plugin-stellar": "-"
|
|
82
|
+
"@creit.tech/stellar-wallets-kit>@hot-wallet/sdk": "-"
|
|
83
|
+
"@reown/appkit-utils>@safe-global/safe-apps-sdk": "-"
|
|
84
|
+
"@reown/appkit-utils>@safe-global/safe-apps-provider": "-"
|
|
85
|
+
"@safe-global/safe-apps-sdk>@safe-global/safe-gateway-typescript-sdk": "-"
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
90
|
+
walletStubOverrides,
|
|
91
|
+
walletStubPnpmWorkspaceYaml,
|
|
92
|
+
walletStubViteAliases
|
|
93
|
+
});
|
package/dist/vite.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type WalletStubPaths = {
|
|
2
|
+
stubsDir: string;
|
|
3
|
+
};
|
|
4
|
+
declare function walletStubOverrides(stubsDir?: string): Record<string, unknown>;
|
|
5
|
+
declare function walletStubViteAliases(stubsDir: string): Record<string, string>;
|
|
6
|
+
declare function walletStubPnpmWorkspaceYaml(): string;
|
|
7
|
+
|
|
8
|
+
export { type WalletStubPaths, walletStubOverrides, walletStubPnpmWorkspaceYaml, walletStubViteAliases };
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type WalletStubPaths = {
|
|
2
|
+
stubsDir: string;
|
|
3
|
+
};
|
|
4
|
+
declare function walletStubOverrides(stubsDir?: string): Record<string, unknown>;
|
|
5
|
+
declare function walletStubViteAliases(stubsDir: string): Record<string, string>;
|
|
6
|
+
declare function walletStubPnpmWorkspaceYaml(): string;
|
|
7
|
+
|
|
8
|
+
export { type WalletStubPaths, walletStubOverrides, walletStubPnpmWorkspaceYaml, walletStubViteAliases };
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/vite/wallet-stubs.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
function walletStubOverrides(stubsDir = "./src/stubs") {
|
|
4
|
+
const posixStubsDir = stubsDir.split(path.sep).join("/");
|
|
5
|
+
return {
|
|
6
|
+
uuid: "^14.0.0",
|
|
7
|
+
"@creit.tech/stellar-wallets-kit": {
|
|
8
|
+
"@trezor/connect-web": `file:${posixStubsDir}/empty-wallet-dep`,
|
|
9
|
+
"@trezor/connect-plugin-stellar": `file:${posixStubsDir}/empty-wallet-dep`,
|
|
10
|
+
"@hot-wallet/sdk": `file:${posixStubsDir}/hot-wallet-sdk`
|
|
11
|
+
},
|
|
12
|
+
"@reown/appkit-utils": {
|
|
13
|
+
"@safe-global/safe-apps-sdk": "-",
|
|
14
|
+
"@safe-global/safe-apps-provider": "-"
|
|
15
|
+
},
|
|
16
|
+
"@safe-global/safe-apps-sdk": {
|
|
17
|
+
"@safe-global/safe-gateway-typescript-sdk": "-"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function walletStubViteAliases(stubsDir) {
|
|
22
|
+
const emptyStub = path.join(stubsDir, "empty-wallet-dep", "index.cjs");
|
|
23
|
+
return {
|
|
24
|
+
"@hot-wallet/sdk": path.join(stubsDir, "hot-wallet.ts"),
|
|
25
|
+
"@trezor/connect-web": emptyStub,
|
|
26
|
+
"@trezor/connect-plugin-stellar": emptyStub,
|
|
27
|
+
"@safe-global/safe-apps-sdk": emptyStub,
|
|
28
|
+
"@safe-global/safe-apps-provider": emptyStub,
|
|
29
|
+
"@safe-global/safe-gateway-typescript-sdk": emptyStub
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function walletStubPnpmWorkspaceYaml() {
|
|
33
|
+
return `allowBuilds:
|
|
34
|
+
esbuild: true
|
|
35
|
+
|
|
36
|
+
ignoredOptionalDependencies:
|
|
37
|
+
- "@safe-global/safe-apps-provider"
|
|
38
|
+
- "@safe-global/safe-apps-sdk"
|
|
39
|
+
|
|
40
|
+
overrides:
|
|
41
|
+
uuid: "^14.0.0"
|
|
42
|
+
"@creit.tech/stellar-wallets-kit>@trezor/connect-web": "-"
|
|
43
|
+
"@creit.tech/stellar-wallets-kit>@trezor/connect-plugin-stellar": "-"
|
|
44
|
+
"@creit.tech/stellar-wallets-kit>@hot-wallet/sdk": "-"
|
|
45
|
+
"@reown/appkit-utils>@safe-global/safe-apps-sdk": "-"
|
|
46
|
+
"@reown/appkit-utils>@safe-global/safe-apps-provider": "-"
|
|
47
|
+
"@safe-global/safe-apps-sdk>@safe-global/safe-gateway-typescript-sdk": "-"
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
walletStubOverrides,
|
|
52
|
+
walletStubPnpmWorkspaceYaml,
|
|
53
|
+
walletStubViteAliases
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caatinga/client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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",
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"types": "./dist/react.d.ts",
|
|
49
49
|
"import": "./dist/react.js",
|
|
50
50
|
"require": "./dist/react.cjs"
|
|
51
|
+
},
|
|
52
|
+
"./vite": {
|
|
53
|
+
"types": "./dist/vite.d.ts",
|
|
54
|
+
"import": "./dist/vite.js",
|
|
55
|
+
"require": "./dist/vite.cjs"
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"files": [
|
|
@@ -56,7 +61,7 @@
|
|
|
56
61
|
"LICENSE"
|
|
57
62
|
],
|
|
58
63
|
"dependencies": {
|
|
59
|
-
"@caatinga/core": "^2.
|
|
64
|
+
"@caatinga/core": "^2.4.0"
|
|
60
65
|
},
|
|
61
66
|
"devDependencies": {
|
|
62
67
|
"tsup": "^8.3.5",
|
|
@@ -87,7 +92,7 @@
|
|
|
87
92
|
}
|
|
88
93
|
},
|
|
89
94
|
"scripts": {
|
|
90
|
-
"build": "tsup src/index.ts src/freighter.ts src/stellar-wallets-kit.ts src/react.ts --format esm,cjs --dts",
|
|
95
|
+
"build": "tsup src/index.ts src/freighter.ts src/stellar-wallets-kit.ts src/react.ts src/vite.ts --format esm,cjs --dts",
|
|
91
96
|
"test": "vitest run --pool=threads",
|
|
92
97
|
"typecheck": "tsc --noEmit"
|
|
93
98
|
}
|