@helium/blockchain-api 0.3.12 → 0.11.11

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 (50) hide show
  1. package/dist/chunk-2SBYC2AH.js +466 -0
  2. package/dist/chunk-4CY5D37F.js +176 -0
  3. package/dist/chunk-4RVSLJOU.js +9 -0
  4. package/dist/chunk-5ZPW3MRC.js +53 -0
  5. package/dist/chunk-6EPXJJY5.js +60 -0
  6. package/dist/chunk-6LMSAIIW.js +230 -0
  7. package/dist/chunk-7CTJX35S.js +16 -0
  8. package/dist/chunk-7R4XQ5SN.js +116 -0
  9. package/dist/chunk-KTADG6LO.js +1 -0
  10. package/dist/chunk-LHKDTWB2.js +177 -0
  11. package/dist/chunk-MSIA3ZUI.js +36 -0
  12. package/dist/chunk-NBOSJXWK.js +50 -0
  13. package/dist/chunk-RD5LUTM5.js +97 -0
  14. package/dist/chunk-T7OKPHTD.js +68 -0
  15. package/dist/chunk-TEWZC6CW.js +1 -0
  16. package/dist/chunk-YVB4ENKX.js +119 -0
  17. package/dist/contracts.d.ts +8671 -0
  18. package/dist/contracts.js +14 -0
  19. package/dist/errors.d.ts +69 -0
  20. package/dist/errors.js +2 -0
  21. package/dist/index.d.ts +16 -8124
  22. package/dist/index.js +16 -1596
  23. package/dist/schemas/common.d.ts +219 -0
  24. package/dist/schemas/common.js +1 -0
  25. package/dist/schemas/fiat.d.ts +175 -0
  26. package/dist/schemas/fiat.js +3 -0
  27. package/dist/schemas/governance.d.ts +470 -0
  28. package/dist/schemas/governance.js +2 -0
  29. package/dist/schemas/health.d.ts +9 -0
  30. package/dist/schemas/health.js +1 -0
  31. package/dist/schemas/hotspots.d.ts +540 -0
  32. package/dist/schemas/hotspots.js +2 -0
  33. package/dist/schemas/migration.d.ts +145 -0
  34. package/dist/schemas/migration.js +3 -0
  35. package/dist/schemas/reward-contract.d.ts +209 -0
  36. package/dist/schemas/reward-contract.js +2 -0
  37. package/dist/schemas/swap.d.ts +95 -0
  38. package/dist/schemas/swap.js +2 -0
  39. package/dist/schemas/tokens.d.ts +94 -0
  40. package/dist/schemas/tokens.js +2 -0
  41. package/dist/schemas/transactions.d.ts +200 -0
  42. package/dist/schemas/transactions.js +2 -0
  43. package/dist/schemas/webhooks.d.ts +17 -0
  44. package/dist/schemas/webhooks.js +1 -0
  45. package/dist/schemas/welcome-packs.d.ts +305 -0
  46. package/dist/schemas/welcome-packs.js +3 -0
  47. package/dist/schemas.d.ts +12 -0
  48. package/dist/schemas.js +12 -0
  49. package/package.json +32 -10
  50. package/README.md +0 -78
