@opendatalabs/vana-sdk 0.1.0-alpha.f05a34e → 0.1.0-alpha.f36c555
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 +98 -36
- package/package.json +54 -27
- package/dist/chains.browser.cjs +0 -96
- package/dist/chains.browser.cjs.map +0 -1
- package/dist/chains.browser.d.cts +0 -53
- package/dist/chains.browser.d.ts +0 -53
- package/dist/chains.browser.js +0 -65
- package/dist/chains.browser.js.map +0 -1
- package/dist/chains.cjs +0 -96
- package/dist/chains.cjs.map +0 -1
- package/dist/chains.d.cts +0 -2
- package/dist/chains.d.ts +0 -2
- package/dist/chains.js +0 -65
- package/dist/chains.js.map +0 -1
- package/dist/chains.node.cjs +0 -96
- package/dist/chains.node.cjs.map +0 -1
- package/dist/chains.node.d.cts +0 -2
- package/dist/chains.node.d.ts +0 -2
- package/dist/chains.node.js +0 -65
- package/dist/chains.node.js.map +0 -1
- package/dist/index.browser.d.ts +0 -32480
- package/dist/index.browser.js +0 -41016
- package/dist/index.browser.js.map +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.node.cjs +0 -41496
- package/dist/index.node.cjs.map +0 -1
- package/dist/index.node.d.cts +0 -32586
- package/dist/index.node.d.ts +0 -32586
- package/dist/index.node.js +0 -41358
- package/dist/index.node.js.map +0 -1
- package/dist/platform.browser.d.ts +0 -224
- package/dist/platform.browser.js +0 -318
- package/dist/platform.browser.js.map +0 -1
- package/dist/platform.cjs +0 -659
- package/dist/platform.cjs.map +0 -1
- package/dist/platform.d.cts +0 -1
- package/dist/platform.d.ts +0 -1
- package/dist/platform.js +0 -622
- package/dist/platform.js.map +0 -1
- package/dist/platform.node.cjs +0 -659
- package/dist/platform.node.cjs.map +0 -1
- package/dist/platform.node.d.cts +0 -264
- package/dist/platform.node.d.ts +0 -264
- package/dist/platform.node.js +0 -622
- package/dist/platform.node.js.map +0 -1
package/README.md
CHANGED
|
@@ -28,12 +28,19 @@ npm install viem@^2.31.7
|
|
|
28
28
|
|
|
29
29
|
## Quick Start
|
|
30
30
|
|
|
31
|
-
The Vana SDK
|
|
31
|
+
The Vana SDK provides optimized builds for different environments:
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
| Build | Use Case | Crypto Implementation | Configuration |
|
|
34
|
+
| -------------- | --------------------------------- | ---------------------------------- | ----------------- |
|
|
35
|
+
| **`/browser`** | Browser apps (React, Vue) | Pure JavaScript (@noble/secp256k1) | **Zero config** ✓ |
|
|
36
|
+
| **`/node`** | Server-side (Node.js, API routes) | Native bindings (secp256k1) | Zero config ✓ |
|
|
37
|
+
|
|
38
|
+
### Browser Applications
|
|
39
|
+
|
|
40
|
+
The browser build uses pure JavaScript cryptography and requires **no special configuration**:
|
|
34
41
|
|
|
35
42
|
```typescript
|
|
36
|
-
//
|
|
43
|
+
// Browser build - works out of the box with any bundler
|
|
37
44
|
import { Vana, mokshaTestnet } from "@opendatalabs/vana-sdk/browser";
|
|
38
45
|
import { createWalletClient, http } from "viem";
|
|
39
46
|
import { privateKeyToAccount } from "viem/accounts";
|
|
@@ -53,7 +60,9 @@ const vana = Vana({
|
|
|
53
60
|
});
|
|
54
61
|
```
|
|
55
62
|
|
|
56
|
-
### Server-side Applications (
|
|
63
|
+
### Server-side Applications (Node.js)
|
|
64
|
+
|
|
65
|
+
The Node.js build uses native secp256k1 bindings for optimal performance:
|
|
57
66
|
|
|
58
67
|
```typescript
|
|
59
68
|
// For server-side applications (Next.js API routes, Express)
|
|
@@ -116,11 +125,17 @@ const files = await vana.data.getUserFiles({
|
|
|
116
125
|
owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
117
126
|
});
|
|
118
127
|
|
|
119
|
-
// Upload encrypted file
|
|
120
|
-
const result = await vana.data.
|
|
121
|
-
|
|
122
|
-
schemaId: 123,
|
|
128
|
+
// Upload encrypted file with decryption permissions
|
|
129
|
+
const result = await vana.data.upload({
|
|
130
|
+
content: "Sensitive user data",
|
|
123
131
|
filename: "user-data.json",
|
|
132
|
+
schemaId: 123,
|
|
133
|
+
permissions: [
|
|
134
|
+
{
|
|
135
|
+
account: "0xServerAddress...", // Who can decrypt
|
|
136
|
+
publicKey: "0x04ServerKey...", // Their public key
|
|
137
|
+
},
|
|
138
|
+
],
|
|
124
139
|
});
|
|
125
140
|
```
|
|
126
141
|
|
|
@@ -220,43 +235,42 @@ try {
|
|
|
220
235
|
|
|
221
236
|
## Examples
|
|
222
237
|
|
|
223
|
-
### Complete
|
|
238
|
+
### Complete Data Sharing Flow
|
|
224
239
|
|
|
225
240
|
```typescript
|
|
226
|
-
import {
|
|
227
|
-
Vana,
|
|
228
|
-
generateEncryptionKey,
|
|
229
|
-
encryptBlobWithSignedKey,
|
|
230
|
-
} from "@opendatalabs/vana-sdk/browser";
|
|
241
|
+
import { Vana } from "@opendatalabs/vana-sdk/browser";
|
|
231
242
|
// OR for server-side applications
|
|
232
243
|
// } from "@opendatalabs/vana-sdk/node";
|
|
233
244
|
|
|
234
|
-
async function
|
|
245
|
+
async function shareDataWithServer() {
|
|
235
246
|
const vana = Vana({ walletClient });
|
|
236
247
|
|
|
237
|
-
// 1
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// 2. Upload encrypted file
|
|
243
|
-
const uploadResult = await vana.data.uploadEncryptedFile({
|
|
244
|
-
data: encryptedData,
|
|
248
|
+
// Step 1: Upload encrypted file with decryption permissions
|
|
249
|
+
const uploadResult = await vana.data.upload({
|
|
250
|
+
content: { data: "sensitive medical records" },
|
|
251
|
+
filename: "health-data.json",
|
|
245
252
|
schemaId: 123,
|
|
246
|
-
|
|
253
|
+
permissions: [
|
|
254
|
+
{
|
|
255
|
+
// Grant decryption access to the AI server
|
|
256
|
+
account: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
257
|
+
publicKey: "0x04abc...", // Server's public key for encryption
|
|
258
|
+
},
|
|
259
|
+
],
|
|
247
260
|
});
|
|
248
261
|
|
|
249
|
-
//
|
|
250
|
-
const
|
|
262
|
+
// Step 2: Grant operation permissions for what the server can do
|
|
263
|
+
const permissionResult = await vana.permissions.grant({
|
|
251
264
|
grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
|
|
252
|
-
|
|
265
|
+
fileIds: [BigInt(uploadResult.fileId)],
|
|
266
|
+
operation: "medical_analysis",
|
|
253
267
|
parameters: {
|
|
254
|
-
|
|
255
|
-
|
|
268
|
+
model: "medical-ai-v2",
|
|
269
|
+
analysisType: "comprehensive",
|
|
256
270
|
},
|
|
257
271
|
});
|
|
258
272
|
|
|
259
|
-
return
|
|
273
|
+
return { uploadResult, permissionResult };
|
|
260
274
|
}
|
|
261
275
|
```
|
|
262
276
|
|
|
@@ -294,13 +308,14 @@ vana.data.validateDataAgainstSchema(userData, schema);
|
|
|
294
308
|
### Permissions
|
|
295
309
|
|
|
296
310
|
```typescript
|
|
297
|
-
// Grant permission
|
|
311
|
+
// Grant operation permission
|
|
298
312
|
await vana.permissions.grant({
|
|
299
313
|
grantee: Address,
|
|
314
|
+
fileIds: bigint[],
|
|
300
315
|
operation: string,
|
|
301
316
|
parameters: object,
|
|
302
317
|
expiresAt?: number
|
|
303
|
-
}): Promise<
|
|
318
|
+
}): Promise<PermissionGrantResult>
|
|
304
319
|
|
|
305
320
|
// Revoke permission
|
|
306
321
|
await vana.permissions.revoke({
|
|
@@ -321,11 +336,16 @@ await vana.data.getUserFiles({
|
|
|
321
336
|
owner: Address
|
|
322
337
|
}): Promise<UserFile[]>
|
|
323
338
|
|
|
324
|
-
// Upload
|
|
325
|
-
await vana.data.
|
|
326
|
-
|
|
339
|
+
// Upload data with automatic encryption
|
|
340
|
+
await vana.data.upload({
|
|
341
|
+
content: string | Blob | Buffer,
|
|
342
|
+
filename?: string,
|
|
327
343
|
schemaId?: number,
|
|
328
|
-
|
|
344
|
+
permissions?: Array<{
|
|
345
|
+
account: Address, // Who can decrypt
|
|
346
|
+
publicKey: string // Their public key
|
|
347
|
+
}>,
|
|
348
|
+
encrypt?: boolean // Default: true
|
|
329
349
|
}): Promise<UploadResult>
|
|
330
350
|
|
|
331
351
|
// Validate schema
|
|
@@ -349,6 +369,48 @@ vana.data.validateDataAgainstSchema(data: unknown, schema: DataSchema): void
|
|
|
349
369
|
- **Issues**: [GitHub Issues](https://github.com/vana-com/vana-sdk/issues)
|
|
350
370
|
- **Discord**: [Join our community](https://discord.gg/vanabuilders)
|
|
351
371
|
|
|
372
|
+
## Generated Code
|
|
373
|
+
|
|
374
|
+
The SDK includes automatically generated code from various sources to provide type-safe interfaces. All generated files are located in `src/generated/` and should **never be edited manually**.
|
|
375
|
+
|
|
376
|
+
### Code Generation Scripts
|
|
377
|
+
|
|
378
|
+
| Script | Purpose | Generated Files |
|
|
379
|
+
| ---------------------------- | -------------------------------------- | --------------------------- |
|
|
380
|
+
| `npm run fetch-abis` | Smart contract ABIs from blockchain | `src/generated/abi/*.ts` |
|
|
381
|
+
| `npm run fetch-server-types` | Personal server API types from OpenAPI | `src/generated/server/*.ts` |
|
|
382
|
+
| `npm run codegen:subgraph` | GraphQL types from subgraph schema | `src/generated/subgraph.ts` |
|
|
383
|
+
|
|
384
|
+
### Network-Specific Generation
|
|
385
|
+
|
|
386
|
+
Some generation scripts support different networks:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Generate subgraph types for different networks
|
|
390
|
+
npm run codegen:subgraph:moksha # Moksha testnet (default)
|
|
391
|
+
npm run codegen:subgraph:mainnet # Vana mainnet
|
|
392
|
+
|
|
393
|
+
# Generate ABIs for different networks
|
|
394
|
+
npm run fetch-abis moksha # Moksha testnet (default)
|
|
395
|
+
npm run fetch-abis mainnet # Vana mainnet
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Development Workflow
|
|
399
|
+
|
|
400
|
+
When working with the SDK:
|
|
401
|
+
|
|
402
|
+
1. **Never edit generated files** - They are overwritten on regeneration
|
|
403
|
+
2. **Regenerate after schema changes** - Run generation scripts when external schemas change
|
|
404
|
+
3. **Generated files are committed** - They're included in version control for consistency
|
|
405
|
+
4. **ESLint ignores generated code** - Style rules don't apply to generated files
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
# Regenerate all code after schema updates
|
|
409
|
+
npm run fetch-abis
|
|
410
|
+
npm run fetch-server-types
|
|
411
|
+
npm run codegen:subgraph
|
|
412
|
+
```
|
|
413
|
+
|
|
352
414
|
## Development
|
|
353
415
|
|
|
354
416
|
```bash
|
package/package.json
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendatalabs/vana-sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.f36c555",
|
|
4
4
|
"description": "A TypeScript library for interacting with Vana Network smart contracts.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
9
10
|
"main": "dist/index.node.js",
|
|
10
11
|
"types": "dist/index.node.d.ts",
|
|
11
12
|
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"browser": {
|
|
15
|
+
"types": "./dist/index.browser.d.ts",
|
|
16
|
+
"import": "./dist/index.browser.js"
|
|
17
|
+
},
|
|
18
|
+
"types": "./dist/index.node.d.ts",
|
|
19
|
+
"import": "./dist/index.node.js",
|
|
20
|
+
"require": "./dist/index.node.cjs"
|
|
21
|
+
},
|
|
12
22
|
"./browser": {
|
|
13
23
|
"types": "./dist/index.browser.d.ts",
|
|
14
24
|
"import": "./dist/index.browser.js"
|
|
@@ -19,15 +29,15 @@
|
|
|
19
29
|
"require": "./dist/index.node.cjs"
|
|
20
30
|
},
|
|
21
31
|
"./chains": {
|
|
32
|
+
"browser": {
|
|
33
|
+
"types": "./dist/chains.browser.d.ts",
|
|
34
|
+
"import": "./dist/chains.browser.js"
|
|
35
|
+
},
|
|
22
36
|
"node": {
|
|
23
37
|
"types": "./dist/chains.node.d.ts",
|
|
24
38
|
"import": "./dist/chains.node.js",
|
|
25
39
|
"require": "./dist/chains.node.cjs"
|
|
26
40
|
},
|
|
27
|
-
"browser": {
|
|
28
|
-
"import": "./dist/chains.browser.js",
|
|
29
|
-
"types": "./dist/chains.browser.d.ts"
|
|
30
|
-
},
|
|
31
41
|
"default": {
|
|
32
42
|
"types": "./dist/chains.node.d.ts",
|
|
33
43
|
"import": "./dist/chains.node.js",
|
|
@@ -35,22 +45,34 @@
|
|
|
35
45
|
}
|
|
36
46
|
},
|
|
37
47
|
"./platform": {
|
|
48
|
+
"browser": {
|
|
49
|
+
"types": "./dist/platform.browser.d.ts",
|
|
50
|
+
"import": "./dist/platform.browser.js"
|
|
51
|
+
},
|
|
38
52
|
"node": {
|
|
39
53
|
"types": "./dist/platform.node.d.ts",
|
|
40
54
|
"import": "./dist/platform.node.js",
|
|
41
55
|
"require": "./dist/platform.node.cjs"
|
|
42
56
|
},
|
|
43
|
-
"browser": {
|
|
44
|
-
"import": "./dist/platform.browser.js",
|
|
45
|
-
"types": "./dist/platform.browser.d.ts"
|
|
46
|
-
},
|
|
47
57
|
"default": {
|
|
48
58
|
"types": "./dist/platform.node.d.ts",
|
|
49
59
|
"import": "./dist/platform.node.js",
|
|
50
60
|
"require": "./dist/platform.node.cjs"
|
|
51
61
|
}
|
|
62
|
+
},
|
|
63
|
+
"./*": {
|
|
64
|
+
"browser": {
|
|
65
|
+
"types": "./dist/*.d.ts",
|
|
66
|
+
"import": "./dist/*.js"
|
|
67
|
+
},
|
|
68
|
+
"types": "./dist/*.d.ts",
|
|
69
|
+
"import": "./dist/*.js"
|
|
52
70
|
}
|
|
53
71
|
},
|
|
72
|
+
"browser": {
|
|
73
|
+
"secp256k1": false,
|
|
74
|
+
"crypto": false
|
|
75
|
+
},
|
|
54
76
|
"files": [
|
|
55
77
|
"dist",
|
|
56
78
|
"README.md",
|
|
@@ -58,13 +80,10 @@
|
|
|
58
80
|
],
|
|
59
81
|
"scripts": {
|
|
60
82
|
"clean": "rimraf dist",
|
|
61
|
-
"build:types": "tsup src
|
|
62
|
-
"build:node": "tsup src
|
|
63
|
-
"build:browser": "tsup
|
|
64
|
-
"build
|
|
65
|
-
"build:platform": "tsup src/platform.ts src/platform.node.ts --platform node --format esm,cjs --target node18 --out-dir dist --dts --no-clean && tsup src/platform.browser.ts --platform browser --format esm --target es2020 --out-dir dist --dts --no-clean",
|
|
66
|
-
"build": "npm run clean && npm run build:types && npm run build:node && npm run build:browser && npm run build:chains && npm run build:platform",
|
|
67
|
-
"prepare": "npm run build",
|
|
83
|
+
"build:types": "tsup 'src/**/*.ts' '!src/**/*.test.ts' '!src/**/*.spec.ts' '!src/tests/**' --dts-only --out-dir dist --no-clean",
|
|
84
|
+
"build:node": "tsup 'src/**/*.ts' '!src/**/*.test.ts' '!src/**/*.spec.ts' '!src/tests/**' --platform node --format esm,cjs --target node18 --out-dir dist --no-clean --no-dts",
|
|
85
|
+
"build:browser": "tsup --config tsup-browser.config.ts",
|
|
86
|
+
"build": "npm run clean && npm run build:types && npm run build:node && npm run build:browser",
|
|
68
87
|
"dev": "npm run build -- --watch",
|
|
69
88
|
"lint": "eslint .",
|
|
70
89
|
"lint:fix": "eslint . --fix",
|
|
@@ -74,7 +93,10 @@
|
|
|
74
93
|
"test:coverage": "vitest run --coverage",
|
|
75
94
|
"test:coverage:verbose": "vitest run --coverage --reporter=verbose --coverage.reporter=text",
|
|
76
95
|
"fetch-abis": "tsx scripts/fetch-abis.ts",
|
|
77
|
-
"fetch-server-types": "tsx scripts/fetch-server-types.ts"
|
|
96
|
+
"fetch-server-types": "tsx scripts/fetch-server-types.ts",
|
|
97
|
+
"codegen:subgraph": "graphql-codegen --config codegen.ts",
|
|
98
|
+
"codegen:subgraph:moksha": "VANA_CODEGEN_NETWORK=moksha graphql-codegen --config codegen.ts",
|
|
99
|
+
"codegen:subgraph:mainnet": "VANA_CODEGEN_NETWORK=mainnet graphql-codegen --config codegen.ts"
|
|
78
100
|
},
|
|
79
101
|
"keywords": [
|
|
80
102
|
"vana",
|
|
@@ -85,40 +107,45 @@
|
|
|
85
107
|
"author": "",
|
|
86
108
|
"license": "ISC",
|
|
87
109
|
"dependencies": {
|
|
110
|
+
"@noble/hashes": "^1.8.0",
|
|
111
|
+
"@noble/secp256k1": "^2.3.0",
|
|
88
112
|
"abitype": "^1.0.8",
|
|
89
113
|
"ajv": "^8.17.1",
|
|
90
114
|
"ajv-formats": "^3.0.1",
|
|
91
115
|
"eccrypto-js": "^5.4.0",
|
|
116
|
+
"graphql": "^16.11.0",
|
|
92
117
|
"openpgp": "^6.1.1",
|
|
93
118
|
"viem": "^2.31.7"
|
|
94
119
|
},
|
|
95
|
-
"peerDependencies": {
|
|
96
|
-
"eccrypto": "^1.1.6"
|
|
97
|
-
},
|
|
98
|
-
"peerDependenciesMeta": {
|
|
99
|
-
"eccrypto": {
|
|
100
|
-
"optional": true
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
120
|
"devDependencies": {
|
|
104
|
-
"@
|
|
121
|
+
"@graphql-codegen/cli": "^5.0.7",
|
|
122
|
+
"@graphql-codegen/typed-document-node": "^5.1.2",
|
|
123
|
+
"@graphql-codegen/typescript": "^4.1.6",
|
|
124
|
+
"@graphql-codegen/typescript-operations": "^4.6.1",
|
|
105
125
|
"@types/node": "^24.0.10",
|
|
106
|
-
"
|
|
126
|
+
"@types/secp256k1": "^4.0.6",
|
|
107
127
|
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
108
128
|
"@typescript-eslint/parser": "^8.32.1",
|
|
109
129
|
"@vitest/coverage-v8": "^3.2.4",
|
|
130
|
+
"bundle-require": "^5.1.0",
|
|
131
|
+
"consola": "^3.4.0",
|
|
110
132
|
"eslint": "^9.26.0",
|
|
111
133
|
"eslint-config-prettier": "^10.1.5",
|
|
112
134
|
"eslint-plugin-prettier": "^5.4.0",
|
|
135
|
+
"fix-dts-default-cjs-exports": "^1.0.1",
|
|
113
136
|
"globals": "^16.3.0",
|
|
114
137
|
"openapi-typescript": "^7.8.0",
|
|
115
138
|
"prettier": "^3.5.3",
|
|
116
139
|
"rimraf": "^6.0.1",
|
|
140
|
+
"tree-kill": "^1.2.2",
|
|
117
141
|
"tsup": "^8.5.0",
|
|
118
142
|
"tsx": "^4.19.4",
|
|
119
143
|
"typescript": "^5.8.3",
|
|
120
144
|
"vitest": "^3.2.4"
|
|
121
145
|
},
|
|
146
|
+
"optionalDependencies": {
|
|
147
|
+
"secp256k1": "^5.0.1"
|
|
148
|
+
},
|
|
122
149
|
"engines": {
|
|
123
150
|
"node": ">=20.0.0"
|
|
124
151
|
},
|
package/dist/chains.browser.cjs
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/chains.browser.ts
|
|
21
|
-
var chains_browser_exports = {};
|
|
22
|
-
__export(chains_browser_exports, {
|
|
23
|
-
getAllChains: () => getAllChains,
|
|
24
|
-
getChainConfig: () => getChainConfig,
|
|
25
|
-
moksha: () => moksha,
|
|
26
|
-
mokshaTestnet: () => mokshaTestnet,
|
|
27
|
-
vanaMainnet: () => vanaMainnet
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(chains_browser_exports);
|
|
30
|
-
|
|
31
|
-
// src/chains/definitions.ts
|
|
32
|
-
var vanaMainnet = {
|
|
33
|
-
id: 1480,
|
|
34
|
-
name: "Vana",
|
|
35
|
-
nativeCurrency: {
|
|
36
|
-
name: "VANA",
|
|
37
|
-
symbol: "VANA",
|
|
38
|
-
decimals: 18
|
|
39
|
-
},
|
|
40
|
-
rpcUrls: {
|
|
41
|
-
default: {
|
|
42
|
-
http: ["https://rpc.vana.org"]
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
blockExplorers: {
|
|
46
|
-
default: {
|
|
47
|
-
name: "Vanascan",
|
|
48
|
-
url: "https://vanascan.io"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.2/gn"
|
|
52
|
-
};
|
|
53
|
-
var moksha = {
|
|
54
|
-
id: 14800,
|
|
55
|
-
name: "Moksha Testnet",
|
|
56
|
-
nativeCurrency: {
|
|
57
|
-
name: "VANA",
|
|
58
|
-
symbol: "VANA",
|
|
59
|
-
decimals: 18
|
|
60
|
-
},
|
|
61
|
-
rpcUrls: {
|
|
62
|
-
default: {
|
|
63
|
-
http: ["https://rpc.moksha.vana.org"]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
blockExplorers: {
|
|
67
|
-
default: {
|
|
68
|
-
name: "Vanascan - Moksha",
|
|
69
|
-
url: "https://moksha.vanascan.io"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.3/gn"
|
|
73
|
-
};
|
|
74
|
-
function getChainConfig(chainId) {
|
|
75
|
-
switch (chainId) {
|
|
76
|
-
case 1480:
|
|
77
|
-
return vanaMainnet;
|
|
78
|
-
case 14800:
|
|
79
|
-
return moksha;
|
|
80
|
-
default:
|
|
81
|
-
return void 0;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
var mokshaTestnet = moksha;
|
|
85
|
-
function getAllChains() {
|
|
86
|
-
return [vanaMainnet, moksha];
|
|
87
|
-
}
|
|
88
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
-
0 && (module.exports = {
|
|
90
|
-
getAllChains,
|
|
91
|
-
getChainConfig,
|
|
92
|
-
moksha,
|
|
93
|
-
mokshaTestnet,
|
|
94
|
-
vanaMainnet
|
|
95
|
-
});
|
|
96
|
-
//# sourceMappingURL=chains.browser.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chains.browser.ts","../src/chains/definitions.ts"],"sourcesContent":["/**\n * Browser-specific chains entry point\n *\n * This is identical to the base chains export since chain configurations\n * are environment-agnostic.\n */\n\nexport type { VanaChainConfig } from \"./chains/definitions\";\nexport {\n vanaMainnet,\n moksha,\n mokshaTestnet,\n getChainConfig,\n getAllChains,\n} from \"./chains/definitions\";\n","/**\n * Chain configuration definitions for Vana networks\n *\n * These provide default configurations for known Vana chains.\n * Applications can use these as-is or override specific values.\n */\n\nimport type { Chain } from \"viem\";\n\nexport interface VanaChainConfig extends Chain {\n /** URL for the subgraph API endpoint used to query on-chain data */\n subgraphUrl: string;\n}\n\n/**\n * Vana Mainnet configuration\n */\nexport const vanaMainnet: VanaChainConfig = {\n id: 1480,\n name: \"Vana\",\n nativeCurrency: {\n name: \"VANA\",\n symbol: \"VANA\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://rpc.vana.org\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Vanascan\",\n url: \"https://vanascan.io\",\n },\n },\n subgraphUrl:\n \"https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.2/gn\",\n} as const;\n\n/**\n * Moksha Testnet configuration\n */\nexport const moksha: VanaChainConfig = {\n id: 14800,\n name: \"Moksha Testnet\",\n nativeCurrency: {\n name: \"VANA\",\n symbol: \"VANA\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://rpc.moksha.vana.org\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Vanascan - Moksha\",\n url: \"https://moksha.vanascan.io\",\n },\n },\n subgraphUrl:\n \"https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.3/gn\",\n} as const;\n\n/**\n * Retrieves the chain configuration for a given chain ID.\n *\n * @param chainId - The numeric chain ID to look up\n * @returns The chain configuration if found, undefined otherwise\n * @example\n * ```typescript\n * const config = getChainConfig(1480);\n * if (config) {\n * console.log('Chain name:', config.name);\n * console.log('Subgraph URL:', config.subgraphUrl);\n * }\n * ```\n */\nexport function getChainConfig(chainId: number): VanaChainConfig | undefined {\n switch (chainId) {\n case 1480:\n return vanaMainnet;\n case 14800:\n return moksha;\n default:\n return undefined;\n }\n}\n\n// Backwards compatibility alias\nexport const mokshaTestnet = moksha;\n\n/**\n * Retrieves all available Vana chain configurations.\n *\n * @returns Array of all supported Vana chain configurations\n * @example\n * ```typescript\n * const chains = getAllChains();\n * console.log('Supported chains:');\n * chains.forEach(chain => {\n * console.log(`- ${chain.name} (ID: ${chain.id})`);\n * });\n * ```\n */\nexport function getAllChains(): VanaChainConfig[] {\n return [vanaMainnet, moksha];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBO,IAAM,cAA+B;AAAA,EAC1C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,MACP,MAAM,CAAC,sBAAsB;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,MAAM;AAAA,MACN,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EACA,aACE;AACJ;AAKO,IAAM,SAA0B;AAAA,EACrC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,MACP,MAAM,CAAC,6BAA6B;AAAA,IACtC;AAAA,EACF;AAAA,EACA,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,MAAM;AAAA,MACN,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EACA,aACE;AACJ;AAgBO,SAAS,eAAe,SAA8C;AAC3E,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAGO,IAAM,gBAAgB;AAetB,SAAS,eAAkC;AAChD,SAAO,CAAC,aAAa,MAAM;AAC7B;","names":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Chain configuration definitions for Vana networks
|
|
5
|
-
*
|
|
6
|
-
* These provide default configurations for known Vana chains.
|
|
7
|
-
* Applications can use these as-is or override specific values.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
interface VanaChainConfig extends Chain {
|
|
11
|
-
/** URL for the subgraph API endpoint used to query on-chain data */
|
|
12
|
-
subgraphUrl: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Vana Mainnet configuration
|
|
16
|
-
*/
|
|
17
|
-
declare const vanaMainnet: VanaChainConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Moksha Testnet configuration
|
|
20
|
-
*/
|
|
21
|
-
declare const moksha: VanaChainConfig;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieves the chain configuration for a given chain ID.
|
|
24
|
-
*
|
|
25
|
-
* @param chainId - The numeric chain ID to look up
|
|
26
|
-
* @returns The chain configuration if found, undefined otherwise
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* const config = getChainConfig(1480);
|
|
30
|
-
* if (config) {
|
|
31
|
-
* console.log('Chain name:', config.name);
|
|
32
|
-
* console.log('Subgraph URL:', config.subgraphUrl);
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
declare function getChainConfig(chainId: number): VanaChainConfig | undefined;
|
|
37
|
-
declare const mokshaTestnet: VanaChainConfig;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieves all available Vana chain configurations.
|
|
40
|
-
*
|
|
41
|
-
* @returns Array of all supported Vana chain configurations
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* const chains = getAllChains();
|
|
45
|
-
* console.log('Supported chains:');
|
|
46
|
-
* chains.forEach(chain => {
|
|
47
|
-
* console.log(`- ${chain.name} (ID: ${chain.id})`);
|
|
48
|
-
* });
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
declare function getAllChains(): VanaChainConfig[];
|
|
52
|
-
|
|
53
|
-
export { type VanaChainConfig, getAllChains, getChainConfig, moksha, mokshaTestnet, vanaMainnet };
|
package/dist/chains.browser.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Chain configuration definitions for Vana networks
|
|
5
|
-
*
|
|
6
|
-
* These provide default configurations for known Vana chains.
|
|
7
|
-
* Applications can use these as-is or override specific values.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
interface VanaChainConfig extends Chain {
|
|
11
|
-
/** URL for the subgraph API endpoint used to query on-chain data */
|
|
12
|
-
subgraphUrl: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Vana Mainnet configuration
|
|
16
|
-
*/
|
|
17
|
-
declare const vanaMainnet: VanaChainConfig;
|
|
18
|
-
/**
|
|
19
|
-
* Moksha Testnet configuration
|
|
20
|
-
*/
|
|
21
|
-
declare const moksha: VanaChainConfig;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieves the chain configuration for a given chain ID.
|
|
24
|
-
*
|
|
25
|
-
* @param chainId - The numeric chain ID to look up
|
|
26
|
-
* @returns The chain configuration if found, undefined otherwise
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* const config = getChainConfig(1480);
|
|
30
|
-
* if (config) {
|
|
31
|
-
* console.log('Chain name:', config.name);
|
|
32
|
-
* console.log('Subgraph URL:', config.subgraphUrl);
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
declare function getChainConfig(chainId: number): VanaChainConfig | undefined;
|
|
37
|
-
declare const mokshaTestnet: VanaChainConfig;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieves all available Vana chain configurations.
|
|
40
|
-
*
|
|
41
|
-
* @returns Array of all supported Vana chain configurations
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* const chains = getAllChains();
|
|
45
|
-
* console.log('Supported chains:');
|
|
46
|
-
* chains.forEach(chain => {
|
|
47
|
-
* console.log(`- ${chain.name} (ID: ${chain.id})`);
|
|
48
|
-
* });
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
declare function getAllChains(): VanaChainConfig[];
|
|
52
|
-
|
|
53
|
-
export { type VanaChainConfig, getAllChains, getChainConfig, moksha, mokshaTestnet, vanaMainnet };
|
package/dist/chains.browser.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// src/chains/definitions.ts
|
|
2
|
-
var vanaMainnet = {
|
|
3
|
-
id: 1480,
|
|
4
|
-
name: "Vana",
|
|
5
|
-
nativeCurrency: {
|
|
6
|
-
name: "VANA",
|
|
7
|
-
symbol: "VANA",
|
|
8
|
-
decimals: 18
|
|
9
|
-
},
|
|
10
|
-
rpcUrls: {
|
|
11
|
-
default: {
|
|
12
|
-
http: ["https://rpc.vana.org"]
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
blockExplorers: {
|
|
16
|
-
default: {
|
|
17
|
-
name: "Vanascan",
|
|
18
|
-
url: "https://vanascan.io"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.2/gn"
|
|
22
|
-
};
|
|
23
|
-
var moksha = {
|
|
24
|
-
id: 14800,
|
|
25
|
-
name: "Moksha Testnet",
|
|
26
|
-
nativeCurrency: {
|
|
27
|
-
name: "VANA",
|
|
28
|
-
symbol: "VANA",
|
|
29
|
-
decimals: 18
|
|
30
|
-
},
|
|
31
|
-
rpcUrls: {
|
|
32
|
-
default: {
|
|
33
|
-
http: ["https://rpc.moksha.vana.org"]
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
blockExplorers: {
|
|
37
|
-
default: {
|
|
38
|
-
name: "Vanascan - Moksha",
|
|
39
|
-
url: "https://moksha.vanascan.io"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
subgraphUrl: "https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.3/gn"
|
|
43
|
-
};
|
|
44
|
-
function getChainConfig(chainId) {
|
|
45
|
-
switch (chainId) {
|
|
46
|
-
case 1480:
|
|
47
|
-
return vanaMainnet;
|
|
48
|
-
case 14800:
|
|
49
|
-
return moksha;
|
|
50
|
-
default:
|
|
51
|
-
return void 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
var mokshaTestnet = moksha;
|
|
55
|
-
function getAllChains() {
|
|
56
|
-
return [vanaMainnet, moksha];
|
|
57
|
-
}
|
|
58
|
-
export {
|
|
59
|
-
getAllChains,
|
|
60
|
-
getChainConfig,
|
|
61
|
-
moksha,
|
|
62
|
-
mokshaTestnet,
|
|
63
|
-
vanaMainnet
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=chains.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chains/definitions.ts"],"sourcesContent":["/**\n * Chain configuration definitions for Vana networks\n *\n * These provide default configurations for known Vana chains.\n * Applications can use these as-is or override specific values.\n */\n\nimport type { Chain } from \"viem\";\n\nexport interface VanaChainConfig extends Chain {\n /** URL for the subgraph API endpoint used to query on-chain data */\n subgraphUrl: string;\n}\n\n/**\n * Vana Mainnet configuration\n */\nexport const vanaMainnet: VanaChainConfig = {\n id: 1480,\n name: \"Vana\",\n nativeCurrency: {\n name: \"VANA\",\n symbol: \"VANA\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://rpc.vana.org\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Vanascan\",\n url: \"https://vanascan.io\",\n },\n },\n subgraphUrl:\n \"https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/vana/7.0.2/gn\",\n} as const;\n\n/**\n * Moksha Testnet configuration\n */\nexport const moksha: VanaChainConfig = {\n id: 14800,\n name: \"Moksha Testnet\",\n nativeCurrency: {\n name: \"VANA\",\n symbol: \"VANA\",\n decimals: 18,\n },\n rpcUrls: {\n default: {\n http: [\"https://rpc.moksha.vana.org\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Vanascan - Moksha\",\n url: \"https://moksha.vanascan.io\",\n },\n },\n subgraphUrl:\n \"https://api.goldsky.com/api/public/project_cm168cz887zva010j39il7a6p/subgraphs/moksha/7.0.3/gn\",\n} as const;\n\n/**\n * Retrieves the chain configuration for a given chain ID.\n *\n * @param chainId - The numeric chain ID to look up\n * @returns The chain configuration if found, undefined otherwise\n * @example\n * ```typescript\n * const config = getChainConfig(1480);\n * if (config) {\n * console.log('Chain name:', config.name);\n * console.log('Subgraph URL:', config.subgraphUrl);\n * }\n * ```\n */\nexport function getChainConfig(chainId: number): VanaChainConfig | undefined {\n switch (chainId) {\n case 1480:\n return vanaMainnet;\n case 14800:\n return moksha;\n default:\n return undefined;\n }\n}\n\n// Backwards compatibility alias\nexport const mokshaTestnet = moksha;\n\n/**\n * Retrieves all available Vana chain configurations.\n *\n * @returns Array of all supported Vana chain configurations\n * @example\n * ```typescript\n * const chains = getAllChains();\n * console.log('Supported chains:');\n * chains.forEach(chain => {\n * console.log(`- ${chain.name} (ID: ${chain.id})`);\n * });\n * ```\n */\nexport function getAllChains(): VanaChainConfig[] {\n return [vanaMainnet, moksha];\n}\n"],"mappings":";AAiBO,IAAM,cAA+B;AAAA,EAC1C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,MACP,MAAM,CAAC,sBAAsB;AAAA,IAC/B;AAAA,EACF;AAAA,EACA,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,MAAM;AAAA,MACN,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EACA,aACE;AACJ;AAKO,IAAM,SAA0B;AAAA,EACrC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,MACP,MAAM,CAAC,6BAA6B;AAAA,IACtC;AAAA,EACF;AAAA,EACA,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,MAAM;AAAA,MACN,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EACA,aACE;AACJ;AAgBO,SAAS,eAAe,SAA8C;AAC3E,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAGO,IAAM,gBAAgB;AAetB,SAAS,eAAkC;AAChD,SAAO,CAAC,aAAa,MAAM;AAC7B;","names":[]}
|