@conto_finance/sdk 0.1.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 ADDED
@@ -0,0 +1,107 @@
1
+ # @conto_finance/sdk
2
+
3
+ TypeScript SDK for Conto. Use it when you control the agent runtime and want typed access to
4
+ payment requests, payment execution, and organization-level provisioning.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install @conto_finance/sdk
10
+ ```
11
+
12
+ ## Choose the Right Key
13
+
14
+ | If your application needs to... | Client | Credential | Env var |
15
+ | --------------------------------------------------------------------- | ------------ | ---------------------------------- | ------------------- |
16
+ | Make payment or read calls as one agent | `Conto` | Agent SDK key (`conto_agent_...`) | `CONTO_API_KEY` |
17
+ | Provision agents, wallets, policies, or memberships from your backend | `ContoAdmin` | Organization API key (`conto_...`) | `CONTO_ORG_API_KEY` |
18
+
19
+ An admin SDK key is still an agent SDK key. It keeps the `conto_agent_...` prefix, so it is not a
20
+ drop-in replacement for `ContoAdmin`.
21
+
22
+ ## Agent SDK Quick Start
23
+
24
+ ```typescript
25
+ import { Conto } from '@conto_finance/sdk';
26
+
27
+ const conto = new Conto({
28
+ apiKey: process.env.CONTO_API_KEY!,
29
+ });
30
+
31
+ const request = await conto.payments.request({
32
+ amount: 25,
33
+ recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f...',
34
+ recipientName: 'OpenAI',
35
+ purpose: 'API credits',
36
+ category: 'API_PROVIDER',
37
+ });
38
+
39
+ if (request.status === 'APPROVED') {
40
+ const result = await conto.payments.execute(request.requestId);
41
+ console.log(result.txHash);
42
+ }
43
+ ```
44
+
45
+ For a single-call managed-wallet flow, use:
46
+
47
+ ```typescript
48
+ const result = await conto.payments.pay({
49
+ amount: 10,
50
+ recipientAddress: '0x...',
51
+ purpose: 'Service fee',
52
+ });
53
+ ```
54
+
55
+ ## Admin SDK Quick Start
56
+
57
+ `ContoAdmin` uses an organization API key (`conto_xxx...`), not an agent SDK key.
58
+
59
+ ```typescript
60
+ import { ContoAdmin } from '@conto_finance/sdk';
61
+
62
+ const admin = new ContoAdmin({
63
+ orgApiKey: process.env.CONTO_ORG_API_KEY!,
64
+ });
65
+
66
+ const { members } = await admin.team.listMembers();
67
+ const serviceOwner = members.find((member) => member.user?.email === 'ops@yourcompany.com');
68
+
69
+ if (!serviceOwner) {
70
+ throw new Error('No dedicated owner membership found');
71
+ }
72
+
73
+ const agent = await admin.agents.create({
74
+ name: 'Trading Bot',
75
+ agentType: 'CUSTOM',
76
+ ownerMembershipId: serviceOwner.id,
77
+ });
78
+
79
+ const wallet = await admin.wallets.create({
80
+ name: 'Operations Wallet',
81
+ });
82
+ ```
83
+
84
+ ## What This Package Covers
85
+
86
+ - `Conto` for agent-scoped payment flows
87
+ - `ContoAdmin` for organization-scoped provisioning and management
88
+ - Built-in retries for `429` and `5xx` responses
89
+ - Typed request and response shapes for the public SDK surface
90
+
91
+ ## What To Use Instead
92
+
93
+ - Use the REST API docs if you need endpoints that are not wrapped by this package yet, especially
94
+ external-wallet `approve -> transfer -> confirm` flows.
95
+ - Use the MCP server if a tool-calling assistant should operate Conto directly.
96
+
97
+ ## Docs
98
+
99
+ - SDK install: [conto.finance/docs/sdk/installation](https://conto.finance/docs/sdk/installation)
100
+ - Authentication: [conto.finance/docs/sdk/authentication](https://conto.finance/docs/sdk/authentication)
101
+ - Payments: [conto.finance/docs/sdk/payments](https://conto.finance/docs/sdk/payments)
102
+ - Admin SDK: [conto.finance/docs/sdk/admin](https://conto.finance/docs/sdk/admin)
103
+ - API reference: [conto.finance/api-docs](https://conto.finance/api-docs)
104
+
105
+ ## License
106
+
107
+ MIT