voidai-sdk 0.1.0 → 0.1.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 CHANGED
@@ -31,25 +31,21 @@ const chains = await sdk.api.getSupportedChains();
31
31
  const assets = await sdk.api.getAssetList();
32
32
  ```
33
33
 
34
- ## 📁 Project Structure
34
+ ## 🔑 Features
35
35
 
36
- ```
37
- bridge-sdk/
38
- ├── src/ # SDK source code
39
- │ ├── api/ # API client
40
- │ ├── config.ts # Configuration
41
- │ ├── core/ # Core bridge logic
42
- │ ├── types/ # TypeScript types
43
- │ ├── utils/ # Utilities
44
- │ ├── wallet/ # Wallet integrations
45
- │ └── index.ts # Main entry point
46
- ├── dist/ # Compiled SDK (Node.js)
47
- ├── dist-browser/ # Browser bundle
48
- ├── test/ # Test suite
49
- ├── examples/ # Example applications
50
- │ └── frontend/ # Frontend demo
51
- └── package.json
52
- ```
36
+ - **Multi-Wallet Support**
37
+ - Bittensor (Talisman, Polkadot.js, Subwallet)
38
+ - Ethereum (MetaMask)
39
+ - Solana (Phantom)
40
+
41
+ - **API Methods**
42
+ - Get supported chains
43
+ - Get asset list
44
+ - Chain filtering (by chainId, isActive, isCcipSupported)
45
+
46
+ - **TypeScript Support**
47
+ - Full type definitions included
48
+ - IntelliSense support
53
49
 
54
50
  ## 🔧 Development
55
51
 
@@ -72,12 +68,25 @@ npm run build:all
72
68
  npm test
73
69
  ```
74
70
 
75
- See [TEST_COVERAGE.md](./TEST_COVERAGE.md) for detailed test coverage information.
76
-
77
- ## 📚 Documentation
71
+ ## 📁 Project Structure
78
72
 
79
- - [Test Coverage](./TEST_COVERAGE.md) - Comprehensive test coverage documentation
80
- - [Examples](./examples/README.md) - Example applications and demos
73
+ ```
74
+ bridge-sdk/
75
+ ├── src/ # SDK source code
76
+ │ ├── api/ # API client
77
+ │ ├── config.ts # Configuration
78
+ │ ├── core/ # Core bridge logic
79
+ │ ├── types/ # TypeScript types
80
+ │ ├── utils/ # Utilities
81
+ │ ├── wallet/ # Wallet integrations
82
+ │ └── index.ts # Main entry point
83
+ ├── dist/ # Compiled SDK (Node.js)
84
+ ├── dist-browser/ # Browser bundle
85
+ ├── test/ # Test suite
86
+ ├── examples/ # Example applications
87
+ │ └── frontend/ # Frontend demo
88
+ └── package.json
89
+ ```
81
90
 
82
91
  ## 🌐 Browser Usage
83
92
 
@@ -93,22 +102,6 @@ For browser usage, include the bundled SDK:
93
102
  </script>
