@helium/blockchain-api 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -69
- package/dist/index.d.ts +2382 -0
- package/dist/index.js +852 -0
- package/package.json +37 -127
- package/tsconfig.json +0 -45
- package/types/README.md +0 -108
- package/types/generated/index.d.mts +0 -2481
- package/types/generated/index.d.ts +0 -2481
- package/types/generated/index.js +0 -723
- package/types/generated/index.mjs +0 -614
- package/types/index.ts +0 -30
package/package.json
CHANGED
|
@@ -1,143 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helium/blockchain-api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TypeScript client and schemas for the Helium Blockchain API",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/helium/my-helium.git"
|
|
8
|
+
"url": "https://github.com/helium/my-helium.git",
|
|
9
|
+
"directory": "packages/api"
|
|
9
10
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"types/",
|
|
14
|
-
"tsconfig.json"
|
|
15
|
-
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
16
14
|
"exports": {
|
|
17
15
|
".": {
|
|
18
|
-
"types": "./
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
}
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"development": "./src/index.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./src/schemas/fiat": "./src/schemas/fiat.ts",
|
|
21
|
+
"./src/contracts/fiat": "./src/contracts/fiat.ts",
|
|
22
|
+
"./src/errors/fiat": "./src/errors/fiat.ts",
|
|
23
|
+
"./src/schemas/webhooks": "./src/schemas/webhooks.ts",
|
|
24
|
+
"./src/contracts/webhooks": "./src/contracts/webhooks.ts"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"dev": "tsup --watch",
|
|
32
|
+
"clean": "rm -rf dist",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@orpc/client": "^1.12.2",
|
|
37
|
+
"@orpc/openapi": "^1.12.2",
|
|
38
|
+
"@orpc/server": "^1.12.2",
|
|
39
|
+
"zod": "^4.0.5"
|
|
22
40
|
},
|
|
23
41
|
"peerDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"zod": "^4.0.0"
|
|
42
|
+
"@solana/web3.js": "^1.98.0 || ^2.0.0"
|
|
26
43
|
},
|
|
27
44
|
"peerDependenciesMeta": {
|
|
28
|
-
"@
|
|
29
|
-
"optional":
|
|
30
|
-
},
|
|
31
|
-
"zod": {
|
|
32
|
-
"optional": false
|
|
45
|
+
"@solana/web3.js": {
|
|
46
|
+
"optional": true
|
|
33
47
|
}
|
|
34
48
|
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build:types": "tsup",
|
|
37
|
-
"prepublishOnly": "yarn build:types && mv README.md DEV_README.md && cp types/README.md README.md && npm run lint && echo 'Ready to publish!'",
|
|
38
|
-
"postpublish": "mv DEV_README.md README.md",
|
|
39
|
-
"dev": "node scripts/dev-with-background.js",
|
|
40
|
-
"dev:next-only": "next dev --turbopack",
|
|
41
|
-
"build": "next build",
|
|
42
|
-
"start": "next start",
|
|
43
|
-
"lint": "prettier --check --write \"src/**/*.{js,ts,tsx}\" && eslint src/",
|
|
44
|
-
"background-service": "node scripts/start-background-service.js",
|
|
45
|
-
"test:e2e": "mocha -r @swc-node/register \"tests/e2e/**/*.test.ts\" --timeout 100000",
|
|
46
|
-
"test:e2e:file": "mocha -r @swc-node/register --timeout 100000"
|
|
47
|
-
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"@helium/distributor-oracle": "^0.11.6",
|
|
53
|
-
"@helium/helium-entity-manager-sdk": "^0.11.6",
|
|
54
|
-
"@helium/helium-sub-daos-sdk": "^0.11.6",
|
|
55
|
-
"@helium/hpl-crons-sdk": "^0.11.6",
|
|
56
|
-
"@helium/idls": "^0.11.6",
|
|
57
|
-
"@helium/lazy-distributor-sdk": "^0.11.6",
|
|
58
|
-
"@helium/mini-fanout-sdk": "^0.11.6",
|
|
59
|
-
"@helium/spl-utils": "^0.11.6",
|
|
60
|
-
"@helium/tuktuk-idls": "^0.0.10",
|
|
61
|
-
"@helium/tuktuk-sdk": "^0.0.10",
|
|
62
|
-
"@helium/welcome-pack-sdk": "^0.11.6",
|
|
63
|
-
"@hookform/resolvers": "^5.1.1",
|
|
64
|
-
"@metaplex-foundation/mpl-bubblegum": "0.7.0",
|
|
65
|
-
"@metaplex-foundation/mpl-token-metadata": "2.10.0",
|
|
66
|
-
"@orpc/client": "1.12.2",
|
|
67
|
-
"@orpc/json-schema": "1.12.2",
|
|
68
|
-
"@orpc/openapi": "1.12.2",
|
|
69
|
-
"@orpc/react": "1.12.2",
|
|
70
|
-
"@orpc/react-query": "1.12.2",
|
|
71
|
-
"@orpc/server": "1.12.2",
|
|
72
|
-
"@orpc/zod": "1.12.2",
|
|
73
|
-
"@privy-io/react-auth": "^2.20.0",
|
|
74
|
-
"@privy-io/server-auth": "^1.28.8",
|
|
75
|
-
"@radix-ui/react-avatar": "^1.1.10",
|
|
76
|
-
"@radix-ui/react-collapsible": "^1.1.11",
|
|
77
|
-
"@radix-ui/react-dialog": "^1.1.14",
|
|
78
|
-
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
79
|
-
"@radix-ui/react-label": "^2.1.7",
|
|
80
|
-
"@radix-ui/react-navigation-menu": "^1.2.13",
|
|
81
|
-
"@radix-ui/react-select": "^2.2.5",
|
|
82
|
-
"@radix-ui/react-slot": "^1.2.3",
|
|
83
|
-
"@solana/spl-token": "^0.4.13",
|
|
84
|
-
"@solana/web3.js": "^1.98.2",
|
|
85
|
-
"@swc-node/register": "^1.11.1",
|
|
86
|
-
"@swc/core": "^1.13.5",
|
|
87
|
-
"@swc/register": "^0.1.10",
|
|
88
|
-
"@t3-oss/env-nextjs": "^0.13.8",
|
|
89
|
-
"@tailwindcss/postcss": "^4",
|
|
90
|
-
"@tanstack/react-query": "^5.80.10",
|
|
91
|
-
"@types/bn.js": "^5.2.0",
|
|
92
|
-
"@types/chai": "^5.2.3",
|
|
93
|
-
"@types/mocha": "^10.0.10",
|
|
94
|
-
"@types/node": "^20",
|
|
95
|
-
"@types/node-cron": "^3.0.11",
|
|
96
|
-
"@types/pg": "^8.15.4",
|
|
97
|
-
"@types/react": "^19",
|
|
98
|
-
"@types/react-dom": "^19",
|
|
99
|
-
"angry-purple-tiger": "^1.0.5",
|
|
100
|
-
"aws-sdk": "^2.1692.0",
|
|
101
|
-
"axios": "^1.10.0",
|
|
102
|
-
"bn.js": "^5.2.2",
|
|
103
|
-
"chai": "^6.2.0",
|
|
104
|
-
"class-variance-authority": "^0.7.1",
|
|
105
|
-
"classnames": "^2.5.1",
|
|
106
|
-
"clsx": "^2.1.1",
|
|
107
|
-
"dotenv": "^17.2.2",
|
|
108
|
-
"eslint": "^9",
|
|
109
|
-
"eslint-config-next": "15.4.6",
|
|
110
|
-
"jito-ts": "^4.2.0",
|
|
111
|
-
"js-sha256": "^0.11.1",
|
|
112
|
-
"lucide-react": "^0.522.0",
|
|
113
|
-
"mocha": "^11.7.5",
|
|
114
|
-
"next": "^16.0.10",
|
|
115
|
-
"next-themes": "^0.4.6",
|
|
116
|
-
"node-cron": "^4.2.1",
|
|
117
|
-
"pg": "^8.16.2",
|
|
118
|
-
"pg-hstore": "^2.3.4",
|
|
119
|
-
"prettier": "^3.7.4",
|
|
120
|
-
"qrcode.react": "^4.2.0",
|
|
121
|
-
"react": "^19.0.0",
|
|
122
|
-
"react-async-hook": "^4.0.0",
|
|
123
|
-
"react-dom": "^19.0.0",
|
|
124
|
-
"react-hook-form": "^7.60.0",
|
|
125
|
-
"react-jazzicon": "^1.0.4",
|
|
126
|
-
"sequelize": "^6.37.7",
|
|
127
|
-
"sequelize-cli": "^6.6.3",
|
|
128
|
-
"sonner": "^2.0.5",
|
|
129
|
-
"sqlite3": "^5.1.7",
|
|
130
|
-
"tailwind-merge": "^3.3.1",
|
|
131
|
-
"tailwindcss": "^4",
|
|
132
|
-
"ts-node": "^10.9.2",
|
|
133
|
-
"tsup": "^8.5.1",
|
|
134
|
-
"tsx": "^4.19.2",
|
|
135
|
-
"tw-animate-css": "^1.3.4",
|
|
136
|
-
"typescript": "^5",
|
|
137
|
-
"uuid": "^11.1.0",
|
|
138
|
-
"why-is-node-running": "^3.2.2",
|
|
139
|
-
"yaml": "^2.8.1",
|
|
140
|
-
"zod": "^4.0.5"
|
|
141
|
-
},
|
|
142
|
-
"packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
|
|
50
|
+
"tsup": "^8.0.0",
|
|
51
|
+
"typescript": "^5.0.0"
|
|
52
|
+
}
|
|
143
53
|
}
|
package/tsconfig.json
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2017",
|
|
4
|
-
"lib": [
|
|
5
|
-
"dom",
|
|
6
|
-
"dom.iterable",
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"noEmit": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"module": "esnext",
|
|
15
|
-
"moduleResolution": "bundler",
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"isolatedModules": true,
|
|
18
|
-
"jsx": "react-jsx",
|
|
19
|
-
"incremental": true,
|
|
20
|
-
"sourceMap": true,
|
|
21
|
-
"inlineSourceMap": false,
|
|
22
|
-
"inlineSources": true,
|
|
23
|
-
"plugins": [
|
|
24
|
-
{
|
|
25
|
-
"name": "next"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"paths": {
|
|
29
|
-
"@/*": [
|
|
30
|
-
"./src/*"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"include": [
|
|
35
|
-
"next-env.d.ts",
|
|
36
|
-
"**/*.ts",
|
|
37
|
-
"**/*.tsx",
|
|
38
|
-
".next/types/**/*.ts",
|
|
39
|
-
".next/dev/types/**/*.ts",
|
|
40
|
-
".next/dev/dev/types/**/*.ts"
|
|
41
|
-
],
|
|
42
|
-
"exclude": [
|
|
43
|
-
"node_modules"
|
|
44
|
-
]
|
|
45
|
-
}
|
package/types/README.md
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# @helium/blockchain-api
|
|
2
|
-
|
|
3
|
-
TypeScript types and Zod schemas for the Helium Blockchain API. Provides full type safety when building clients for the Helium blockchain services.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @helium/blockchain-api
|
|
9
|
-
# or
|
|
10
|
-
yarn add @helium/blockchain-api
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Peer Dependencies
|
|
14
|
-
|
|
15
|
-
- `@orpc/client` ^1.12.0
|
|
16
|
-
- `zod` ^4.0.0
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
### Setting up a typed client
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import type { BlockchainAPIClient } from "@helium/blockchain-api"
|
|
24
|
-
import { createORPCClient } from "@orpc/client"
|
|
25
|
-
import { RPCLink } from "@orpc/client/fetch"
|
|
26
|
-
|
|
27
|
-
const link = new RPCLink({
|
|
28
|
-
url: "https://your-api-url.com/rpc",
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const client: BlockchainAPIClient = createORPCClient(link)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Example API calls
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
// Get token balances
|
|
38
|
-
const balances = await client.tokens.getBalances({
|
|
39
|
-
walletAddress: "your-wallet-address"
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
// Get swap quote
|
|
43
|
-
const quote = await client.swap.getQuote({
|
|
44
|
-
inputMint: "input-token-mint",
|
|
45
|
-
outputMint: "output-token-mint",
|
|
46
|
-
amount: "1000000"
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
// Claim hotspot rewards
|
|
50
|
-
const { transactionData } = await client.hotspots.claimRewards({
|
|
51
|
-
walletAddress: "your-wallet-address"
|
|
52
|
-
})
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Using Zod schemas for validation
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
import { HotspotSchema, TokenAccountSchema } from "@helium/blockchain-api"
|
|
59
|
-
|
|
60
|
-
// Validate data
|
|
61
|
-
const hotspot = HotspotSchema.parse(rawData)
|
|
62
|
-
|
|
63
|
-
// Type inference
|
|
64
|
-
type Hotspot = z.infer<typeof HotspotSchema>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### With TanStack Query
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
import { createRouterUtils } from "@orpc/tanstack-query"
|
|
71
|
-
|
|
72
|
-
const orpc = createRouterUtils(client)
|
|
73
|
-
|
|
74
|
-
// In a React component
|
|
75
|
-
const { data, isLoading } = orpc.tokens.getBalances.useQuery({
|
|
76
|
-
input: { walletAddress: "your-wallet-address" }
|
|
77
|
-
})
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Available Routers
|
|
81
|
-
|
|
82
|
-
- `hotspots` - Hotspot management, rewards, splits
|
|
83
|
-
- `tokens` - Token balances, transfers
|
|
84
|
-
- `swap` - Jupiter DEX integration
|
|
85
|
-
- `transactions` - Transaction submission/tracking
|
|
86
|
-
- `welcomePacks` - Onboarding rewards
|
|
87
|
-
- `fiat` - Bank accounts, KYC, offramp
|
|
88
|
-
- `health` - Health checks
|
|
89
|
-
|
|
90
|
-
## Exports
|
|
91
|
-
|
|
92
|
-
### Types
|
|
93
|
-
- `ORPCRouter` - The full router type
|
|
94
|
-
- `BlockchainAPIClient` - Helper type for typed clients
|
|
95
|
-
- `RouterClient` - Re-exported from @orpc/server
|
|
96
|
-
|
|
97
|
-
### Zod Schemas
|
|
98
|
-
- `HotspotSchema`, `HotspotsDataSchema` - Hotspot data validation
|
|
99
|
-
- `TokenAccountSchema`, `TokenBalanceDataSchema` - Token data validation
|
|
100
|
-
- `TransactionDataSchema`, `TransactionItemSchema` - Transaction validation
|
|
101
|
-
- `QuoteResponseSchema` - Swap quote validation
|
|
102
|
-
- `WelcomePackSchema` - Welcome pack validation
|
|
103
|
-
- `BankAccountSchema`, `KycStatusOutputSchema` - Fiat/KYC validation
|
|
104
|
-
- And many more input/output schemas for each router
|
|
105
|
-
|
|
106
|
-
## License
|
|
107
|
-
|
|
108
|
-
Apache-2.0
|