@diviswap/sdk 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +69 -21
- package/dist/index.d.mts +12 -31
- package/dist/index.d.ts +12 -31
- package/dist/index.js +247 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +248 -72
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/{wallet-Cohx6L51.d.mts → wallet-DO1Nbsfk.d.mts} +38 -7
- package/dist/{wallet-Cohx6L51.d.ts → wallet-DO1Nbsfk.d.ts} +38 -7
- package/package.json +2 -1
package/dist/react/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-
|
|
2
|
+
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-DO1Nbsfk.mjs';
|
|
3
3
|
|
|
4
4
|
interface DiviswapContextValue {
|
|
5
5
|
user: User | null;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-
|
|
2
|
+
import { U as User, T as Transaction, P as Payee, D as Diviswap, d as Address, e as CreateAddressRequest, g as ChainName, l as WalletTrackingConfig, W as WalletConnection, k as EthereumWallet, i as WalletTracker } from '../wallet-DO1Nbsfk.js';
|
|
3
3
|
|
|
4
4
|
interface DiviswapContextValue {
|
|
5
5
|
user: User | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core type definitions for Diviswap SDK
|
|
3
3
|
*/
|
|
4
|
-
type Environment = 'production' | 'sandbox'
|
|
4
|
+
type Environment = 'production' | 'sandbox';
|
|
5
5
|
type AuthMode = 'user' | 'partner';
|
|
6
6
|
interface BaseDiviswapConfig {
|
|
7
7
|
/** Environment to use (defaults to 'production') */
|
|
@@ -89,22 +89,38 @@ interface User {
|
|
|
89
89
|
updatedAt: string;
|
|
90
90
|
}
|
|
91
91
|
interface IndividualData {
|
|
92
|
+
/** Country code for residential address (e.g., 'USA') */
|
|
92
93
|
residential_country_code: string;
|
|
94
|
+
/** Street address line 1 */
|
|
93
95
|
residential_address_line_one: string;
|
|
96
|
+
/** Street address line 2 (optional) */
|
|
94
97
|
residential_address_line_two?: string;
|
|
98
|
+
/** City */
|
|
95
99
|
residential_city: string;
|
|
100
|
+
/** State/province code */
|
|
96
101
|
residential_state: string;
|
|
102
|
+
/** Postal/ZIP code */
|
|
97
103
|
residential_postal_code: string;
|
|
104
|
+
/** Country code for government ID */
|
|
98
105
|
id_country_code: string;
|
|
106
|
+
/** Type of government ID (e.g., 'ssn', 'passport', 'drivers_license') */
|
|
107
|
+
id_type?: string;
|
|
108
|
+
/** Date of birth (YYYY-MM-DD format) */
|
|
99
109
|
dob: string;
|
|
110
|
+
/** Government ID number (without dashes or spaces) */
|
|
100
111
|
id_number: string;
|
|
101
112
|
}
|
|
102
113
|
interface RegisterRequest extends AuthCredentials {
|
|
103
|
-
|
|
104
|
-
|
|
114
|
+
/** User's first name (required for KYC compliance) */
|
|
115
|
+
firstName: string;
|
|
116
|
+
/** User's last name (required for KYC compliance) */
|
|
117
|
+
lastName: string;
|
|
118
|
+
/** User's phone number (optional) */
|
|
105
119
|
phone?: string;
|
|
120
|
+
/** Referral code (optional) */
|
|
106
121
|
referralCode?: string;
|
|
107
|
-
|
|
122
|
+
/** Complete KYC/identity information (required for regulatory compliance) */
|
|
123
|
+
individual: IndividualData;
|
|
108
124
|
}
|
|
109
125
|
interface AuthResponse {
|
|
110
126
|
accessToken: string;
|
|
@@ -248,7 +264,12 @@ interface TokenData {
|
|
|
248
264
|
declare class TokenManager {
|
|
249
265
|
private storage;
|
|
250
266
|
private refreshPromise;
|
|
251
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Create a new TokenManager
|
|
269
|
+
* @param useLocalStorage Whether to use localStorage (default: memory storage for security)
|
|
270
|
+
* @param userId Optional user ID for multi-user session isolation
|
|
271
|
+
*/
|
|
272
|
+
constructor(useLocalStorage?: boolean, userId?: string);
|
|
252
273
|
/**
|
|
253
274
|
* Parse JWT token to extract expiration
|
|
254
275
|
*/
|
|
@@ -317,6 +338,15 @@ declare class UnifiedApiClient {
|
|
|
317
338
|
private partnerAuth?;
|
|
318
339
|
private refreshCallback?;
|
|
319
340
|
constructor(config: UnifiedApiClientConfig, useLocalStorage?: boolean);
|
|
341
|
+
/**
|
|
342
|
+
* Override toJSON to prevent accidental serialization of sensitive data
|
|
343
|
+
*/
|
|
344
|
+
toJSON(): any;
|
|
345
|
+
/**
|
|
346
|
+
* Get the actual API key (for internal use only)
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
private getApiKey;
|
|
320
350
|
/**
|
|
321
351
|
* Create client from legacy user config (backward compatibility)
|
|
322
352
|
*/
|
|
@@ -618,9 +648,10 @@ interface FeeEstimate {
|
|
|
618
648
|
declare class TransactionsModule {
|
|
619
649
|
private client;
|
|
620
650
|
private depositAddresses;
|
|
621
|
-
|
|
651
|
+
private static readonly SUPPORTED_CHAINS;
|
|
652
|
+
constructor(client: UnifiedApiClient, environment?: 'production' | 'sandbox');
|
|
622
653
|
/**
|
|
623
|
-
* Map chain name to chain ID
|
|
654
|
+
* Map chain name to chain ID with validation
|
|
624
655
|
* @private
|
|
625
656
|
*/
|
|
626
657
|
private getChainId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core type definitions for Diviswap SDK
|
|
3
3
|
*/
|
|
4
|
-
type Environment = 'production' | 'sandbox'
|
|
4
|
+
type Environment = 'production' | 'sandbox';
|
|
5
5
|
type AuthMode = 'user' | 'partner';
|
|
6
6
|
interface BaseDiviswapConfig {
|
|
7
7
|
/** Environment to use (defaults to 'production') */
|
|
@@ -89,22 +89,38 @@ interface User {
|
|
|
89
89
|
updatedAt: string;
|
|
90
90
|
}
|
|
91
91
|
interface IndividualData {
|
|
92
|
+
/** Country code for residential address (e.g., 'USA') */
|
|
92
93
|
residential_country_code: string;
|
|
94
|
+
/** Street address line 1 */
|
|
93
95
|
residential_address_line_one: string;
|
|
96
|
+
/** Street address line 2 (optional) */
|
|
94
97
|
residential_address_line_two?: string;
|
|
98
|
+
/** City */
|
|
95
99
|
residential_city: string;
|
|
100
|
+
/** State/province code */
|
|
96
101
|
residential_state: string;
|
|
102
|
+
/** Postal/ZIP code */
|
|
97
103
|
residential_postal_code: string;
|
|
104
|
+
/** Country code for government ID */
|
|
98
105
|
id_country_code: string;
|
|
106
|
+
/** Type of government ID (e.g., 'ssn', 'passport', 'drivers_license') */
|
|
107
|
+
id_type?: string;
|
|
108
|
+
/** Date of birth (YYYY-MM-DD format) */
|
|
99
109
|
dob: string;
|
|
110
|
+
/** Government ID number (without dashes or spaces) */
|
|
100
111
|
id_number: string;
|
|
101
112
|
}
|
|
102
113
|
interface RegisterRequest extends AuthCredentials {
|
|
103
|
-
|
|
104
|
-
|
|
114
|
+
/** User's first name (required for KYC compliance) */
|
|
115
|
+
firstName: string;
|
|
116
|
+
/** User's last name (required for KYC compliance) */
|
|
117
|
+
lastName: string;
|
|
118
|
+
/** User's phone number (optional) */
|
|
105
119
|
phone?: string;
|
|
120
|
+
/** Referral code (optional) */
|
|
106
121
|
referralCode?: string;
|
|
107
|
-
|
|
122
|
+
/** Complete KYC/identity information (required for regulatory compliance) */
|
|
123
|
+
individual: IndividualData;
|
|
108
124
|
}
|
|
109
125
|
interface AuthResponse {
|
|
110
126
|
accessToken: string;
|
|
@@ -248,7 +264,12 @@ interface TokenData {
|
|
|
248
264
|
declare class TokenManager {
|
|
249
265
|
private storage;
|
|
250
266
|
private refreshPromise;
|
|
251
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Create a new TokenManager
|
|
269
|
+
* @param useLocalStorage Whether to use localStorage (default: memory storage for security)
|
|
270
|
+
* @param userId Optional user ID for multi-user session isolation
|
|
271
|
+
*/
|
|
272
|
+
constructor(useLocalStorage?: boolean, userId?: string);
|
|
252
273
|
/**
|
|
253
274
|
* Parse JWT token to extract expiration
|
|
254
275
|
*/
|
|
@@ -317,6 +338,15 @@ declare class UnifiedApiClient {
|
|
|
317
338
|
private partnerAuth?;
|
|
318
339
|
private refreshCallback?;
|
|
319
340
|
constructor(config: UnifiedApiClientConfig, useLocalStorage?: boolean);
|
|
341
|
+
/**
|
|
342
|
+
* Override toJSON to prevent accidental serialization of sensitive data
|
|
343
|
+
*/
|
|
344
|
+
toJSON(): any;
|
|
345
|
+
/**
|
|
346
|
+
* Get the actual API key (for internal use only)
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
private getApiKey;
|
|
320
350
|
/**
|
|
321
351
|
* Create client from legacy user config (backward compatibility)
|
|
322
352
|
*/
|
|
@@ -618,9 +648,10 @@ interface FeeEstimate {
|
|
|
618
648
|
declare class TransactionsModule {
|
|
619
649
|
private client;
|
|
620
650
|
private depositAddresses;
|
|
621
|
-
|
|
651
|
+
private static readonly SUPPORTED_CHAINS;
|
|
652
|
+
constructor(client: UnifiedApiClient, environment?: 'production' | 'sandbox');
|
|
622
653
|
/**
|
|
623
|
-
* Map chain name to chain ID
|
|
654
|
+
* Map chain name to chain ID with validation
|
|
624
655
|
* @private
|
|
625
656
|
*/
|
|
626
657
|
private getChainId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diviswap/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Official Diviswap SDK - Crypto rails made simple",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"typescript": "^5.7.3"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
+
"@noble/hashes": "2.0.1",
|
|
75
76
|
"@solana/wallet-adapter-base": "0.9.27",
|
|
76
77
|
"@solana/wallet-adapter-react": "0.15.39",
|
|
77
78
|
"@solana/wallet-adapter-react-ui": "0.9.39",
|