@helium/blockchain-api 0.1.0 → 0.1.2

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 CHANGED
@@ -1,25 +1,86 @@
1
- This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1
+ # @helium/blockchain-api
2
2
 
3
- ## Getting Started
3
+ TypeScript types for the Helium Blockchain API. Provides full type safety when building clients for the Helium blockchain services.
4
4
 
5
- First, setup the indexers and postgres database for solana data. You'll need to get a solana RPC url.
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
- You may need to wait a few minutes until the asset-ownership service is running.
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
- Next, migrate the database:
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
- yarn sequelize-cli db:migrate
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
- Now, run the development server:
55
+ ### With TanStack Query
20
56
 
21
- ```bash
22
- yarn dev
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
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
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.0",
3
+ "version": "0.1.2",
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",
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { QuoteResponseSchema } from "../swap/schemas";
2
3
 
3
4
  // ============================================================================
4
5
  // Input Schemas
@@ -133,8 +134,18 @@ export const TransactionDataSchema = z.object({
133
134
  tag: z.string().optional(),
134
135
  });
135
136
 
137
+ export const BridgeTransferSchema = z
138
+ .object({
139
+ id: z.string(),
140
+ state: z.string(),
141
+ source_deposit_instructions: z.object({
142
+ to_address: z.string(),
143
+ }),
144
+ })
145
+ .passthrough();
146
+
136
147
  export const SendFundsOutputSchema = z.object({
137
- bridgeTransfer: z.unknown(),
148
+ bridgeTransfer: BridgeTransferSchema,
138
149
  transactionData: TransactionDataSchema,
139
150
  });
140
151
 
@@ -143,7 +154,7 @@ export const UpdateTransferOutputSchema = z.object({
143
154
  });
144
155
 
145
156
  // Quote response is pass-through from Jupiter
146
- export const QuoteOutputSchema = z.unknown();
157
+ export const QuoteOutputSchema = QuoteResponseSchema;
147
158
 
148
159
  // ============================================================================
149
160
  // Type Exports
@@ -155,3 +166,4 @@ export type CreateBankAccountInput = z.infer<
155
166
  >;
156
167
  export type KycStatusOutput = z.infer<typeof KycStatusOutputSchema>;
157
168
  export type FeesOutput = z.infer<typeof FeesOutputSchema>;
169
+ export type BridgeTransfer = z.infer<typeof BridgeTransferSchema>;
@@ -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