@multisender.app/multisender-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.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +410 -0
  3. package/dist/auth/api-key.d.ts +8 -0
  4. package/dist/auth/api-key.d.ts.map +1 -0
  5. package/dist/cli/commands/distribute.d.ts +3 -0
  6. package/dist/cli/commands/distribute.d.ts.map +1 -0
  7. package/dist/cli/commands/distributions.d.ts +3 -0
  8. package/dist/cli/commands/distributions.d.ts.map +1 -0
  9. package/dist/cli/commands/lists.d.ts +3 -0
  10. package/dist/cli/commands/lists.d.ts.map +1 -0
  11. package/dist/cli/index.cjs +4507 -0
  12. package/dist/cli/index.cjs.map +46 -0
  13. package/dist/cli/index.d.ts +3 -0
  14. package/dist/cli/index.d.ts.map +1 -0
  15. package/dist/cli/index.js +4514 -0
  16. package/dist/cli/index.js.map +46 -0
  17. package/dist/core/errors.d.ts +20 -0
  18. package/dist/core/errors.d.ts.map +1 -0
  19. package/dist/core/generated-transport.d.ts +3 -0
  20. package/dist/core/generated-transport.d.ts.map +1 -0
  21. package/dist/core/pagination.d.ts +4 -0
  22. package/dist/core/pagination.d.ts.map +1 -0
  23. package/dist/core/types.d.ts +19 -0
  24. package/dist/core/types.d.ts.map +1 -0
  25. package/dist/gen/client/client.gen.d.ts +3 -0
  26. package/dist/gen/client/client.gen.d.ts.map +1 -0
  27. package/dist/gen/client/index.d.ts +9 -0
  28. package/dist/gen/client/index.d.ts.map +1 -0
  29. package/dist/gen/client/types.gen.d.ts +118 -0
  30. package/dist/gen/client/types.gen.d.ts.map +1 -0
  31. package/dist/gen/client/utils.gen.d.ts +34 -0
  32. package/dist/gen/client/utils.gen.d.ts.map +1 -0
  33. package/dist/gen/client.gen.d.ts +13 -0
  34. package/dist/gen/client.gen.d.ts.map +1 -0
  35. package/dist/gen/core/auth.gen.d.ts +19 -0
  36. package/dist/gen/core/auth.gen.d.ts.map +1 -0
  37. package/dist/gen/core/bodySerializer.gen.d.ts +26 -0
  38. package/dist/gen/core/bodySerializer.gen.d.ts.map +1 -0
  39. package/dist/gen/core/params.gen.d.ts +44 -0
  40. package/dist/gen/core/params.gen.d.ts.map +1 -0
  41. package/dist/gen/core/pathSerializer.gen.d.ts +34 -0
  42. package/dist/gen/core/pathSerializer.gen.d.ts.map +1 -0
  43. package/dist/gen/core/queryKeySerializer.gen.d.ts +19 -0
  44. package/dist/gen/core/queryKeySerializer.gen.d.ts.map +1 -0
  45. package/dist/gen/core/serverSentEvents.gen.d.ts +72 -0
  46. package/dist/gen/core/serverSentEvents.gen.d.ts.map +1 -0
  47. package/dist/gen/core/types.gen.d.ts +79 -0
  48. package/dist/gen/core/types.gen.d.ts.map +1 -0
  49. package/dist/gen/core/utils.gen.d.ts +20 -0
  50. package/dist/gen/core/utils.gen.d.ts.map +1 -0
  51. package/dist/gen/index.d.ts +3 -0
  52. package/dist/gen/index.d.ts.map +1 -0
  53. package/dist/gen/sdk.gen.d.ts +168 -0
  54. package/dist/gen/sdk.gen.d.ts.map +1 -0
  55. package/dist/gen/types.gen.d.ts +2501 -0
  56. package/dist/gen/types.gen.d.ts.map +1 -0
  57. package/dist/index.cjs +1648 -0
  58. package/dist/index.cjs.map +31 -0
  59. package/dist/index.d.ts +16 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +1651 -0
  62. package/dist/index.js.map +31 -0
  63. package/dist/multisender.d.ts +46 -0
  64. package/dist/multisender.d.ts.map +1 -0
  65. package/dist/openapi-runtime.d.ts +10 -0
  66. package/dist/openapi-runtime.d.ts.map +1 -0
  67. package/dist/services/catalogs.d.ts +15 -0
  68. package/dist/services/catalogs.d.ts.map +1 -0
  69. package/dist/services/distributions.d.ts +17 -0
  70. package/dist/services/distributions.d.ts.map +1 -0
  71. package/dist/services/lists.d.ts +36 -0
  72. package/dist/services/lists.d.ts.map +1 -0
  73. package/dist/services/project.d.ts +19 -0
  74. package/dist/services/project.d.ts.map +1 -0
  75. package/dist/services/response-utils.d.ts +9 -0
  76. package/dist/services/response-utils.d.ts.map +1 -0
  77. package/dist/services/types.d.ts +33 -0
  78. package/dist/services/types.d.ts.map +1 -0
  79. package/dist/types.d.ts +5 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/utils/csv.d.ts +9 -0
  82. package/dist/utils/csv.d.ts.map +1 -0
  83. package/dist/utils/validation.d.ts +7 -0
  84. package/dist/utils/validation.d.ts.map +1 -0
  85. package/package.json +64 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Multisender
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 ADDED
@@ -0,0 +1,410 @@
1
+ # Multisender SDK
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@multisender/sdk.svg)](https://www.npmjs.com/package/@multisender/sdk)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue.svg)](https://www.typescriptlang.org/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ TypeScript SDK for the Multisender Enterprise API - streamline mass token distributions across multiple EVM chains.
8
+
9
+ ## Features
10
+
11
+ - 🚀 **Simple API** - Intuitive methods for token distributions
12
+ - 📦 **Full TypeScript Support** - Complete type safety and IntelliSense
13
+ - 🔗 **Multi-Chain** - Support for Ethereum, Polygon, Arbitrum, Optimism, Base, and more
14
+ - 📊 **CSV Support** - Import recipients from CSV files
15
+ - 🛠️ **CLI Tools** - Command-line interface for quick operations
16
+ - ✅ **Tested** - Comprehensive test coverage with Bun test runner
17
+ - 🌐 **Dual Builds** - ESM and CommonJS support
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @multisender.app/multisender-sdk
23
+ ```
24
+
25
+ Or with yarn:
26
+
27
+ ```bash
28
+ yarn add @multisender.app/multisender-sdk
29
+ ```
30
+
31
+ Or with Bun:
32
+
33
+ ```bash
34
+ bun add @multisender.app/multisender-sdk
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ```typescript
40
+ import { Multisender } from '@multisender.app/multisender-sdk';
41
+
42
+ // Initialize the SDK
43
+ const multisender = new Multisender({
44
+ apiKey: 'your-api-key-here',
45
+ });
46
+
47
+ // Create a token distribution
48
+ const distribution = await multisender.distributions.distribute({
49
+ chainId: 1, // Ethereum mainnet
50
+ tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
51
+ tokenSymbol: 'USDC',
52
+ recipients: [
53
+ ['0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6', '100'],
54
+ ['0x1234567890123456789012345678901234567890', '200'],
55
+ ],
56
+ });
57
+
58
+ console.log('Distribution created:', distribution.id);
59
+ ```
60
+
61
+ ## OpenAPI-First Workflow
62
+
63
+ This SDK is generated from an OpenAPI spec and committed under `src/gen`.
64
+
65
+ ### Environment placeholders
66
+
67
+ - `OPENAPI_SPEC_URL` (required, points to the OpenAPI JSON endpoint)
68
+ - `OPENAPI_SPEC_AUTH_HEADER` (optional)
69
+ - `OPENAPI_SPEC_AUTH_TOKEN` (optional)
70
+
71
+ ### Commands
72
+
73
+ ```bash
74
+ # Regenerate SDK client/types from OpenAPI
75
+ bun run generate:api
76
+
77
+ # Verify generated artifacts are committed and up to date
78
+ bun run generate:api:check
79
+ ```
80
+
81
+ ### Release policy
82
+
83
+ - Treat spec changes as the source of truth for SDK surface changes.
84
+ - Include spec revision/source in release notes when publishing.
85
+ - Document migration notes for any spec-driven breaking change.
86
+
87
+ ## API Reference
88
+
89
+ ### Initialize SDK
90
+
91
+ ```typescript
92
+ const multisender = new Multisender({
93
+ apiKey: string; // Required: Your API key
94
+ baseUrl?: string; // Optional: Custom API base URL
95
+ timeout?: number; // Optional: Request timeout in ms (default: 30000)
96
+ headers?: Record<string, string>; // Optional: Additional headers
97
+ });
98
+ ```
99
+
100
+ ### Distributions
101
+
102
+ #### Create Distribution
103
+
104
+ ```typescript
105
+ const distribution = await multisender.distributions.distribute({
106
+ chainId: number; // Blockchain chain ID
107
+ tokenAddress: string; // Token contract address
108
+ tokenSymbol: string; // Token symbol
109
+ recipients?: [string, string][]; // Array of [address, amount] tuples
110
+ csv?: string; // Or CSV string with recipients
111
+ account?: string; // Optional: Sender wallet address
112
+ idempotencyKey?: string; // Optional: Prevent duplicates
113
+ });
114
+ ```
115
+
116
+ #### List Distributions
117
+
118
+ ```typescript
119
+ const distributions = await multisender.distributions.list({
120
+ page?: number; // Page number (default: 1)
121
+ limit?: number; // Items per page (default: 20)
122
+ orderBy?: string; // Field to order by
123
+ orderDir?: 'ASC' | 'DESC'; // Order direction
124
+ search?: string; // Search term
125
+ });
126
+ ```
127
+
128
+ #### Get Distribution
129
+
130
+ ```typescript
131
+ const distribution = await multisender.distributions.get('dist_123');
132
+ ```
133
+
134
+ #### Get Distribution Statistics
135
+
136
+ ```typescript
137
+ const stats = await multisender.distributions.getStats('dist_123');
138
+ // Returns: totalRecipients, totalAmount, completedTransactions, etc.
139
+ ```
140
+
141
+ #### Cancel Distribution
142
+
143
+ ```typescript
144
+ await multisender.distributions.cancel('dist_123');
145
+ ```
146
+
147
+ ### Lists
148
+
149
+ #### Create Recipient List
150
+
151
+ ```typescript
152
+ const list = await multisender.lists.create({
153
+ name: 'VIP Customers',
154
+ notes?: 'Optional notes',
155
+ });
156
+ ```
157
+
158
+ #### List All Lists
159
+
160
+ ```typescript
161
+ const lists = await multisender.lists.list({
162
+ page?: number;
163
+ limit?: number;
164
+ });
165
+ ```
166
+
167
+ #### Get List
168
+
169
+ ```typescript
170
+ const list = await multisender.lists.get('list_123');
171
+ ```
172
+
173
+ #### Update List
174
+
175
+ ```typescript
176
+ const list = await multisender.lists.update('list_123', {
177
+ name?: 'Updated Name',
178
+ notes?: 'Updated notes',
179
+ });
180
+ ```
181
+
182
+ #### Delete List
183
+
184
+ ```typescript
185
+ await multisender.lists.delete('list_123');
186
+ ```
187
+
188
+ #### Add Recipients
189
+
190
+ ```typescript
191
+ // Add single recipient
192
+ await multisender.lists.addRecipient('list_123', {
193
+ address: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
194
+ addressType: 'EVM',
195
+ label?: 'Customer A',
196
+ tags?: ['vip', 'early-adopter'],
197
+ });
198
+
199
+ // Add multiple recipients
200
+ await multisender.lists.addRecipientsBulk('list_123', {
201
+ items: [
202
+ { address: '0x...', addressType: 'EVM', label: 'Customer A' },
203
+ { address: '0x...', addressType: 'EVM', label: 'Customer B' },
204
+ ],
205
+ });
206
+ ```
207
+
208
+ ### Project
209
+
210
+ #### Get Project Info
211
+
212
+ ```typescript
213
+ const project = await multisender.project.getInfo();
214
+ ```
215
+
216
+ #### Manage API Keys
217
+
218
+ ```typescript
219
+ // List API keys
220
+ const keys = await multisender.project.listApiKeys();
221
+
222
+ // Create API key
223
+ const key = await multisender.project.createApiKey({
224
+ name: 'Production Key',
225
+ scopes: ['read:lists', 'write:distributions'],
226
+ });
227
+
228
+ // Delete API key
229
+ await multisender.project.deleteApiKey('key_123');
230
+ ```
231
+
232
+ ### Catalogs
233
+
234
+ ```typescript
235
+ // Get supported chains
236
+ const chains = await multisender.catalogs.getChains();
237
+
238
+ // Get tokens
239
+ const tokens = await multisender.catalogs.getTokens('1'); // Chain ID
240
+
241
+ // Search tokens
242
+ const results = await multisender.catalogs.searchTokens('USDC', '1');
243
+ ```
244
+
245
+ ## CSV Support
246
+
247
+ ### Parse CSV
248
+
249
+ ```typescript
250
+ import { parseCsv } from '@multisender.app/multisender-sdk';
251
+
252
+ const recipients = parseCsv(csvString, {
253
+ hasHeader: true,
254
+ delimiter: ',',
255
+ skipRows: 0,
256
+ });
257
+ ```
258
+
259
+ ### Generate CSV
260
+
261
+ ```typescript
262
+ import { toCsv } from '@multisender.app/multisender-sdk';
263
+
264
+ const csv = toCsv([
265
+ ['0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6', '100'],
266
+ ['0x1234567890123456789012345678901234567890', '200'],
267
+ ], true); // includeHeader
268
+ ```
269
+
270
+ ### CSV Format
271
+
272
+ ```csv
273
+ address,amount
274
+ 0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6,100
275
+ 0x1234567890123456789012345678901234567890,200
276
+ ```
277
+
278
+ ## CLI Usage
279
+
280
+ The SDK includes a command-line interface for quick operations.
281
+
282
+ ### Install Globally
283
+
284
+ ```bash
285
+ npm install -g @multisender.app/multisender-sdk
286
+ ```
287
+
288
+ ### Commands
289
+
290
+ #### Distribute Tokens
291
+
292
+ ```bash
293
+ multisender distribute \
294
+ --api-key YOUR_API_KEY \
295
+ --chain 1 \
296
+ --token 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
297
+ --symbol USDC \
298
+ --recipients recipients.csv
299
+ ```
300
+
301
+ #### List Distributions
302
+
303
+ ```bash
304
+ multisender distributions list --api-key YOUR_API_KEY
305
+ ```
306
+
307
+ #### Get Distribution Details
308
+
309
+ ```bash
310
+ multisender distributions get dist_123 --api-key YOUR_API_KEY
311
+ ```
312
+
313
+ #### Manage Lists
314
+
315
+ ```bash
316
+ # Create list
317
+ multisender lists create --api-key YOUR_API_KEY --name "My List"
318
+
319
+ # List all
320
+ multisender lists list --api-key YOUR_API_KEY
321
+
322
+ # Get list
323
+ multisender lists get list_123 --api-key YOUR_API_KEY
324
+
325
+ # Delete list
326
+ multisender lists delete list_123 --api-key YOUR_API_KEY
327
+ ```
328
+
329
+ #### Local development
330
+
331
+ To use the CLI against a local API (e.g. `http://localhost:3000`), pass `--base-url`:
332
+
333
+ ```bash
334
+ multisender lists list --api-key YOUR_API_KEY --base-url http://localhost:3000
335
+ multisender distributions list --api-key YOUR_API_KEY --base-url http://localhost:3000
336
+ ```
337
+
338
+ ## Supported Chains
339
+
340
+ | Chain | Chain ID |
341
+ |-------|----------|
342
+ | Ethereum | 1 |
343
+ | Optimism | 10 |
344
+ | Polygon | 137 |
345
+ | Base | 8453 |
346
+ | Arbitrum | 42161 |
347
+
348
+ ## Error Handling
349
+
350
+ ```typescript
351
+ import { ApiError, NetworkError, ValidationError } from '@multisender.app/multisender-sdk';
352
+
353
+ try {
354
+ await multisender.distributions.distribute({ /* ... */ });
355
+ } catch (error) {
356
+ if (error instanceof ApiError) {
357
+ console.error('API Error:', error.status, error.body);
358
+ } else if (error instanceof NetworkError) {
359
+ console.error('Network Error:', error.message);
360
+ } else if (error instanceof ValidationError) {
361
+ console.error('Validation Error:', error.message);
362
+ }
363
+ }
364
+ ```
365
+
366
+ ## Examples
367
+
368
+ See the [examples](./examples) directory for complete examples:
369
+
370
+ - [Basic Node.js Script](./examples/node-script.ts)
371
+ - [CSV Distribution](./examples/csv-distribution.ts)
372
+ - [Managing Lists](./examples/manage-lists.ts)
373
+ - [React App](./examples/react-app.tsx)
374
+
375
+ ## Development
376
+
377
+ Use Bun for package and script management.
378
+
379
+ ```bash
380
+ bun install
381
+ bun run build
382
+ bun run test
383
+ bun run test:coverage
384
+ bun run typecheck
385
+ bun run lint
386
+ ```
387
+
388
+ ## Browser Support
389
+
390
+ The SDK works in both Node.js (18+) and modern browsers that support native `fetch`.
391
+
392
+ ## Requirements
393
+
394
+ - **Runtime:** Node.js 18+ or Bun 1+ (for development and consumption)
395
+ - **TypeScript 5+** (for development)
396
+
397
+ ## License
398
+
399
+ MIT License - see [LICENSE](./LICENSE) file for details.
400
+
401
+ ## Links
402
+
403
+ - [NPM Package](https://www.npmjs.com/package/@multisender.app/multisender-sdk)
404
+ - [API Documentation](https://docs.multisender.app)
405
+ - [GitHub Repository](https://github.com/multisender/sdk)
406
+ - [Issue Tracker](https://github.com/multisender/sdk/issues)
407
+
408
+ ## Support
409
+
410
+ For support, email support@multisender.app or open an issue on GitHub.
@@ -0,0 +1,8 @@
1
+ export declare class ApiKeyAuth {
2
+ private apiKey;
3
+ constructor(apiKey: string);
4
+ getApiKey(): string;
5
+ applyToHeaders(headers: Record<string, string>): Record<string, string>;
6
+ static validate(apiKey: string): boolean;
7
+ }
8
+ //# sourceMappingURL=api-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-key.d.ts","sourceRoot":"","sources":["../../src/auth/api-key.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAO1B,SAAS,IAAI,MAAM;IAInB,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAOvE,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAIzC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createDistributeCommand(): Command;
3
+ //# sourceMappingURL=distribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distribute.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/distribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,uBAAuB,IAAI,OAAO,CAyDjD"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createDistributionsCommand(): Command;
3
+ //# sourceMappingURL=distributions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distributions.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/distributions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,0BAA0B,IAAI,OAAO,CA6HpD"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createListsCommand(): Command;
3
+ //# sourceMappingURL=lists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lists.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/lists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,kBAAkB,IAAI,OAAO,CA4H5C"}