@oumla/sdk 0.0.5 → 1.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/LICENSE +21 -0
- package/README.md +266 -9
- package/dist/index.cjs +4091 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2228 -446
- package/dist/index.js +3819 -3807
- package/dist/index.js.map +1 -0
- package/package.json +57 -22
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.prettierrc +0 -7
- package/dist/index.mjs +0 -4047
- package/tsconfig.json +0 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Oumla
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,16 +1,273 @@
|
|
|
1
|
-
# Oumla SDK
|
|
1
|
+
# Oumla TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/js/%40oumla%2Fsdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Official TypeScript SDK for Oumla - Blockchain integration made simple. This SDK provides a comprehensive interface to interact with the Oumla API, enabling developers to build blockchain applications with ease.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
import { Oumla } from '@oumla/sdk';
|
|
8
|
+
## Features
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
- 🚀 **Full API Coverage** - Complete access to all Oumla API endpoints
|
|
11
|
+
- 🔒 **Type Safety** - Full TypeScript support with comprehensive type definitions
|
|
12
|
+
- 🎯 **Easy Integration** - Simple and intuitive API design
|
|
13
|
+
- 📦 **Tree Shakeable** - Optimized bundle size with ES modules support
|
|
14
|
+
- 🔄 **Auto-generated** - Always up-to-date with the latest API changes
|
|
15
|
+
- 🌐 **Multi-environment** - Support for different deployment environments
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @oumla/sdk
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @oumla/sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
or
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add @oumla/sdk
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { OumlaSdkApiClient, OumlaSdkApiEnvironment } from '@oumla/sdk';
|
|
39
|
+
|
|
40
|
+
// Initialize the client
|
|
41
|
+
const client = new OumlaSdkApiClient({
|
|
42
|
+
apiKey: 'your-api-key-here',
|
|
43
|
+
environment: OumlaSdkApiEnvironment.Production,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Example: Get profiles
|
|
47
|
+
async function getProfiles() {
|
|
48
|
+
try {
|
|
49
|
+
const profiles = await client.profiles.getProfiles();
|
|
50
|
+
console.log('Profiles:', profiles);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error('Error fetching profiles:', error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Example: Create a wallet
|
|
57
|
+
async function createWallet() {
|
|
58
|
+
try {
|
|
59
|
+
const wallet = await client.wallets.createWallet({
|
|
60
|
+
profileId: 'your-profile-id',
|
|
61
|
+
name: 'My Wallet',
|
|
62
|
+
});
|
|
63
|
+
console.log('Created wallet:', wallet);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
console.error('Error creating wallet:', error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## API Resources
|
|
71
|
+
|
|
72
|
+
The SDK provides access to the following resources:
|
|
73
|
+
|
|
74
|
+
### 🏠 Profiles
|
|
75
|
+
Manage user profiles and organizations
|
|
76
|
+
```typescript
|
|
77
|
+
const profiles = await client.profiles.getProfiles();
|
|
78
|
+
const profile = await client.profiles.createProfile({ name: 'My Profile' });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 💼 Wallets
|
|
82
|
+
Create and manage blockchain wallets
|
|
83
|
+
```typescript
|
|
84
|
+
const wallets = await client.wallets.getProfileWallets({ profileId: 'profile-id' });
|
|
85
|
+
const wallet = await client.wallets.createWallet({ profileId: 'profile-id', name: 'My Wallet' });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 📍 Addresses
|
|
89
|
+
Generate and manage blockchain addresses
|
|
90
|
+
```typescript
|
|
91
|
+
const addresses = await client.addresses.getProfileAddresses({ profileId: 'profile-id' });
|
|
92
|
+
const address = await client.addresses.createAddress({ walletId: 'wallet-id' });
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 💰 Transactions
|
|
96
|
+
Track and manage blockchain transactions
|
|
97
|
+
```typescript
|
|
98
|
+
const transactions = await client.transactions.getProfileTransactions({ profileId: 'profile-id' });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 🎨 Assets
|
|
102
|
+
Manage digital assets and collections
|
|
103
|
+
```typescript
|
|
104
|
+
const assets = await client.assets.getAssets();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 🔥 Withdrawals
|
|
108
|
+
Handle withdrawal operations
|
|
109
|
+
```typescript
|
|
110
|
+
const withdrawal = await client.withdrawals.createWithdrawal({
|
|
111
|
+
walletId: 'wallet-id',
|
|
112
|
+
amount: '1.0',
|
|
113
|
+
currency: 'ETH',
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 📋 Contract Templates
|
|
118
|
+
Deploy and manage smart contract templates
|
|
119
|
+
```typescript
|
|
120
|
+
const templates = await client.contractTemplates.getContractTemplates();
|
|
121
|
+
const template = await client.contractTemplates.createContractTemplate({
|
|
122
|
+
name: 'My Contract',
|
|
123
|
+
abi: contractAbi,
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 🏗️ Deployed Contracts
|
|
128
|
+
Interact with deployed smart contracts
|
|
129
|
+
```typescript
|
|
130
|
+
const contracts = await client.deployedContracts.getDeployedContracts();
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 🔧 Contract Interactions
|
|
134
|
+
Read from and write to smart contracts
|
|
135
|
+
```typescript
|
|
136
|
+
const result = await client.contractInteractions.readFunction({
|
|
137
|
+
contractAddress: '0x...',
|
|
138
|
+
functionName: 'balanceOf',
|
|
139
|
+
parameters: ['0x...'],
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 🪙 Tokenization
|
|
144
|
+
Create and manage tokens and collections
|
|
145
|
+
```typescript
|
|
146
|
+
const collections = await client.tokenization.getCollections();
|
|
147
|
+
const collection = await client.tokenization.createCollection({
|
|
148
|
+
name: 'My NFT Collection',
|
|
149
|
+
symbol: 'MNC',
|
|
13
150
|
});
|
|
14
151
|
```
|
|
15
152
|
|
|
16
|
-
|
|
153
|
+
## Configuration
|
|
154
|
+
|
|
155
|
+
### Environment Setup
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
import { OumlaSdkApiClient, OumlaSdkApiEnvironment } from '@oumla/sdk';
|
|
159
|
+
|
|
160
|
+
const client = new OumlaSdkApiClient({
|
|
161
|
+
apiKey: process.env.OUMLA_API_KEY!,
|
|
162
|
+
environment: OumlaSdkApiEnvironment.Production, // or custom URL
|
|
163
|
+
baseUrl: 'https://custom-api.oumla.com', // Optional: custom base URL
|
|
164
|
+
headers: {
|
|
165
|
+
'Custom-Header': 'value', // Optional: additional headers
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Request Options
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// Global request options
|
|
174
|
+
const client = new OumlaSdkApiClient({
|
|
175
|
+
apiKey: 'your-api-key',
|
|
176
|
+
// ... other options
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Per-request options
|
|
180
|
+
const profiles = await client.profiles.getProfiles({
|
|
181
|
+
timeoutInSeconds: 30,
|
|
182
|
+
maxRetries: 3,
|
|
183
|
+
headers: {
|
|
184
|
+
'Custom-Header': 'value',
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Error Handling
|
|
190
|
+
|
|
191
|
+
The SDK provides comprehensive error handling:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { OumlaSdkApiError, OumlaSdkApiTimeoutError } from '@oumla/sdk';
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
const result = await client.profiles.getProfiles();
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (error instanceof OumlaSdkApiError) {
|
|
200
|
+
console.error('API Error:', error.message);
|
|
201
|
+
console.error('Status Code:', error.statusCode);
|
|
202
|
+
console.error('Response Body:', error.body);
|
|
203
|
+
} else if (error instanceof OumlaSdkApiTimeoutError) {
|
|
204
|
+
console.error('Request timeout:', error.message);
|
|
205
|
+
} else {
|
|
206
|
+
console.error('Unexpected error:', error);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## TypeScript Support
|
|
212
|
+
|
|
213
|
+
The SDK is built with TypeScript and provides full type safety:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import type {
|
|
217
|
+
CreateProfileRequest,
|
|
218
|
+
GetProfilesRequest,
|
|
219
|
+
Profile,
|
|
220
|
+
PaginatedResponse
|
|
221
|
+
} from '@oumla/sdk';
|
|
222
|
+
|
|
223
|
+
// Type-safe request parameters
|
|
224
|
+
const createProfileRequest: CreateProfileRequest = {
|
|
225
|
+
name: 'My Profile',
|
|
226
|
+
// TypeScript will enforce the correct structure
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// Type-safe response handling
|
|
230
|
+
const response: PaginatedResponse<Profile> = await client.profiles.getProfiles();
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Development
|
|
234
|
+
|
|
235
|
+
### Building from Source
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Clone the repository
|
|
239
|
+
git clone https://github.com/oumla/sdk.git
|
|
240
|
+
cd sdk/sdks/typescript
|
|
241
|
+
|
|
242
|
+
# Install dependencies
|
|
243
|
+
pnpm install
|
|
244
|
+
|
|
245
|
+
# Build the SDK
|
|
246
|
+
pnpm run build
|
|
247
|
+
|
|
248
|
+
# Run in development mode
|
|
249
|
+
pnpm run dev
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Contributing
|
|
253
|
+
|
|
254
|
+
We welcome contributions! Please see our [Contributing Guide](https://github.com/oumla/sdk/blob/main/CONTRIBUTING.md) for details.
|
|
255
|
+
|
|
256
|
+
## Support
|
|
257
|
+
|
|
258
|
+
- 📚 [Documentation](https://docs.oumla.com)
|
|
259
|
+
- 🐛 [Issue Tracker](https://github.com/oumla/sdk/issues)
|
|
260
|
+
- 💬 [Discord Community](https://discord.gg/oumla)
|
|
261
|
+
- 📧 [Email Support](mailto:support@oumla.com)
|
|
262
|
+
|
|
263
|
+
## License
|
|
264
|
+
|
|
265
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
266
|
+
|
|
267
|
+
## Changelog
|
|
268
|
+
|
|
269
|
+
See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
Made with ❤️ by the Oumla team
|