@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.
@@ -0,0 +1,86 @@
1
+ import { CaatingaArtifacts } from '@caatinga/core/browser';
2
+
3
+ interface CaatingaNetwork {
4
+ name: string;
5
+ rpcUrl: string;
6
+ networkPassphrase: string;
7
+ }
8
+ /**
9
+ * Wallet integration for browser-side signing.
10
+ *
11
+ * Implementations must reject the returned promise when the user dismisses or
12
+ * cancels signing (do not leave the promise pending indefinitely). Adapters may
13
+ * apply their own timeout. Caatinga optionally enforces {@link CaatingaClientConfig.walletTimeout}.
14
+ */
15
+ interface CaatingaWalletAdapter {
16
+ getPublicKey(): Promise<string>;
17
+ signTransaction(input: {
18
+ xdr: string;
19
+ networkPassphrase: string;
20
+ }): Promise<string>;
21
+ }
22
+ interface CaatingaContractRegistration {
23
+ binding: unknown;
24
+ contractId?: string;
25
+ }
26
+ interface CaatingaClientConfig {
27
+ network: CaatingaNetwork;
28
+ artifacts: CaatingaArtifacts;
29
+ wallet: CaatingaWalletAdapter;
30
+ /** Optional timeout (ms) for wallet `getPublicKey` and `signTransaction`. No default when omitted. */
31
+ walletTimeout?: number;
32
+ contracts: Record<string, CaatingaContractRegistration>;
33
+ }
34
+ type CaatingaInvokeStatus = "built" | "prepared" | "signed" | "submitted" | "confirmed" | "failed";
35
+ interface CaatingaInvokeOptions {
36
+ debugXdr?: boolean;
37
+ debugRaw?: boolean;
38
+ }
39
+ interface CaatingaReadOptions {
40
+ debugRaw?: boolean;
41
+ }
42
+ interface CaatingaInvokeResult<T = unknown> {
43
+ status: CaatingaInvokeStatus;
44
+ contract: string;
45
+ method: string;
46
+ contractId: string;
47
+ transactionHash?: string;
48
+ result?: T;
49
+ xdr?: {
50
+ unsigned?: string;
51
+ prepared?: string;
52
+ signed?: string;
53
+ };
54
+ raw?: unknown;
55
+ }
56
+ interface CaatingaReadResult<T = unknown> {
57
+ status: "simulated";
58
+ contract: string;
59
+ method: string;
60
+ contractId: string;
61
+ result: T;
62
+ raw?: unknown;
63
+ }
64
+ interface CaatingaXdrBuildResult {
65
+ contract: string;
66
+ method: string;
67
+ contractId: string;
68
+ unsignedXdr?: string;
69
+ preparedXdr: string;
70
+ raw?: unknown;
71
+ }
72
+ interface CaatingaBindingAdapter {
73
+ createClient(input: {
74
+ contractId: string;
75
+ publicKey: string;
76
+ rpcUrl: string;
77
+ networkPassphrase: string;
78
+ }): unknown;
79
+ callMethod(input: {
80
+ client: unknown;
81
+ method: string;
82
+ args?: Record<string, unknown>;
83
+ }): Promise<unknown>;
84
+ }
85
+
86
+ export type { CaatingaWalletAdapter as C, CaatingaBindingAdapter as a, CaatingaClientConfig as b, CaatingaContractRegistration as c, CaatingaXdrBuildResult as d, CaatingaInvokeOptions as e, CaatingaInvokeResult as f, CaatingaReadOptions as g, CaatingaReadResult as h, CaatingaInvokeStatus as i, CaatingaNetwork as j };
@@ -0,0 +1,86 @@
1
+ import { CaatingaArtifacts } from '@caatinga/core/browser';
2
+
3
+ interface CaatingaNetwork {
4
+ name: string;
5
+ rpcUrl: string;
6
+ networkPassphrase: string;
7
+ }
8
+ /**
9
+ * Wallet integration for browser-side signing.
10
+ *
11
+ * Implementations must reject the returned promise when the user dismisses or
12
+ * cancels signing (do not leave the promise pending indefinitely). Adapters may
13
+ * apply their own timeout. Caatinga optionally enforces {@link CaatingaClientConfig.walletTimeout}.
14
+ */
15
+ interface CaatingaWalletAdapter {
16
+ getPublicKey(): Promise<string>;
17
+ signTransaction(input: {
18
+ xdr: string;
19
+ networkPassphrase: string;
20
+ }): Promise<string>;
21
+ }
22
+ interface CaatingaContractRegistration {
23
+ binding: unknown;
24
+ contractId?: string;
25
+ }
26
+ interface CaatingaClientConfig {
27
+ network: CaatingaNetwork;
28
+ artifacts: CaatingaArtifacts;
29
+ wallet: CaatingaWalletAdapter;
30
+ /** Optional timeout (ms) for wallet `getPublicKey` and `signTransaction`. No default when omitted. */
31
+ walletTimeout?: number;
32
+ contracts: Record<string, CaatingaContractRegistration>;
33
+ }
34
+ type CaatingaInvokeStatus = "built" | "prepared" | "signed" | "submitted" | "confirmed" | "failed";
35
+ interface CaatingaInvokeOptions {
36
+ debugXdr?: boolean;
37
+ debugRaw?: boolean;
38
+ }
39
+ interface CaatingaReadOptions {
40
+ debugRaw?: boolean;
41
+ }
42
+ interface CaatingaInvokeResult<T = unknown> {
43
+ status: CaatingaInvokeStatus;
44
+ contract: string;
45
+ method: string;
46
+ contractId: string;
47
+ transactionHash?: string;
48
+ result?: T;
49
+ xdr?: {
50
+ unsigned?: string;
51
+ prepared?: string;
52
+ signed?: string;
53
+ };
54
+ raw?: unknown;
55
+ }
56
+ interface CaatingaReadResult<T = unknown> {
57
+ status: "simulated";
58
+ contract: string;
59
+ method: string;
60
+ contractId: string;
61
+ result: T;
62
+ raw?: unknown;
63
+ }
64
+ interface CaatingaXdrBuildResult {
65
+ contract: string;
66
+ method: string;
67
+ contractId: string;
68
+ unsignedXdr?: string;
69
+ preparedXdr: string;
70
+ raw?: unknown;
71
+ }
72
+ interface CaatingaBindingAdapter {
73
+ createClient(input: {
74
+ contractId: string;
75
+ publicKey: string;
76
+ rpcUrl: string;
77
+ networkPassphrase: string;
78
+ }): unknown;
79
+ callMethod(input: {
80
+ client: unknown;
81
+ method: string;
82
+ args?: Record<string, unknown>;
83
+ }): Promise<unknown>;
84
+ }
85
+
86
+ export type { CaatingaWalletAdapter as C, CaatingaBindingAdapter as a, CaatingaClientConfig as b, CaatingaContractRegistration as c, CaatingaXdrBuildResult as d, CaatingaInvokeOptions as e, CaatingaInvokeResult as f, CaatingaReadOptions as g, CaatingaReadResult as h, CaatingaInvokeStatus as i, CaatingaNetwork as j };
@@ -1,10 +1,17 @@
1
- import { CaatingaArtifacts } from '@caatinga/core';
1
+ import { CaatingaArtifacts } from '@caatinga/core/browser';
2
2
 
