@ordanetwork/sdk 1.0.1 → 1.0.2

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 (2) hide show
  1. package/README.md +149 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -11,24 +11,23 @@ TypeScript SDK for cross-chain cryptocurrency payments with smart wallet support
11
11
  ```bash
12
12
  npm install @ordanetwork/sdk
13
13
  # or
14
- yarn add @ordaordanetwork/sdk
14
+ yarn add @ordanetwork/sdk
15
15
  # or
16
- pnpm add @ordaordanetwork/sdk
16
+ pnpm add @ordanetwork/sdk
17
17
  ```
18
18
 
19
19
  ### Requirements
20
20
 
21
+ - **Node.js**: Version 18.0.0 or higher
21
22
  - **TypeScript**: Version 5.0.0 or higher (if using TypeScript)
22
- - **viem**: Required peer dependency for blockchain interactions
23
23
 
24
24
  ## Features
25
25
 
26
- - 🔐 **HMAC Authentication**: Secure API authentication
27
- - 🚀 **Zero Dependencies**: Pure TypeScript implementation, no runtime dependencies
28
- - 📦 **Tree-shakeable**: Optimized for minimal bundle size
29
- - 🔄 **Async/Await**: Modern promise-based API
30
- - 💱 **Multi-chain Support**: Cross-chain transfers, off-ramp, and on-ramp operations
31
- - 🔑 **Smart Wallets**: Integrated Alchemy Account Kit support for UserOperations
26
+ - **HMAC Authentication**: Secure API authentication
27
+ - **Multi-chain Support**: Cross-chain transfers, off-ramp, and on-ramp operations
28
+ - **Smart Wallets**: Integrated Alchemy Account Kit support for UserOperations
29
+ - **Module Formats**: ESM and CommonJS
30
+ - **TypeScript**: Full type definitions included
32
31
 
33
32
 
34
33
  ## Quick Start
@@ -41,25 +40,37 @@ const orda = new OrdaSDK({
41
40
  clientSecret: 'your-client-secret'
42
41
  });
43
42
 
