@opendatalabs/vana-sdk 0.1.0-alpha.d44f792 → 0.1.0-alpha.db07fe1

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 (45) hide show
  1. package/README.md +68 -13
  2. package/package.json +45 -24
  3. package/dist/chains.browser.cjs +0 -96
  4. package/dist/chains.browser.cjs.map +0 -1
  5. package/dist/chains.browser.d.cts +0 -53
  6. package/dist/chains.browser.d.ts +0 -53
  7. package/dist/chains.browser.js +0 -65
  8. package/dist/chains.browser.js.map +0 -1
  9. package/dist/chains.cjs +0 -96
  10. package/dist/chains.cjs.map +0 -1
  11. package/dist/chains.d.cts +0 -2
  12. package/dist/chains.d.ts +0 -2
  13. package/dist/chains.js +0 -65
  14. package/dist/chains.js.map +0 -1
  15. package/dist/chains.node.cjs +0 -96
  16. package/dist/chains.node.cjs.map +0 -1
  17. package/dist/chains.node.d.cts +0 -2
  18. package/dist/chains.node.d.ts +0 -2
  19. package/dist/chains.node.js +0 -65
  20. package/dist/chains.node.js.map +0 -1
  21. package/dist/index.browser.d.ts +0 -34334
  22. package/dist/index.browser.js +0 -41687
  23. package/dist/index.browser.js.map +0 -1
  24. package/dist/index.d.cts +0 -2
  25. package/dist/index.node.cjs +0 -42197
  26. package/dist/index.node.cjs.map +0 -1
  27. package/dist/index.node.d.cts +0 -34468
  28. package/dist/index.node.d.ts +0 -34468
  29. package/dist/index.node.js +0 -42057
  30. package/dist/index.node.js.map +0 -1
  31. package/dist/platform.browser.d.ts +0 -293
  32. package/dist/platform.browser.js +0 -365
  33. package/dist/platform.browser.js.map +0 -1
  34. package/dist/platform.cjs +0 -734
  35. package/dist/platform.cjs.map +0 -1
  36. package/dist/platform.d.cts +0 -1
  37. package/dist/platform.d.ts +0 -1
  38. package/dist/platform.js +0 -697
  39. package/dist/platform.js.map +0 -1
  40. package/dist/platform.node.cjs +0 -734
  41. package/dist/platform.node.cjs.map +0 -1
  42. package/dist/platform.node.d.cts +0 -334
  43. package/dist/platform.node.d.ts +0 -334
  44. package/dist/platform.node.js +0 -697
  45. 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 supports both browser and Node.js environments with explicit entry points:
31
+ The Vana SDK provides optimized builds for different environments:
32
32
 
33
- ### Browser Applications (React, Vue, etc.)
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
- // For browser-based applications (React, Vue, etc.)
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 (Next.js API routes, Express)
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)
@@ -121,10 +130,12 @@ const result = await vana.data.upload({
121
130
  content: "Sensitive user data",
122
131
  filename: "user-data.json",
123
132
  schemaId: 123,
124
- permissions: [{
125
- account: "0xServerAddress...", // Who can decrypt
126
- publicKey: "0x04ServerKey..." // Their public key
127
- }]
133
+ permissions: [
134
+ {
135
+ account: "0xServerAddress...", // Who can decrypt
136
+ publicKey: "0x04ServerKey...", // Their public key
137
+ },
138
+ ],
128
139
  });
129
140
  ```
130
141
 
@@ -239,11 +250,13 @@ async function shareDataWithServer() {
239
250
  content: { data: "sensitive medical records" },
240
251
  filename: "health-data.json",
241
252
  schemaId: 123,
242
- permissions: [{
243
- // Grant decryption access to the AI server
244
- account: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
245
- publicKey: "0x04abc..." // Server's public key for encryption
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
262
  // Step 2: Grant operation permissions for what the server can do
@@ -356,6 +369,48 @@ vana.data.validateDataAgainstSchema(data: unknown, schema: DataSchema): void
356
369
  - **Issues**: [GitHub Issues](https://github.com/vana-com/vana-sdk/issues)
357
370
  - **Discord**: [Join our community](https://discord.gg/vanabuilders)
358
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
+
359
414
  ## Development
360
415
 
361
416
  ```bash
package/package.json CHANGED
@@ -1,14 +1,24 @@
1
1
  {
2
2
  "name": "@opendatalabs/vana-sdk",
3
- "version": "0.1.0-alpha.d44f792",
3
+ "version": "0.1.0-alpha.db07fe1",
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,15 +45,15 @@
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",
@@ -51,6 +61,10 @@
51
61
  }
52
62
  }
53
63
  },
