@voidaisdk/bridge-sdk 0.0.2 → 0.0.3
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 +125 -109
- package/dist/api/client.d.ts +4 -3
- package/dist/api/client.js +22 -12
- package/dist/core/bridge.js +4 -1
- package/dist/index.js +1 -1
- package/dist/wallet/bittensor.js +2 -1
- package/dist/wallet/ethereum.js +2 -2
- package/dist/wallet/solana.js +1 -1
- package/dist-browser/voidai-sdk.js +1 -1
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -41,8 +41,8 @@ pnpm add voidai-sdk
|
|
|
41
41
|
import { BridgeSDK } from 'voidai-sdk';
|
|
42
42
|
|
|
43
43
|
const sdk = new BridgeSDK({
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
apiKey: process.env.VOIDAI_API_KEY!,
|
|
45
|
+
environment: 'testnet', // 'devnet' | 'testnet' | 'mainnet'
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
// Wait for authentication & API key validation
|
|
@@ -56,8 +56,8 @@ await sdk.ready;
|
|
|
56
56
|
```typescript
|
|
57
57
|
// Get all active chains
|
|
58
58
|
const chains = await sdk.api.getSupportedChains({
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
isActive: true,
|
|
60
|
+
isCcipSupported: true,
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
// Get assets (optionally filtered by chain)
|
|
@@ -85,29 +85,31 @@ console.log('Connected:', solanaAccount.address);
|
|
|
85
85
|
```typescript
|
|
86
86
|
// Bridge TAO from Bittensor to Ethereum
|
|
87
87
|
const result = await sdk.bridge.bridge({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
fromWallet: '5DqAEsZi...', // Bittensor address
|
|
89
|
+
toWallet: '0x742d35...', // Ethereum address
|
|
90
|
+
fromToken: 'tao',
|
|
91
|
+
toToken: 'wtao',
|
|
92
|
+
fromChain: 'BITTENSOR',
|
|
93
|
+
toChain: 'ETHEREUM_SEPOLIA',
|
|
94
|
+
amount: 1.0,
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
console.log('Bridge identifier:', result.identifier);
|
|
98
98
|
|
|
99
99
|
// For EVM burn flows (wTAO → TAO), use the pre-built transaction
|
|
100
100
|
if (result.evmTransaction) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
const txHash = await window.ethereum.request({
|
|
102
|
+
method: 'eth_sendTransaction',
|
|
103
|
+
params: [
|
|
104
|
+
{
|
|
105
|
+
from: ethAccount.address,
|
|
106
|
+
to: result.evmTransaction.to,
|
|
107
|
+
data: result.evmTransaction.data,
|
|
108
|
+
value: result.evmTransaction.value,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
});
|
|
112
|
+
console.log('Transaction sent:', txHash);
|
|
111
113
|
}
|
|
112
114
|
```
|
|
113
115
|
|
|
@@ -115,25 +117,27 @@ if (result.evmTransaction) {
|
|
|
115
117
|
|
|
116
118
|
```typescript
|
|
117
119
|
const route = await sdk.bridge.routeSwap({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
operationType: 'SWAP',
|
|
121
|
+
originAssetId: 1,
|
|
122
|
+
destinationAssetId: 2,
|
|
123
|
+
fromAddress: '0xSource...',
|
|
124
|
+
toAddress: '0xDestination...',
|
|
125
|
+
amount: 0.5,
|
|
124
126
|
});
|
|
125
127
|
|
|
126
128
|
if (route.success && route.data) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
// Execute via MetaMask
|
|
130
|
+
await window.ethereum.request({
|
|
131
|
+
method: 'eth_sendTransaction',
|
|
132
|
+
params: [
|
|
133
|
+
{
|
|
134
|
+
from: '0xSource...',
|
|
135
|
+
to: route.data.to,
|
|
136
|
+
data: route.data.data,
|
|
137
|
+
value: route.data.value,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
});
|
|
137
141
|
}
|
|
138
142
|
```
|
|
139
143
|
|
|
@@ -142,9 +146,9 @@ if (route.success && route.data) {
|
|
|
142
146
|
```typescript
|
|
143
147
|
// Bridge fee estimate
|
|
144
148
|
const bridgeFee = await sdk.bridge.getBridgeFeeEstimate({
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
fromToken: 'tao',
|
|
150
|
+
toToken: 'wtao',
|
|
151
|
+
amount: 2.5,
|
|
148
152
|
});
|
|
149
153
|
|
|
150
154
|
console.log('Bridge fee:', bridgeFee.data.fee);
|
|
@@ -152,11 +156,11 @@ console.log('Recipient will receive:', bridgeFee.data.recipientAmount);
|
|
|
152
156
|
|
|
153
157
|
// Router swap fee estimate
|
|
154
158
|
const swapFee = await sdk.bridge.getRouterSwapFeeEstimate({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
originAssetId: 1,
|
|
160
|
+
destinationAssetId: 2,
|
|
161
|
+
amount: 0.75,
|
|
162
|
+
operationType: 'SWAP',
|
|
163
|
+
toAddress: '0xDestination...',
|
|
160
164
|
});
|
|
161
165
|
|
|
162
166
|
console.log('Total fee:', swapFee.totalFee);
|
|
@@ -176,6 +180,7 @@ console.log('Total fee:', swapFee.totalFee);
|
|
|
176
180
|
## 💡 Key Features
|
|
177
181
|
|
|
178
182
|
### ✅ Multi-Chain Support
|
|
183
|
+
|
|
179
184
|
- **Bittensor** (TAO, Alpha)
|
|
180
185
|
- **Ethereum** (Mainnet, Sepolia)
|
|
181
186
|
- **Base** (Mainnet, Sepolia)
|
|
@@ -183,26 +188,31 @@ console.log('Total fee:', swapFee.totalFee);
|
|
|
183
188
|
- More chains added regularly
|
|
184
189
|
|
|
185
190
|
### ✅ Wallet Integration
|
|
191
|
+
|
|
186
192
|
- **Bittensor**: Talisman, Subwallet, Polkadot.js
|
|
187
193
|
- **Ethereum**: MetaMask
|
|
188
194
|
- **Solana**: Phantom
|
|
189
195
|
|
|
190
196
|
### ✅ Bridge Operations
|
|
197
|
+
|
|
191
198
|
- TAO ↔ wTAO (Bittensor ↔ Ethereum)
|
|
192
199
|
- Alpha ↔ wAlpha
|
|
193
200
|
- Cross-chain asset transfers
|
|
194
201
|
- Automatic EVM transaction building for burn operations
|
|
195
202
|
|
|
196
203
|
### ✅ Routing & Swaps
|
|
204
|
+
|
|
197
205
|
- Unified route-transaction API
|
|
198
206
|
- SWAP, BRIDGE, and CCIP operations
|
|
199
207
|
- Fee estimation before execution
|
|
200
208
|
|
|
201
209
|
### ✅ Frontend vs Backend
|
|
210
|
+
|
|
202
211
|
- **BridgeSDK** – Frontend usage (apiKey only, no secretKey)
|
|
203
212
|
- **BridgeSDKServer** – Backend usage (apiKey + secretKey for JWT auth, no wallets)
|
|
204
213
|
|
|
205
214
|
### ✅ Production Ready
|
|
215
|
+
|
|
206
216
|
- TypeScript-first with full type definitions
|
|
207
217
|
- Automatic JWT refresh on token expiry
|
|
208
218
|
- Normalized error messages
|
|
@@ -217,16 +227,18 @@ For server-side or backend integrations, use `BridgeSDKServer` with both `apiKey
|
|
|
217
227
|
import { BridgeSDKServer } from 'voidai-sdk';
|
|
218
228
|
|
|
219
229
|
const sdk = new BridgeSDKServer({
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
230
|
+
apiKey: process.env.VOIDAI_API_KEY!,
|
|
231
|
+
secretKey: process.env.VOIDAI_SECRET_KEY!,
|
|
232
|
+
environment: 'production',
|
|
223
233
|
});
|
|
224
234
|
|
|
225
235
|
await sdk.ready;
|
|
226
236
|
|
|
227
237
|
// Same bridge/api API, no wallets
|
|
228
238
|
const chains = await sdk.api.getSupportedChains();
|
|
229
|
-
const result = await sdk.bridge.bridge({
|
|
239
|
+
const result = await sdk.bridge.bridge({
|
|
240
|
+
/* ... */
|
|
241
|
+
});
|
|
230
242
|
```
|
|
231
243
|
|
|
232
244
|
`BridgeSDKServer` exposes `config`, `api`, `bridge`, and `ready` – no `wallets` (use `BridgeSDK` in frontend for that).
|
|
@@ -235,11 +247,11 @@ const result = await sdk.bridge.bridge({ /* ... */ });
|
|
|
235
247
|
|
|
236
248
|
The SDK supports three environments:
|
|
237
249
|
|
|
238
|
-
| Environment | Base URL
|
|
239
|
-
|
|
240
|
-
| `development` | `http://localhost:3003`
|
|
241
|
-
| `staging` | `https://api-staging.voidai.envistudios.com` | Testing & QA
|
|
242
|
-
| `production` | `https://api.voidai.envistudios.com`
|
|
250
|
+
| Environment | Base URL | Use Case |
|
|
251
|
+
| ------------- | -------------------------------------------- | ----------------- |
|
|
252
|
+
| `development` | `http://localhost:3003` | Local development |
|
|
253
|
+
| `staging` | `https://api-staging.voidai.envistudios.com` | Testing & QA |
|
|
254
|
+
| `production` | `https://api.voidai.envistudios.com` | Live applications |
|
|
243
255
|
|
|
244
256
|
## 📝 Example: Complete Bridge Flow
|
|
245
257
|
|
|
@@ -247,51 +259,53 @@ The SDK supports three environments:
|
|
|
247
259
|
import { BridgeSDK } from 'voidai-sdk';
|
|
248
260
|
|
|
249
261
|
async function bridgeTAO() {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
await sdk.ready;
|
|
262
|
+
// 1. Initialize SDK
|
|
263
|
+
const sdk = new BridgeSDK({
|
|
264
|
+
apiKey: process.env.VOIDAI_API_KEY!,
|
|
265
|
+
environment: 'staging',
|
|
266
|
+
});
|
|
257
267
|
|
|
258
|
-
|
|
259
|
-
const bittensorAccount = await sdk.wallets.bittensor.connect();
|
|
260
|
-
const ethAccount = await sdk.wallets.ethereum.connect();
|
|
268
|
+
await sdk.ready;
|
|
261
269
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
toToken: 'wtao',
|
|
266
|
-
amount: 1.0,
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
console.log(`Fee: ${fee.data.fee}, You'll receive: ${fee.data.recipientAmount}`);
|
|
270
|
-
|
|
271
|
-
// 4. Execute bridge
|
|
272
|
-
const result = await sdk.bridge.bridge({
|
|
273
|
-
fromWallet: bittensorAccount.address,
|
|
274
|
-
toWallet: ethAccount.address,
|
|
275
|
-
fromToken: 'tao',
|
|
276
|
-
toToken: 'wtao',
|
|
277
|
-
fromChain: 'BITTENSOR',
|
|
278
|
-
toChain: 'ETHEREUM_SEPOLIA',
|
|
279
|
-
amount: 1.0,
|
|
280
|
-
});
|
|
270
|
+
// 2. Connect wallets
|
|
271
|
+
const bittensorAccount = await sdk.wallets.bittensor.connect();
|
|
272
|
+
const ethAccount = await sdk.wallets.ethereum.connect();
|
|
281
273
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
method: 'eth_sendTransaction',
|
|
288
|
-
params: [{
|
|
289
|
-
from: ethAccount.address,
|
|
290
|
-
...result.evmTransaction,
|
|
291
|
-
}],
|
|
274
|
+
// 3. Estimate fees
|
|
275
|
+
const fee = await sdk.bridge.getBridgeFeeEstimate({
|
|
276
|
+
fromToken: 'tao',
|
|
277
|
+
toToken: 'wtao',
|
|
278
|
+
amount: 1.0,
|
|
292
279
|
});
|
|
293
|
-
|
|
294
|
-
|
|
280
|
+
|
|
281
|
+
console.log(`Fee: ${fee.data.fee}, You'll receive: ${fee.data.recipientAmount}`);
|
|
282
|
+
|
|
283
|
+
// 4. Execute bridge
|
|
284
|
+
const result = await sdk.bridge.bridge({
|
|
285
|
+
fromWallet: bittensorAccount.address,
|
|
286
|
+
toWallet: ethAccount.address,
|
|
287
|
+
fromToken: 'tao',
|
|
288
|
+
toToken: 'wtao',
|
|
289
|
+
fromChain: 'BITTENSOR',
|
|
290
|
+
toChain: 'ETHEREUM_SEPOLIA',
|
|
291
|
+
amount: 1.0,
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
console.log('Bridge initiated:', result.identifier);
|
|
295
|
+
|
|
296
|
+
// 5. Execute on-chain transaction (if EVM burn flow)
|
|
297
|
+
if (result.evmTransaction) {
|
|
298
|
+
const txHash = await window.ethereum.request({
|
|
299
|
+
method: 'eth_sendTransaction',
|
|
300
|
+
params: [
|
|
301
|
+
{
|
|
302
|
+
from: ethAccount.address,
|
|
303
|
+
...result.evmTransaction,
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
});
|
|
307
|
+
console.log('On-chain tx:', txHash);
|
|
308
|
+
}
|
|
295
309
|
}
|
|
296
310
|
|
|
297
311
|
bridgeTAO().catch(console.error);
|
|
@@ -351,12 +365,12 @@ bridge-sdk/
|
|
|
351
365
|
|
|
352
366
|
```html
|
|
353
367
|
<script type="module">
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
368
|
+
import { BridgeSDK } from './node_modules/voidai-sdk/dist-browser/voidai-sdk.js';
|
|
369
|
+
|
|
370
|
+
const sdk = new BridgeSDK({
|
|
371
|
+
apiKey: 'your-api-key',
|
|
372
|
+
environment: 'staging',
|
|
373
|
+
});
|
|
360
374
|
</script>
|
|
361
375
|
```
|
|
362
376
|
|
|
@@ -375,15 +389,17 @@ The SDK throws `Error` instances with user-friendly messages:
|
|
|
375
389
|
|
|
376
390
|
```typescript
|
|
377
391
|
try {
|
|
378
|
-
|
|
392
|
+
await sdk.bridge.bridge({
|
|
393
|
+
/* ... */
|
|
394
|
+
});
|
|
379
395
|
} catch (error) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
396
|
+
// error.message contains a clear, actionable message
|
|
397
|
+
console.error('Bridge failed:', error.message);
|
|
398
|
+
|
|
399
|
+
// Common errors:
|
|
400
|
+
// - "Session expired or unauthorized..." → Check API key
|
|
401
|
+
// - "Failed to execute bridge swap" → Check parameters
|
|
402
|
+
// - "User rejected the connection request" → User cancelled wallet
|
|
387
403
|
}
|
|
388
404
|
```
|
|
389
405
|
|
package/dist/api/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
1
2
|
import { BridgeConfig } from '../config';
|
|
2
|
-
import { Chain,
|
|
3
|
+
import { Chain, AssetsApiResponse, ApiKeyValidationData, BridgeSwapRequest, BridgeSwapResponse, RouteTransactionRequest, RouteTransactionResponse, BridgeFeeEstimateRequest, BridgeFeeEstimateResponse, RouterSwapFeeEstimateRequest, RouterSwapFeeEstimateResponse, CancelCcipRequest, CancelRouterSwapRequest, CancelBridgeSwapRequest, CancelOperationResponse, ApiTransactionsResponse, ValidateBurnRequest, ValidateBurnResponse, CcipTxConfirmationRequest, CcipTxConfirmationResponse } from '../types';
|
|
3
4
|
export declare class VoidAIBridgeClient {
|
|
4
5
|
private config;
|
|
5
6
|
private client;
|
|
@@ -45,7 +46,7 @@ export declare class VoidAIBridgeClient {
|
|
|
45
46
|
*/
|
|
46
47
|
getValidatedApiKeyData(): ApiKeyValidationData | null;
|
|
47
48
|
private getUrl;
|
|
48
|
-
get<T>(path: string, params?: any, retryAttempted?: boolean): Promise<T>;
|
|
49
|
+
get<T>(path: string, params?: any, retryAttempted?: boolean, requestConfig?: AxiosRequestConfig): Promise<T>;
|
|
49
50
|
post<T>(path: string, data?: any, retryAttempted?: boolean): Promise<T>;
|
|
50
51
|
delete<T>(path: string, params?: any, retryAttempted?: boolean): Promise<T>;
|
|
51
52
|
patch<T>(path: string, data?: any, retryAttempted?: boolean): Promise<T>;
|
|
@@ -96,7 +97,7 @@ export declare class VoidAIBridgeClient {
|
|
|
96
97
|
/**
|
|
97
98
|
* Get list of supported assets
|
|
98
99
|
*/
|
|
99
|
-
getAssetList(chainId?: string): Promise<
|
|
100
|
+
getAssetList(chainId?: string, page?: number, limit?: number): Promise<AssetsApiResponse>;
|
|
100
101
|
/**
|
|
101
102
|
* Get bridge fee estimate
|
|
102
103
|
* @param params - Fee estimation parameters
|
package/dist/api/client.js
CHANGED
|
@@ -80,7 +80,9 @@ class VoidAIBridgeClient {
|
|
|
80
80
|
headers: { 'Content-Type': 'application/json' },
|
|
81
81
|
timeout: 10000,
|
|
82
82
|
});
|
|
83
|
-
if (response.data &&
|
|
83
|
+
if (response.data &&
|
|
84
|
+
response.data.success &&
|
|
85
|
+
response.data.accessToken) {
|
|
84
86
|
return response.data.accessToken;
|
|
85
87
|
}
|
|
86
88
|
const errorData = response.data;
|
|
@@ -188,11 +190,14 @@ class VoidAIBridgeClient {
|
|
|
188
190
|
const cleanPath = path.replace(/^\//, '');
|
|
189
191
|
return `${cleanBase}/${cleanPath}`;
|
|
190
192
|
}
|
|
191
|
-
async get(path, params, retryAttempted = false) {
|
|
193
|
+
async get(path, params, retryAttempted = false, requestConfig) {
|
|
192
194
|
await this.ready;
|
|
193
195
|
const url = this.getUrl(path);
|
|
194
196
|
try {
|
|
195
|
-
const response = await this.client.get(url, {
|
|
197
|
+
const response = await this.client.get(url, {
|
|
198
|
+
params,
|
|
199
|
+
...(requestConfig || {}),
|
|
200
|
+
});
|
|
196
201
|
return response.data;
|
|
197
202
|
}
|
|
198
203
|
catch (error) {
|
|
@@ -202,7 +207,7 @@ class VoidAIBridgeClient {
|
|
|
202
207
|
try {
|
|
203
208
|
await this.authenticate();
|
|
204
209
|
// Retry the original request once with fresh credentials.
|
|
205
|
-
return await this.get(path, params, true);
|
|
210
|
+
return await this.get(path, params, true, requestConfig);
|
|
206
211
|
}
|
|
207
212
|
catch (retryError) {
|
|
208
213
|
this.handleError(retryError);
|
|
@@ -376,17 +381,20 @@ class VoidAIBridgeClient {
|
|
|
376
381
|
/**
|
|
377
382
|
* Get list of supported assets
|
|
378
383
|
*/
|
|
379
|
-
async getAssetList(chainId) {
|
|
380
|
-
const
|
|
384
|
+
async getAssetList(chainId, page = 1, limit = 20) {
|
|
385
|
+
const queryParams = {
|
|
386
|
+
page: String(page),
|
|
387
|
+
limit: String(limit),
|
|
388
|
+
};
|
|
389
|
+
const response = await this.get('api/v1/asset/assets', queryParams);
|
|
381
390
|
if (!response.success || !response.data) {
|
|
382
391
|
throw new Error(response.message || 'Failed to fetch assets');
|
|
383
392
|
}
|
|
384
|
-
|
|
385
|
-
// Filter by chainId if provided
|
|
393
|
+
// Filter by chainId if provided (client-side filtering after pagination)
|
|
386
394
|
if (chainId !== undefined) {
|
|
387
|
-
assets = assets.filter(asset => asset.chainId === chainId);
|
|
395
|
+
response.data.assets = response.data.assets.filter((asset) => asset.chainId === chainId);
|
|
388
396
|
}
|
|
389
|
-
return
|
|
397
|
+
return response;
|
|
390
398
|
}
|
|
391
399
|
/**
|
|
392
400
|
* Get bridge fee estimate
|
|
@@ -398,7 +406,9 @@ class VoidAIBridgeClient {
|
|
|
398
406
|
toToken: params.toToken,
|
|
399
407
|
amount: String(params.amount),
|
|
400
408
|
};
|
|
401
|
-
return this.get('api/v1/bridge/call-fee', queryParams
|
|
409
|
+
return this.get('api/v1/bridge/call-fee', queryParams, false, {
|
|
410
|
+
headers: { 'x-api-key': this.config.apiKey },
|
|
411
|
+
});
|
|
402
412
|
}
|
|
403
413
|
/**
|
|
404
414
|
* Get router swap fee estimate
|
|
@@ -412,7 +422,7 @@ class VoidAIBridgeClient {
|
|
|
412
422
|
operationType: params.operationType,
|
|
413
423
|
toAddress: params.toAddress,
|
|
414
424
|
};
|
|
415
|
-
return this.get('api/v1/router-swap/call-fee', queryParams);
|
|
425
|
+
return this.get('api/v1/router-swap/call-fee', queryParams, false, { headers: { 'x-api-key': this.config.apiKey } });
|
|
416
426
|
}
|
|
417
427
|
/**
|
|
418
428
|
* Normalize and rethrow errors with backend message (if available) so
|
package/dist/core/bridge.js
CHANGED
|
@@ -41,7 +41,10 @@ class Bridge {
|
|
|
41
41
|
},
|
|
42
42
|
],
|
|
43
43
|
functionName: 'burn',
|
|
44
|
-
args: [
|
|
44
|
+
args: [
|
|
45
|
+
maybeWithEncoded.encodedData,
|
|
46
|
+
maybeWithEncoded.signature,
|
|
47
|
+
],
|
|
45
48
|
});
|
|
46
49
|
// Attach the prepared transaction payload in a non-breaking way.
|
|
47
50
|
maybeWithEncoded.evmTransaction = {
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ class BridgeSDK {
|
|
|
38
38
|
this.wallets = {
|
|
39
39
|
bittensor: new bittensor_1.BittensorWallet(),
|
|
40
40
|
ethereum: new ethereum_1.EthereumWallet(),
|
|
41
|
-
solana: new solana_1.SolanaWallet()
|
|
41
|
+
solana: new solana_1.SolanaWallet(),
|
|
42
42
|
};
|
|
43
43
|
this.bridge = new bridge_1.Bridge(this.api);
|
|
44
44
|
}
|
package/dist/wallet/bittensor.js
CHANGED
|
@@ -131,7 +131,8 @@ class BittensorWallet {
|
|
|
131
131
|
return !!injectedWeb3[extensionName];
|
|
132
132
|
}
|
|
133
133
|
const supportedExtensions = ['talisman', 'subwallet-js', 'polkadot-js'];
|
|
134
|
-
return supportedExtensions.some(name => !!injectedWeb3[name]) ||
|
|
134
|
+
return (supportedExtensions.some((name) => !!injectedWeb3[name]) ||
|
|
135
|
+
Object.keys(injectedWeb3).length > 0);
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
137
138
|
* Get the wallet extension instance (for advanced usage)
|
package/dist/wallet/ethereum.js
CHANGED
|
@@ -16,7 +16,7 @@ class EthereumWallet {
|
|
|
16
16
|
if (typeof window === 'undefined') {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
-
return typeof window.ethereum !== 'undefined' && window.ethereum.isMetaMask;
|
|
19
|
+
return (typeof window.ethereum !== 'undefined' && window.ethereum.isMetaMask);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Connect to MetaMask wallet
|
|
@@ -40,7 +40,7 @@ class EthereumWallet {
|
|
|
40
40
|
const chainId = await ethereum.request({ method: 'eth_chainId' });
|
|
41
41
|
this.account = {
|
|
42
42
|
address: accounts[0],
|
|
43
|
-
chainId: chainId
|
|
43
|
+
chainId: chainId,
|
|
44
44
|
};
|
|
45
45
|
this.chainId = chainId;
|
|
46
46
|
// Listen for account changes
|
package/dist/wallet/solana.js
CHANGED
|
@@ -37,7 +37,7 @@ class SolanaWallet {
|
|
|
37
37
|
}
|
|
38
38
|
this.account = {
|
|
39
39
|
address: response.publicKey.toString(),
|
|
40
|
-
publicKey: response.publicKey.toString()
|
|
40
|
+
publicKey: response.publicKey.toString(),
|
|
41
41
|
};
|
|
42
42
|
// Listen for disconnect
|
|
43
43
|
solana.on('disconnect', this.handleDisconnect.bind(this));
|