3
3
  interface CaatingaNetwork {
4
4
  name: string;
5
5
  rpcUrl: string;
6
6
  networkPassphrase: string;
7
7
  }
8
+ /**
9
+ * Wallet integration for browser-side signing.
10
+ *
11
+ * Implementations must reject the returned promise when the user dismisses or
12
+ * cancels signing (do not leave the promise pending indefinitely). Adapters may
13
+ * apply their own timeout. Caatinga optionally enforces {@link CaatingaClientConfig.walletTimeout}.
14
+ */
8
15
  interface CaatingaWalletAdapter {
9
16
  getPublicKey(): Promise<string>;
10
17
  signTransaction(input: {
@@ -20,6 +27,8 @@ interface CaatingaClientConfig {
20
27
  network: CaatingaNetwork;
21
28
  artifacts: CaatingaArtifacts;
22
29
  wallet: CaatingaWalletAdapter;
30
+ /** Optional timeout (ms) for wallet `getPublicKey` and `signTransaction`. No default when omitted. */
31
+ walletTimeout?: number;
23
32
  contracts: Record<string, CaatingaContractRegistration>;
24
33
  }
25
34
  type CaatingaInvokeStatus = "built" | "prepared" | "signed" | "submitted" | "confirmed" | "failed";
@@ -1,10 +1,17 @@
1
- import { CaatingaArtifacts } from '@caatinga/core';
1
+ import { CaatingaArtifacts } from '@caatinga/core/browser';
2
2
 
3
3
  interface CaatingaNetwork {
4
4
  name: string;
5
5
  rpcUrl: string;
6
6
  networkPassphrase: string;
7
7
  }
8
+ /**
9
+ * Wallet integration for browser-side signing.
10
+ *
11
+ * Implementations must reject the returned promise when the user dismisses or
12
+ * cancels signing (do not leave the promise pending indefinitely). Adapters may
13
+ * apply their own timeout. Caatinga optionally enforces {@link CaatingaClientConfig.walletTimeout}.
14
+ */
8
15
  interface CaatingaWalletAdapter {
9
16
  getPublicKey(): Promise<string>;
10
17
  signTransaction(input: {
@@ -20,6 +27,8 @@ interface CaatingaClientConfig {
20
27
  network: CaatingaNetwork;
21
28
  artifacts: CaatingaArtifacts;
22
29
  wallet: CaatingaWalletAdapter;
30
+ /** Optional timeout (ms) for wallet `getPublicKey` and `signTransaction`. No default when omitted. */
31
+ walletTimeout?: number;
23
32
  contracts: Record<string, CaatingaContractRegistration>;
24
33
  }
25
34
  type CaatingaInvokeStatus = "built" | "prepared" | "signed" | "submitted" | "confirmed" | "failed";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caatinga/client",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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",
@@ -38,6 +38,11 @@
38
38
  "types": "./dist/freighter.d.ts",
39
39
  "import": "./dist/freighter.js",
40
40
  "require": "./dist/freighter.cjs"
41
+ },
42
+ "./stellar-wallets-kit": {
43
+ "types": "./dist/stellar-wallets-kit.d.ts",
44
+ "import": "./dist/stellar-wallets-kit.js",
45
+ "require": "./dist/stellar-wallets-kit.cjs"
41
46
  }
42
47
  },
43
48
  "files": [
@@ -46,24 +51,30 @@
46
51
  "LICENSE"
47
52
  ],
48
53
  "dependencies": {
49
- "@caatinga/core": "^0.2.1"
54
+ "@caatinga/core": "^0.2.3"
50
55
  },
51
56
  "devDependencies": {
52
57
  "tsup": "^8.3.5",
58
+ "stellar-wallets-kit": "github:Creit-Tech/Stellar-Wallets-Kit#v0.0.7",
53
59
  "typescript": "^5.7.2",
54
60
  "vitest": "^2.1.8"
55
61
  },
56
62
  "peerDependencies": {
57
- "@stellar/freighter-api": "^4.0.0"
63
+ "@stellar/freighter-api": "^4.0.0",
64
+ "stellar-wallets-kit": "github:Creit-Tech/Stellar-Wallets-Kit#v0.0.7"
58
65
  },
59
66
  "peerDependenciesMeta": {
60
67
  "@stellar/freighter-api": {
61
68
  "optional": true
69
+ },
70
+ "stellar-wallets-kit": {
71
+ "optional": true
62
72
  }
63
73
  },
64
74
  "scripts": {
65
- "build": "tsup src/index.ts src/freighter.ts --format esm,cjs --dts",
75
+ "build": "tsup src/index.ts src/freighter.ts src/stellar-wallets-kit.ts --format esm,cjs --dts",
66
76
  "test": "vitest run --pool=threads",
77
+ "pretypecheck": "pnpm --filter @caatinga/core run build",
67
78
  "typecheck": "tsc --noEmit"
68
79
  }
69
80
  }