64
+ "browser": {
65
+ "secp256k1": false,
66
+ "crypto": false
67
+ },
54
68
  "files": [
55
69
  "dist",
56
70
  "README.md",
@@ -60,11 +74,10 @@
60
74
  "clean": "rimraf dist",
61
75
  "build:types": "tsup src/index.ts --dts-only --out-dir dist --no-clean",
62
76
  "build:node": "tsup src/index.node.ts --platform node --format esm,cjs --target node18 --out-dir dist --no-clean",
63
- "build:browser": "tsup src/index.browser.ts --platform browser --format esm --target es2020 --out-dir dist --dts --no-clean",
77
+ "build:browser": "tsup --config tsup-browser.config.ts",
64
78
  "build:chains": "tsup src/chains.ts src/chains.node.ts src/chains.browser.ts --platform node --format esm,cjs --target node18 --out-dir dist --dts --no-clean",
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",
79
+ "build:platform": "tsup src/platform.ts src/platform.node.ts src/node.ts --platform node --format esm,cjs --target node18 --out-dir dist --dts --no-clean && tsup src/platform.browser.ts src/browser.ts --platform browser --format esm --target es2020 --out-dir dist --dts --no-clean",
80
+ "build": "npm run clean && npx npm-run-all --parallel build:types build:node build:browser build:chains build:platform",
68
81
  "dev": "npm run build -- --watch",
69
82
  "lint": "eslint .",
70
83
  "lint:fix": "eslint . --fix",
@@ -74,7 +87,10 @@
74
87
  "test:coverage": "vitest run --coverage",
75
88
  "test:coverage:verbose": "vitest run --coverage --reporter=verbose --coverage.reporter=text",
76
89
  "fetch-abis": "tsx scripts/fetch-abis.ts",
77
- "fetch-server-types": "tsx scripts/fetch-server-types.ts"
90
+ "fetch-server-types": "tsx scripts/fetch-server-types.ts",
91
+ "codegen:subgraph": "graphql-codegen --config codegen.ts",
92
+ "codegen:subgraph:moksha": "VANA_CODEGEN_NETWORK=moksha graphql-codegen --config codegen.ts",
93
+ "codegen:subgraph:mainnet": "VANA_CODEGEN_NETWORK=mainnet graphql-codegen --config codegen.ts"
78
94
  },
79
95
  "keywords": [
80
96
  "vana",
@@ -85,40 +101,45 @@
85
101
  "author": "",
86
102
  "license": "ISC",
87
103
  "dependencies": {
104
+ "@noble/hashes": "^1.8.0",
105
+ "@noble/secp256k1": "^2.3.0",
88
106
  "abitype": "^1.0.8",
89
107
  "ajv": "^8.17.1",
90
108
  "ajv-formats": "^3.0.1",
91
109
  "eccrypto-js": "^5.4.0",
110
+ "graphql": "^16.11.0",
92
111
  "openpgp": "^6.1.1",
93
112
  "viem": "^2.31.7"
94
113
  },
95
- "peerDependencies": {
96
- "eccrypto": "^1.1.6"
97
- },
98
- "peerDependenciesMeta": {
99
- "eccrypto": {
100
- "optional": true
101
- }
102
- },
103
114
  "devDependencies": {
104
- "@types/eccrypto": "^1.1.6",
115
+ "@graphql-codegen/cli": "^5.0.7",
116
+ "@graphql-codegen/typed-document-node": "^5.1.2",
117
+ "@graphql-codegen/typescript": "^4.1.6",
118
+ "@graphql-codegen/typescript-operations": "^4.6.1",
105
119
  "@types/node": "^24.0.10",
106
- "eccrypto": "^1.1.6",
120
+ "@types/secp256k1": "^4.0.6",
107
121
  "@typescript-eslint/eslint-plugin": "^8.32.1",
108
122
  "@typescript-eslint/parser": "^8.32.1",
109
123
  "@vitest/coverage-v8": "^3.2.4",
124
+ "bundle-require": "^5.1.0",
125
+ "consola": "^3.4.0",
110
126
  "eslint": "^9.26.0",
111
127
  "eslint-config-prettier": "^10.1.5",
112
128
  "eslint-plugin-prettier": "^5.4.0",
129
+ "fix-dts-default-cjs-exports": "^1.0.1",
113
130
  "globals": "^16.3.0",
114
131
  "openapi-typescript": "^7.8.0",
115
132
  "prettier": "^3.5.3",
116
133
  "rimraf": "^6.0.1",
134
+ "tree-kill": "^1.2.2",
117
135
  "tsup": "^8.5.0",
118
136
  "tsx": "^4.19.4",
119
137
  "typescript": "^5.8.3",
120
138
  "vitest": "^3.2.4"
121
139
  },
140
+ "optionalDependencies": {
141
+ "secp256k1": "^5.0.1"
142
+ },
122
143
  "engines": {
123
144
  "node": ">=20.0.0"
124
145
  },
@@ -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 };
@@ -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 };
@@ -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":[]}
package/dist/chains.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.ts
21
- var chains_exports = {};
22
- __export(chains_exports, {
23
- getAllChains: () => getAllChains,
24
- getChainConfig: () => getChainConfig,
25
- moksha: () => moksha,
26
- mokshaTestnet: () => mokshaTestnet,
27
- vanaMainnet: () => vanaMainnet
28
- });
29
- module.exports = __toCommonJS(chains_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.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/chains.ts","../src/chains/definitions.ts"],"sourcesContent":["/**\n * Chains entry point for SSR-safe chain configuration exports\n *\n * This module exports only chain configurations without any platform-specific\n * dependencies, making it safe for server-side rendering.\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":[]}
package/dist/chains.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export { VanaChainConfig, getAllChains, getChainConfig, moksha, mokshaTestnet, vanaMainnet } from './chains.browser.cjs';
2
- import 'viem';