@@ -0,0 +1,466 @@
1
+ import { BridgeWebhookInputSchema, BridgeWebhookOutputSchema } from './chunk-7CTJX35S.js';
2
+ import { INSUFFICIENT_FUNDS, INVALID_WALLET_ADDRESS, BAD_REQUEST, UNAUTHORIZED, NOT_FOUND, CONFLICT, SIMULATION_FAILED, UNAUTHENTICATED } from './chunk-6EPXJJY5.js';
3
+ import { MigrateInputSchema, MigrateOutputSchema, MigratableHotspotsInputSchema, MigratableHotspotsOutputSchema } from './chunk-NBOSJXWK.js';
4
+ import { ClaimInviteRequestSchema, ClaimInviteResponseSchema, CreateInviteResponseSchema, DeleteRewardContractTransactionResponseSchema, CreateRewardContractTransactionInputSchema, CreateRewardContractTransactionResponseSchema, EstimateCostToCreateRewardContractResponseSchema, FindRewardContractResponseSchema } from './chunk-4CY5D37F.js';
5
+ import { CreateHntAccountInputSchema, CreateHntAccountOutputSchema, TransferInputSchema, TransferOutputSchema, GetBalancesInputSchema, TokenBalanceDataSchema } from './chunk-MSIA3ZUI.js';
6
+ import { EstimateInputSchema, EstimateOutputSchema, GetByPayerAndTagInputSchema, PayerBatchesOutputSchema, GetByPayerInputSchema, ResubmitInputSchema, ResubmitOutputSchema, GetInputSchema, BatchStatusOutputSchema, SubmitInputSchema, SubmitOutputSchema } from './chunk-7R4XQ5SN.js';
7
+ import { WelcomePackInviteInputSchema, WelcomePackInviteOutputSchema, WelcomePackClaimInputSchema, WelcomePackClaimOutputSchema, WelcomePackGetByAddressInputSchema, WelcomePackSchema, WelcomePackDeleteInputSchema, WelcomePackDeleteOutputSchema, WelcomePackGetInputSchema, WelcomePackCreateInputSchema, WelcomePackCreateOutputSchema, WelcomePackListInputSchema, WelcomePackListOutputSchema } from './chunk-T7OKPHTD.js';
8
+ import { UpdateTransferInputSchema, UpdateTransferOutputSchema, SendFundsInputSchema, SendFundsOutputSchema, GetSendQuoteInputSchema, QuoteOutputSchema, DeleteBankAccountInputSchema, DeleteBankAccountOutputSchema, CreateBankAccountInputSchema, BankAccountSchema, BankAccountListOutputSchema, FeesOutputSchema, InitKycInputSchema, KycStatusOutputSchema } from './chunk-RD5LUTM5.js';
9
+ import { GetInstructionsInputSchema, GetQuoteInputSchema, QuoteResponseSchema, GetTokensInputSchema, TokenListOutputSchema } from './chunk-5ZPW3MRC.js';
10
+ import { UnassignProxiesInputSchema, UnassignProxiesResponseSchema, AssignProxiesInputSchema, AssignProxiesResponseSchema, RelinquishPositionVotesInputSchema, RelinquishPositionVotesResponseSchema, RelinquishVoteInputSchema, RelinquishVoteResponseSchema, VoteInputSchema, VoteResponseSchema, ExtendDelegationInputSchema, ExtendDelegationResponseSchema, UndelegateInputSchema, UndelegatePositionResponseSchema, ClaimDelegationRewardsInputSchema, ClaimDelegationRewardsResponseSchema, DelegatePositionInputSchema, DelegatePositionsResponseSchema, TransferPositionInputSchema, TransferPositionResponseSchema, SplitPositionInputSchema, SplitPositionResponseSchema, ResetLockupInputSchema, ResetLockupResponseSchema, FlipLockupKindInputSchema, FlipLockupKindResponseSchema, ExtendPositionInputSchema, ExtendPositionResponseSchema, ClosePositionInputSchema, ClosePositionResponseSchema, CreatePositionInputSchema, CreatePositionResponseSchema } from './chunk-LHKDTWB2.js';
11
+ import { HealthResponseSchema } from './chunk-4RVSLJOU.js';
12
+ import { UpdateHotspotInfoInputSchema, UpdateHotspotInfoOutputSchema, GetFundingEstimateInputSchema, FundingEstimateOutputSchema, FundAutomationInputSchema, FundAutomationOutputSchema, SetupAutomationInputSchema, SetupAutomationOutputSchema, GetAutomationStatusInputSchema, AutomationStatusOutputSchema, CloseAutomationInputSchema, CloseAutomationOutputSchema, DeleteSplitInputSchema, DeleteSplitOutputSchema, CreateSplitInputSchema, CreateSplitOutputSchema, GetSplitInputSchema, SplitResponseSchema, UpdateRewardsDestinationInputSchema, UpdateRewardsDestinationOutputSchema, TransferHotspotInputSchema, TransferHotspotOutputSchema, GetPendingRewardsInputSchema, GetPendingRewardsOutputSchema, ClaimRewardsInputSchema, ClaimRewardsOutputSchema, GetHotspotsInputSchema, HotspotsDataSchema } from './chunk-6LMSAIIW.js';
13
+ import { WalletAddressSchema, HeliumPublicKeySchema, TransactionDataSchema } from './chunk-YVB4ENKX.js';
14
+ import { oc } from '@orpc/contract';
15
+ import { z } from 'zod';
16
+
17
+ var healthContract = oc.tag("Health").router({
18
+ check: oc.route({ method: "GET", path: "/health", summary: "Health check" }).output(HealthResponseSchema),
19
+ testSentry: oc.route({
20
+ method: "GET",
21
+ path: "/health/test-sentry",
22
+ summary: "Test Sentry error reporting"
23
+ }).output(HealthResponseSchema)
24
+ });
25
+ var tokensContract = oc.tag("Tokens").router({
26
+ /** Public: Get token balances for a wallet */
27
+ getBalances: oc.route({ method: "GET", path: "/tokens/{walletAddress}", summary: "Get token balances for a wallet" }).input(GetBalancesInputSchema).output(TokenBalanceDataSchema).errors({
28
+ INVALID_WALLET_ADDRESS
29
+ }),
30
+ /** Protected: Transfer tokens */
31
+ transfer: oc.route({ method: "POST", path: "/tokens/transfer", summary: "Transfer tokens" }).input(TransferInputSchema).output(TransferOutputSchema).errors({
32
+ BAD_REQUEST,
33
+ INSUFFICIENT_FUNDS
34
+ }),
35
+ /** Protected: Create HNT account */
36
+ createHntAccount: oc.route({ method: "POST", path: "/tokens/hnt-account", summary: "Create HNT account" }).input(CreateHntAccountInputSchema).output(CreateHntAccountOutputSchema).errors({
37
+ INVALID_WALLET_ADDRESS,
38
+ INSUFFICIENT_FUNDS
39
+ })
40
+ });
41
+ var hotspotsContract = oc.tag("Hotspot").prefix("/hotspots").router({
42
+ /** Public: Get hotspots for a wallet */
43
+ getHotspots: oc.route({ method: "GET", path: "/wallet/{walletAddress}", summary: "Get hotspots for a wallet" }).input(GetHotspotsInputSchema).output(HotspotsDataSchema).errors({
44
+ INVALID_WALLET_ADDRESS
45
+ }),
46
+ /** Protected: Claim rewards for hotspots */
47
+ claimRewards: oc.route({ method: "POST", path: "/claim-rewards", summary: "Claim all hotspot rewards" }).input(ClaimRewardsInputSchema).output(ClaimRewardsOutputSchema).errors({
48
+ INSUFFICIENT_FUNDS
49
+ }),
50
+ /** Public: Get pending rewards for a wallet */
51
+ getPendingRewards: oc.route({ method: "GET", path: "/pending-rewards/{walletAddress}", summary: "Get pending rewards" }).input(GetPendingRewardsInputSchema).output(GetPendingRewardsOutputSchema).errors({
52
+ BAD_REQUEST: { message: "Invalid wallet address", status: 400 },
53
+ INVALID_WALLET_ADDRESS
54
+ }),
55
+ /** Protected: Transfer hotspot ownership */
56
+ transferHotspot: oc.route({ method: "POST", path: "/transfer", summary: "Transfer ownership" }).input(TransferHotspotInputSchema).output(TransferHotspotOutputSchema).errors({
57
+ UNAUTHORIZED,
58
+ NOT_FOUND,
59
+ BAD_REQUEST: { message: "Invalid transfer parameters", status: 400 },
60
+ INSUFFICIENT_FUNDS,
61
+ CONFLICT
62
+ }),
63
+ /** Protected: Update rewards destination */
64
+ updateRewardsDestination: oc.route({ method: "POST", path: "/update-rewards-destination", summary: "Update rewards destination" }).input(UpdateRewardsDestinationInputSchema).output(UpdateRewardsDestinationOutputSchema).errors({
65
+ BAD_REQUEST: { message: "Invalid parameters", status: 400 },
66
+ NOT_FOUND,
67
+ INSUFFICIENT_FUNDS
68
+ }),
69
+ /** Public: Get split configuration for a hotspot */
70
+ getSplit: oc.route({ method: "GET", path: "/split/{walletAddress}/{hotspotPubkey}", summary: "Get reward split" }).input(GetSplitInputSchema).output(SplitResponseSchema).errors({
71
+ NOT_FOUND: { message: "Split not found", status: 404 },
72
+ INVALID_WALLET_ADDRESS
73
+ }),
74
+ /** Protected: Create a split configuration */
75
+ createSplit: oc.route({ method: "POST", path: "/split", summary: "Create a reward split" }).input(CreateSplitInputSchema).output(CreateSplitOutputSchema).errors({
76
+ NOT_FOUND,
77
+ BAD_REQUEST: { message: "Invalid split configuration", status: 400 },
78
+ INSUFFICIENT_FUNDS
79
+ }),
80
+ /** Protected: Delete a split configuration */
81
+ deleteSplit: oc.route({ method: "DELETE", path: "/split", summary: "Delete a reward split" }).input(DeleteSplitInputSchema).output(DeleteSplitOutputSchema).errors({
82
+ NOT_FOUND,
83
+ INSUFFICIENT_FUNDS
84
+ }),
85
+ /** Protected: Close automation */
86
+ closeAutomation: oc.route({ method: "POST", path: "/wallet/{walletAddress}/automation/close", summary: "Close automation" }).input(CloseAutomationInputSchema).output(CloseAutomationOutputSchema).errors({
87
+ NOT_FOUND,
88
+ INSUFFICIENT_FUNDS
89
+ }),
90
+ /** Protected: Get automation status */
91
+ getAutomationStatus: oc.route({ method: "GET", path: "/wallet/{walletAddress}/automation/status", summary: "Get automation status" }).input(GetAutomationStatusInputSchema).output(AutomationStatusOutputSchema).errors({
92
+ NOT_FOUND
93
+ }),
94
+ /** Protected: Create automation */
95
+ createAutomation: oc.route({
96
+ method: "POST",
97
+ path: "/wallet/{walletAddress}/automation",
98
+ summary: "Setup automation"
99
+ }).input(SetupAutomationInputSchema).output(SetupAutomationOutputSchema).errors({
100
+ NOT_FOUND,
101
+ INSUFFICIENT_FUNDS
102
+ }),
103
+ /** Protected: Fund automation */
104
+ fundAutomation: oc.route({ method: "POST", path: "/wallet/{walletAddress}/automation/fund", summary: "Fund automation" }).input(FundAutomationInputSchema).output(FundAutomationOutputSchema).errors({
105
+ NOT_FOUND,
106
+ INSUFFICIENT_FUNDS
107
+ }),
108
+ /** Protected: Get funding estimate */
109
+ getFundingEstimate: oc.route({ method: "GET", path: "/wallet/{walletAddress}/automation/funding-estimate", summary: "Get funding estimate" }).input(GetFundingEstimateInputSchema).output(FundingEstimateOutputSchema).errors({}),
110
+ updateHotspotInfo: oc.route({ method: "POST", path: "/update-info", summary: "Update hotspot info", description: "Creates an unsigned transaction to update hotspot configuration. Requires deviceType discriminant (iot or mobile) to select the correct update path and validate against on-chain network." }).input(UpdateHotspotInfoInputSchema).output(UpdateHotspotInfoOutputSchema).errors({
111
+ NOT_FOUND,
112
+ UNAUTHORIZED,
113
+ BAD_REQUEST: { message: "Device type mismatch", status: 400 },
114
+ INSUFFICIENT_FUNDS
115
+ })
116
+ });
117
+ var governanceContract = oc.tag("Governance").prefix("/governance").router({
118
+ createPosition: oc.route({
119
+ method: "POST",
120
+ path: "/positions",
121
+ summary: "Create staking position",
122
+ description: "Create a new staking position with specified lockup parameters. Optionally delegate to a sub-DAO immediately."
123
+ }).input(CreatePositionInputSchema).errors({ BAD_REQUEST, INSUFFICIENT_FUNDS }).output(CreatePositionResponseSchema),
124
+ closePosition: oc.route({
125
+ method: "POST",
126
+ path: "/positions/{positionMint}/close",
127
+ summary: "Close staking position",
128
+ description: "Close an expired staking position and withdraw all deposited tokens. Position must have no active votes and lockup must be expired."
129
+ }).input(ClosePositionInputSchema).errors({ BAD_REQUEST, NOT_FOUND, UNAUTHORIZED, INSUFFICIENT_FUNDS }).output(ClosePositionResponseSchema),
130
+ extendPosition: oc.route({
131
+ method: "POST",
132
+ path: "/positions/{positionMint}/extend",
133
+ summary: "Extend position lockup",
134
+ description: "Extend the lockup period of an existing staking position."
135
+ }).input(ExtendPositionInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(ExtendPositionResponseSchema),
136
+ flipLockupKind: oc.route({
137
+ method: "POST",
138
+ path: "/positions/{positionMint}/flip-lockup",
139
+ summary: "Flip lockup kind",
140
+ description: "Switch position lockup between cliff and constant. Cliff unlocks at a specific time, constant never decays."
141
+ }).input(FlipLockupKindInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(FlipLockupKindResponseSchema),
142
+ resetLockup: oc.route({
143
+ method: "POST",
144
+ path: "/positions/{positionMint}/reset-lockup",
145
+ summary: "Reset position lockup",
146
+ description: "Reset both lockup kind and period for a position. Allows changing cliff/constant and duration in one transaction."
147
+ }).input(ResetLockupInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(ResetLockupResponseSchema),
148
+ splitPosition: oc.route({
149
+ method: "POST",
150
+ path: "/positions/{positionMint}/split",
151
+ summary: "Split position",
152
+ description: "Split tokens from an existing position into a new position with its own lockup parameters."
153
+ }).input(SplitPositionInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(SplitPositionResponseSchema),
154
+ transferPosition: oc.route({
155
+ method: "POST",
156
+ path: "/positions/{positionMint}/transfer",
157
+ summary: "Transfer between positions",
158
+ description: "Transfer tokens from one position to another. Both positions must have no active votes."
159
+ }).input(TransferPositionInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(TransferPositionResponseSchema),
160
+ delegatePositions: oc.route({
161
+ method: "POST",
162
+ path: "/positions/delegate/{subDaoMint}",
163
+ summary: "Delegate positions",
164
+ description: "Delegate one or more positions to a sub-DAO. When changing delegation (already delegated to a different sub-DAO), automatically claims pending rewards first. If many epochs need claiming, may require multiple API calls - check hasMore in the response. Automatically handles expired delegations (claim, close, re-delegate) and renewable delegations (extend expiration). Optionally enable/disable automation for reward claiming. Safe to call repeatedly with the same positions. Supports proxy voting \u2014 positions proxied to the caller are auto-detected."
165
+ }).input(DelegatePositionInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(DelegatePositionsResponseSchema),
166
+ claimDelegationRewards: oc.route({
167
+ method: "POST",
168
+ path: "/positions/claim-rewards",
169
+ summary: "Claim delegation rewards",
170
+ description: "Claim delegation rewards for one or more positions. May produce multiple transactions if rewards span many epochs. If many epochs need claiming, may require multiple API calls - check hasMore in the response. Safe to call repeatedly with the same positions - returns empty transactions when nothing left to claim."
171
+ }).input(ClaimDelegationRewardsInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(ClaimDelegationRewardsResponseSchema),
172
+ undelegatePosition: oc.route({
173
+ method: "POST",
174
+ path: "/positions/{positionMint}/undelegate",
175
+ summary: "Undelegate position",
176
+ description: "Remove delegation from a position. Automatically claims any pending rewards before undelegating. If many epochs need claiming, may require multiple API calls - check hasMore in the response. Submit the returned transactions, then call again to get remaining claims or the final undelegate transaction."
177
+ }).input(UndelegateInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(UndelegatePositionResponseSchema),
178
+ extendDelegation: oc.route({
179
+ method: "POST",
180
+ path: "/positions/{positionMint}/delegation/extend",
181
+ summary: "Extend delegation",
182
+ description: "Extend the expiration of a delegated position to the current season end."
183
+ }).input(ExtendDelegationInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(ExtendDelegationResponseSchema),
184
+ vote: oc.route({
185
+ method: "POST",
186
+ path: "/proposals/{proposalKey}/vote",
187
+ summary: "Vote on proposal",
188
+ description: "Cast votes on a proposal using one or more positions. Auto-detects owned vs proxied positions \u2014 proxied positions use proxy vote path. Automatically queues cleanup tasks to relinquish vote markers after the proposal ends. If many positions are provided, may require multiple API calls - check hasMore in the response."
189
+ }).input(VoteInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(VoteResponseSchema),
190
+ relinquishVote: oc.route({
191
+ method: "POST",
192
+ path: "/proposals/{proposalKey}/relinquish-votes",
193
+ summary: "Relinquish vote",
194
+ description: "Remove votes from a specific choice on a proposal for one or more positions. Auto-detects owned vs proxied positions \u2014 proxied positions use proxy relinquish path. If many positions are provided, may require multiple API calls - check hasMore in the response."
195
+ }).input(RelinquishVoteInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(RelinquishVoteResponseSchema),
196
+ relinquishPositionVotes: oc.route({
197
+ method: "POST",
198
+ path: "/positions/{positionMint}/relinquish-vote",
199
+ summary: "Relinquish all position votes",
200
+ description: "Remove ALL active votes from a single position across all proposals in an organization. If many votes exist, may require multiple API calls - check hasMore in the response."
201
+ }).input(RelinquishPositionVotesInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(RelinquishPositionVotesResponseSchema),
202
+ assignProxies: oc.route({
203
+ method: "POST",
204
+ path: "/proxy/{proxyKey}/assign",
205
+ summary: "Assign voting proxy",
206
+ description: "Delegate voting power to a proxy recipient for one or more positions. The proxy can vote on your behalf until the expiration time. If the recipient has already voted on open proposals, automatically propagates those votes to delegated positions via countProxyVoteV0. If many positions are provided, may require multiple API calls - check hasMore in the response."
207
+ }).input(AssignProxiesInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(AssignProxiesResponseSchema),
208
+ unassignProxies: oc.route({
209
+ method: "POST",
210
+ path: "/proxy/{proxyKey}/unassign",
211
+ summary: "Unassign voting proxy",
212
+ description: "Remove voting proxy delegation from one or more positions, returning voting power to the owner. If many positions are provided, may require multiple API calls - check hasMore in the response."
213
+ }).input(UnassignProxiesInputSchema).errors({ BAD_REQUEST, NOT_FOUND, INSUFFICIENT_FUNDS }).output(UnassignProxiesResponseSchema)
214
+ });
215
+ var rewardContract = oc.tag("Reward Contract").prefix("/hotspots").router({
216
+ find: oc.route({
217
+ method: "GET",
218
+ path: "/{entityPubKey}/reward-contract",
219
+ summary: "Get Contract",
220
+ description: "Retrieves the reward contract (pending or active) associated with a specific hotspot entity."
221
+ }).input(z.object({
222
+ entityPubKey: HeliumPublicKeySchema
223
+ })).errors({
224
+ NOT_FOUND,
225
+ BAD_REQUEST
226
+ }).output(FindRewardContractResponseSchema),
227
+ estimateCreationCost: oc.route({
228
+ method: "GET",
229
+ path: "/{entityPubKey}/reward-contract/estimate-creation-cost",
230
+ summary: "Estimate Creation Cost",
231
+ description: "Estimates the cost to create a reward contract for a specific hotspot entity."
232
+ }).input(CreateRewardContractTransactionInputSchema.extend({
233
+ entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity")
234
+ })).output(EstimateCostToCreateRewardContractResponseSchema).errors({
235
+ BAD_REQUEST,
236
+ NOT_FOUND
237
+ }),
238
+ create: oc.route({
239
+ method: "POST",
240
+ path: "/{entityPubKey}/reward-contract",
241
+ summary: "Create Reward Contract",
242
+ description: "Assembles an unsigned transaction to create a claimable or finalized reward contract for a specific hotspot entity. If the input inlcudes a pending/claimable recipient, the contract will be created as a pending/claimable contract. If the input is defined exclusively with preset recipients, an active contract will be created directly."
243
+ }).input(
244
+ CreateRewardContractTransactionInputSchema.extend({
245
+ entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
246
+ signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller")
247
+ })
248
+ ).errors({
249
+ BAD_REQUEST,
250
+ CONFLICT,
251
+ NOT_FOUND,
252
+ UNAUTHORIZED,
253
+ // Does this belong here to guard gifted currency check?
254
+ INSUFFICIENT_FUNDS
255
+ }).output(CreateRewardContractTransactionResponseSchema),
256
+ delete: oc.route({
257
+ method: "DELETE",
258
+ path: "/{entityPubKey}/reward-contract",
259
+ summary: "Delete Pending Contract",
260
+ description: "Assembles an unsigned transaction to delete a reward contract (pending or active) for a specific hotspot entity."
261
+ }).input(
262
+ z.object({
263
+ entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
264
+ signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller")
265
+ })
266
+ ).errors({
267
+ BAD_REQUEST,
268
+ NOT_FOUND,
269
+ // if wallet is not the delegate
270
+ UNAUTHORIZED,
271
+ INSUFFICIENT_FUNDS
272
+ }).output(DeleteRewardContractTransactionResponseSchema),
273
+ invite: oc.route({
274
+ method: "POST",
275
+ path: "/{entityPubKey}/reward-contract/invite",
276
+ summary: "Create Invite",
277
+ description: "Assembles details required to create a shareable invite to claim a pending reward contract."
278
+ }).input(
279
+ z.object({
280
+ entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
281
+ signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller"),
282
+ expirationDays: z.number().int().positive().max(365).default(7).describe("Number of days until the invite expires")
283
+ })
284
+ ).errors({
285
+ // if no hotspot or contract found
286
+ NOT_FOUND,
287
+ // if the contract is not pending
288
+ BAD_REQUEST,
289
+ // if wallet is not the delegate
290
+ UNAUTHORIZED
291
+ }).output(CreateInviteResponseSchema),
292
+ claim: oc.route({
293
+ method: "POST",
294
+ path: "/{entityPubKey}/reward-contract/claim",
295
+ summary: "Claim Invite",
296
+ description: "Assembles an unsigned transaction which can be used to claim an invite."
297
+ }).input(
298
+ ClaimInviteRequestSchema.extend({
299
+ entityPubKey: HeliumPublicKeySchema.describe("The public key of the hotspot entity"),
300
+ signerWalletAddress: WalletAddressSchema.describe("The wallet address of the caller")
301
+ })
302
+ ).errors({
303
+ // if no hotspot or contract found
304
+ NOT_FOUND,
305
+ // if the contract is not pending
306
+ BAD_REQUEST,
307
+ // if wallet is not the delegate
308
+ UNAUTHORIZED
309
+ }).output(ClaimInviteResponseSchema)
310
+ });
311
+ var swapContract = oc.tag("Swap").router({
312
+ getTokens: oc.route({ method: "GET", path: "/swap/tokens" }).input(GetTokensInputSchema).output(TokenListOutputSchema).errors({
313
+ JUPITER_ERROR: { message: "Failed to fetch tokens from Jupiter" }
314
+ }),
315
+ getQuote: oc.route({ method: "GET", path: "/swap/quote" }).input(GetQuoteInputSchema).output(QuoteResponseSchema).errors({
316
+ BAD_REQUEST: { message: "Invalid quote parameters", status: 400 },
317
+ JUPITER_ERROR: { message: "Failed to get quote from Jupiter" }
318
+ }),
319
+ getInstructions: oc.route({ method: "POST", path: "/swap/instructions" }).input(GetInstructionsInputSchema).output(TransactionDataSchema).errors({
320
+ BAD_REQUEST: { message: "Invalid instruction parameters", status: 400 },
321
+ JUPITER_ERROR: { message: "Failed to get swap instructions from Jupiter" },
322
+ INSUFFICIENT_FUNDS
323
+ })
324
+ });
325
+ var transactionsContract = oc.tag("Transactions").router({
326
+ submit: oc.route({ method: "POST", path: "/transactions", summary: "Submit a transaction" }).input(SubmitInputSchema).output(SubmitOutputSchema).errors({
327
+ BAD_REQUEST,
328
+ CONFLICT,
329
+ SIMULATION_FAILED
330
+ }),
331
+ get: oc.route({ method: "GET", path: "/transactions/{id}", summary: "Get transaction status" }).input(GetInputSchema).output(BatchStatusOutputSchema).errors({
332
+ NOT_FOUND
333
+ }),
334
+ resubmit: oc.route({ method: "POST", path: "/transactions/{id}/resubmit", summary: "Resubmit a transaction" }).input(ResubmitInputSchema).output(ResubmitOutputSchema).errors({
335
+ NOT_FOUND,
336
+ BAD_REQUEST
337
+ }),
338
+ getByPayer: oc.route({ method: "GET", path: "/transactions/payer/{payer}", summary: "Get transactions by payer" }).input(GetByPayerInputSchema).output(PayerBatchesOutputSchema).errors({
339
+ BAD_REQUEST
340
+ }),
341
+ getByPayerAndTag: oc.route({ method: "GET", path: "/transactions/payer/{payer}/tag/{tag}", summary: "Get transactions by payer and tag" }).input(GetByPayerAndTagInputSchema).output(PayerBatchesOutputSchema).errors({
342
+ BAD_REQUEST
343
+ }),
344
+ estimate: oc.route({ method: "POST", path: "/transactions/estimate", summary: "Estimate transaction costs" }).input(EstimateInputSchema).output(EstimateOutputSchema).errors({
345
+ BAD_REQUEST,
346
+ SIMULATION_FAILED
347
+ })
348
+ });
349
+ var welcomePacksContract = oc.tag("Welcome Packs").router({
350
+ /** Public: List welcome packs for a wallet */
351
+ list: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}", summary: "List welcome packs for a wallet" }).input(WelcomePackListInputSchema).output(WelcomePackListOutputSchema).errors({
352
+ INVALID_WALLET_ADDRESS
353
+ }),
354
+ /** Protected: Create a new welcome pack */
355
+ create: oc.route({ method: "POST", path: "/welcome-packs", summary: "Create a new welcome pack" }).input(WelcomePackCreateInputSchema).output(WelcomePackCreateOutputSchema).errors({
356
+ BAD_REQUEST,
357
+ CONFLICT,
358
+ INSUFFICIENT_FUNDS
359
+ }),
360
+ /** Public: Get a specific welcome pack */
361
+ get: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Get a specific welcome pack" }).input(WelcomePackGetInputSchema).output(WelcomePackSchema).errors({
362
+ NOT_FOUND,
363
+ INVALID_WALLET_ADDRESS
364
+ }),
365
+ /** Protected: Delete a welcome pack */
366
+ delete: oc.route({ method: "DELETE", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Delete a welcome pack" }).input(WelcomePackDeleteInputSchema).output(WelcomePackDeleteOutputSchema).errors({
367
+ BAD_REQUEST,
368
+ INVALID_WALLET_ADDRESS,
369
+ INSUFFICIENT_FUNDS
370
+ }),
371
+ /** Public: Get welcome pack by pack address */
372
+ getByAddress: oc.route({ method: "GET", path: "/welcome-packs/address/{packAddress}", summary: "Get welcome pack by pack address" }).input(WelcomePackGetByAddressInputSchema).output(WelcomePackSchema).errors({
373
+ NOT_FOUND
374
+ }),
375
+ /** Public: Claim a welcome pack (no auth needed, uses claim token) */
376
+ claim: oc.route({ method: "POST", path: "/welcome-packs/claim", summary: "Claim a welcome pack" }).input(WelcomePackClaimInputSchema).output(WelcomePackClaimOutputSchema).errors({
377
+ BAD_REQUEST,
378
+ EXPIRED: { message: "Claim link has expired", status: 410 }
379
+ }),
380
+ /** Protected: Send an invite for a welcome pack */
381
+ invite: oc.route({ method: "POST", path: "/welcome-packs/invite", summary: "Send an invite for a welcome pack" }).input(WelcomePackInviteInputSchema).output(WelcomePackInviteOutputSchema).errors({
382
+ BAD_REQUEST,
383
+ NOT_FOUND
384
+ })
385
+ });
386
+ var fiatContract = oc.errors({
387
+ UNAUTHENTICATED,
388
+ UNAUTHORIZED
389
+ }).tag("Fiat").router({
390
+ getKycStatus: oc.route({ method: "GET", path: "/fiat/kyc/status" }).output(KycStatusOutputSchema).errors({
391
+ EMAIL_NOT_LINKED: { status: 401, message: "Email not linked." }
392
+ }),
393
+ initKyc: oc.route({ method: "POST", path: "/fiat/kyc/init" }).input(InitKycInputSchema).output(KycStatusOutputSchema).errors({
394
+ EMAIL_NOT_LINKED: { status: 401, message: "Email not linked." },
395
+ BRIDGE_ERROR: { message: "Failed to create Bridge KYC link", status: 500 }
396
+ }),
397
+ getFees: oc.route({ method: "GET", path: "/fiat/fees" }).output(FeesOutputSchema).errors({}),
398
+ listBankAccounts: oc.route({ method: "GET", path: "/fiat/bank-accounts" }).output(BankAccountListOutputSchema).errors({
399
+ NOT_FOUND: { message: "Bridge customer ID not found", status: 404 }
400
+ }),
401
+ createBankAccount: oc.route({ method: "POST", path: "/fiat/bank-accounts" }).input(CreateBankAccountInputSchema).output(BankAccountSchema).errors({
402
+ NO_CUSTOMER: { message: "Bridge customer ID not found", status: 404 },
403
+ BRIDGE_ERROR: { message: "Failed to create Bridge KYC link", status: 500 }
404
+ }),
405
+ deleteBankAccount: oc.route({ method: "DELETE", path: "/fiat/bank-accounts/{id}" }).input(DeleteBankAccountInputSchema).output(DeleteBankAccountOutputSchema).errors({
406
+ NO_CUSTOMER: { message: "Bridge customer ID not found", status: 404 },
407
+ BRIDGE_ERROR: { message: "Failed to delete bank account", status: 500 }
408
+ }),
409
+ getSendQuote: oc.route({ method: "GET", path: "/fiat/quote/{id}" }).input(GetSendQuoteInputSchema).output(QuoteOutputSchema).errors({
410
+ BAD_REQUEST,
411
+ JUPITER_ERROR: { message: "Failed to get quote from Jupiter", status: 500 }
412
+ }),
413
+ sendFunds: oc.route({ method: "POST", path: "/fiat/send" }).input(SendFundsInputSchema).output(SendFundsOutputSchema).errors({
414
+ NOT_FOUND,
415
+ BRIDGE_ERROR: { message: "Failed to create Bridge transfer", status: 500 },
416
+ JUPITER_ERROR: { message: "Failed to get quote from Jupiter", status: 500 },
417
+ INSUFFICIENT_FUNDS
418
+ }),
419
+ updateTransfer: oc.route({ method: "PUT", path: "/fiat/transfer/{id}" }).input(UpdateTransferInputSchema).output(UpdateTransferOutputSchema).errors({
420
+ NOT_FOUND: { message: "Transfer not found", status: 404 }
421
+ })
422
+ });
423
+ var webhooksContract = oc.tag("Webhooks").router({
424
+ bridge: oc.route({ method: "POST", path: "/webhooks/bridge" }).input(BridgeWebhookInputSchema).output(BridgeWebhookOutputSchema).errors({
425
+ NOT_FOUND,
426
+ INVALID_PAYLOAD: { message: "Invalid webhook payload", status: 400 }
427
+ })
428
+ });
429
+ var migrationContract = oc.tag("Migration").router({
430
+ getHotspots: oc.route({
431
+ method: "GET",
432
+ path: "/migration/hotspots",
433
+ summary: "Get hotspots that can be migrated (owned directly or in welcome packs)"
434
+ }).input(MigratableHotspotsInputSchema).output(MigratableHotspotsOutputSchema).errors({
435
+ BAD_REQUEST
436
+ }),
437
+ migrate: oc.route({
438
+ method: "POST",
439
+ path: "/migration/migrate",
440
+ summary: "Migrate assets to a new wallet",
441
+ description: "Returns up to 5 transactions per call. If hasMore is true, submit the transactions then call again with nextParams."
442
+ }).input(MigrateInputSchema).output(MigrateOutputSchema).errors({
443
+ UNAUTHORIZED,
444
+ BAD_REQUEST,
445
+ NOT_FOUND,
446
+ INSUFFICIENT_FUNDS
447
+ })
448
+ });
449
+ var apiContract = oc.router({
450
+ governance: governanceContract,
451
+ health: healthContract,
452
+ tokens: tokensContract,
453
+ hotspots: hotspotsContract,
454
+ rewardContract,
455
+ swap: swapContract,
456
+ transactions: transactionsContract,
457
+ welcomePacks: welcomePacksContract
458
+ });
459
+ var fullApiContract = oc.router({
460
+ ...apiContract,
461
+ fiat: fiatContract,
462
+ webhooks: webhooksContract,
463
+ migration: migrationContract
464
+ });
465
+
466
+ export { apiContract, fiatContract, fullApiContract, governanceContract, healthContract, hotspotsContract, migrationContract, rewardContract, swapContract, tokensContract, transactionsContract, webhooksContract, welcomePacksContract };
@@ -0,0 +1,176 @@
1
+ import { TokenAmountInputSchema, TokenAmountOutputSchema, WalletAddressSchema, TransactionDataSchema } from './chunk-YVB4ENKX.js';
2
+ import { z } from 'zod';
3
+
4
+ var CRON_REGEX = /^(\*|[0-9,\-\/]+)\s+(\*|[0-9,\-\/]+)\s+(\*|[0-9,\-\/]+)\s+(\*|[0-9,\-\/]+)\s+(\*|[0-9,\-\/]+)$/;
5
+ var RewardSchedule = z.string().regex(
6
+ CRON_REGEX,
7
+ "Invalid cron format. Expected 5 fields: minute hour day month weekday"
8
+ ).describe(
9
+ `UTC cron expression with 5 fields (e.g. '30 9 * * *' or '0 0 1,15 * *')`
10
+ );
11
+ var RecipientShareInput = z.discriminatedUnion("type", [
12
+ z.object({
13
+ type: z.literal("FIXED"),
14
+ tokenAmount: TokenAmountInputSchema
15
+ }),
16
+ z.object({
17
+ type: z.literal("SHARES"),
18
+ shares: z.number().int().min(1).max(100).describe("Percentage share of rewards")
19
+ })
20
+ ]);
21
+ var RecipientShareOutput = z.discriminatedUnion("type", [
22
+ z.object({
23
+ type: z.literal("FIXED"),
24
+ tokenAmount: TokenAmountOutputSchema
25
+ }),
26
+ z.object({
27
+ type: z.literal("SHARES"),
28
+ shares: z.number().int().min(1).max(100).describe("Percentage share of rewards")
29
+ })
30
+ ]);
31
+ var RecipientConfigInput = z.discriminatedUnion("type", [
32
+ z.object({
33
+ type: z.literal("PRESET"),
34
+ walletAddress: WalletAddressSchema.describe(
35
+ "The wallet address of a preconfigured recipient"
36
+ ),
37
+ receives: RecipientShareInput
38
+ }).describe("A recipient that uses a preset configuration"),
39
+ z.object({
40
+ type: z.literal("CLAIMABLE"),
41
+ giftedCurrency: TokenAmountInputSchema.describe(
42
+ "The amount of currency bundled in the contract, and gifted to the claimer upon creation"
43
+ ),
44
+ receives: RecipientShareInput
45
+ }).describe(
46
+ "A recipient that in yet unknown, but will claim the pending contract"
47
+ )
48
+ ]);
49
+ var RecipientConfigOutput = z.discriminatedUnion("type", [
50
+ z.object({
51
+ type: z.literal("PRESET"),
52
+ walletAddress: WalletAddressSchema.describe(
53
+ "The wallet address of a preconfigured recipient"
54
+ ),
55
+ receives: RecipientShareOutput
56
+ }).describe("A recipient that uses a preset configuration"),
57
+ z.object({
58
+ type: z.literal("CLAIMABLE"),
59
+ giftedCurrency: TokenAmountOutputSchema.describe(
60
+ "The amount of currency bundled in the contract, and gifted to the claimer upon creation"
61
+ ),
62
+ receives: RecipientShareOutput
63
+ }).describe(
64
+ "A recipient that in yet unknown, but will claim the pending contract"
65
+ )
66
+ ]);
67
+ var PendingRewardContract = z.object({
68
+ delegateWalletAddress: WalletAddressSchema.describe(
69
+ "The wallet address of the contract delegate. This wallet is capable of taking admin actions (delete) on the pending contract."
70
+ ),
71
+ recipients: z.array(RecipientConfigOutput).min(1).max(6).describe(
72
+ "An exhaustive list of recipients and their respective shares in the reward contract"
73
+ ),
74
+ rewardSchedule: RewardSchedule.describe(
75
+ "The schedule on which rewards would be distributed to recipients"
76
+ )
77
+ });
78
+ var ActiveRewardContract = z.object({
79
+ delegateWalletAddress: WalletAddressSchema.describe(
80
+ "The wallet address of the contract delegate. This wallet is capable of taking admin actions (delete) on the active contract."
81
+ ),
82
+ entityOwnerAddress: WalletAddressSchema.describe(
83
+ "The wallet address that owns the entity (hotspot)"
84
+ ),
85
+ recipients: z.array(
86
+ z.object({
87
+ walletAddress: WalletAddressSchema.describe(
88
+ "The wallet address of the reward recipient"
89
+ ),
90
+ receives: RecipientShareOutput
91
+ })
92
+ ).min(1).max(6).describe(
93
+ "An exhaustive list of recipients and their respective shares in the reward contract"
94
+ ),
95
+ rewardSchedule: RewardSchedule.describe(
96
+ "The schedule on which rewards are distributed to recipients"
97
+ )
98
+ });
99
+ var FindRewardContractResponseSchema = z.discriminatedUnion("status", [
100
+ z.object({
101
+ status: z.literal("PENDING"),
102
+ contract: PendingRewardContract
103
+ }),
104
+ z.object({
105
+ status: z.literal("ACTIVE"),
106
+ contract: ActiveRewardContract
107
+ }),
108
+ z.object({
109
+ status: z.literal("NONE")
110
+ })
111
+ ]);
112
+ var CreateRewardContractTransactionInputSchema = z.object({
113
+ delegateWalletAddress: WalletAddressSchema.describe(
114
+ "The wallet address of the contract delegate. This wallet is capable of taking admin actions (delete) on the contract."
115
+ ),
116
+ recipients: z.array(RecipientConfigInput).min(1).max(6).refine((arr) => arr.filter((s) => s.type === "CLAIMABLE").length <= 1, {
117
+ message: "At most one recipient can be of type CLAIMABLE."
118
+ }).refine(
119
+ (arr) => {
120
+ const shareEntries = arr.filter((s) => s.receives.type === "SHARES");
121
+ if (shareEntries.length === 0) {
122
+ return true;
123
+ }
124
+ return shareEntries.reduce(
125
+ (acc, curr) => acc + (curr.receives.type === "SHARES" ? curr.receives.shares : 0),
126
+ 0
127
+ ) === 100;
128
+ },
129
+ {
130
+ message: "Total shares must equal 100."
131
+ }
132
+ ).describe(
133
+ "An exhaustive list of recipients and their respective shares in the reward contract"
134
+ ),
135
+ rewardSchedule: RewardSchedule.describe(
136
+ "The schedule on which rewards would be distributed to recipients"
137
+ )
138
+ });
139
+ var EstimateCostToCreateRewardContractResponseSchema = z.object({
140
+ total: TokenAmountOutputSchema.describe("The total cost to create the contract."),
141
+ lineItems: z.object({
142
+ transactionFees: TokenAmountOutputSchema.describe("The cost of transaction fees, including funding for future scheduled transactions."),
143
+ rentFee: TokenAmountOutputSchema.describe("The cost of the rent fee."),
144
+ recipientGift: TokenAmountOutputSchema.describe("The total cost of gifted currency, bundled with the contract.")
145
+ }).describe("A breakdown of the costs invovled. Should sum to the total cost.")
146
+ });
147
+ var CreateRewardContractTransactionResponseSchema = z.object({
148
+ unsignedTransactionData: TransactionDataSchema.describe(
149
+ "The unsigned transaction data which, when signed and submitted will create the pending or finalized reward contract"
150
+ ),
151
+ estimatedSolFee: TokenAmountOutputSchema
152
+ });
153
+ var DeleteRewardContractTransactionResponseSchema = z.object({
154
+ unsignedTransactionData: TransactionDataSchema.describe(
155
+ "The unsigned transaction data which, when signed and submitted will delete the contract"
156
+ ),
157
+ estimatedSolFee: TokenAmountOutputSchema
158
+ });
159
+ var CreateInviteResponseSchema = z.object({
160
+ unsignedMessage: z.string().min(1).describe(
161
+ "The unsigned invite message which, when signed by the delegate's wallet, can be used by a recipient to claim the pending contract."
162
+ ),
163
+ expiration: z.iso.datetime()
164
+ });
165
+ var ClaimInviteRequestSchema = z.object({
166
+ delegateSignature: z.string().min(1).describe("The signed invite message provided by the contract delegate."),
167
+ expiration: z.iso.datetime()
168
+ });
169
+ var ClaimInviteResponseSchema = z.object({
170
+ unsignedTransactionData: TransactionDataSchema.describe(
171
+ "The unsigned transaction data which, when signed and submitted will claim the pending reward contract"
172
+ ),
173
+ estimatedSolFee: TokenAmountOutputSchema
174
+ });
175
+
176
+ export { ClaimInviteRequestSchema, ClaimInviteResponseSchema, CreateInviteResponseSchema, CreateRewardContractTransactionInputSchema, CreateRewardContractTransactionResponseSchema, DeleteRewardContractTransactionResponseSchema, EstimateCostToCreateRewardContractResponseSchema, FindRewardContractResponseSchema };
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/schemas/health.ts
4
+ var HealthResponseSchema = z.object({
5
+ ok: z.boolean(),
6
+ error: z.string().optional()
7
+ });
8
+
9
+ export { HealthResponseSchema };