@helium/blockchain-api 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -12
- package/package.json +3 -2
- package/types/README.md +86 -0
package/README.md
CHANGED
|
@@ -1,25 +1,86 @@
|
|
|
1
|
-
|
|
1
|
+
# @helium/blockchain-api
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript types for the Helium Blockchain API. Provides full type safety when building clients for the Helium blockchain services.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
+
```bash
|
|
8
|
+
npm install @helium/blockchain-api
|
|
9
|
+
# or
|
|
10
|
+
yarn add @helium/blockchain-api
|
|
7
11
|
```
|
|
8
|
-
SOLANA_URL=<your-rpc-url> docker-compose up
|
|
9
|
-
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Peer Dependencies
|
|
14
|
+
|
|
15
|
+
- `@orpc/server` ^1.12.0
|
|
16
|
+
- `zod` ^4.0.0
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Setting up a typed client
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
```typescript
|
|
23
|
+
import type { BlockchainAPIClient } from "@helium/blockchain-api"
|
|
24
|
+
import { createORPCClient } from "@orpc/client"
|
|
25
|
+
import { RPCLink } from "@orpc/client/fetch"
|
|
14
26
|
|
|
27
|
+
const link = new RPCLink({
|
|
28
|
+
url: "https://your-api-url.com/rpc",
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const client: BlockchainAPIClient = createORPCClient(link)
|
|
15
32
|
```
|
|
16
|
-
|
|
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
|
+
})
|
|
17
53
|
```
|
|
18
54
|
|
|
19
|
-
|
|
55
|
+
### With TanStack Query
|
|
20
56
|
|
|
21
|
-
```
|
|
22
|
-
|
|
57
|
+
```typescript
|
|
58
|
+
import { createRouterUtils } from "@orpc/tanstack-query"
|
|
59
|
+
|
|
60
|
+
const orpc = createRouterUtils(client)
|
|
61
|
+
|
|
62
|
+
// In a React component
|
|
63
|
+
const { data, isLoading } = orpc.tokens.getBalances.useQuery({
|
|
64
|
+
input: { walletAddress: "your-wallet-address" }
|
|
65
|
+
})
|
|
23
66
|
```
|
|
24
67
|
|
|
25
|
-
|
|
68
|
+
## Available Routers
|
|
69
|
+
|
|
70
|
+
- `hotspots` - Hotspot management, rewards, splits
|
|
71
|
+
- `tokens` - Token balances, transfers
|
|
72
|
+
- `swap` - Jupiter DEX integration
|
|
73
|
+
- `transactions` - Transaction submission/tracking
|
|
74
|
+
- `welcomePacks` - Onboarding rewards
|
|
75
|
+
- `fiat` - Bank accounts, KYC, offramp
|
|
76
|
+
- `health` - Health checks
|
|
77
|
+
|
|
78
|
+
## Exports
|
|
79
|
+
|
|
80
|
+
- `ORPCRouter` - The full router type
|
|
81
|
+
- `BlockchainAPIClient` - Helper type for typed clients
|
|
82
|
+
- `RouterClient` - Re-exported from @orpc/server
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helium/blockchain-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "TypeScript types for the Helium Blockchain API",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"prepublishOnly": "npm run lint && echo 'Ready to publish!'",
|
|
36
|
+
"prepublishOnly": "mv README.md DEV_README.md && cp types/README.md README.md && npm run lint && echo 'Ready to publish!'",
|
|
37
|
+
"postpublish": "mv DEV_README.md README.md",
|
|
37
38
|
"dev": "node scripts/dev-with-background.js",
|
|
38
39
|
"dev:next-only": "next dev --turbopack",
|
|
39
40
|
"build": "next build",
|
package/types/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @helium/blockchain-api
|
|
2
|
+
|
|
3
|
+
TypeScript types 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/server` ^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
|
+
### With TanStack Query
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { createRouterUtils } from "@orpc/tanstack-query"
|
|
59
|
+
|
|
60
|
+
const orpc = createRouterUtils(client)
|
|
61
|
+
|
|
62
|
+
// In a React component
|
|
63
|
+
const { data, isLoading } = orpc.tokens.getBalances.useQuery({
|
|
64
|
+
input: { walletAddress: "your-wallet-address" }
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Available Routers
|
|
69
|
+
|
|
70
|
+
- `hotspots` - Hotspot management, rewards, splits
|
|
71
|
+
- `tokens` - Token balances, transfers
|
|
72
|
+
- `swap` - Jupiter DEX integration
|
|
73
|
+
- `transactions` - Transaction submission/tracking
|
|
74
|
+
- `welcomePacks` - Onboarding rewards
|
|
75
|
+
- `fiat` - Bank accounts, KYC, offramp
|
|
76
|
+
- `health` - Health checks
|
|
77
|
+
|
|
78
|
+
## Exports
|
|
79
|
+
|
|
80
|
+
- `ORPCRouter` - The full router type
|
|
81
|
+
- `BlockchainAPIClient` - Helper type for typed clients
|
|
82
|
+
- `RouterClient` - Re-exported from @orpc/server
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
Apache-2.0
|