94
103
  ```
95
104
 
96
- ## 🔑 Features
97
-
98
- - **Multi-Wallet Support**
99
- - Bittensor (Talisman, Polkadot.js, Subwallet)
100
- - Ethereum (MetaMask)
101
- - Solana (Phantom)
102
-
103
- - **API Methods**
104
- - Get supported chains
105
- - Get asset list
106
- - Chain filtering (by chainId, isActive, isCcipSupported)
107
-
108
- - **TypeScript Support**
109
- - Full type definitions included
110
- - IntelliSense support
111
-
112
105
  ## 📝 License
113
106
 
114
107
  MIT
@@ -116,4 +109,3 @@ MIT
116
109
  ## 🤝 Contributing
117
110
 
118
111
  Contributions are welcome! Please ensure all tests pass before submitting a pull request.
119
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voidai-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript SDK for VoidAI Bridge - Blockchain wallet authentication and API integration",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist-browser/voidai-sdk.js",
@@ -52,4 +52,4 @@
52
52
  "cors": "^2.8.5",
53
53
  "zod": "^3.22.4"
54
54
  }
55
- }
55
+ }
@@ -1,50 +0,0 @@
1
- import { VoidAIBridgeClient } from '../api/client';
2
- import { SignInResponse, RefreshTokenResponse } from '../types';
3
- export declare class AuthSession {
4
- private apiClient;
5
- private accessToken;
6
- private refreshToken;
7
- private accessTokenWs;
8
- private adminStatus;
9
- constructor(apiClient: VoidAIBridgeClient);
10
- /**
11
- * Get nonce (signature) for wallet authentication
12
- * @param wallet - Public key wallet address
13
- */
14
- getNonce(wallet: string): Promise<string>;
15
- /**
16
- * Sign in with wallet
17
- * @param publicKey - Wallet public key
18
- * @param signature - Signed nonce
19
- * @param chainId - Blockchain chain ID
20
- */
21
- signIn(publicKey: string, signature: string, chainId: string): Promise<SignInResponse>;
22
- /**
23
- * Refresh access token using refresh token
24
- */
25
- refreshAccessToken(): Promise<RefreshTokenResponse>;
26
- /**
27
- * Get current access token
28
- */
29
- getAccessToken(): string | null;
30
- /**
31
- * Get current refresh token
32
- */
33
- getRefreshToken(): string | null;
34
- /**
35
- * Get WebSocket access token
36
- */
37
- getAccessTokenWs(): string | null;
38
- /**
39
- * Check if user is admin
40
- */
41
- isAdmin(): boolean;
42
- /**
43
- * Check if user is authenticated
44
- */
45
- isAuthenticated(): boolean;
46
- /**
47
- * Logout and clear session
48
- */
49
- logout(): Promise<void>;
50
- }
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthSession = void 0;
4
- class AuthSession {
5
- constructor(apiClient) {
6
- this.accessToken = null;
7
- this.refreshToken = null;
8
- this.accessTokenWs = null;
9
- this.adminStatus = false;
10
- this.apiClient = apiClient;
11
- }
12
- /**
13
- * Get nonce (signature) for wallet authentication
14
- * @param wallet - Public key wallet address
15
- */
16
- async getNonce(wallet) {
17
- const response = await this.apiClient.post('/api/wallet/get-nonce', {
18
- wallet,
19
- });
20
- return response.nonce;
21
- }
22
- /**
23
- * Sign in with wallet
24
- * @param publicKey - Wallet public key
25
- * @param signature - Signed nonce
26
- * @param chainId - Blockchain chain ID
27
- */
28
- async signIn(publicKey, signature, chainId) {
29
- const requestBody = {
30
- publicKey,
31
- signature,
32
- chainId,
33
- };
34
- const response = await this.apiClient.post('/api/wallet/signin/wallet', requestBody);
35
- // Store session data
36
- this.accessToken = response.accessToken;
37
- this.refreshToken = response.refreshToken;
38
- this.accessTokenWs = response.accessTokenWs;
39
- this.adminStatus = response.isAdmin;
40
- // Update client with access token for future requests
41
- this.apiClient.setAccessToken(response.accessToken);
42
- return response;
43
- }
44
- /**
45
- * Refresh access token using refresh token
46
- */
47
- async refreshAccessToken() {
48
- if (!this.refreshToken) {
49
- throw new Error('VoidAI SDK: No refresh token available');
50
- }
51
- // Temporarily set refresh token as authorization
52
- const previousToken = this.apiClient.getAccessToken();
53
- this.apiClient.setAccessToken(this.refreshToken);
54
- try {
55
- const response = await this.apiClient.post('/api/wallet/refresh-token');
56
- // Update stored tokens
57
- this.accessToken = response.accessToken;
58
- this.refreshToken = response.refreshToken;
59
- // Update client with new access token
60
- this.apiClient.setAccessToken(response.accessToken);
61
- return response;
62
- }
63
- catch (error) {
64
- // Restore previous token on error
65
- this.apiClient.setAccessToken(previousToken);
66
- throw error;
67
- }
68
- }
69
- /**
70
- * Get current access token
71
- */
72
- getAccessToken() {
73
- return this.accessToken;
74
- }
75
- /**
76
- * Get current refresh token
77
- */
78
- getRefreshToken() {
79
- return this.refreshToken;
80
- }
81
- /**
82
- * Get WebSocket access token
83
- */
84
- getAccessTokenWs() {
85
- return this.accessTokenWs;
86
- }
87
- /**
88
- * Check if user is admin
89
- */
90
- isAdmin() {
91
- return this.adminStatus;
92
- }
93
- /**
94
- * Check if user is authenticated
95
- */
96
- isAuthenticated() {
97
- return !!this.accessToken;
98
- }
99
- /**
100
- * Logout and clear session
101
- */
102
- async logout() {
103
- this.accessToken = null;
104
- this.refreshToken = null;
105
- this.accessTokenWs = null;
106
- this.adminStatus = false;
107
- this.apiClient.setAccessToken(null);
108
- }
109
- }
110
- exports.AuthSession = AuthSession;