44
- // Create a recipient
45
- const recipient = await orda.recipients.create({
43
+ // Create a recipient with smart wallet (no toAddress)
44
+ const recipientWithSmartWallet = await orda.recipients.create({
46
45
  name: 'Test Recipient',
47
46
  cryptoSettlementDetails: {
48
- toChain: '8453'
49
- toToken: '0x4200000000000000000000000000000000000006'
47
+ toChain: '8453',
48
+ toToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
49
+ // No toAddress - will generate smart wallet
50
+ }
51
+ });
52
+ console.log('Smart wallet:', recipientWithSmartWallet.smartWallet?.address);
53
+
54
+ // Create a recipient with specific address
55
+ const recipientWithAddress = await orda.recipients.create({
56
+ name: 'Test Recipient',
57
+ cryptoSettlementDetails: {
58
+ toChain: '8453',
59
+ toToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
60
+ toAddress: '0xYourRecipientAddress'
50
61
  }
51
62
  });
52
63
 
53
64
  // Request a quote
54
65
  const quote = await orda.quote.request({
55
- fromChain: '1', // Ethereum
56
- fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
66
+ fromChain: '1', // Ethereum mainnet
67
+ fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
57
68
  fromAddress: '0xYourAddress',
58
69
  intent: {
59
70
  method: 'usd',
60
71
  value: '100'
61
72
  },
62
- recipientId: recipient.recipientId
73
+ recipientId: recipientWithSmartWallet.recipientId
63
74
  });
64
75
  ```
65
76
 
@@ -79,7 +90,7 @@ import { OrdaSDK } from '@ordanetwork/sdk';
79
90
 
80
91
  ## Security Considerations
81
92
 
82
- ⚠️ **CRITICAL SECURITY WARNING** ⚠️
93
+ **CRITICAL SECURITY WARNING**
83
94
 
84
95
  **Never expose your API credentials in frontend code!** Your `clientId` and `clientSecret` should always be kept secure on your backend server.
85
96
 
@@ -91,7 +102,6 @@ const orda = new OrdaSDK({
91
102
  clientSecret: process.env.ORDA_CLIENT_SECRET
92
103
  });
93
104
 
94
- // Use the SDK to make API calls
95
105
  const quote = await orda.quote.request({
96
106
  fromChain: '1',
97
107
  fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
@@ -112,7 +122,6 @@ const quote = await orda.quote.request({
112
122
  const orda = new OrdaSDK({
113
123
  clientId: 'your-client-id',
114
124
  clientSecret: 'your-client-secret',
115
- debug: true
116
125
  });
117
126
  ```
118
127
 
@@ -245,6 +254,127 @@ try {
245
254
  }
246
255
  ```
247
256
 
257
+ ## Smart Wallet Support
258
+
259
+ The SDK includes integrated support for Alchemy Account Kit smart wallets:
260
+
261
+ ```typescript
262
+ // Generate a new private key
263
+ const { privateKey, address } = await orda.smartWallets.generatePrivateKey();
264
+
265
+ // Validate private key
266
+ const isValid = orda.smartWallets.validatePrivateKey(privateKey);
267
+
268
+ // Get address from private key
269
+ const address = await orda.smartWallets.getAddressFromPrivateKey(privateKey);
270
+
271
+ // Create project wallet
272
+ const wallet = await orda.smartWallets.createProjectWallet(
273
+ projectId,
274
+ privateKey,
275
+ chainId
276
+ );
277
+
278
+ // Create recipient wallet
279
+ const recipientWallet = await orda.smartWallets.createRecipientWallet(
280
+ recipientId,
281
+ privateKey,
282
+ chainId
283
+ );
284
+ ```
285
+
286
+ ## Complete Example
287
+
288
+ ```javascript
289
+ const { OrdaSDK } = require('@ordanetwork/sdk');
290
+
291
+ async function main() {
292
+ const orda = new OrdaSDK({
293
+ clientId: process.env.ORDA_CLIENT_ID,
294
+ clientSecret: process.env.ORDA_CLIENT_SECRET,
295
+ debug: true,
296
+ });
297
+
298
+ // Create recipient with smart wallet
299
+ const recipient = await orda.recipients.create({
300
+ name: 'Test Recipient',
301
+ cryptoSettlementDetails: {
302
+ toChain: '8453', // Base
303
+ toToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // USDC
304
+ },
305
+ });
306
+ console.log('Smart wallet:', recipient.smartWallet?.address);
307
+
308
+ // Request cross-chain quote
309
+ const quote = await orda.quote.request({
310
+ fromChain: '1', // Ethereum
311
+ fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
312
+ fromAddress: '0xYourAddress',
313
+ intent: {
314
+ method: 'usd',
315
+ value: '100',
316
+ },
317
+ recipientId: recipient.recipientId,
318
+ });
319
+
320
+ // Monitor transaction
321
+ await orda.transactions.waitForCompletion(quote.transactionId, {
322
+ intervalMs: 10000,
323
+ timeoutMs: 600000,
324
+ onStatusUpdate: (status) => console.log('Status:', status),
325
+ });
326
+
327
+ // Off-ramp example (Crypto to Fiat)
328
+ const offRampRecipient = await orda.recipients.create({
329
+ name: 'Fiat Recipient',
330
+ fiatSettlementDetails: {
331
+ toCurrency: 'BRL',
332
+ pixKey: 'user@example.com',
333
+ },
334
+ kycInformation: {
335
+ taxId: '12345678901',
336
+ taxIdCountry: 'BRA',
337
+ email: 'user@example.com',
338
+ name: 'User Name',
339
+ },
340
+ });
341
+
342
+ const offRampQuote = await orda.offRamp.requestQuote({
343
+ fromChain: '8453',
344
+ fromToken: '0xE9185Ee218cae427aF7B9764A011bb89FeA761B4', // BRZ
345
+ fromAddress: '0xYourAddress',
346
+ intent: {
347
+ method: 'fromAmount',
348
+ value: '10000000000000000000', // 10 BRZ
349
+ },
350
+ recipientId: offRampRecipient.recipientId,
351
+ });
352
+
353
+ // On-ramp example (Fiat to Crypto)
354
+ const onRampQuote = await orda.onRamp.requestQuote({
355
+ fromCurrency: 'BRL',
356
+ intent: {
357
+ method: 'fromAmount',
358
+ value: '100.00',
359
+ },
360
+ recipientId: recipient.recipientId,
361
+ });
362
+ console.log('PIX payment key:', onRampQuote.depositInstructions.pixKey);
363
+ }
364
+
365
+ main().catch(console.error);
366
+ ```
367
+
368
+ ## Dependencies
369
+
370
+ The SDK uses the following runtime dependencies:
371
+
372
+ - `@aa-sdk/core` - Alchemy Account Abstraction SDK core
373
+ - `@account-kit/core` - Account Kit core functionality
374
+ - `@account-kit/infra` - Account Kit infrastructure
375
+ - `@account-kit/smart-contracts` - Smart contract implementations
376
+ - `viem` - TypeScript interface for Ethereum
377
+
248
378
  ## License
249
379
 
250
380
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordanetwork/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "TypeScript SDK for orda API",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",