@helium/blockchain-api 0.1.1 → 0.1.3
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 +24 -2
- package/package.json +31 -31
- package/types/README.md +24 -2
- package/types/generated/index.d.mts +2481 -0
- package/types/generated/index.d.ts +2481 -0
- package/types/generated/index.js +723 -0
- package/types/generated/index.mjs +614 -0
- package/types/index.ts +11 -8
- package/src/server/api/errors.ts +0 -152
- package/src/server/api/index.ts +0 -40
- package/src/server/api/procedures.ts +0 -144
- package/src/server/api/routers/fiat/router.ts +0 -709
- package/src/server/api/routers/fiat/schemas.ts +0 -157
- package/src/server/api/routers/health/router.ts +0 -41
- package/src/server/api/routers/hotspots/procedures/claimRewards.ts +0 -258
- package/src/server/api/routers/hotspots/procedures/createSplit.ts +0 -253
- package/src/server/api/routers/hotspots/procedures/deleteSplit.ts +0 -156
- package/src/server/api/routers/hotspots/procedures/getHotspots.ts +0 -31
- package/src/server/api/routers/hotspots/procedures/getPendingRewards.ts +0 -44
- package/src/server/api/routers/hotspots/procedures/getSplit.ts +0 -88
- package/src/server/api/routers/hotspots/procedures/transferHotspot.ts +0 -204
- package/src/server/api/routers/hotspots/procedures/updateRewardsDestination.ts +0 -201
- package/src/server/api/routers/hotspots/router.ts +0 -30
- package/src/server/api/routers/hotspots/schemas.ts +0 -182
- package/src/server/api/routers/swap/procedures/getInstructions.ts +0 -152
- package/src/server/api/routers/swap/procedures/getQuote.ts +0 -53
- package/src/server/api/routers/swap/procedures/getTokens.ts +0 -88
- package/src/server/api/routers/swap/router.ts +0 -15
- package/src/server/api/routers/swap/schemas.ts +0 -96
- package/src/server/api/routers/tokens/procedures/createHntAccount.ts +0 -87
- package/src/server/api/routers/tokens/procedures/getBalances.ts +0 -27
- package/src/server/api/routers/tokens/procedures/transfer.ts +0 -159
- package/src/server/api/routers/tokens/router.ts +0 -15
- package/src/server/api/routers/tokens/schemas.ts +0 -80
- package/src/server/api/routers/transactions/procedures/get.ts +0 -46
- package/src/server/api/routers/transactions/procedures/getByPayer.ts +0 -111
- package/src/server/api/routers/transactions/procedures/getByPayerAndTag.ts +0 -119
- package/src/server/api/routers/transactions/procedures/resubmit.ts +0 -68
- package/src/server/api/routers/transactions/procedures/submit.ts +0 -216
- package/src/server/api/routers/transactions/router.ts +0 -21
- package/src/server/api/routers/transactions/schemas.ts +0 -119
- package/src/server/api/routers/webhooks/router.ts +0 -75
- package/src/server/api/routers/welcomePacks/procedures/claim.ts +0 -157
- package/src/server/api/routers/welcomePacks/procedures/create.ts +0 -247
- package/src/server/api/routers/welcomePacks/procedures/deletePack.ts +0 -118
- package/src/server/api/routers/welcomePacks/procedures/get.ts +0 -36
- package/src/server/api/routers/welcomePacks/procedures/getByAddress.ts +0 -26
- package/src/server/api/routers/welcomePacks/procedures/invite.ts +0 -44
- package/src/server/api/routers/welcomePacks/procedures/list.ts +0 -27
- package/src/server/api/routers/welcomePacks/router.ts +0 -27
- package/src/server/api/routers/welcomePacks/schemas.ts +0 -135
- package/src/server/api/schemas.ts +0 -281
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { HotspotSchema } from "@/server/api/schemas";
|
|
3
|
-
|
|
4
|
-
// ============================================================================
|
|
5
|
-
// Input Schemas
|
|
6
|
-
// ============================================================================
|
|
7
|
-
|
|
8
|
-
export const ListInputSchema = z.object({
|
|
9
|
-
walletAddress: z.string().min(32),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const RewardSplitInputSchema = z.object({
|
|
13
|
-
address: z.string(),
|
|
14
|
-
type: z.enum(["percentage", "fixed"]),
|
|
15
|
-
amount: z.number(),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const ScheduleInputSchema = z.object({
|
|
19
|
-
frequency: z.enum(["daily", "weekly", "monthly"]),
|
|
20
|
-
time: z.string(),
|
|
21
|
-
timezone: z.string(),
|
|
22
|
-
dayOfWeek: z.string().optional(),
|
|
23
|
-
dayOfMonth: z.string().optional(),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const CreateInputSchema = z.object({
|
|
27
|
-
walletAddress: z.string().min(32),
|
|
28
|
-
assetId: z.string(),
|
|
29
|
-
solAmount: z.number(),
|
|
30
|
-
rentRefund: z.string(),
|
|
31
|
-
assetReturnAddress: z.string(),
|
|
32
|
-
rewardsSplit: z.array(RewardSplitInputSchema),
|
|
33
|
-
schedule: ScheduleInputSchema,
|
|
34
|
-
lazyDistributor: z.string(),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const GetInputSchema = z.object({
|
|
38
|
-
walletAddress: z.string().min(32),
|
|
39
|
-
packId: z.number(),
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const DeleteInputSchema = z.object({
|
|
43
|
-
walletAddress: z.string().min(32),
|
|
44
|
-
packId: z.number(),
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export const GetByAddressInputSchema = z.object({
|
|
48
|
-
packAddress: z.string().min(32),
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const ClaimInputSchema = z.object({
|
|
52
|
-
packAddress: z.string().min(32),
|
|
53
|
-
walletAddress: z.string().min(32),
|
|
54
|
-
signature: z.string(),
|
|
55
|
-
expirationTs: z.string(),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export const InviteInputSchema = z.object({
|
|
59
|
-
packAddress: z.string().min(32),
|
|
60
|
-
walletAddress: z.string().min(32),
|
|
61
|
-
expirationDays: z.number().int().positive().max(365).default(7),
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ============================================================================
|
|
65
|
-
// Output Schemas
|
|
66
|
-
// ============================================================================
|
|
67
|
-
|
|
68
|
-
export const WelcomePackSchema = z.object({
|
|
69
|
-
address: z.string(),
|
|
70
|
-
id: z.number(),
|
|
71
|
-
owner: z.string(),
|
|
72
|
-
asset: z.string(),
|
|
73
|
-
lazyDistributor: z.string(),
|
|
74
|
-
rewardsMint: z.string(),
|
|
75
|
-
rentRefund: z.string(),
|
|
76
|
-
solAmount: z.string(),
|
|
77
|
-
rewardsSplit: z.array(RewardSplitInputSchema),
|
|
78
|
-
rewardsSchedule: z.string(),
|
|
79
|
-
assetReturnAddress: z.string(),
|
|
80
|
-
bumpSeed: z.number(),
|
|
81
|
-
uniqueId: z.string(),
|
|
82
|
-
loading: z.boolean().optional(),
|
|
83
|
-
hotspot: HotspotSchema.nullable(),
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
export const ListOutputSchema = z.array(WelcomePackSchema);
|
|
87
|
-
|
|
88
|
-
export const TransactionMetadataSchema = z
|
|
89
|
-
.object({
|
|
90
|
-
type: z.string(),
|
|
91
|
-
description: z.string(),
|
|
92
|
-
})
|
|
93
|
-
.catchall(z.unknown());
|
|
94
|
-
|
|
95
|
-
export const TransactionItemSchema = z.object({
|
|
96
|
-
serializedTransaction: z.string(),
|
|
97
|
-
metadata: TransactionMetadataSchema.optional(),
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export const TransactionDataSchema = z.object({
|
|
101
|
-
transactions: z.array(TransactionItemSchema),
|
|
102
|
-
parallel: z.boolean(),
|
|
103
|
-
tag: z.string().optional(),
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
export const CreateOutputSchema = z.object({
|
|
107
|
-
welcomePack: WelcomePackSchema,
|
|
108
|
-
transactionData: TransactionDataSchema,
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
export const DeleteOutputSchema = z.object({
|
|
112
|
-
transactionData: TransactionDataSchema,
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
export const ClaimOutputSchema = z.object({
|
|
116
|
-
transactionData: TransactionDataSchema,
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
export const InviteOutputSchema = z.object({
|
|
120
|
-
message: z.string(),
|
|
121
|
-
expirationTs: z.number(),
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// ============================================================================
|
|
125
|
-
// Type Exports
|
|
126
|
-
// ============================================================================
|
|
127
|
-
|
|
128
|
-
export type ListInput = z.infer<typeof ListInputSchema>;
|
|
129
|
-
export type CreateInput = z.infer<typeof CreateInputSchema>;
|
|
130
|
-
export type GetInput = z.infer<typeof GetInputSchema>;
|
|
131
|
-
export type DeleteInput = z.infer<typeof DeleteInputSchema>;
|
|
132
|
-
export type GetByAddressInput = z.infer<typeof GetByAddressInputSchema>;
|
|
133
|
-
export type ClaimInput = z.infer<typeof ClaimInputSchema>;
|
|
134
|
-
export type InviteInput = z.infer<typeof InviteInputSchema>;
|
|
135
|
-
export type WelcomePack = z.infer<typeof WelcomePackSchema>;
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// Common Transaction Schemas
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Metadata associated with a transaction for tracking and display purposes.
|
|
9
|
-
*/
|
|
10
|
-
export const TransactionMetadataSchema = z
|
|
11
|
-
.object({
|
|
12
|
-
type: z.string(),
|
|
13
|
-
description: z.string(),
|
|
14
|
-
})
|
|
15
|
-
.catchall(z.unknown());
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A single transaction item with serialized data and optional metadata.
|
|
19
|
-
*/
|
|
20
|
-
export const TransactionItemSchema = z.object({
|
|
21
|
-
serializedTransaction: z.string(),
|
|
22
|
-
metadata: TransactionMetadataSchema.optional(),
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Transaction data returned by procedures that create transactions.
|
|
27
|
-
* Contains serialized transactions ready for signing and submission.
|
|
28
|
-
*/
|
|
29
|
-
export const TransactionDataSchema = z.object({
|
|
30
|
-
transactions: z.array(TransactionItemSchema),
|
|
31
|
-
parallel: z.boolean(),
|
|
32
|
-
tag: z.string().optional(),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Request schema for submitting a batch of transactions.
|
|
37
|
-
*/
|
|
38
|
-
export const TransactionBatchRequestSchema = z.object({
|
|
39
|
-
transactions: z.array(TransactionItemSchema),
|
|
40
|
-
parallel: z.boolean(),
|
|
41
|
-
tag: z.string().optional(),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Response schema for transaction batch submission.
|
|
46
|
-
*/
|
|
47
|
-
export const TransactionBatchResponseSchema = z.object({
|
|
48
|
-
batchId: z.string(),
|
|
49
|
-
message: z.string().optional(),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// ============================================================================
|
|
53
|
-
// Common Response Schemas
|
|
54
|
-
// ============================================================================
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Standard error response schema.
|
|
58
|
-
*/
|
|
59
|
-
export const ErrorResponseSchema = z.object({
|
|
60
|
-
error: z.string(),
|
|
61
|
-
details: z.array(z.string()).optional(),
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ============================================================================
|
|
65
|
-
// Wallet Address Schema
|
|
66
|
-
// ============================================================================
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Solana wallet address validation.
|
|
70
|
-
*/
|
|
71
|
-
export const WalletAddressSchema = z.string().min(32).max(44);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Solana public key validation (base58 encoded).
|
|
75
|
-
*/
|
|
76
|
-
export const PublicKeySchema = z.string().min(32).max(44);
|
|
77
|
-
|
|
78
|
-
// ============================================================================
|
|
79
|
-
// Pagination Schemas
|
|
80
|
-
// ============================================================================
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Standard pagination input schema.
|
|
84
|
-
*/
|
|
85
|
-
export const PaginationInputSchema = z.object({
|
|
86
|
-
page: z.coerce.number().int().min(1).default(1),
|
|
87
|
-
limit: z.coerce.number().int().min(1).max(100).default(10),
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Standard pagination output schema.
|
|
92
|
-
*/
|
|
93
|
-
export const PaginationOutputSchema = z.object({
|
|
94
|
-
total: z.number(),
|
|
95
|
-
page: z.number(),
|
|
96
|
-
totalPages: z.number(),
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// ============================================================================
|
|
100
|
-
// Hotspot Schemas
|
|
101
|
-
// ============================================================================
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Hotspot type enumeration.
|
|
105
|
-
*/
|
|
106
|
-
export const HotspotTypeSchema = z.enum(["iot", "mobile", "all"]);
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Hotspot device type enumeration.
|
|
110
|
-
*/
|
|
111
|
-
export const DeviceTypeSchema = z.enum([
|
|
112
|
-
"iot-gateway",
|
|
113
|
-
"wifiIndoor",
|
|
114
|
-
"wifiOutdoor",
|
|
115
|
-
"wifiDataOnly",
|
|
116
|
-
"cbrs",
|
|
117
|
-
]);
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Hotspot ownership type enumeration.
|
|
121
|
-
*/
|
|
122
|
-
export const OwnershipTypeSchema = z.enum(["owner", "direct", "fanout", "all"]);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Hotspot share configuration.
|
|
126
|
-
*/
|
|
127
|
-
export const HotspotSharesSchema = z.object({
|
|
128
|
-
fixed: z.string().optional(),
|
|
129
|
-
percentage: z.number().optional(),
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Complete hotspot data schema.
|
|
134
|
-
*/
|
|
135
|
-
export const HotspotSchema = z.object({
|
|
136
|
-
address: z.string(),
|
|
137
|
-
entityKey: z.string(),
|
|
138
|
-
name: z.string(),
|
|
139
|
-
type: HotspotTypeSchema,
|
|
140
|
-
deviceType: DeviceTypeSchema,
|
|
141
|
-
city: z.string().optional(),
|
|
142
|
-
state: z.string().optional(),
|
|
143
|
-
country: z.string().optional(),
|
|
144
|
-
asset: z.string(),
|
|
145
|
-
isOnline: z.boolean().optional(),
|
|
146
|
-
owner: z.string().optional(),
|
|
147
|
-
shares: HotspotSharesSchema.optional(),
|
|
148
|
-
ownershipType: z.string(),
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Paginated hotspots response schema.
|
|
153
|
-
*/
|
|
154
|
-
export const HotspotsDataSchema = z.object({
|
|
155
|
-
hotspots: z.array(HotspotSchema),
|
|
156
|
-
total: z.number(),
|
|
157
|
-
page: z.number(),
|
|
158
|
-
totalPages: z.number(),
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// ============================================================================
|
|
162
|
-
// Token Schemas
|
|
163
|
-
// ============================================================================
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Token account data schema.
|
|
167
|
-
*/
|
|
168
|
-
export const TokenAccountSchema = z.object({
|
|
169
|
-
mint: z.string(),
|
|
170
|
-
address: z.string(),
|
|
171
|
-
balance: z.string(),
|
|
172
|
-
decimals: z.number(),
|
|
173
|
-
uiAmount: z.number(),
|
|
174
|
-
symbol: z.string().optional(),
|
|
175
|
-
name: z.string().optional(),
|
|
176
|
-
logoURI: z.string().optional(),
|
|
177
|
-
priceUsd: z.number().optional(),
|
|
178
|
-
balanceUsd: z.number().optional(),
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Token balance data response schema.
|
|
183
|
-
*/
|
|
184
|
-
export const TokenBalanceDataSchema = z.object({
|
|
185
|
-
totalBalanceUsd: z.number(),
|
|
186
|
-
solBalance: z.number(),
|
|
187
|
-
solBalanceUsd: z.number(),
|
|
188
|
-
tokens: z.array(TokenAccountSchema),
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
// ============================================================================
|
|
192
|
-
// Welcome Pack Schemas
|
|
193
|
-
// ============================================================================
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Reward split recipient schema.
|
|
197
|
-
*/
|
|
198
|
-
export const RewardSplitSchema = z.object({
|
|
199
|
-
address: z.string(),
|
|
200
|
-
type: z.enum(["percentage", "fixed"]),
|
|
201
|
-
amount: z.number(),
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Schedule configuration schema.
|
|
206
|
-
*/
|
|
207
|
-
export const ScheduleSchema = z.object({
|
|
208
|
-
frequency: z.enum(["daily", "weekly", "monthly"]),
|
|
209
|
-
time: z.string(),
|
|
210
|
-
timezone: z.string(),
|
|
211
|
-
dayOfWeek: z.string().optional(),
|
|
212
|
-
dayOfMonth: z.string().optional(),
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Welcome pack with status schema.
|
|
217
|
-
*/
|
|
218
|
-
export const WelcomePackWithStatusSchema = z.object({
|
|
219
|
-
address: z.string(),
|
|
220
|
-
id: z.number(),
|
|
221
|
-
owner: z.string(),
|
|
222
|
-
asset: z.string(),
|
|
223
|
-
lazyDistributor: z.string(),
|
|
224
|
-
rewardsMint: z.string(),
|
|
225
|
-
rentRefund: z.string(),
|
|
226
|
-
solAmount: z.string(),
|
|
227
|
-
rewardsSplit: z.array(RewardSplitSchema),
|
|
228
|
-
rewardsSchedule: z.string(),
|
|
229
|
-
assetReturnAddress: z.string(),
|
|
230
|
-
bumpSeed: z.number(),
|
|
231
|
-
uniqueId: z.string(),
|
|
232
|
-
loading: z.boolean().optional(),
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
// ============================================================================
|
|
236
|
-
// Split Schemas
|
|
237
|
-
// ============================================================================
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Split share schema.
|
|
241
|
-
*/
|
|
242
|
-
export const SplitShareSchema = z.object({
|
|
243
|
-
wallet: z.string(),
|
|
244
|
-
delegate: z.string(),
|
|
245
|
-
fixed: z.number(),
|
|
246
|
-
shares: z.number(),
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Split response schema.
|
|
251
|
-
*/
|
|
252
|
-
export const SplitResponseSchema = z.object({
|
|
253
|
-
walletAddress: z.string(),
|
|
254
|
-
hotspotPubkey: z.string(),
|
|
255
|
-
splitAddress: z.string(),
|
|
256
|
-
shares: z.array(SplitShareSchema),
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
// ============================================================================
|
|
260
|
-
// Type Exports
|
|
261
|
-
// ============================================================================
|
|
262
|
-
|
|
263
|
-
export type TransactionMetadata = z.infer<typeof TransactionMetadataSchema>;
|
|
264
|
-
export type TransactionItem = z.infer<typeof TransactionItemSchema>;
|
|
265
|
-
export type TransactionData = z.infer<typeof TransactionDataSchema>;
|
|
266
|
-
export type TransactionBatchRequest = z.infer<
|
|
267
|
-
typeof TransactionBatchRequestSchema
|
|
268
|
-
>;
|
|
269
|
-
export type TransactionBatchResponse = z.infer<
|
|
270
|
-
typeof TransactionBatchResponseSchema
|
|
271
|
-
>;
|
|
272
|
-
export type ErrorResponse = z.infer<typeof ErrorResponseSchema>;
|
|
273
|
-
export type Hotspot = z.infer<typeof HotspotSchema>;
|
|
274
|
-
export type HotspotsData = z.infer<typeof HotspotsDataSchema>;
|
|
275
|
-
export type TokenAccount = z.infer<typeof TokenAccountSchema>;
|
|
276
|
-
export type TokenBalanceData = z.infer<typeof TokenBalanceDataSchema>;
|
|
277
|
-
export type RewardSplit = z.infer<typeof RewardSplitSchema>;
|
|
278
|
-
export type Schedule = z.infer<typeof ScheduleSchema>;
|
|
279
|
-
export type WelcomePackWithStatus = z.infer<typeof WelcomePackWithStatusSchema>;
|
|
280
|
-
export type SplitShare = z.infer<typeof SplitShareSchema>;
|
|
281
|
-
export type SplitResponse = z.infer<typeof SplitResponseSchema>;
|