cilantro-sdk 0.0.1
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 +1370 -0
- package/dist/admin.cjs +425 -0
- package/dist/admin.cjs.map +7 -0
- package/dist/admin.d.ts +31 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.mjs +364 -0
- package/dist/admin.mjs.map +7 -0
- package/dist/api/admin/admin.d.ts +64 -0
- package/dist/api/admin/admin.d.ts.map +1 -0
- package/dist/api/app/app.d.ts +15 -0
- package/dist/api/app/app.d.ts.map +1 -0
- package/dist/api/auth/auth.d.ts +16 -0
- package/dist/api/auth/auth.d.ts.map +1 -0
- package/dist/api/delegated-keys/delegated-keys.d.ts +24 -0
- package/dist/api/delegated-keys/delegated-keys.d.ts.map +1 -0
- package/dist/api/gUACSmartAPIV2.d.ts +138 -0
- package/dist/api/gUACSmartAPIV2.d.ts.map +1 -0
- package/dist/api/health/health.d.ts +15 -0
- package/dist/api/health/health.d.ts.map +1 -0
- package/dist/api/plans/plans.d.ts +28 -0
- package/dist/api/plans/plans.d.ts.map +1 -0
- package/dist/api/platforms/platforms.d.ts +40 -0
- package/dist/api/platforms/platforms.d.ts.map +1 -0
- package/dist/api/transactions/transactions.d.ts +18 -0
- package/dist/api/transactions/transactions.d.ts.map +1 -0
- package/dist/api/users/users.d.ts +20 -0
- package/dist/api/users/users.d.ts.map +1 -0
- package/dist/api/wallets/wallets.d.ts +92 -0
- package/dist/api/wallets/wallets.d.ts.map +1 -0
- package/dist/api/webhooks/webhooks.d.ts +24 -0
- package/dist/api/webhooks/webhooks.d.ts.map +1 -0
- package/dist/api-client.d.ts +13 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/auth.cjs +123 -0
- package/dist/auth.cjs.map +7 -0
- package/dist/auth.d.ts +30 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.mjs +85 -0
- package/dist/auth.mjs.map +7 -0
- package/dist/config.d.ts +74 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.cjs +1900 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1848 -0
- package/dist/index.mjs.map +7 -0
- package/dist/models/accountMeta.d.ts +16 -0
- package/dist/models/accountMeta.d.ts.map +1 -0
- package/dist/models/addSignerDto.d.ts +22 -0
- package/dist/models/addSignerDto.d.ts.map +1 -0
- package/dist/models/addSignerDtoSignerType.d.ts +18 -0
- package/dist/models/addSignerDtoSignerType.d.ts.map +1 -0
- package/dist/models/adminControllerFindAllParams.d.ts +18 -0
- package/dist/models/adminControllerFindAllParams.d.ts.map +1 -0
- package/dist/models/adminControllerFindAllPlatformsParams.d.ts +18 -0
- package/dist/models/adminControllerFindAllPlatformsParams.d.ts.map +1 -0
- package/dist/models/adminControllerGetPlatformsWithUsersParams.d.ts +18 -0
- package/dist/models/adminControllerGetPlatformsWithUsersParams.d.ts.map +1 -0
- package/dist/models/adminControllerGetUsersWithWalletsParams.d.ts +18 -0
- package/dist/models/adminControllerGetUsersWithWalletsParams.d.ts.map +1 -0
- package/dist/models/adminControllerGetWalletAssetsAssetType.d.ts +14 -0
- package/dist/models/adminControllerGetWalletAssetsAssetType.d.ts.map +1 -0
- package/dist/models/adminControllerGetWalletAssetsParams.d.ts +23 -0
- package/dist/models/adminControllerGetWalletAssetsParams.d.ts.map +1 -0
- package/dist/models/adminSignerConfigDto.d.ts +21 -0
- package/dist/models/adminSignerConfigDto.d.ts.map +1 -0
- package/dist/models/adminSignerConfigDtoType.d.ts +17 -0
- package/dist/models/adminSignerConfigDtoType.d.ts.map +1 -0
- package/dist/models/assignPlanDto.d.ts +13 -0
- package/dist/models/assignPlanDto.d.ts.map +1 -0
- package/dist/models/assignPlanDtoPlanEnforcementType.d.ts +17 -0
- package/dist/models/assignPlanDtoPlanEnforcementType.d.ts.map +1 -0
- package/dist/models/authControllerLogin200.d.ts +14 -0
- package/dist/models/authControllerLogin200.d.ts.map +1 -0
- package/dist/models/authControllerLogin200Data.d.ts +17 -0
- package/dist/models/authControllerLogin200Data.d.ts.map +1 -0
- package/dist/models/authControllerLogin200DataUser.d.ts +11 -0
- package/dist/models/authControllerLogin200DataUser.d.ts.map +1 -0
- package/dist/models/authControllerLogin200DataUserType.d.ts +14 -0
- package/dist/models/authControllerLogin200DataUserType.d.ts.map +1 -0
- package/dist/models/batchCreateWalletDto.d.ts +21 -0
- package/dist/models/batchCreateWalletDto.d.ts.map +1 -0
- package/dist/models/batchSendSolDto.d.ts +17 -0
- package/dist/models/batchSendSolDto.d.ts.map +1 -0
- package/dist/models/batchSendSolItem.d.ts +17 -0
- package/dist/models/batchSendSolItem.d.ts.map +1 -0
- package/dist/models/batchSendSplDto.d.ts +19 -0
- package/dist/models/batchSendSplDto.d.ts.map +1 -0
- package/dist/models/batchSendSplItem.d.ts +19 -0
- package/dist/models/batchSendSplItem.d.ts.map +1 -0
- package/dist/models/commonLoginDto.d.ts +14 -0
- package/dist/models/commonLoginDto.d.ts.map +1 -0
- package/dist/models/createAdminDto.d.ts +16 -0
- package/dist/models/createAdminDto.d.ts.map +1 -0
- package/dist/models/createApiKeySignerDto.d.ts +12 -0
- package/dist/models/createApiKeySignerDto.d.ts.map +1 -0
- package/dist/models/createDelegatedKeyDto.d.ts +17 -0
- package/dist/models/createDelegatedKeyDto.d.ts.map +1 -0
- package/dist/models/createEmailSignerDto.d.ts +14 -0
- package/dist/models/createEmailSignerDto.d.ts.map +1 -0
- package/dist/models/createExternalWalletSignerDto.d.ts +14 -0
- package/dist/models/createExternalWalletSignerDto.d.ts.map +1 -0
- package/dist/models/createPhoneSignerDto.d.ts +14 -0
- package/dist/models/createPhoneSignerDto.d.ts.map +1 -0
- package/dist/models/createPlanDto.d.ts +34 -0
- package/dist/models/createPlanDto.d.ts.map +1 -0
- package/dist/models/createPlanDtoEnforcementType.d.ts +17 -0
- package/dist/models/createPlanDtoEnforcementType.d.ts.map +1 -0
- package/dist/models/createPlanDtoFeatures.d.ts +14 -0
- package/dist/models/createPlanDtoFeatures.d.ts.map +1 -0
- package/dist/models/createPlanDtoMaxUsers.d.ts +14 -0
- package/dist/models/createPlanDtoMaxUsers.d.ts.map +1 -0
- package/dist/models/createPlanDtoMaxWalletsPerUser.d.ts +14 -0
- package/dist/models/createPlanDtoMaxWalletsPerUser.d.ts.map +1 -0
- package/dist/models/createPlanDtoMetadata.d.ts +14 -0
- package/dist/models/createPlanDtoMetadata.d.ts.map +1 -0
- package/dist/models/createPlanDtoPrice.d.ts +14 -0
- package/dist/models/createPlanDtoPrice.d.ts.map +1 -0
- package/dist/models/createPlatformDto.d.ts +24 -0
- package/dist/models/createPlatformDto.d.ts.map +1 -0
- package/dist/models/createUserDto.d.ts +20 -0
- package/dist/models/createUserDto.d.ts.map +1 -0
- package/dist/models/createWalletDto.d.ts +17 -0
- package/dist/models/createWalletDto.d.ts.map +1 -0
- package/dist/models/createWebhookDto.d.ts +15 -0
- package/dist/models/createWebhookDto.d.ts.map +1 -0
- package/dist/models/delegatedKeyPermissionsDto.d.ts +29 -0
- package/dist/models/delegatedKeyPermissionsDto.d.ts.map +1 -0
- package/dist/models/index.d.ts +100 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/loginAdminDto.d.ts +14 -0
- package/dist/models/loginAdminDto.d.ts.map +1 -0
- package/dist/models/loginPlatformDto.d.ts +14 -0
- package/dist/models/loginPlatformDto.d.ts.map +1 -0
- package/dist/models/loginUserDto.d.ts +14 -0
- package/dist/models/loginUserDto.d.ts.map +1 -0
- package/dist/models/mintNftDto.d.ts +15 -0
- package/dist/models/mintNftDto.d.ts.map +1 -0
- package/dist/models/mintNftSimpleDto.d.ts +29 -0
- package/dist/models/mintNftSimpleDto.d.ts.map +1 -0
- package/dist/models/mintTokenDto.d.ts +29 -0
- package/dist/models/mintTokenDto.d.ts.map +1 -0
- package/dist/models/mintTokenDtoTokenStandard.d.ts +16 -0
- package/dist/models/mintTokenDtoTokenStandard.d.ts.map +1 -0
- package/dist/models/nftAttribute.d.ts +14 -0
- package/dist/models/nftAttribute.d.ts.map +1 -0
- package/dist/models/passkeyAuthenticationDto.d.ts +15 -0
- package/dist/models/passkeyAuthenticationDto.d.ts.map +1 -0
- package/dist/models/passkeyAuthenticationDtoCredential.d.ts +14 -0
- package/dist/models/passkeyAuthenticationDtoCredential.d.ts.map +1 -0
- package/dist/models/passkeyRegistrationDto.d.ts +15 -0
- package/dist/models/passkeyRegistrationDto.d.ts.map +1 -0
- package/dist/models/passkeyRegistrationDtoCredential.d.ts +14 -0
- package/dist/models/passkeyRegistrationDtoCredential.d.ts.map +1 -0
- package/dist/models/permissionsDto.d.ts +20 -0
- package/dist/models/permissionsDto.d.ts.map +1 -0
- package/dist/models/sendSolDto.d.ts +21 -0
- package/dist/models/sendSolDto.d.ts.map +1 -0
- package/dist/models/sendSplDto.d.ts +23 -0
- package/dist/models/sendSplDto.d.ts.map +1 -0
- package/dist/models/sendTransactionDto.d.ts +17 -0
- package/dist/models/sendTransactionDto.d.ts.map +1 -0
- package/dist/models/simulateTransactionDto.d.ts +17 -0
- package/dist/models/simulateTransactionDto.d.ts.map +1 -0
- package/dist/models/transactionControllerGetWalletTransactionsParams.d.ts +38 -0
- package/dist/models/transactionControllerGetWalletTransactionsParams.d.ts.map +1 -0
- package/dist/models/transactionStatus.d.ts +14 -0
- package/dist/models/transactionStatus.d.ts.map +1 -0
- package/dist/models/transactionType.d.ts +19 -0
- package/dist/models/transactionType.d.ts.map +1 -0
- package/dist/models/updateAdminDto.d.ts +16 -0
- package/dist/models/updateAdminDto.d.ts.map +1 -0
- package/dist/models/updateAdminSignerDto.d.ts +12 -0
- package/dist/models/updateAdminSignerDto.d.ts.map +1 -0
- package/dist/models/updateDelegatedKeyDto.d.ts +17 -0
- package/dist/models/updateDelegatedKeyDto.d.ts.map +1 -0
- package/dist/models/updatePlanDto.d.ts +34 -0
- package/dist/models/updatePlanDto.d.ts.map +1 -0
- package/dist/models/updatePlanDtoEnforcementType.d.ts +17 -0
- package/dist/models/updatePlanDtoEnforcementType.d.ts.map +1 -0
- package/dist/models/updatePlanDtoFeatures.d.ts +14 -0
- package/dist/models/updatePlanDtoFeatures.d.ts.map +1 -0
- package/dist/models/updatePlanDtoMaxUsers.d.ts +14 -0
- package/dist/models/updatePlanDtoMaxUsers.d.ts.map +1 -0
- package/dist/models/updatePlanDtoMaxWalletsPerUser.d.ts +14 -0
- package/dist/models/updatePlanDtoMaxWalletsPerUser.d.ts.map +1 -0
- package/dist/models/updatePlanDtoMetadata.d.ts +14 -0
- package/dist/models/updatePlanDtoMetadata.d.ts.map +1 -0
- package/dist/models/updatePlanDtoPrice.d.ts +14 -0
- package/dist/models/updatePlanDtoPrice.d.ts.map +1 -0
- package/dist/models/updatePlatformDto.d.ts +24 -0
- package/dist/models/updatePlatformDto.d.ts.map +1 -0
- package/dist/models/updateSignerDto.d.ts +14 -0
- package/dist/models/updateSignerDto.d.ts.map +1 -0
- package/dist/models/updateSignerPermissionsDto.d.ts +13 -0
- package/dist/models/updateSignerPermissionsDto.d.ts.map +1 -0
- package/dist/models/updateUserDto.d.ts +20 -0
- package/dist/models/updateUserDto.d.ts.map +1 -0
- package/dist/models/updateWalletDto.d.ts +19 -0
- package/dist/models/updateWalletDto.d.ts.map +1 -0
- package/dist/models/updateWebhookDto.d.ts +17 -0
- package/dist/models/updateWebhookDto.d.ts.map +1 -0
- package/dist/models/walletAssetResponseDto.d.ts +21 -0
- package/dist/models/walletAssetResponseDto.d.ts.map +1 -0
- package/dist/models/walletAssetResponseDtoAssetType.d.ts +14 -0
- package/dist/models/walletAssetResponseDtoAssetType.d.ts.map +1 -0
- package/dist/models/walletAssetResponseDtoMetadata.d.ts +11 -0
- package/dist/models/walletAssetResponseDtoMetadata.d.ts.map +1 -0
- package/dist/models/walletControllerFindAllParams.d.ts +14 -0
- package/dist/models/walletControllerFindAllParams.d.ts.map +1 -0
- package/dist/models/walletControllerGetDeviceEncryptedSecretParams.d.ts +14 -0
- package/dist/models/walletControllerGetDeviceEncryptedSecretParams.d.ts.map +1 -0
- package/dist/models/walletControllerGetWalletAssetsAssetType.d.ts +14 -0
- package/dist/models/walletControllerGetWalletAssetsAssetType.d.ts.map +1 -0
- package/dist/models/walletControllerGetWalletAssetsParams.d.ts +15 -0
- package/dist/models/walletControllerGetWalletAssetsParams.d.ts.map +1 -0
- package/dist/models/walletControllerMintNFT200.d.ts +11 -0
- package/dist/models/walletControllerMintNFT200.d.ts.map +1 -0
- package/dist/models/walletControllerMintNFTSimple200.d.ts +13 -0
- package/dist/models/walletControllerMintNFTSimple200.d.ts.map +1 -0
- package/dist/models/walletControllerMintToken200.d.ts +14 -0
- package/dist/models/walletControllerMintToken200.d.ts.map +1 -0
- package/dist/models/walletControllerSendSOL200.d.ts +13 -0
- package/dist/models/walletControllerSendSOL200.d.ts.map +1 -0
- package/dist/models/walletControllerSendSOL200Wallet.d.ts +11 -0
- package/dist/models/walletControllerSendSOL200Wallet.d.ts.map +1 -0
- package/dist/models/walletControllerSendSPL200.d.ts +11 -0
- package/dist/models/walletControllerSendSPL200.d.ts.map +1 -0
- package/dist/models/walletControllerSendTransaction200.d.ts +11 -0
- package/dist/models/walletControllerSendTransaction200.d.ts.map +1 -0
- package/dist/models/webhookEvent.d.ts +23 -0
- package/dist/models/webhookEvent.d.ts.map +1 -0
- package/dist/platform.cjs +256 -0
- package/dist/platform.cjs.map +7 -0
- package/dist/platform.d.ts +16 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.mjs +210 -0
- package/dist/platform.mjs.map +7 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/user.cjs +132 -0
- package/dist/user.cjs.map +7 -0
- package/dist/user.d.ts +9 -0
- package/dist/user.d.ts.map +1 -0
- package/dist/user.mjs +93 -0
- package/dist/user.mjs.map +7 -0
- package/dist/wallet.cjs +547 -0
- package/dist/wallet.cjs.map +7 -0
- package/dist/wallet.d.ts +21 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.mjs +496 -0
- package/dist/wallet.mjs.map +7 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,1370 @@
|
|
|
1
|
+
# Cilantro Smart SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript/JavaScript SDK for interacting with the Cilantro Smart API - A Solana wallet management system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install cilantro-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Option 1: Using API Key (Recommended for Server-Side)
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { configure } from 'cilantro-sdk';
|
|
17
|
+
import { sendSOL } from 'cilantro-sdk/wallet';
|
|
18
|
+
|
|
19
|
+
// Configure SDK with your API key
|
|
20
|
+
configure({
|
|
21
|
+
apiKey: 'your-api-key-here'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Make authenticated requests
|
|
25
|
+
const result = await sendSOL('wallet-id', {
|
|
26
|
+
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
|
|
27
|
+
amountLamports: 1000000000
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Option 2: Using Login (For User Authentication)
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { loginAndSetAuth } from 'cilantro-sdk/auth';
|
|
35
|
+
import { sendSOL } from 'cilantro-sdk/wallet';
|
|
36
|
+
|
|
37
|
+
// Login and set authentication automatically
|
|
38
|
+
await loginAndSetAuth({
|
|
39
|
+
usernameOrEmail: 'user@example.com',
|
|
40
|
+
password: 'SecurePass123!'
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Make authenticated requests
|
|
44
|
+
const result = await sendSOL('wallet-id', {
|
|
45
|
+
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
|
|
46
|
+
amountLamports: 1000000000
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Option 3: Manual Authentication Control
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { setAuth } from 'cilantro-sdk';
|
|
54
|
+
import { login } from 'cilantro-sdk/auth';
|
|
55
|
+
import { sendSOL } from 'cilantro-sdk/wallet';
|
|
56
|
+
|
|
57
|
+
// Login without automatically setting auth
|
|
58
|
+
const authResult = await login({
|
|
59
|
+
usernameOrEmail: 'user@example.com',
|
|
60
|
+
password: 'password123'
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Manually set authentication
|
|
64
|
+
setAuth({ jwt: authResult.data.jwt });
|
|
65
|
+
|
|
66
|
+
// Make authenticated requests
|
|
67
|
+
const result = await sendSOL('wallet-id', {
|
|
68
|
+
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
|
|
69
|
+
amountLamports: 1000000000
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### CommonJS
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
const { configure } = require('cilantro-sdk');
|
|
77
|
+
const { sendSOL } = require('cilantro-sdk/wallet');
|
|
78
|
+
|
|
79
|
+
// Configure with API key
|
|
80
|
+
configure({ apiKey: 'your-api-key' });
|
|
81
|
+
|
|
82
|
+
// Make authenticated requests
|
|
83
|
+
const result = await sendSOL('wallet-id', { ... });
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Configuration
|
|
87
|
+
|
|
88
|
+
### SDK Configuration Functions
|
|
89
|
+
|
|
90
|
+
The SDK provides several functions to manage authentication and settings:
|
|
91
|
+
|
|
92
|
+
#### `configure(config)`
|
|
93
|
+
|
|
94
|
+
Initialize the SDK with configuration options including API key, JWT token, or base URL.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { configure } from 'cilantro-sdk';
|
|
98
|
+
|
|
99
|
+
configure({
|
|
100
|
+
apiKey: 'your-api-key', // Optional: API key for authentication
|
|
101
|
+
jwt: 'your-jwt-token', // Optional: JWT token for authentication
|
|
102
|
+
baseURL: 'https://api.cilantro.gg' // Optional: Custom API base URL
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### `setAuth(auth)`
|
|
107
|
+
|
|
108
|
+
Update authentication credentials after initialization.
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { setAuth } from 'cilantro-sdk';
|
|
112
|
+
|
|
113
|
+
setAuth({
|
|
114
|
+
jwt: 'your-jwt-token',
|
|
115
|
+
apiKey: 'your-api-key'
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### `clearAuth()`
|
|
120
|
+
|
|
121
|
+
Clear all authentication credentials.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { clearAuth } from 'cilantro-sdk';
|
|
125
|
+
|
|
126
|
+
clearAuth();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Authentication Types
|
|
130
|
+
|
|
131
|
+
The SDK supports two types of authentication:
|
|
132
|
+
|
|
133
|
+
1. **API Key Authentication**: For server-side applications and platform-level access
|
|
134
|
+
2. **JWT Token Authentication**: For user-specific operations after login
|
|
135
|
+
|
|
136
|
+
You can use either or both simultaneously. The SDK will automatically include the appropriate headers in all requests.
|
|
137
|
+
|
|
138
|
+
## Module Structure
|
|
139
|
+
|
|
140
|
+
The SDK is organized into modules for better code organization:
|
|
141
|
+
|
|
142
|
+
- **Platform** (`cilantro-sdk/platform`) - Platform management and user operations
|
|
143
|
+
- **User** (`cilantro-sdk/user`) - User account operations
|
|
144
|
+
- **Wallet** (`cilantro-sdk/wallet`) - Wallet and blockchain operations
|
|
145
|
+
- **Admin** (`cilantro-sdk/admin`) - Administrative operations
|
|
146
|
+
- **Auth** (`cilantro-sdk/auth`) - Universal authentication
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Platform Module
|
|
151
|
+
|
|
152
|
+
Platform management and user operations under a platform.
|
|
153
|
+
|
|
154
|
+
**Note:** For authentication, use the universal `login` function from the `auth` module instead of platform-specific login endpoints.
|
|
155
|
+
|
|
156
|
+
### `getOwnProfile(options?)`
|
|
157
|
+
|
|
158
|
+
Retrieve the authenticated platform's own profile information. Requires platform JWT token.
|
|
159
|
+
|
|
160
|
+
**Parameters:**
|
|
161
|
+
- `options?` - Optional axios request configuration
|
|
162
|
+
|
|
163
|
+
**Returns:** `Promise<PlatformControllerGetOwnProfileResult>`
|
|
164
|
+
|
|
165
|
+
**Example:**
|
|
166
|
+
```typescript
|
|
167
|
+
import { getOwnProfile } from 'cilantro-sdk/platform';
|
|
168
|
+
|
|
169
|
+
const profile = await getOwnProfile();
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `updateOwnProfile(updatePlatformDto, options?)`
|
|
173
|
+
|
|
174
|
+
Update own platform profile. Requires platform JWT token.
|
|
175
|
+
|
|
176
|
+
**Parameters:**
|
|
177
|
+
- `updatePlatformDto: UpdatePlatformDto` - Platform update data
|
|
178
|
+
- `firstName?: string` - Platform first name
|
|
179
|
+
- `lastName?: string` - Platform last name
|
|
180
|
+
- `email?: string` - Platform email address
|
|
181
|
+
- `password?: string` - Platform password (minimum 8 characters)
|
|
182
|
+
- `isActive?: boolean` - Whether the platform account is active
|
|
183
|
+
- `options?` - Optional axios request configuration
|
|
184
|
+
|
|
185
|
+
**Returns:** `Promise<PlatformControllerUpdateOwnProfileResult>`
|
|
186
|
+
|
|
187
|
+
**Example:**
|
|
188
|
+
```typescript
|
|
189
|
+
import { updateOwnProfile } from 'cilantro-sdk/platform';
|
|
190
|
+
|
|
191
|
+
await updateOwnProfile({
|
|
192
|
+
firstName: 'John',
|
|
193
|
+
lastName: 'Doe',
|
|
194
|
+
email: 'newemail@example.com'
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### `findOne(id, options?)`
|
|
199
|
+
|
|
200
|
+
Get platform by ID.
|
|
201
|
+
|
|
202
|
+
**Parameters:**
|
|
203
|
+
- `id: string` - Platform ID
|
|
204
|
+
- `options?` - Optional axios request configuration
|
|
205
|
+
|
|
206
|
+
**Returns:** `Promise<PlatformControllerFindOneResult>`
|
|
207
|
+
|
|
208
|
+
**Example:**
|
|
209
|
+
```typescript
|
|
210
|
+
import { findOne } from 'cilantro-sdk/platform';
|
|
211
|
+
|
|
212
|
+
const platform = await findOne('platform-id');
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### `remove(id, options?)`
|
|
216
|
+
|
|
217
|
+
Delete platform.
|
|
218
|
+
|
|
219
|
+
**Parameters:**
|
|
220
|
+
- `id: string` - Platform ID
|
|
221
|
+
- `options?` - Optional axios request configuration
|
|
222
|
+
|
|
223
|
+
**Returns:** `Promise<PlatformControllerRemoveResult>`
|
|
224
|
+
|
|
225
|
+
### `getUsers(options?)`
|
|
226
|
+
|
|
227
|
+
Retrieve all users that belong to the authenticated platform. Requires platform JWT token.
|
|
228
|
+
|
|
229
|
+
**Parameters:**
|
|
230
|
+
- `options?` - Optional axios request configuration
|
|
231
|
+
|
|
232
|
+
**Returns:** `Promise<PlatformControllerGetUsersForPlatformResult>`
|
|
233
|
+
|
|
234
|
+
**Example:**
|
|
235
|
+
```typescript
|
|
236
|
+
import { getUsers } from 'cilantro-sdk/platform';
|
|
237
|
+
|
|
238
|
+
const users = await getUsers();
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### `createUser(createUserDto, options?)`
|
|
242
|
+
|
|
243
|
+
Create user under this platform. Requires platform JWT token.
|
|
244
|
+
|
|
245
|
+
**Parameters:**
|
|
246
|
+
- `createUserDto: CreateUserDto` - User creation data
|
|
247
|
+
- `username: string` - Username
|
|
248
|
+
- `email: string` - User email address
|
|
249
|
+
- `password: string` - User password (minimum 8 characters)
|
|
250
|
+
- `isActive?: boolean` - Whether the user account is active
|
|
251
|
+
- `platformId?: string` - Platform ID this user belongs to
|
|
252
|
+
- `options?` - Optional axios request configuration
|
|
253
|
+
|
|
254
|
+
**Returns:** `Promise<PlatformControllerCreateUserForPlatformResult>`
|
|
255
|
+
|
|
256
|
+
**Example:**
|
|
257
|
+
```typescript
|
|
258
|
+
import { createUser } from 'cilantro-sdk/platform';
|
|
259
|
+
|
|
260
|
+
const newUser = await createUser({
|
|
261
|
+
username: 'johndoe',
|
|
262
|
+
email: 'user@example.com',
|
|
263
|
+
password: 'SecurePass123!',
|
|
264
|
+
isActive: true
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### `updateUser(userId, updateUserDto, options?)`
|
|
269
|
+
|
|
270
|
+
Update user under this platform. Requires platform JWT token.
|
|
271
|
+
|
|
272
|
+
**Parameters:**
|
|
273
|
+
- `userId: string` - User ID
|
|
274
|
+
- `updateUserDto: UpdateUserDto` - User update data
|
|
275
|
+
- `username?: string` - Username
|
|
276
|
+
- `email?: string` - User email address
|
|
277
|
+
- `password?: string` - User password (minimum 8 characters)
|
|
278
|
+
- `isActive?: boolean` - Whether the user account is active
|
|
279
|
+
- `platformId?: string` - Platform ID this user belongs to
|
|
280
|
+
- `options?` - Optional axios request configuration
|
|
281
|
+
|
|
282
|
+
**Returns:** `Promise<PlatformControllerUpdateUserForPlatformResult>`
|
|
283
|
+
|
|
284
|
+
**Example:**
|
|
285
|
+
```typescript
|
|
286
|
+
import { updateUser } from 'cilantro-sdk/platform';
|
|
287
|
+
|
|
288
|
+
await updateUser('user-id', {
|
|
289
|
+
username: 'newusername',
|
|
290
|
+
email: 'newemail@example.com'
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### `removeUser(userId, options?)`
|
|
295
|
+
|
|
296
|
+
Delete user under this platform. Requires platform JWT token.
|
|
297
|
+
|
|
298
|
+
**Parameters:**
|
|
299
|
+
- `userId: string` - User ID
|
|
300
|
+
- `options?` - Optional axios request configuration
|
|
301
|
+
|
|
302
|
+
**Returns:** `Promise<PlatformControllerRemoveUserForPlatformResult>`
|
|
303
|
+
|
|
304
|
+
### `toggleUserActive(userId, options?)`
|
|
305
|
+
|
|
306
|
+
Toggle user active status under this platform. Requires platform JWT token.
|
|
307
|
+
|
|
308
|
+
**Parameters:**
|
|
309
|
+
- `userId: string` - User ID
|
|
310
|
+
- `options?` - Optional axios request configuration
|
|
311
|
+
|
|
312
|
+
**Returns:** `Promise<PlatformControllerToggleUserActiveForPlatformResult>`
|
|
313
|
+
|
|
314
|
+
### `getWallets(options?)`
|
|
315
|
+
|
|
316
|
+
Retrieve all wallets belonging to users under the authenticated platform. Read-only access. Requires platform JWT token.
|
|
317
|
+
|
|
318
|
+
**Parameters:**
|
|
319
|
+
- `options?` - Optional axios request configuration
|
|
320
|
+
|
|
321
|
+
**Returns:** `Promise<PlatformControllerGetWalletsForPlatformResult>`
|
|
322
|
+
|
|
323
|
+
**Example:**
|
|
324
|
+
```typescript
|
|
325
|
+
import { getWallets } from 'cilantro-sdk/platform';
|
|
326
|
+
|
|
327
|
+
const wallets = await getWallets();
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## User Module
|
|
333
|
+
|
|
334
|
+
User account operations.
|
|
335
|
+
|
|
336
|
+
**Note:** For authentication, use the universal `login` function from the `auth` module instead of user-specific login endpoints.
|
|
337
|
+
|
|
338
|
+
### `create(createUserDto, options?)`
|
|
339
|
+
|
|
340
|
+
Register a new user.
|
|
341
|
+
|
|
342
|
+
**Parameters:**
|
|
343
|
+
- `createUserDto: CreateUserDto` - User creation data
|
|
344
|
+
- `username: string` - Username
|
|
345
|
+
- `email: string` - User email address
|
|
346
|
+
- `password: string` - User password (minimum 8 characters)
|
|
347
|
+
- `isActive?: boolean` - Whether the user account is active
|
|
348
|
+
- `platformId?: string` - Platform ID this user belongs to
|
|
349
|
+
- `options?` - Optional axios request configuration
|
|
350
|
+
|
|
351
|
+
**Returns:** `Promise<UserControllerCreateResult>`
|
|
352
|
+
|
|
353
|
+
**Example:**
|
|
354
|
+
```typescript
|
|
355
|
+
import { create } from 'cilantro-sdk/user';
|
|
356
|
+
|
|
357
|
+
const newUser = await create({
|
|
358
|
+
username: 'johndoe',
|
|
359
|
+
email: 'user@example.com',
|
|
360
|
+
password: 'SecurePass123!'
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### `findOne(id, options?)`
|
|
365
|
+
|
|
366
|
+
Retrieve user profile by ID. Users can only access their own profile. Requires user JWT token.
|
|
367
|
+
|
|
368
|
+
**Parameters:**
|
|
369
|
+
- `id: string` - User ID
|
|
370
|
+
- `options?` - Optional axios request configuration
|
|
371
|
+
|
|
372
|
+
**Returns:** `Promise<UserControllerFindOneResult>`
|
|
373
|
+
|
|
374
|
+
**Example:**
|
|
375
|
+
```typescript
|
|
376
|
+
import { findOne } from 'cilantro-sdk/user';
|
|
377
|
+
|
|
378
|
+
const user = await findOne('user-id');
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### `update(id, updateUserDto, options?)`
|
|
382
|
+
|
|
383
|
+
Update user profile by ID. Users can only update their own profile. Requires user JWT token.
|
|
384
|
+
|
|
385
|
+
**Parameters:**
|
|
386
|
+
- `id: string` - User ID
|
|
387
|
+
- `updateUserDto: UpdateUserDto` - User update data
|
|
388
|
+
- `username?: string` - Username
|
|
389
|
+
- `email?: string` - User email address
|
|
390
|
+
- `password?: string` - User password (minimum 8 characters)
|
|
391
|
+
- `isActive?: boolean` - Whether the user account is active
|
|
392
|
+
- `platformId?: string` - Platform ID this user belongs to
|
|
393
|
+
- `options?` - Optional axios request configuration
|
|
394
|
+
|
|
395
|
+
**Returns:** `Promise<UserControllerUpdateResult>`
|
|
396
|
+
|
|
397
|
+
**Example:**
|
|
398
|
+
```typescript
|
|
399
|
+
import { update } from 'cilantro-sdk/user';
|
|
400
|
+
|
|
401
|
+
await update('user-id', {
|
|
402
|
+
username: 'newusername',
|
|
403
|
+
email: 'newemail@example.com'
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Wallet Module
|
|
410
|
+
|
|
411
|
+
Wallet and blockchain operations on Solana.
|
|
412
|
+
|
|
413
|
+
### `create(createWalletDto, options?)`
|
|
414
|
+
|
|
415
|
+
Initialize a new wallet on-chain and store in database. Requires user JWT token.
|
|
416
|
+
|
|
417
|
+
**Parameters:**
|
|
418
|
+
- `createWalletDto: CreateWalletDto` - Wallet creation data
|
|
419
|
+
- `walletName: string` - Wallet name
|
|
420
|
+
- `options?` - Optional axios request configuration
|
|
421
|
+
|
|
422
|
+
**Returns:** `Promise<WalletControllerCreateResult>`
|
|
423
|
+
|
|
424
|
+
**Example:**
|
|
425
|
+
```typescript
|
|
426
|
+
import { create } from 'cilantro-sdk/wallet';
|
|
427
|
+
|
|
428
|
+
const newWallet = await create({
|
|
429
|
+
walletName: 'My Solana Wallet'
|
|
430
|
+
});
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### `findAll(options?)`
|
|
434
|
+
|
|
435
|
+
Get all wallets for authenticated user. Requires user JWT token.
|
|
436
|
+
|
|
437
|
+
**Parameters:**
|
|
438
|
+
- `options?` - Optional axios request configuration
|
|
439
|
+
|
|
440
|
+
**Returns:** `Promise<WalletControllerFindAllResult>`
|
|
441
|
+
|
|
442
|
+
**Example:**
|
|
443
|
+
```typescript
|
|
444
|
+
import { findAll } from 'cilantro-sdk/wallet';
|
|
445
|
+
|
|
446
|
+
const wallets = await findAll();
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### `getTotalBalance(options?)`
|
|
450
|
+
|
|
451
|
+
Get total balance across all user wallets. Requires user JWT token.
|
|
452
|
+
|
|
453
|
+
**Parameters:**
|
|
454
|
+
- `options?` - Optional axios request configuration
|
|
455
|
+
|
|
456
|
+
**Returns:** `Promise<number>` - Balance in lamports
|
|
457
|
+
|
|
458
|
+
**Example:**
|
|
459
|
+
```typescript
|
|
460
|
+
import { getTotalBalance } from 'cilantro-sdk/wallet';
|
|
461
|
+
|
|
462
|
+
const balance = await getTotalBalance();
|
|
463
|
+
console.log(`Total balance: ${balance / 1e9} SOL`);
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### `findOne(id, options?)`
|
|
467
|
+
|
|
468
|
+
Get wallet by ID. Requires user JWT token.
|
|
469
|
+
|
|
470
|
+
**Parameters:**
|
|
471
|
+
- `id: string` - Wallet ID
|
|
472
|
+
- `options?` - Optional axios request configuration
|
|
473
|
+
|
|
474
|
+
**Returns:** `Promise<WalletControllerFindOneResult>`
|
|
475
|
+
|
|
476
|
+
**Example:**
|
|
477
|
+
```typescript
|
|
478
|
+
import { findOne } from 'cilantro-sdk/wallet';
|
|
479
|
+
|
|
480
|
+
const wallet = await findOne('wallet-id');
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### `update(id, updateWalletDto, options?)`
|
|
484
|
+
|
|
485
|
+
Update wallet. Requires user JWT token.
|
|
486
|
+
|
|
487
|
+
**Parameters:**
|
|
488
|
+
- `id: string` - Wallet ID
|
|
489
|
+
- `updateWalletDto: UpdateWalletDto` - Wallet update data
|
|
490
|
+
- `walletName?: string` - Wallet name
|
|
491
|
+
- `options?` - Optional axios request configuration
|
|
492
|
+
|
|
493
|
+
**Returns:** `Promise<WalletControllerUpdateResult>`
|
|
494
|
+
|
|
495
|
+
**Example:**
|
|
496
|
+
```typescript
|
|
497
|
+
import { update } from 'cilantro-sdk/wallet';
|
|
498
|
+
|
|
499
|
+
await update('wallet-id', {
|
|
500
|
+
walletName: 'Updated Wallet Name'
|
|
501
|
+
});
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### `remove(id, options?)`
|
|
505
|
+
|
|
506
|
+
Delete wallet. Requires user JWT token.
|
|
507
|
+
|
|
508
|
+
**Parameters:**
|
|
509
|
+
- `id: string` - Wallet ID
|
|
510
|
+
- `options?` - Optional axios request configuration
|
|
511
|
+
|
|
512
|
+
**Returns:** `Promise<WalletControllerRemoveResult>`
|
|
513
|
+
|
|
514
|
+
### `findByAddress(address, options?)`
|
|
515
|
+
|
|
516
|
+
Get wallet by address. Requires user JWT token.
|
|
517
|
+
|
|
518
|
+
**Parameters:**
|
|
519
|
+
- `address: string` - Solana wallet address
|
|
520
|
+
- `options?` - Optional axios request configuration
|
|
521
|
+
|
|
522
|
+
**Returns:** `Promise<WalletControllerFindByAddressResult>`
|
|
523
|
+
|
|
524
|
+
**Example:**
|
|
525
|
+
```typescript
|
|
526
|
+
import { findByAddress } from 'cilantro-sdk/wallet';
|
|
527
|
+
|
|
528
|
+
const wallet = await findByAddress('DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK');
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### `sendSOL(id, sendSolDto, options?)`
|
|
532
|
+
|
|
533
|
+
Send SOL from wallet to recipient. Requires user JWT token.
|
|
534
|
+
|
|
535
|
+
**Parameters:**
|
|
536
|
+
- `id: string` - Wallet ID
|
|
537
|
+
- `sendSolDto: SendSolDto` - Send SOL data
|
|
538
|
+
- `recipientAddress: string` - Recipient Solana wallet address
|
|
539
|
+
- `amountLamports: number` - Amount to send in lamports (1 SOL = 1,000,000,000 lamports), minimum 1
|
|
540
|
+
- `options?` - Optional axios request configuration
|
|
541
|
+
|
|
542
|
+
**Returns:** `Promise<WalletControllerSendSOL200>`
|
|
543
|
+
|
|
544
|
+
**Example:**
|
|
545
|
+
```typescript
|
|
546
|
+
import { sendSOL } from 'cilantro-sdk/wallet';
|
|
547
|
+
|
|
548
|
+
const result = await sendSOL('wallet-id', {
|
|
549
|
+
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
|
|
550
|
+
amountLamports: 1000000000 // 1 SOL
|
|
551
|
+
});
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### `sendSPL(id, sendSplDto, options?)`
|
|
555
|
+
|
|
556
|
+
Send SPL tokens from wallet to recipient. Requires user JWT token.
|
|
557
|
+
|
|
558
|
+
**Parameters:**
|
|
559
|
+
- `id: string` - Wallet ID
|
|
560
|
+
- `sendSplDto: SendSplDto` - Send SPL data
|
|
561
|
+
- `mintAddress: string` - SPL token mint address
|
|
562
|
+
- `recipientAddress: string` - Recipient Solana wallet address
|
|
563
|
+
- `amount: number` - Token amount to send (in human-readable units, e.g., 100 for 100 tokens). Decimals are automatically fetched from on-chain. Minimum 0
|
|
564
|
+
- `options?` - Optional axios request configuration
|
|
565
|
+
|
|
566
|
+
**Returns:** `Promise<WalletControllerSendSPL200>`
|
|
567
|
+
|
|
568
|
+
**Example:**
|
|
569
|
+
```typescript
|
|
570
|
+
import { sendSPL } from 'cilantro-sdk/wallet';
|
|
571
|
+
|
|
572
|
+
const result = await sendSPL('wallet-id', {
|
|
573
|
+
mintAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
|
|
574
|
+
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
|
|
575
|
+
amount: 100
|
|
576
|
+
});
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### `mintNFT(id, mintNftDto, options?)`
|
|
580
|
+
|
|
581
|
+
Mint NFT using Metaplex via CPI (Advanced). Requires user JWT token.
|
|
582
|
+
|
|
583
|
+
**Parameters:**
|
|
584
|
+
- `id: string` - Wallet ID
|
|
585
|
+
- `mintNftDto: MintNftDto` - Mint NFT data
|
|
586
|
+
- `metaplexInstructionData: string` - Metaplex instruction data encoded in base64
|
|
587
|
+
- `accounts: AccountMeta[]` - Array of account metadata for the transaction
|
|
588
|
+
- `pubkey: string` - Account public key
|
|
589
|
+
- `isWritable: boolean` - Whether the account is writable
|
|
590
|
+
- `isSigner: boolean` - Whether the account is a signer
|
|
591
|
+
- `options?` - Optional axios request configuration
|
|
592
|
+
|
|
593
|
+
**Returns:** `Promise<WalletControllerMintNFT200>`
|
|
594
|
+
|
|
595
|
+
### `mintNFTSimple(id, mintNftSimpleDto, options?)`
|
|
596
|
+
|
|
597
|
+
Mint NFT with metadata - handles all logic internally using Metaplex Core. Requires user JWT token.
|
|
598
|
+
|
|
599
|
+
**Parameters:**
|
|
600
|
+
- `id: string` - Wallet ID
|
|
601
|
+
- `mintNftSimpleDto: MintNftSimpleDto` - Mint NFT simple data
|
|
602
|
+
- `name: string` - NFT name
|
|
603
|
+
- `symbol: string` - NFT symbol
|
|
604
|
+
- `description: string` - NFT description
|
|
605
|
+
- `imageUri: string` - Image URI (IPFS, Arweave, or HTTP URL)
|
|
606
|
+
- `externalUrl?: string` - External URL for the NFT
|
|
607
|
+
- `attributes?: NftAttribute[]` - NFT attributes/traits
|
|
608
|
+
- `trait_type: string` - Trait type/name
|
|
609
|
+
- `value: string` - Trait value
|
|
610
|
+
- `sellerFeeBasisPoints?: number` - Seller fee basis points (royalties: 100 = 1%), default 0, min 0, max 10000
|
|
611
|
+
- `options?` - Optional axios request configuration
|
|
612
|
+
|
|
613
|
+
**Returns:** `Promise<WalletControllerMintNFTSimple200>`
|
|
614
|
+
|
|
615
|
+
**Example:**
|
|
616
|
+
```typescript
|
|
617
|
+
import { mintNFTSimple } from 'cilantro-sdk/wallet';
|
|
618
|
+
|
|
619
|
+
const result = await mintNFTSimple('wallet-id', {
|
|
620
|
+
name: 'My Awesome NFT',
|
|
621
|
+
symbol: 'MNFT',
|
|
622
|
+
description: 'A unique digital collectible',
|
|
623
|
+
imageUri: 'https://arweave.net/abc123...',
|
|
624
|
+
externalUrl: 'https://myproject.com/nft/1',
|
|
625
|
+
attributes: [
|
|
626
|
+
{ trait_type: 'Color', value: 'Blue' },
|
|
627
|
+
{ trait_type: 'Rarity', value: 'Legendary' }
|
|
628
|
+
],
|
|
629
|
+
sellerFeeBasisPoints: 500 // 5% royalties
|
|
630
|
+
});
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### `mintToken(id, mintTokenDto, options?)`
|
|
634
|
+
|
|
635
|
+
Mint fungible token (SPL or Token-2022) with initial supply to wallet. Requires user JWT token.
|
|
636
|
+
|
|
637
|
+
**Parameters:**
|
|
638
|
+
- `id: string` - Wallet ID
|
|
639
|
+
- `mintTokenDto: MintTokenDto` - Mint token data
|
|
640
|
+
- `name: string` - Token name
|
|
641
|
+
- `symbol: string` - Token symbol
|
|
642
|
+
- `decimals: number` - Number of decimal places, min 0, max 9
|
|
643
|
+
- `initialSupply: number` - Initial supply to mint to the wallet
|
|
644
|
+
- `tokenStandard: 'spl' | 'token-2022'` - Token standard to use
|
|
645
|
+
- `description?: string` - Token description (used for Token-2022 metadata)
|
|
646
|
+
- `imageUri?: string` - Image URI for token (used for Token-2022 metadata)
|
|
647
|
+
- `options?` - Optional axios request configuration
|
|
648
|
+
|
|
649
|
+
**Returns:** `Promise<WalletControllerMintToken200>`
|
|
650
|
+
|
|
651
|
+
**Example:**
|
|
652
|
+
```typescript
|
|
653
|
+
import { mintToken } from 'cilantro-sdk/wallet';
|
|
654
|
+
|
|
655
|
+
const result = await mintToken('wallet-id', {
|
|
656
|
+
name: 'My Token',
|
|
657
|
+
symbol: 'MTK',
|
|
658
|
+
decimals: 9,
|
|
659
|
+
initialSupply: 1000000,
|
|
660
|
+
tokenStandard: 'spl'
|
|
661
|
+
});
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### `sendTransaction(id, sendTransactionDto, options?)`
|
|
665
|
+
|
|
666
|
+
Execute arbitrary transaction via CPI to any Solana program. Requires user JWT token.
|
|
667
|
+
|
|
668
|
+
**Parameters:**
|
|
669
|
+
- `id: string` - Wallet ID
|
|
670
|
+
- `sendTransactionDto: SendTransactionDto` - Transaction data
|
|
671
|
+
- `targetProgramId: string` - Target program public key to execute instruction on
|
|
672
|
+
- `instructionData: string` - Instruction data encoded in base64
|
|
673
|
+
- `accounts: AccountMeta[]` - Array of account metadata for the transaction
|
|
674
|
+
- `pubkey: string` - Account public key
|
|
675
|
+
- `isWritable: boolean` - Whether the account is writable
|
|
676
|
+
- `isSigner: boolean` - Whether the account is a signer
|
|
677
|
+
- `options?` - Optional axios request configuration
|
|
678
|
+
|
|
679
|
+
**Returns:** `Promise<WalletControllerSendTransaction200>`
|
|
680
|
+
|
|
681
|
+
**Example:**
|
|
682
|
+
```typescript
|
|
683
|
+
import { sendTransaction } from 'cilantro-sdk/wallet';
|
|
684
|
+
|
|
685
|
+
const result = await sendTransaction('wallet-id', {
|
|
686
|
+
targetProgramId: 'ProgramIdHere...',
|
|
687
|
+
instructionData: 'base64EncodedData...',
|
|
688
|
+
accounts: [
|
|
689
|
+
{
|
|
690
|
+
pubkey: 'AccountPubkey...',
|
|
691
|
+
isWritable: true,
|
|
692
|
+
isSigner: false
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
});
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### `getAssets(id, params?, options?)`
|
|
699
|
+
|
|
700
|
+
Get all assets for a wallet (cached with auto-refresh). Requires user JWT token.
|
|
701
|
+
|
|
702
|
+
**Parameters:**
|
|
703
|
+
- `id: string` - Wallet ID
|
|
704
|
+
- `params?: WalletControllerGetWalletAssetsParams` - Query parameters
|
|
705
|
+
- `assetType?: 'NFT' | 'SPL_TOKEN' | 'SOL'` - Filter by asset type
|
|
706
|
+
- `options?` - Optional axios request configuration
|
|
707
|
+
|
|
708
|
+
**Returns:** `Promise<WalletAssetResponseDto[]>`
|
|
709
|
+
|
|
710
|
+
**Example:**
|
|
711
|
+
```typescript
|
|
712
|
+
import { getAssets } from 'cilantro-sdk/wallet';
|
|
713
|
+
|
|
714
|
+
const assets = await getAssets('wallet-id', {
|
|
715
|
+
assetType: 'NFT'
|
|
716
|
+
});
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
### `syncAssets(id, options?)`
|
|
720
|
+
|
|
721
|
+
Force sync wallet balance and assets from blockchain immediately. Requires user JWT token.
|
|
722
|
+
|
|
723
|
+
**Parameters:**
|
|
724
|
+
- `id: string` - Wallet ID
|
|
725
|
+
- `options?` - Optional axios request configuration
|
|
726
|
+
|
|
727
|
+
**Returns:** `Promise<WalletAssetResponseDto[]>`
|
|
728
|
+
|
|
729
|
+
**Example:**
|
|
730
|
+
```typescript
|
|
731
|
+
import { syncAssets } from 'cilantro-sdk/wallet';
|
|
732
|
+
|
|
733
|
+
const assets = await syncAssets('wallet-id');
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## Admin Module
|
|
739
|
+
|
|
740
|
+
Administrative operations for managing the system. All admin endpoints require admin JWT token.
|
|
741
|
+
|
|
742
|
+
**Note:** For authentication, use the universal `login` function from the `auth` module instead of admin-specific login endpoints.
|
|
743
|
+
|
|
744
|
+
### `create(createAdminDto, options?)`
|
|
745
|
+
|
|
746
|
+
Register a new admin.
|
|
747
|
+
|
|
748
|
+
**Parameters:**
|
|
749
|
+
- `createAdminDto: CreateAdminDto` - Admin creation data
|
|
750
|
+
- `username: string` - Admin username
|
|
751
|
+
- `email: string` - Admin email address
|
|
752
|
+
- `password: string` - Admin password (min 8 characters)
|
|
753
|
+
- `options?` - Optional axios request configuration
|
|
754
|
+
|
|
755
|
+
**Returns:** `Promise<AdminControllerCreateResult>`
|
|
756
|
+
|
|
757
|
+
**Example:**
|
|
758
|
+
```typescript
|
|
759
|
+
import { create } from 'cilantro-sdk/admin';
|
|
760
|
+
|
|
761
|
+
const newAdmin = await create({
|
|
762
|
+
username: 'admin',
|
|
763
|
+
email: 'admin@example.com',
|
|
764
|
+
password: 'SecurePass123!'
|
|
765
|
+
});
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
### `findAll(params?, options?)`
|
|
769
|
+
|
|
770
|
+
Get all admins. Requires admin JWT token.
|
|
771
|
+
|
|
772
|
+
**Parameters:**
|
|
773
|
+
- `params?: AdminControllerFindAllParams` - Query parameters
|
|
774
|
+
- `page?: number` - Page number for pagination
|
|
775
|
+
- `limit?: number` - Number of results per page
|
|
776
|
+
- `options?` - Optional axios request configuration
|
|
777
|
+
|
|
778
|
+
**Returns:** `Promise<AdminControllerFindAllResult>`
|
|
779
|
+
|
|
780
|
+
**Example:**
|
|
781
|
+
```typescript
|
|
782
|
+
import { findAll } from 'cilantro-sdk/admin';
|
|
783
|
+
|
|
784
|
+
const admins = await findAll({ page: 1, limit: 10 });
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
### `getCurrentAdmin(options?)`
|
|
788
|
+
|
|
789
|
+
Get current admin profile. Requires admin JWT token.
|
|
790
|
+
|
|
791
|
+
**Parameters:**
|
|
792
|
+
- `options?` - Optional axios request configuration
|
|
793
|
+
|
|
794
|
+
**Returns:** `Promise<AdminControllerGetCurrentAdminResult>`
|
|
795
|
+
|
|
796
|
+
### `getAllApiKeys(options?)`
|
|
797
|
+
|
|
798
|
+
Get all platform API keys. Requires admin JWT token.
|
|
799
|
+
|
|
800
|
+
**Parameters:**
|
|
801
|
+
- `options?` - Optional axios request configuration
|
|
802
|
+
|
|
803
|
+
**Returns:** `Promise<AdminControllerGetAllApiKeysResult>`
|
|
804
|
+
|
|
805
|
+
### `getPlatformApiKey(platformId, options?)`
|
|
806
|
+
|
|
807
|
+
Get specific platform API key. Requires admin JWT token.
|
|
808
|
+
|
|
809
|
+
**Parameters:**
|
|
810
|
+
- `platformId: string` - Platform ID
|
|
811
|
+
- `options?` - Optional axios request configuration
|
|
812
|
+
|
|
813
|
+
**Returns:** `Promise<AdminControllerGetplatformApiKeyResult>`
|
|
814
|
+
|
|
815
|
+
### `findOne(id, options?)`
|
|
816
|
+
|
|
817
|
+
Get admin by ID. Requires admin JWT token.
|
|
818
|
+
|
|
819
|
+
**Parameters:**
|
|
820
|
+
- `id: string` - Admin ID
|
|
821
|
+
- `options?` - Optional axios request configuration
|
|
822
|
+
|
|
823
|
+
**Returns:** `Promise<AdminControllerFindOneResult>`
|
|
824
|
+
|
|
825
|
+
### `update(id, updateAdminDto, options?)`
|
|
826
|
+
|
|
827
|
+
Update admin. Requires admin JWT token.
|
|
828
|
+
|
|
829
|
+
**Parameters:**
|
|
830
|
+
- `id: string` - Admin ID
|
|
831
|
+
- `updateAdminDto: UpdateAdminDto` - Admin update data
|
|
832
|
+
- `username?: string` - Admin username
|
|
833
|
+
- `email?: string` - Admin email address
|
|
834
|
+
- `password?: string` - New password (min 8 characters)
|
|
835
|
+
- `options?` - Optional axios request configuration
|
|
836
|
+
|
|
837
|
+
**Returns:** `Promise<AdminControllerUpdateResult>`
|
|
838
|
+
|
|
839
|
+
### `remove(id, options?)`
|
|
840
|
+
|
|
841
|
+
Delete admin. Requires admin JWT token.
|
|
842
|
+
|
|
843
|
+
**Parameters:**
|
|
844
|
+
- `id: string` - Admin ID
|
|
845
|
+
- `options?` - Optional axios request configuration
|
|
846
|
+
|
|
847
|
+
**Returns:** `Promise<AdminControllerRemoveResult>`
|
|
848
|
+
|
|
849
|
+
### `toggleActive(id, options?)`
|
|
850
|
+
|
|
851
|
+
Toggle admin active status. Requires admin JWT token.
|
|
852
|
+
|
|
853
|
+
**Parameters:**
|
|
854
|
+
- `id: string` - Admin ID
|
|
855
|
+
- `options?` - Optional axios request configuration
|
|
856
|
+
|
|
857
|
+
**Returns:** `Promise<AdminControllerToggleActiveResult>`
|
|
858
|
+
|
|
859
|
+
### `findAllPlatforms(params?, options?)`
|
|
860
|
+
|
|
861
|
+
View all platforms. Requires admin JWT token.
|
|
862
|
+
|
|
863
|
+
**Parameters:**
|
|
864
|
+
- `params?: AdminControllerFindAllPlatformsParams` - Query parameters
|
|
865
|
+
- `page?: number` - Page number for pagination
|
|
866
|
+
- `limit?: number` - Number of results per page
|
|
867
|
+
- `options?` - Optional axios request configuration
|
|
868
|
+
|
|
869
|
+
**Returns:** `Promise<AdminControllerFindAllPlatformsResult>`
|
|
870
|
+
|
|
871
|
+
**Example:**
|
|
872
|
+
```typescript
|
|
873
|
+
import { findAllPlatforms } from 'cilantro-sdk/admin';
|
|
874
|
+
|
|
875
|
+
const platforms = await findAllPlatforms({ page: 1, limit: 20 });
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
### `findOnePlatform(id, options?)`
|
|
879
|
+
|
|
880
|
+
View platform details. Requires admin JWT token.
|
|
881
|
+
|
|
882
|
+
**Parameters:**
|
|
883
|
+
- `id: string` - Platform ID
|
|
884
|
+
- `options?` - Optional axios request configuration
|
|
885
|
+
|
|
886
|
+
**Returns:** `Promise<AdminControllerFindOnePlatformResult>`
|
|
887
|
+
|
|
888
|
+
### `updatePlatform(id, updatePlatformDto, options?)`
|
|
889
|
+
|
|
890
|
+
Update platform. Requires admin JWT token.
|
|
891
|
+
|
|
892
|
+
**Parameters:**
|
|
893
|
+
- `id: string` - Platform ID
|
|
894
|
+
- `updatePlatformDto: UpdatePlatformDto` - Platform update data
|
|
895
|
+
- `firstName?: string` - Platform first name
|
|
896
|
+
- `lastName?: string` - Platform last name
|
|
897
|
+
- `email?: string` - Platform email address
|
|
898
|
+
- `password?: string` - Platform password (minimum 8 characters)
|
|
899
|
+
- `isActive?: boolean` - Whether the platform account is active
|
|
900
|
+
- `options?` - Optional axios request configuration
|
|
901
|
+
|
|
902
|
+
**Returns:** `Promise<AdminControllerUpdatePlatformResult>`
|
|
903
|
+
|
|
904
|
+
### `removePlatform(id, options?)`
|
|
905
|
+
|
|
906
|
+
Delete platform. Requires admin JWT token.
|
|
907
|
+
|
|
908
|
+
**Parameters:**
|
|
909
|
+
- `id: string` - Platform ID
|
|
910
|
+
- `options?` - Optional axios request configuration
|
|
911
|
+
|
|
912
|
+
**Returns:** `Promise<AdminControllerRemovePlatformResult>`
|
|
913
|
+
|
|
914
|
+
### `findAllUsers(options?)`
|
|
915
|
+
|
|
916
|
+
Retrieve all users in the system. Admin has read-only access to user data. Requires admin JWT token.
|
|
917
|
+
|
|
918
|
+
**Parameters:**
|
|
919
|
+
- `options?` - Optional axios request configuration
|
|
920
|
+
|
|
921
|
+
**Returns:** `Promise<AdminControllerFindAllUsersResult>`
|
|
922
|
+
|
|
923
|
+
### `findOneUser(id, options?)`
|
|
924
|
+
|
|
925
|
+
View user details. Requires admin JWT token.
|
|
926
|
+
|
|
927
|
+
**Parameters:**
|
|
928
|
+
- `id: string` - User ID
|
|
929
|
+
- `options?` - Optional axios request configuration
|
|
930
|
+
|
|
931
|
+
**Returns:** `Promise<AdminControllerFindOneUserResult>`
|
|
932
|
+
|
|
933
|
+
### `findAllWallets(options?)`
|
|
934
|
+
|
|
935
|
+
Retrieve all wallets in the system. Admin has read-only access to wallet data. Requires admin JWT token.
|
|
936
|
+
|
|
937
|
+
**Parameters:**
|
|
938
|
+
- `options?` - Optional axios request configuration
|
|
939
|
+
|
|
940
|
+
**Returns:** `Promise<AdminControllerFindAllWalletsResult>`
|
|
941
|
+
|
|
942
|
+
### `findWalletsByUserId(userId, options?)`
|
|
943
|
+
|
|
944
|
+
View all wallets for a specific user (read-only). Requires admin JWT token.
|
|
945
|
+
|
|
946
|
+
**Parameters:**
|
|
947
|
+
- `userId: string` - User ID
|
|
948
|
+
- `options?` - Optional axios request configuration
|
|
949
|
+
|
|
950
|
+
**Returns:** `Promise<AdminControllerFindWalletsByUserIdResult>`
|
|
951
|
+
|
|
952
|
+
### `findOneWallet(id, options?)`
|
|
953
|
+
|
|
954
|
+
View wallet details (read-only). Requires admin JWT token.
|
|
955
|
+
|
|
956
|
+
**Parameters:**
|
|
957
|
+
- `id: string` - Wallet ID
|
|
958
|
+
- `options?` - Optional axios request configuration
|
|
959
|
+
|
|
960
|
+
**Returns:** `Promise<AdminControllerFindOneWalletResult>`
|
|
961
|
+
|
|
962
|
+
### `getOverviewAnalytics(options?)`
|
|
963
|
+
|
|
964
|
+
Get dashboard overview analytics. Requires admin JWT token.
|
|
965
|
+
|
|
966
|
+
**Parameters:**
|
|
967
|
+
- `options?` - Optional axios request configuration
|
|
968
|
+
|
|
969
|
+
**Returns:** `Promise<AdminControllerGetOverviewAnalyticsResult>`
|
|
970
|
+
|
|
971
|
+
### `getWalletAnalytics(options?)`
|
|
972
|
+
|
|
973
|
+
Get wallet analytics and statistics. Requires admin JWT token.
|
|
974
|
+
|
|
975
|
+
**Parameters:**
|
|
976
|
+
- `options?` - Optional axios request configuration
|
|
977
|
+
|
|
978
|
+
**Returns:** `Promise<AdminControllerGetWalletAnalyticsResult>`
|
|
979
|
+
|
|
980
|
+
### `getRecentActivity(options?)`
|
|
981
|
+
|
|
982
|
+
Get recent activity across all entities. Requires admin JWT token.
|
|
983
|
+
|
|
984
|
+
**Parameters:**
|
|
985
|
+
- `options?` - Optional axios request configuration
|
|
986
|
+
|
|
987
|
+
**Returns:** `Promise<AdminControllerGetRecentActivityResult>`
|
|
988
|
+
|
|
989
|
+
### `regenerateApiKey(platformId, options?)`
|
|
990
|
+
|
|
991
|
+
Regenerate platform API key. Requires admin JWT token.
|
|
992
|
+
|
|
993
|
+
**Parameters:**
|
|
994
|
+
- `platformId: string` - Platform ID
|
|
995
|
+
- `options?` - Optional axios request configuration
|
|
996
|
+
|
|
997
|
+
**Returns:** `Promise<AdminControllerRegenerateApiKeyResult>`
|
|
998
|
+
|
|
999
|
+
### `getPlatformsWithUsers(params?, options?)`
|
|
1000
|
+
|
|
1001
|
+
Get platforms with their user counts. Requires admin JWT token.
|
|
1002
|
+
|
|
1003
|
+
**Parameters:**
|
|
1004
|
+
- `params?: AdminControllerGetPlatformsWithUsersParams` - Query parameters
|
|
1005
|
+
- `page?: number` - Page number for pagination
|
|
1006
|
+
- `limit?: number` - Number of results per page
|
|
1007
|
+
- `options?` - Optional axios request configuration
|
|
1008
|
+
|
|
1009
|
+
**Returns:** `Promise<AdminControllerGetPlatformsWithUsersResult>`
|
|
1010
|
+
|
|
1011
|
+
**Example:**
|
|
1012
|
+
```typescript
|
|
1013
|
+
import { getPlatformsWithUsers } from 'cilantro-sdk/admin';
|
|
1014
|
+
|
|
1015
|
+
const data = await getPlatformsWithUsers({ page: 1, limit: 10 });
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
### `getUsersWithWallets(params?, options?)`
|
|
1019
|
+
|
|
1020
|
+
Get users with their wallet counts and balances. Requires admin JWT token.
|
|
1021
|
+
|
|
1022
|
+
**Parameters:**
|
|
1023
|
+
- `params?: AdminControllerGetUsersWithWalletsParams` - Query parameters
|
|
1024
|
+
- `page?: number` - Page number for pagination
|
|
1025
|
+
- `limit?: number` - Number of results per page
|
|
1026
|
+
- `options?` - Optional axios request configuration
|
|
1027
|
+
|
|
1028
|
+
**Returns:** `Promise<AdminControllerGetUsersWithWalletsResult>`
|
|
1029
|
+
|
|
1030
|
+
**Example:**
|
|
1031
|
+
```typescript
|
|
1032
|
+
import { getUsersWithWallets } from 'cilantro-sdk/admin';
|
|
1033
|
+
|
|
1034
|
+
const data = await getUsersWithWallets({ page: 1, limit: 10 });
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
### `getWalletAssets(params?, options?)`
|
|
1038
|
+
|
|
1039
|
+
Get all wallet assets with filtering. Requires admin JWT token.
|
|
1040
|
+
|
|
1041
|
+
**Parameters:**
|
|
1042
|
+
- `params?: AdminControllerGetWalletAssetsParams` - Query parameters
|
|
1043
|
+
- `assetType?: 'NFT' | 'SPL_TOKEN' | 'SOL'` - Filter by asset type
|
|
1044
|
+
- `page?: number` - Page number for pagination
|
|
1045
|
+
- `limit?: number` - Number of results per page
|
|
1046
|
+
- `options?` - Optional axios request configuration
|
|
1047
|
+
|
|
1048
|
+
**Returns:** `Promise<AdminControllerGetWalletAssetsResult>`
|
|
1049
|
+
|
|
1050
|
+
**Example:**
|
|
1051
|
+
```typescript
|
|
1052
|
+
import { getWalletAssets } from 'cilantro-sdk/admin';
|
|
1053
|
+
|
|
1054
|
+
const assets = await getWalletAssets({
|
|
1055
|
+
assetType: 'NFT',
|
|
1056
|
+
page: 1,
|
|
1057
|
+
limit: 50
|
|
1058
|
+
});
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
---
|
|
1062
|
+
|
|
1063
|
+
## Auth Module
|
|
1064
|
+
|
|
1065
|
+
Universal authentication operations. **This is the only authentication endpoint you should use** - it works for admin, platform, and user authentication.
|
|
1066
|
+
|
|
1067
|
+
### `login(commonLoginDto, options?)`
|
|
1068
|
+
|
|
1069
|
+
Authenticate as admin, platform, or user. Returns user type and appropriate JWT token. This is the universal login endpoint that replaces the individual login endpoints in the user, platform, and admin modules.
|
|
1070
|
+
|
|
1071
|
+
**Parameters:**
|
|
1072
|
+
- `commonLoginDto: CommonLoginDto` - Login credentials
|
|
1073
|
+
- `usernameOrEmail: string` - Username or email address
|
|
1074
|
+
- `password: string` - Password
|
|
1075
|
+
- `options?` - Optional axios request configuration
|
|
1076
|
+
|
|
1077
|
+
**Returns:** `Promise<AuthControllerLogin200>` - Contains `data` object with:
|
|
1078
|
+
- `userType?: 'admin' | 'platform' | 'user'` - Type of authenticated user
|
|
1079
|
+
- `jwt?: string` - JWT token for authenticated user
|
|
1080
|
+
- `user?: AuthControllerLogin200DataUser` - User data object
|
|
1081
|
+
- `apiKey?: string` - API key (only for platform/user)
|
|
1082
|
+
|
|
1083
|
+
**Example:**
|
|
1084
|
+
```typescript
|
|
1085
|
+
import { login } from 'cilantro-sdk/auth';
|
|
1086
|
+
|
|
1087
|
+
const result = await login({
|
|
1088
|
+
usernameOrEmail: 'user@example.com',
|
|
1089
|
+
password: 'password123'
|
|
1090
|
+
});
|
|
1091
|
+
|
|
1092
|
+
console.log(result.data.userType); // 'admin' | 'platform' | 'user'
|
|
1093
|
+
console.log(result.data.jwt); // JWT token
|
|
1094
|
+
if (result.data.apiKey) {
|
|
1095
|
+
console.log(result.data.apiKey); // API key (for platform/user)
|
|
1096
|
+
}
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
---
|
|
1100
|
+
|
|
1101
|
+
## TypeScript Support
|
|
1102
|
+
|
|
1103
|
+
The SDK is written in TypeScript and includes full type definitions. All types are exported from the main package:
|
|
1104
|
+
|
|
1105
|
+
```typescript
|
|
1106
|
+
import type {
|
|
1107
|
+
CreatePlatformDto,
|
|
1108
|
+
UpdatePlatformDto,
|
|
1109
|
+
CreateUserDto,
|
|
1110
|
+
UpdateUserDto,
|
|
1111
|
+
CreateWalletDto,
|
|
1112
|
+
UpdateWalletDto,
|
|
1113
|
+
SendSolDto,
|
|
1114
|
+
SendSplDto,
|
|
1115
|
+
MintNftSimpleDto,
|
|
1116
|
+
MintTokenDto,
|
|
1117
|
+
SendTransactionDto,
|
|
1118
|
+
WalletAssetResponseDto,
|
|
1119
|
+
AccountMeta,
|
|
1120
|
+
NftAttribute,
|
|
1121
|
+
LoginPlatformDto,
|
|
1122
|
+
LoginUserDto,
|
|
1123
|
+
LoginAdminDto,
|
|
1124
|
+
CommonLoginDto,
|
|
1125
|
+
// ... and many more
|
|
1126
|
+
} from 'cilantro-sdk';
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
---
|
|
1130
|
+
|
|
1131
|
+
## Authentication
|
|
1132
|
+
|
|
1133
|
+
The SDK provides automatic authentication handling for both JWT tokens and API keys. After logging in, the SDK will automatically include the appropriate authentication headers in all subsequent requests.
|
|
1134
|
+
|
|
1135
|
+
### Automatic Authentication (Recommended)
|
|
1136
|
+
|
|
1137
|
+
The easiest way to authenticate is to use the `loginAndSetAuth` function, which automatically handles login and authentication setup:
|
|
1138
|
+
|
|
1139
|
+
```typescript
|
|
1140
|
+
import { loginAndSetAuth } from 'cilantro-sdk/auth';
|
|
1141
|
+
import { findAll } from 'cilantro-sdk/wallet';
|
|
1142
|
+
|
|
1143
|
+
// Login and set authentication automatically
|
|
1144
|
+
await loginAndSetAuth({
|
|
1145
|
+
usernameOrEmail: 'user@example.com',
|
|
1146
|
+
password: 'password123'
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
// Now all subsequent requests will include the authentication headers
|
|
1150
|
+
const wallets = await findAll();
|
|
1151
|
+
```
|
|
1152
|
+
|
|
1153
|
+
### Manual Authentication
|
|
1154
|
+
|
|
1155
|
+
You can manually set authentication credentials using the configuration functions:
|
|
1156
|
+
|
|
1157
|
+
#### JWT Token Authentication
|
|
1158
|
+
|
|
1159
|
+
```typescript
|
|
1160
|
+
import { setAuth } from 'cilantro-sdk';
|
|
1161
|
+
import { login } from 'cilantro-sdk/auth';
|
|
1162
|
+
|
|
1163
|
+
// Login first
|
|
1164
|
+
const loginResult = await login({
|
|
1165
|
+
usernameOrEmail: 'admin@example.com',
|
|
1166
|
+
password: 'password123'
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
// Manually set JWT token
|
|
1170
|
+
setAuth({ jwt: loginResult.data.jwt });
|
|
1171
|
+
|
|
1172
|
+
// All subsequent requests will include: Authorization: Bearer <token>
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
#### API Key Authentication
|
|
1176
|
+
|
|
1177
|
+
For platform-level authentication, you can use API keys instead of JWT tokens:
|
|
1178
|
+
|
|
1179
|
+
```typescript
|
|
1180
|
+
import { configure } from 'cilantro-sdk';
|
|
1181
|
+
|
|
1182
|
+
// Set API key (received from platform settings)
|
|
1183
|
+
configure({ apiKey: 'your-api-key-here' });
|
|
1184
|
+
|
|
1185
|
+
// All subsequent requests will include: X-API-Key: <api-key>
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
#### Using Both JWT and API Key
|
|
1189
|
+
|
|
1190
|
+
The SDK supports using both JWT tokens and API keys simultaneously:
|
|
1191
|
+
|
|
1192
|
+
```typescript
|
|
1193
|
+
import { setAuth } from 'cilantro-sdk';
|
|
1194
|
+
|
|
1195
|
+
setAuth({
|
|
1196
|
+
jwt: 'your-jwt-token',
|
|
1197
|
+
apiKey: 'your-api-key'
|
|
1198
|
+
});
|
|
1199
|
+
|
|
1200
|
+
// Both headers will be included in requests
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
### Authentication Management
|
|
1204
|
+
|
|
1205
|
+
The SDK provides configuration functions for managing authentication:
|
|
1206
|
+
|
|
1207
|
+
```typescript
|
|
1208
|
+
import { configure, setAuth, clearAuth } from 'cilantro-sdk';
|
|
1209
|
+
|
|
1210
|
+
// Configure with both auth and settings
|
|
1211
|
+
configure({
|
|
1212
|
+
jwt: 'your-jwt-token',
|
|
1213
|
+
apiKey: 'your-api-key',
|
|
1214
|
+
baseURL: 'https://api.cilantro.gg' // optional
|
|
1215
|
+
});
|
|
1216
|
+
|
|
1217
|
+
// Or just update authentication
|
|
1218
|
+
setAuth({
|
|
1219
|
+
jwt: 'your-jwt-token',
|
|
1220
|
+
apiKey: 'your-api-key'
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
// Clear all authentication
|
|
1224
|
+
clearAuth(); // Removes both JWT token and API key
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
### Complete Authentication Example
|
|
1228
|
+
|
|
1229
|
+
```typescript
|
|
1230
|
+
import { loginAndSetAuth } from 'cilantro-sdk/auth';
|
|
1231
|
+
import { clearAuth } from 'cilantro-sdk';
|
|
1232
|
+
import { findAll } from 'cilantro-sdk/wallet';
|
|
1233
|
+
import { getCurrentAdmin } from 'cilantro-sdk/admin';
|
|
1234
|
+
|
|
1235
|
+
async function authenticateAndFetchData() {
|
|
1236
|
+
try {
|
|
1237
|
+
// Login and set authentication automatically
|
|
1238
|
+
const loginResult = await loginAndSetAuth({
|
|
1239
|
+
usernameOrEmail: 'user@example.com',
|
|
1240
|
+
password: 'password123'
|
|
1241
|
+
});
|
|
1242
|
+
|
|
1243
|
+
console.log('Logged in as:', loginResult.data.userType);
|
|
1244
|
+
|
|
1245
|
+
// Now you can make authenticated requests
|
|
1246
|
+
const wallets = await findAll();
|
|
1247
|
+
console.log('User wallets:', wallets);
|
|
1248
|
+
|
|
1249
|
+
// Logout (clear authentication)
|
|
1250
|
+
clearAuth();
|
|
1251
|
+
} catch (error) {
|
|
1252
|
+
console.error('Authentication failed:', error);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
```
|
|
1256
|
+
|
|
1257
|
+
### Advanced: Custom Base URL and Configuration
|
|
1258
|
+
|
|
1259
|
+
You can customize the SDK configuration including base URL:
|
|
1260
|
+
|
|
1261
|
+
```typescript
|
|
1262
|
+
import { configure } from 'cilantro-sdk';
|
|
1263
|
+
|
|
1264
|
+
// Configure custom base URL and authentication
|
|
1265
|
+
configure({
|
|
1266
|
+
apiKey: 'your-api-key',
|
|
1267
|
+
baseURL: 'https://custom-api.example.com'
|
|
1268
|
+
});
|
|
1269
|
+
|
|
1270
|
+
// Or update just the base URL
|
|
1271
|
+
configure({
|
|
1272
|
+
baseURL: 'https://staging-api.example.com'
|
|
1273
|
+
});
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
---
|
|
1277
|
+
|
|
1278
|
+
## Error Handling
|
|
1279
|
+
|
|
1280
|
+
All API functions return promises that may reject with axios errors. You should handle errors appropriately:
|
|
1281
|
+
|
|
1282
|
+
```typescript
|
|
1283
|
+
import { sendSOL } from 'cilantro-sdk/wallet';
|
|
1284
|
+
|
|
1285
|
+
try {
|
|
1286
|
+
const result = await sendSOL('wallet-id', {
|
|
1287
|
+
recipientAddress: 'DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK',
|
|
1288
|
+
amountLamports: 1000000000
|
|
1289
|
+
});
|
|
1290
|
+
console.log('Transaction successful:', result);
|
|
1291
|
+
} catch (error) {
|
|
1292
|
+
if (error.response) {
|
|
1293
|
+
// The request was made and the server responded with a status code
|
|
1294
|
+
// that falls out of the range of 2xx
|
|
1295
|
+
console.error('Error status:', error.response.status);
|
|
1296
|
+
console.error('Error data:', error.response.data);
|
|
1297
|
+
} else if (error.request) {
|
|
1298
|
+
// The request was made but no response was received
|
|
1299
|
+
console.error('No response received:', error.request);
|
|
1300
|
+
} else {
|
|
1301
|
+
// Something happened in setting up the request that triggered an Error
|
|
1302
|
+
console.error('Error:', error.message);
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
---
|
|
1308
|
+
|
|
1309
|
+
## API Reference
|
|
1310
|
+
|
|
1311
|
+
### Configuration Functions
|
|
1312
|
+
|
|
1313
|
+
```typescript
|
|
1314
|
+
// Configure SDK with authentication and settings
|
|
1315
|
+
configure(config: {
|
|
1316
|
+
apiKey?: string;
|
|
1317
|
+
jwt?: string;
|
|
1318
|
+
baseURL?: string;
|
|
1319
|
+
}): void
|
|
1320
|
+
|
|
1321
|
+
// Update authentication credentials
|
|
1322
|
+
setAuth(auth: {
|
|
1323
|
+
jwt?: string;
|
|
1324
|
+
apiKey?: string;
|
|
1325
|
+
}): void
|
|
1326
|
+
|
|
1327
|
+
// Clear all authentication
|
|
1328
|
+
clearAuth(): void
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
### Authentication Functions
|
|
1332
|
+
|
|
1333
|
+
```typescript
|
|
1334
|
+
// Login with credentials
|
|
1335
|
+
login(credentials: CommonLoginDto, options?): Promise<AuthControllerLoginResult>
|
|
1336
|
+
|
|
1337
|
+
// Login and automatically set authentication (convenience function)
|
|
1338
|
+
loginAndSetAuth(credentials: CommonLoginDto, options?): Promise<AuthControllerLoginResult>
|
|
1339
|
+
```
|
|
1340
|
+
|
|
1341
|
+
For complete API documentation of all endpoints, see the type definitions or refer to the inline documentation in your IDE.
|
|
1342
|
+
|
|
1343
|
+
---
|
|
1344
|
+
|
|
1345
|
+
## Development
|
|
1346
|
+
|
|
1347
|
+
### Building
|
|
1348
|
+
|
|
1349
|
+
```bash
|
|
1350
|
+
npm run build
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
This will:
|
|
1354
|
+
- Generate API client code from OpenAPI specification
|
|
1355
|
+
- Compile TypeScript to CommonJS (`.cjs`) and ES Modules (`.mjs`)
|
|
1356
|
+
- Generate TypeScript declaration files (`.d.ts`)
|
|
1357
|
+
|
|
1358
|
+
### Publishing
|
|
1359
|
+
|
|
1360
|
+
```bash
|
|
1361
|
+
npm publish
|
|
1362
|
+
```
|
|
1363
|
+
|
|
1364
|
+
The `prepublishOnly` script will automatically build the package before publishing.
|
|
1365
|
+
|
|
1366
|
+
---
|
|
1367
|
+
|
|
1368
|
+
## License
|
|
1369
|
+
|
|
1370
|
+
ISC
|