@helium/blockchain-api 0.2.1 → 0.2.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/dist/index.d.ts +698 -500
- package/dist/index.js +228 -120
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -92,6 +92,7 @@ var ErrorResponseSchema = z.object({
|
|
|
92
92
|
});
|
|
93
93
|
var WalletAddressSchema = z.string().min(32).max(44);
|
|
94
94
|
var PublicKeySchema = z.string().min(32).max(44);
|
|
95
|
+
var HeliumPublicKeySchema = z.string().min(32).max(400);
|
|
95
96
|
var PaginationInputSchema = z.object({
|
|
96
97
|
page: z.coerce.number().int().min(1).default(1),
|
|
97
98
|
limit: z.coerce.number().int().min(1).max(100).default(10)
|
|
@@ -106,17 +107,17 @@ var HealthResponseSchema = z.object({
|
|
|
106
107
|
error: z.string().optional()
|
|
107
108
|
});
|
|
108
109
|
var GetBalancesInputSchema = z.object({
|
|
109
|
-
walletAddress:
|
|
110
|
+
walletAddress: WalletAddressSchema
|
|
110
111
|
});
|
|
111
112
|
var TransferInputSchema = z.object({
|
|
112
|
-
walletAddress:
|
|
113
|
+
walletAddress: WalletAddressSchema,
|
|
113
114
|
mint: z.string().nullable().optional(),
|
|
114
115
|
destination: z.string().min(32),
|
|
115
116
|
amount: z.string(),
|
|
116
117
|
decimals: z.number().optional()
|
|
117
118
|
});
|
|
118
119
|
var CreateHntAccountInputSchema = z.object({
|
|
119
|
-
walletAddress:
|
|
120
|
+
walletAddress: WalletAddressSchema
|
|
120
121
|
});
|
|
121
122
|
var TokenAccountSchema = z.object({
|
|
122
123
|
mint: z.string(),
|
|
@@ -143,33 +144,6 @@ var CreateHntAccountOutputSchema = z.object({
|
|
|
143
144
|
transactionData: TransactionDataSchema
|
|
144
145
|
});
|
|
145
146
|
var HotspotTypeSchema = z.enum(["iot", "mobile", "all"]);
|
|
146
|
-
var DeviceTypeSchema = z.enum([
|
|
147
|
-
"iot-gateway",
|
|
148
|
-
"wifiIndoor",
|
|
149
|
-
"wifiOutdoor",
|
|
150
|
-
"wifiDataOnly",
|
|
151
|
-
"cbrs"
|
|
152
|
-
]);
|
|
153
|
-
var OwnershipTypeSchema = z.enum(["owner", "direct", "fanout", "all"]);
|
|
154
|
-
var HotspotSharesSchema = z.object({
|
|
155
|
-
fixed: z.string().optional(),
|
|
156
|
-
percentage: z.number().optional()
|
|
157
|
-
});
|
|
158
|
-
var HotspotSchema = z.object({
|
|
159
|
-
address: z.string(),
|
|
160
|
-
entityKey: z.string(),
|
|
161
|
-
name: z.string(),
|
|
162
|
-
type: HotspotTypeSchema,
|
|
163
|
-
deviceType: DeviceTypeSchema,
|
|
164
|
-
city: z.string().optional(),
|
|
165
|
-
state: z.string().optional(),
|
|
166
|
-
country: z.string().optional(),
|
|
167
|
-
asset: z.string(),
|
|
168
|
-
isOnline: z.boolean().optional(),
|
|
169
|
-
owner: z.string().optional(),
|
|
170
|
-
shares: HotspotSharesSchema.optional(),
|
|
171
|
-
ownershipType: z.string()
|
|
172
|
-
});
|
|
173
147
|
var GetHotspotsInputSchema = z.object({
|
|
174
148
|
walletAddress: z.string().min(32),
|
|
175
149
|
type: HotspotTypeSchema.optional(),
|
|
@@ -220,6 +194,57 @@ var DeleteSplitInputSchema = z.object({
|
|
|
220
194
|
walletAddress: z.string().min(32),
|
|
221
195
|
hotspotPubkey: z.string().min(1)
|
|
222
196
|
});
|
|
197
|
+
var GetAutomationStatusInputSchema = z.object({
|
|
198
|
+
walletAddress: z.string().min(32)
|
|
199
|
+
});
|
|
200
|
+
var AutomationScheduleSchema = z.enum(["daily", "weekly", "monthly"]);
|
|
201
|
+
var SetupAutomationInputSchema = z.object({
|
|
202
|
+
walletAddress: z.string().min(32),
|
|
203
|
+
schedule: AutomationScheduleSchema,
|
|
204
|
+
duration: z.number().int().min(1),
|
|
205
|
+
// Number of claims
|
|
206
|
+
totalHotspots: z.number().int().min(1)
|
|
207
|
+
});
|
|
208
|
+
var FundAutomationInputSchema = z.object({
|
|
209
|
+
walletAddress: z.string().min(32),
|
|
210
|
+
additionalDuration: z.number().int().min(1)
|
|
211
|
+
// Additional number of claims
|
|
212
|
+
});
|
|
213
|
+
var GetFundingEstimateInputSchema = z.object({
|
|
214
|
+
walletAddress: z.string().min(32),
|
|
215
|
+
duration: z.coerce.number().int().min(1)
|
|
216
|
+
// Number of claims to estimate funding for
|
|
217
|
+
});
|
|
218
|
+
var CloseAutomationInputSchema = z.object({
|
|
219
|
+
walletAddress: z.string().min(32)
|
|
220
|
+
});
|
|
221
|
+
var DeviceTypeSchema = z.enum([
|
|
222
|
+
"iot-gateway",
|
|
223
|
+
"wifiIndoor",
|
|
224
|
+
"wifiOutdoor",
|
|
225
|
+
"wifiDataOnly",
|
|
226
|
+
"cbrs"
|
|
227
|
+
]);
|
|
228
|
+
var OwnershipTypeSchema = z.enum(["owner", "direct", "fanout", "all"]);
|
|
229
|
+
var HotspotSharesSchema = z.object({
|
|
230
|
+
fixed: z.string().optional(),
|
|
231
|
+
percentage: z.number().optional()
|
|
232
|
+
});
|
|
233
|
+
var HotspotSchema = z.object({
|
|
234
|
+
address: z.string(),
|
|
235
|
+
entityKey: z.string(),
|
|
236
|
+
name: z.string(),
|
|
237
|
+
type: HotspotTypeSchema,
|
|
238
|
+
deviceType: DeviceTypeSchema,
|
|
239
|
+
city: z.string().optional(),
|
|
240
|
+
state: z.string().optional(),
|
|
241
|
+
country: z.string().optional(),
|
|
242
|
+
asset: z.string(),
|
|
243
|
+
isOnline: z.boolean().optional(),
|
|
244
|
+
owner: z.string().optional(),
|
|
245
|
+
shares: HotspotSharesSchema.optional(),
|
|
246
|
+
ownershipType: z.string()
|
|
247
|
+
});
|
|
223
248
|
var HotspotsDataSchema = z.object({
|
|
224
249
|
hotspots: z.array(HotspotSchema),
|
|
225
250
|
total: z.number(),
|
|
@@ -256,6 +281,68 @@ var DeleteSplitOutputSchema = z.object({
|
|
|
256
281
|
var PendingRewardsOutputSchema = z.object({
|
|
257
282
|
pending: z.string()
|
|
258
283
|
});
|
|
284
|
+
var AutomationStatusOutputSchema = z.object({
|
|
285
|
+
hasExistingAutomation: z.boolean(),
|
|
286
|
+
isOutOfSol: z.boolean(),
|
|
287
|
+
currentSchedule: z.object({
|
|
288
|
+
schedule: AutomationScheduleSchema,
|
|
289
|
+
time: z.string(),
|
|
290
|
+
nextRun: z.string()
|
|
291
|
+
// ISO date string
|
|
292
|
+
}).optional(),
|
|
293
|
+
rentFee: z.number(),
|
|
294
|
+
recipientFee: z.number(),
|
|
295
|
+
solFee: z.number(),
|
|
296
|
+
remainingClaims: z.number().optional(),
|
|
297
|
+
fundingPeriodInfo: z.object({
|
|
298
|
+
periodLength: AutomationScheduleSchema,
|
|
299
|
+
periodsRemaining: z.number(),
|
|
300
|
+
// Minimum of both pools
|
|
301
|
+
cronJobPeriodsRemaining: z.number(),
|
|
302
|
+
pdaWalletPeriodsRemaining: z.number()
|
|
303
|
+
}).optional(),
|
|
304
|
+
cronJobBalance: z.string(),
|
|
305
|
+
// lamports as string
|
|
306
|
+
pdaWalletBalance: z.string()
|
|
307
|
+
// lamports as string
|
|
308
|
+
});
|
|
309
|
+
var SetupAutomationOutputSchema = z.object({
|
|
310
|
+
transactionData: TransactionDataSchema
|
|
311
|
+
});
|
|
312
|
+
var FundAutomationOutputSchema = z.object({
|
|
313
|
+
transactionData: TransactionDataSchema
|
|
314
|
+
});
|
|
315
|
+
var CloseAutomationOutputSchema = z.object({
|
|
316
|
+
transactionData: TransactionDataSchema
|
|
317
|
+
});
|
|
318
|
+
var FundingEstimateOutputSchema = z.object({
|
|
319
|
+
cronJobFunding: z.number(),
|
|
320
|
+
// SOL needed for cron job account
|
|
321
|
+
pdaWalletFunding: z.number(),
|
|
322
|
+
// SOL needed for PDA wallet
|
|
323
|
+
recipientFee: z.number(),
|
|
324
|
+
// SOL needed for recipient accounts (if any)
|
|
325
|
+
totalFunding: z.number(),
|
|
326
|
+
// Total SOL needed
|
|
327
|
+
currentCronJobBalance: z.string(),
|
|
328
|
+
// Current balance in cronJob (lamports as string)
|
|
329
|
+
currentPdaWalletBalance: z.string(),
|
|
330
|
+
// Current balance in pdaWallet (lamports as string)
|
|
331
|
+
additionalFundingNeeded: z.number()
|
|
332
|
+
// Net additional funding required (SOL)
|
|
333
|
+
});
|
|
334
|
+
var ReassertLocationRequestSchema = z.object({
|
|
335
|
+
entityPubKey: HeliumPublicKeySchema,
|
|
336
|
+
walletAddress: WalletAddressSchema,
|
|
337
|
+
location: z.object({
|
|
338
|
+
lat: z.number().min(-90).max(90),
|
|
339
|
+
lng: z.number().min(-180).max(180)
|
|
340
|
+
}),
|
|
341
|
+
azimuth: z.number().min(0).max(360).optional()
|
|
342
|
+
});
|
|
343
|
+
var ReassertLocationResponseSchema = z.object({
|
|
344
|
+
transactionData: TransactionDataSchema
|
|
345
|
+
});
|
|
259
346
|
var GetTokensInputSchema = z.object({
|
|
260
347
|
limit: z.coerce.number().int().min(1).max(100).default(50)
|
|
261
348
|
});
|
|
@@ -390,10 +477,10 @@ var PayerBatchesOutputSchema = z.object({
|
|
|
390
477
|
})
|
|
391
478
|
});
|
|
392
479
|
var WelcomePackListInputSchema = z.object({
|
|
393
|
-
walletAddress:
|
|
480
|
+
walletAddress: WalletAddressSchema
|
|
394
481
|
});
|
|
395
482
|
var WelcomePackCreateInputSchema = z.object({
|
|
396
|
-
walletAddress:
|
|
483
|
+
walletAddress: WalletAddressSchema,
|
|
397
484
|
assetId: z.string(),
|
|
398
485
|
solAmount: z.number(),
|
|
399
486
|
rentRefund: z.string(),
|
|
@@ -403,11 +490,11 @@ var WelcomePackCreateInputSchema = z.object({
|
|
|
403
490
|
lazyDistributor: z.string()
|
|
404
491
|
});
|
|
405
492
|
var WelcomePackGetInputSchema = z.object({
|
|
406
|
-
walletAddress:
|
|
493
|
+
walletAddress: WalletAddressSchema,
|
|
407
494
|
packId: z.number()
|
|
408
495
|
});
|
|
409
496
|
var WelcomePackDeleteInputSchema = z.object({
|
|
410
|
-
walletAddress:
|
|
497
|
+
walletAddress: WalletAddressSchema,
|
|
411
498
|
packId: z.number()
|
|
412
499
|
});
|
|
413
500
|
var WelcomePackGetByAddressInputSchema = z.object({
|
|
@@ -415,13 +502,13 @@ var WelcomePackGetByAddressInputSchema = z.object({
|
|
|
415
502
|
});
|
|
416
503
|
var WelcomePackClaimInputSchema = z.object({
|
|
417
504
|
packAddress: z.string().min(32),
|
|
418
|
-
walletAddress:
|
|
505
|
+
walletAddress: WalletAddressSchema,
|
|
419
506
|
signature: z.string(),
|
|
420
507
|
expirationTs: z.string()
|
|
421
508
|
});
|
|
422
509
|
var WelcomePackInviteInputSchema = z.object({
|
|
423
510
|
packAddress: z.string().min(32),
|
|
424
|
-
walletAddress:
|
|
511
|
+
walletAddress: WalletAddressSchema,
|
|
425
512
|
expirationDays: z.number().int().positive().max(365).default(7)
|
|
426
513
|
});
|
|
427
514
|
var WelcomePackSchema = z.object({
|
|
@@ -475,6 +562,10 @@ var BAD_REQUEST = {
|
|
|
475
562
|
fields: z.array(z.string()).optional()
|
|
476
563
|
}).optional()
|
|
477
564
|
};
|
|
565
|
+
var INVALID_WALLET_ADDRESS = {
|
|
566
|
+
status: 400,
|
|
567
|
+
message: "The provided wallet address is invalid."
|
|
568
|
+
};
|
|
478
569
|
var RATE_LIMITED = {
|
|
479
570
|
status: 429,
|
|
480
571
|
message: "Too many requests. Please try again later."
|
|
@@ -507,139 +598,157 @@ var SIMULATION_FAILED = {
|
|
|
507
598
|
link: z.string().optional()
|
|
508
599
|
})
|
|
509
600
|
};
|
|
510
|
-
var
|
|
511
|
-
|
|
512
|
-
UNAUTHORIZED
|
|
513
|
-
});
|
|
514
|
-
var publicOc = oc.errors({
|
|
515
|
-
INVALID_WALLET_ADDRESS: { message: "Invalid wallet address", status: 400 }
|
|
601
|
+
var healthContract = oc.tag("Health").router({
|
|
602
|
+
check: oc.route({ method: "GET", path: "/health", summary: "Health check" }).output(HealthResponseSchema)
|
|
516
603
|
});
|
|
517
|
-
|
|
518
|
-
// src/contracts/health.ts
|
|
519
|
-
var healthContract = {
|
|
520
|
-
check: publicOc.route({ method: "GET", path: "/health", tags: ["Health"], summary: "Health check" }).output(HealthResponseSchema)
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
// src/contracts/tokens.ts
|
|
524
|
-
var tokensContract = {
|
|
604
|
+
var tokensContract = oc.tag("Tokens").router({
|
|
525
605
|
/** Public: Get token balances for a wallet */
|
|
526
|
-
getBalances:
|
|
606
|
+
getBalances: oc.route({ method: "GET", path: "/tokens/{walletAddress}", summary: "Get token balances for a wallet" }).input(GetBalancesInputSchema).output(TokenBalanceDataSchema).errors({
|
|
607
|
+
INVALID_WALLET_ADDRESS
|
|
608
|
+
}),
|
|
527
609
|
/** Protected: Transfer tokens */
|
|
528
|
-
transfer:
|
|
610
|
+
transfer: oc.route({ method: "POST", path: "/tokens/transfer", summary: "Transfer tokens" }).input(TransferInputSchema).output(TransferOutputSchema).errors({
|
|
529
611
|
BAD_REQUEST,
|
|
530
612
|
INSUFFICIENT_FUNDS
|
|
531
613
|
}),
|
|
532
614
|
/** Protected: Create HNT account */
|
|
533
|
-
createHntAccount:
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
var hotspotsContract = {
|
|
615
|
+
createHntAccount: oc.route({ method: "POST", path: "/tokens/hnt-account", summary: "Create HNT account" }).input(CreateHntAccountInputSchema).output(CreateHntAccountOutputSchema).errors({
|
|
616
|
+
INVALID_WALLET_ADDRESS
|
|
617
|
+
})
|
|
618
|
+
});
|
|
619
|
+
var hotspotsContract = oc.tag("Hotspot").prefix("/hotspots").router({
|
|
538
620
|
/** Public: Get hotspots for a wallet */
|
|
539
|
-
getHotspots:
|
|
621
|
+
getHotspots: oc.route({ method: "GET", path: "/wallet/{walletAddress}", summary: "Get hotspots for a wallet" }).input(GetHotspotsInputSchema).output(HotspotsDataSchema).errors({
|
|
622
|
+
INVALID_WALLET_ADDRESS
|
|
623
|
+
}),
|
|
540
624
|
/** Protected: Claim rewards for hotspots */
|
|
541
|
-
claimRewards:
|
|
625
|
+
claimRewards: oc.route({ method: "POST", path: "/claim-rewards", summary: "Claim all hotspot rewards" }).input(ClaimRewardsInputSchema).output(ClaimRewardsOutputSchema).errors({
|
|
542
626
|
INSUFFICIENT_FUNDS
|
|
543
627
|
}),
|
|
544
628
|
/** Public: Get pending rewards for a wallet */
|
|
545
|
-
getPendingRewards:
|
|
546
|
-
BAD_REQUEST: { message: "Invalid wallet address", status: 400 }
|
|
629
|
+
getPendingRewards: oc.route({ method: "GET", path: "/pending-rewards/{walletAddress}", summary: "Get pending rewards" }).input(GetPendingRewardsInputSchema).output(PendingRewardsOutputSchema).errors({
|
|
630
|
+
BAD_REQUEST: { message: "Invalid wallet address", status: 400 },
|
|
631
|
+
INVALID_WALLET_ADDRESS
|
|
547
632
|
}),
|
|
548
633
|
/** Protected: Transfer hotspot ownership */
|
|
549
|
-
transferHotspot:
|
|
634
|
+
transferHotspot: oc.route({ method: "POST", path: "/transfer", summary: "Transfer ownership" }).input(TransferHotspotInputSchema).output(TransferHotspotOutputSchema).errors({
|
|
550
635
|
UNAUTHORIZED,
|
|
551
636
|
NOT_FOUND,
|
|
552
637
|
BAD_REQUEST: { message: "Invalid transfer parameters", status: 400 }
|
|
553
638
|
}),
|
|
554
639
|
/** Protected: Update rewards destination */
|
|
555
|
-
updateRewardsDestination:
|
|
640
|
+
updateRewardsDestination: oc.route({ method: "POST", path: "/update-rewards-destination", summary: "Update rewards destination" }).input(UpdateRewardsDestinationInputSchema).output(UpdateRewardsDestinationOutputSchema).errors({
|
|
556
641
|
BAD_REQUEST: { message: "Invalid parameters", status: 400 },
|
|
557
642
|
NOT_FOUND
|
|
558
643
|
}),
|
|
559
644
|
/** Public: Get split configuration for a hotspot */
|
|
560
|
-
getSplit:
|
|
561
|
-
NOT_FOUND: { message: "Split not found", status: 404 }
|
|
645
|
+
getSplit: oc.route({ method: "GET", path: "/split/{walletAddress}/{hotspotPubkey}", summary: "Get reward split" }).input(GetSplitInputSchema).output(SplitResponseSchema).errors({
|
|
646
|
+
NOT_FOUND: { message: "Split not found", status: 404 },
|
|
647
|
+
INVALID_WALLET_ADDRESS
|
|
562
648
|
}),
|
|
563
649
|
/** Protected: Create a split configuration */
|
|
564
|
-
createSplit:
|
|
650
|
+
createSplit: oc.route({ method: "POST", path: "/split", summary: "Create a reward split" }).input(CreateSplitInputSchema).output(CreateSplitOutputSchema).errors({
|
|
565
651
|
NOT_FOUND,
|
|
566
652
|
BAD_REQUEST: { message: "Invalid split configuration", status: 400 },
|
|
567
653
|
INSUFFICIENT_FUNDS
|
|
568
654
|
}),
|
|
569
655
|
/** Protected: Delete a split configuration */
|
|
570
|
-
deleteSplit:
|
|
656
|
+
deleteSplit: oc.route({ method: "DELETE", path: "/split", summary: "Delete a reward split" }).input(DeleteSplitInputSchema).output(DeleteSplitOutputSchema).errors({
|
|
657
|
+
NOT_FOUND
|
|
658
|
+
}),
|
|
659
|
+
/** Protected: Close automation */
|
|
660
|
+
closeAutomation: oc.route({ method: "POST", path: "/hotspots/wallet/{walletAddress}/automation/close", summary: "Close automation" }).input(CloseAutomationInputSchema).output(CloseAutomationOutputSchema).errors({
|
|
661
|
+
NOT_FOUND
|
|
662
|
+
}),
|
|
663
|
+
/** Protected: Get automation status */
|
|
664
|
+
getAutomationStatus: oc.route({ method: "GET", path: "/hotspots/wallet/{walletAddress}/automation/status", summary: "Get automation status" }).input(GetAutomationStatusInputSchema).output(AutomationStatusOutputSchema).errors({
|
|
665
|
+
NOT_FOUND
|
|
666
|
+
}),
|
|
667
|
+
/** Protected: Create automation */
|
|
668
|
+
createAutomation: oc.route({
|
|
669
|
+
method: "POST",
|
|
670
|
+
path: "/hotspots/wallet/{walletAddress}/automation",
|
|
671
|
+
summary: "Setup automation"
|
|
672
|
+
}).input(SetupAutomationInputSchema).output(SetupAutomationOutputSchema).errors({
|
|
673
|
+
NOT_FOUND
|
|
674
|
+
}),
|
|
675
|
+
/** Protected: Fund automation */
|
|
676
|
+
fundAutomation: oc.route({ method: "POST", path: "/hotspots/wallet/{walletAddress}/automation/fund", summary: "Fund automation" }).input(FundAutomationInputSchema).output(FundAutomationOutputSchema).errors({
|
|
677
|
+
NOT_FOUND,
|
|
678
|
+
INSUFFICIENT_FUNDS
|
|
679
|
+
}),
|
|
680
|
+
/** Protected: Get funding estimate */
|
|
681
|
+
getFundingEstimate: oc.route({ method: "GET", path: "/hotspots/wallet/{walletAddress}/automation/funding-estimate", summary: "Get funding estimate" }).input(GetFundingEstimateInputSchema).output(FundingEstimateOutputSchema).errors({
|
|
571
682
|
NOT_FOUND
|
|
572
683
|
})
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
var swapContract = {
|
|
577
|
-
getTokens: publicOc.route({ method: "GET", path: "/swap/tokens", tags: ["Swap"] }).input(GetTokensInputSchema).output(TokenListOutputSchema).errors({
|
|
684
|
+
});
|
|
685
|
+
var swapContract = oc.tag("Swap").router({
|
|
686
|
+
getTokens: oc.route({ method: "GET", path: "/swap/tokens" }).input(GetTokensInputSchema).output(TokenListOutputSchema).errors({
|
|
578
687
|
JUPITER_ERROR: { message: "Failed to fetch tokens from Jupiter" }
|
|
579
688
|
}),
|
|
580
|
-
getQuote:
|
|
689
|
+
getQuote: oc.route({ method: "GET", path: "/swap/quote" }).input(GetQuoteInputSchema).output(QuoteResponseSchema).errors({
|
|
581
690
|
BAD_REQUEST: { message: "Invalid quote parameters", status: 400 },
|
|
582
691
|
JUPITER_ERROR: { message: "Failed to get quote from Jupiter" }
|
|
583
692
|
}),
|
|
584
|
-
getInstructions:
|
|
693
|
+
getInstructions: oc.route({ method: "POST", path: "/swap/instructions" }).input(GetInstructionsInputSchema).output(TransactionDataSchema).errors({
|
|
585
694
|
BAD_REQUEST: { message: "Invalid instruction parameters", status: 400 },
|
|
586
695
|
JUPITER_ERROR: { message: "Failed to get swap instructions from Jupiter" }
|
|
587
696
|
})
|
|
588
|
-
};
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
var transactionsContract = {
|
|
592
|
-
submit: publicOc.route({ method: "POST", path: "/transactions", tags: ["Transactions"], summary: "Submit a transaction" }).input(SubmitInputSchema).output(SubmitOutputSchema).errors({
|
|
697
|
+
});
|
|
698
|
+
var transactionsContract = oc.tag("Transactions").router({
|
|
699
|
+
submit: oc.route({ method: "POST", path: "/transactions", summary: "Submit a transaction" }).input(SubmitInputSchema).output(SubmitOutputSchema).errors({
|
|
593
700
|
BAD_REQUEST,
|
|
594
701
|
CONFLICT,
|
|
595
702
|
SIMULATION_FAILED
|
|
596
703
|
}),
|
|
597
|
-
get:
|
|
704
|
+
get: oc.route({ method: "GET", path: "/transactions/{id}", summary: "Get transaction status" }).input(GetInputSchema).output(BatchStatusOutputSchema).errors({
|
|
598
705
|
NOT_FOUND
|
|
599
706
|
}),
|
|
600
|
-
resubmit:
|
|
707
|
+
resubmit: oc.route({ method: "POST", path: "/transactions/{id}/resubmit", summary: "Resubmit a transaction" }).input(ResubmitInputSchema).output(ResubmitOutputSchema).errors({
|
|
601
708
|
NOT_FOUND,
|
|
602
709
|
BAD_REQUEST
|
|
603
710
|
}),
|
|
604
|
-
getByPayer:
|
|
711
|
+
getByPayer: oc.route({ method: "GET", path: "/transactions/payer/{payer}", summary: "Get transactions by payer" }).input(GetByPayerInputSchema).output(PayerBatchesOutputSchema).errors({
|
|
605
712
|
BAD_REQUEST
|
|
606
713
|
}),
|
|
607
|
-
getByPayerAndTag:
|
|
714
|
+
getByPayerAndTag: oc.route({ method: "GET", path: "/transactions/payer/{payer}/tag/{tag}", summary: "Get transactions by payer and tag" }).input(GetByPayerAndTagInputSchema).output(PayerBatchesOutputSchema).errors({
|
|
608
715
|
BAD_REQUEST
|
|
609
716
|
})
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
// src/contracts/welcome-packs.ts
|
|
613
|
-
var welcomePacksContract = {
|
|
717
|
+
});
|
|
718
|
+
var welcomePacksContract = oc.tag("Welcome Packs").router({
|
|
614
719
|
/** Public: List welcome packs for a wallet */
|
|
615
|
-
list:
|
|
720
|
+
list: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}", summary: "List welcome packs for a wallet" }).input(WelcomePackListInputSchema).output(WelcomePackListOutputSchema).errors({
|
|
721
|
+
INVALID_WALLET_ADDRESS
|
|
722
|
+
}),
|
|
616
723
|
/** Protected: Create a new welcome pack */
|
|
617
|
-
create:
|
|
724
|
+
create: oc.route({ method: "POST", path: "/welcome-packs", summary: "Create a new welcome pack" }).input(WelcomePackCreateInputSchema).output(WelcomePackCreateOutputSchema).errors({
|
|
618
725
|
BAD_REQUEST
|
|
619
726
|
}),
|
|
620
727
|
/** Public: Get a specific welcome pack */
|
|
621
|
-
get:
|
|
622
|
-
NOT_FOUND
|
|
728
|
+
get: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Get a specific welcome pack" }).input(WelcomePackGetInputSchema).output(WelcomePackSchema).errors({
|
|
729
|
+
NOT_FOUND,
|
|
730
|
+
INVALID_WALLET_ADDRESS
|
|
623
731
|
}),
|
|
624
732
|
/** Protected: Delete a welcome pack */
|
|
625
|
-
delete:
|
|
626
|
-
BAD_REQUEST
|
|
733
|
+
delete: oc.route({ method: "DELETE", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Delete a welcome pack" }).input(WelcomePackDeleteInputSchema).output(WelcomePackDeleteOutputSchema).errors({
|
|
734
|
+
BAD_REQUEST,
|
|
735
|
+
INVALID_WALLET_ADDRESS
|
|
627
736
|
}),
|
|
628
737
|
/** Public: Get welcome pack by pack address */
|
|
629
|
-
getByAddress:
|
|
738
|
+
getByAddress: oc.route({ method: "GET", path: "/welcome-packs/address/{packAddress}", summary: "Get welcome pack by pack address" }).input(WelcomePackGetByAddressInputSchema).output(WelcomePackSchema).errors({
|
|
630
739
|
NOT_FOUND
|
|
631
740
|
}),
|
|
632
741
|
/** Public: Claim a welcome pack (no auth needed, uses claim token) */
|
|
633
|
-
claim:
|
|
742
|
+
claim: oc.route({ method: "POST", path: "/welcome-packs/claim", summary: "Claim a welcome pack" }).input(WelcomePackClaimInputSchema).output(WelcomePackClaimOutputSchema).errors({
|
|
634
743
|
BAD_REQUEST,
|
|
635
744
|
EXPIRED: { message: "Claim link has expired", status: 410 }
|
|
636
745
|
}),
|
|
637
746
|
/** Protected: Send an invite for a welcome pack */
|
|
638
|
-
invite:
|
|
747
|
+
invite: oc.route({ method: "POST", path: "/welcome-packs/invite", summary: "Send an invite for a welcome pack" }).input(WelcomePackInviteInputSchema).output(WelcomePackInviteOutputSchema).errors({
|
|
639
748
|
BAD_REQUEST,
|
|
640
749
|
NOT_FOUND
|
|
641
750
|
})
|
|
642
|
-
};
|
|
751
|
+
});
|
|
643
752
|
var InitKycInputSchema = z.object({
|
|
644
753
|
type: z.enum(["individual", "business"]).optional()
|
|
645
754
|
});
|
|
@@ -732,41 +841,42 @@ var UpdateTransferOutputSchema = z.object({
|
|
|
732
841
|
success: z.boolean()
|
|
733
842
|
});
|
|
734
843
|
var QuoteOutputSchema = QuoteResponseSchema;
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
844
|
+
var fiatContract = oc.errors({
|
|
845
|
+
UNAUTHENTICATED,
|
|
846
|
+
UNAUTHORIZED
|
|
847
|
+
}).tag("Fiat").router({
|
|
848
|
+
getKycStatus: oc.route({ method: "GET", path: "/fiat/kyc/status" }).output(KycStatusOutputSchema).errors({
|
|
739
849
|
EMAIL_NOT_LINKED: { status: 401, message: "Email not linked." }
|
|
740
850
|
}),
|
|
741
|
-
initKyc:
|
|
851
|
+
initKyc: oc.route({ method: "POST", path: "/fiat/kyc/init" }).input(InitKycInputSchema).output(KycStatusOutputSchema).errors({
|
|
742
852
|
EMAIL_NOT_LINKED: { status: 401, message: "Email not linked." },
|
|
743
853
|
BRIDGE_ERROR: { message: "Failed to create Bridge KYC link", status: 500 }
|
|
744
854
|
}),
|
|
745
|
-
getFees:
|
|
746
|
-
listBankAccounts:
|
|
855
|
+
getFees: oc.route({ method: "GET", path: "/fiat/fees" }).output(FeesOutputSchema).errors({}),
|
|
856
|
+
listBankAccounts: oc.route({ method: "GET", path: "/fiat/bank-accounts" }).output(BankAccountListOutputSchema).errors({
|
|
747
857
|
NOT_FOUND: { message: "Bridge customer ID not found", status: 404 }
|
|
748
858
|
}),
|
|
749
|
-
createBankAccount:
|
|
859
|
+
createBankAccount: oc.route({ method: "POST", path: "/fiat/bank-accounts" }).input(CreateBankAccountInputSchema).output(BankAccountSchema).errors({
|
|
750
860
|
NO_CUSTOMER: { message: "Bridge customer ID not found", status: 404 },
|
|
751
861
|
BRIDGE_ERROR: { message: "Failed to create Bridge KYC link", status: 500 }
|
|
752
862
|
}),
|
|
753
|
-
deleteBankAccount:
|
|
863
|
+
deleteBankAccount: oc.route({ method: "DELETE", path: "/fiat/bank-accounts/{id}" }).input(DeleteBankAccountInputSchema).output(DeleteBankAccountOutputSchema).errors({
|
|
754
864
|
NO_CUSTOMER: { message: "Bridge customer ID not found", status: 404 },
|
|
755
865
|
BRIDGE_ERROR: { message: "Failed to delete bank account", status: 500 }
|
|
756
866
|
}),
|
|
757
|
-
getSendQuote:
|
|
867
|
+
getSendQuote: oc.route({ method: "GET", path: "/fiat/quote/{id}" }).input(GetSendQuoteInputSchema).output(QuoteOutputSchema).errors({
|
|
758
868
|
BAD_REQUEST,
|
|
759
869
|
JUPITER_ERROR: { message: "Failed to get quote from Jupiter", status: 500 }
|
|
760
870
|
}),
|
|
761
|
-
sendFunds:
|
|
871
|
+
sendFunds: oc.route({ method: "POST", path: "/fiat/send" }).input(SendFundsInputSchema).output(SendFundsOutputSchema).errors({
|
|
762
872
|
NOT_FOUND,
|
|
763
873
|
BRIDGE_ERROR: { message: "Failed to create Bridge transfer", status: 500 },
|
|
764
874
|
JUPITER_ERROR: { message: "Failed to get quote from Jupiter", status: 500 }
|
|
765
875
|
}),
|
|
766
|
-
updateTransfer:
|
|
876
|
+
updateTransfer: oc.route({ method: "PUT", path: "/fiat/transfer/{id}" }).input(UpdateTransferInputSchema).output(UpdateTransferOutputSchema).errors({
|
|
767
877
|
NOT_FOUND: { message: "Transfer not found", status: 404 }
|
|
768
878
|
})
|
|
769
|
-
};
|
|
879
|
+
});
|
|
770
880
|
var BridgeWebhookInputSchema = z.object({
|
|
771
881
|
type: z.string(),
|
|
772
882
|
kyc_link_id: z.string().optional(),
|
|
@@ -780,26 +890,24 @@ var BridgeWebhookOutputSchema = z.object({
|
|
|
780
890
|
});
|
|
781
891
|
|
|
782
892
|
// src/contracts/webhooks.ts
|
|
783
|
-
var webhooksContract = {
|
|
784
|
-
bridge:
|
|
893
|
+
var webhooksContract = oc.tag("Webhooks").router({
|
|
894
|
+
bridge: oc.route({ method: "POST", path: "/webhooks/bridge" }).input(BridgeWebhookInputSchema).output(BridgeWebhookOutputSchema).errors({
|
|
785
895
|
NOT_FOUND,
|
|
786
896
|
INVALID_PAYLOAD: { message: "Invalid webhook payload", status: 400 }
|
|
787
897
|
})
|
|
788
|
-
};
|
|
789
|
-
|
|
790
|
-
// src/contracts/index.ts
|
|
791
|
-
var apiContract = {
|
|
898
|
+
});
|
|
899
|
+
var apiContract = oc.router({
|
|
792
900
|
health: healthContract,
|
|
793
901
|
tokens: tokensContract,
|
|
794
902
|
hotspots: hotspotsContract,
|
|
795
903
|
swap: swapContract,
|
|
796
904
|
transactions: transactionsContract,
|
|
797
905
|
welcomePacks: welcomePacksContract
|
|
798
|
-
};
|
|
799
|
-
var fullApiContract = {
|
|
906
|
+
});
|
|
907
|
+
var fullApiContract = oc.router({
|
|
800
908
|
...apiContract,
|
|
801
909
|
fiat: fiatContract,
|
|
802
910
|
webhooks: webhooksContract
|
|
803
|
-
};
|
|
911
|
+
});
|
|
804
912
|
|
|
805
|
-
export { BAD_REQUEST, BatchStatusOutputSchema, CONFLICT, ClaimRewardsInputSchema, ClaimRewardsOutputSchema, CreateHntAccountInputSchema, CreateHntAccountOutputSchema, CreateSplitInputSchema, CreateSplitOutputSchema, DeleteSplitInputSchema, DeleteSplitOutputSchema, DeviceTypeSchema, ErrorResponseSchema, GetBalancesInputSchema, GetByPayerAndTagInputSchema, GetByPayerInputSchema, GetHotspotsInputSchema, GetInputSchema, GetInstructionsInputSchema, GetPendingRewardsInputSchema, GetQuoteInputSchema, GetSplitInputSchema, GetTokensInputSchema, HealthResponseSchema, HotspotSchema, HotspotSharesSchema, HotspotTypeSchema, HotspotsDataSchema, INSUFFICIENT_FUNDS, NOT_FOUND, OwnershipTypeSchema, PaginationInputSchema, PaginationOutputSchema, PayerBatchSummarySchema, PayerBatchesOutputSchema, PendingRewardsOutputSchema, PublicKeySchema, QuoteResponseSchema, RATE_LIMITED, ResubmitInputSchema, ResubmitOutputSchema, RewardSplitInputSchema, SIMULATION_FAILED, ScheduleInputSchema, SplitResponseSchema, SplitShareSchema, SubmitInputSchema, SubmitOutputSchema, SwapTransactionDataSchema, TRANSACTION_FAILED, TokenAccountSchema, TokenBalanceDataSchema, TokenListOutputSchema, TokenSchema, TransactionBatchRequestSchema, TransactionBatchResponseSchema, TransactionDataSchema, TransactionItemSchema, TransactionMetadataSchema, TransactionStatusSchema, TransferHotspotInputSchema, TransferHotspotOutputSchema, TransferInputSchema, TransferOutputSchema, UNAUTHENTICATED, UNAUTHORIZED, UpdateRewardsDestinationInputSchema, UpdateRewardsDestinationOutputSchema, WalletAddressSchema, WelcomePackClaimInputSchema, WelcomePackClaimOutputSchema, WelcomePackCreateInputSchema, WelcomePackCreateOutputSchema, WelcomePackDeleteInputSchema, WelcomePackDeleteOutputSchema, WelcomePackGetByAddressInputSchema, WelcomePackGetInputSchema, WelcomePackInviteInputSchema, WelcomePackInviteOutputSchema, WelcomePackListInputSchema, WelcomePackListOutputSchema, WelcomePackSchema, apiContract, createClient, createMockClient, fullApiContract };
|
|
913
|
+
export { AutomationScheduleSchema, AutomationStatusOutputSchema, BAD_REQUEST, BatchStatusOutputSchema, CONFLICT, ClaimRewardsInputSchema, ClaimRewardsOutputSchema, CloseAutomationInputSchema, CloseAutomationOutputSchema, CreateHntAccountInputSchema, CreateHntAccountOutputSchema, CreateSplitInputSchema, CreateSplitOutputSchema, DeleteSplitInputSchema, DeleteSplitOutputSchema, DeviceTypeSchema, ErrorResponseSchema, FundAutomationInputSchema, FundAutomationOutputSchema, FundingEstimateOutputSchema, GetAutomationStatusInputSchema, GetBalancesInputSchema, GetByPayerAndTagInputSchema, GetByPayerInputSchema, GetFundingEstimateInputSchema, GetHotspotsInputSchema, GetInputSchema, GetInstructionsInputSchema, GetPendingRewardsInputSchema, GetQuoteInputSchema, GetSplitInputSchema, GetTokensInputSchema, HealthResponseSchema, HeliumPublicKeySchema, HotspotSchema, HotspotSharesSchema, HotspotTypeSchema, HotspotsDataSchema, INSUFFICIENT_FUNDS, INVALID_WALLET_ADDRESS, NOT_FOUND, OwnershipTypeSchema, PaginationInputSchema, PaginationOutputSchema, PayerBatchSummarySchema, PayerBatchesOutputSchema, PendingRewardsOutputSchema, PublicKeySchema, QuoteResponseSchema, RATE_LIMITED, ReassertLocationRequestSchema, ReassertLocationResponseSchema, ResubmitInputSchema, ResubmitOutputSchema, RewardSplitInputSchema, SIMULATION_FAILED, ScheduleInputSchema, SetupAutomationInputSchema, SetupAutomationOutputSchema, SplitResponseSchema, SplitShareSchema, SubmitInputSchema, SubmitOutputSchema, SwapTransactionDataSchema, TRANSACTION_FAILED, TokenAccountSchema, TokenBalanceDataSchema, TokenListOutputSchema, TokenSchema, TransactionBatchRequestSchema, TransactionBatchResponseSchema, TransactionDataSchema, TransactionItemSchema, TransactionMetadataSchema, TransactionStatusSchema, TransferHotspotInputSchema, TransferHotspotOutputSchema, TransferInputSchema, TransferOutputSchema, UNAUTHENTICATED, UNAUTHORIZED, UpdateRewardsDestinationInputSchema, UpdateRewardsDestinationOutputSchema, WalletAddressSchema, WelcomePackClaimInputSchema, WelcomePackClaimOutputSchema, WelcomePackCreateInputSchema, WelcomePackCreateOutputSchema, WelcomePackDeleteInputSchema, WelcomePackDeleteOutputSchema, WelcomePackGetByAddressInputSchema, WelcomePackGetInputSchema, WelcomePackInviteInputSchema, WelcomePackInviteOutputSchema, WelcomePackListInputSchema, WelcomePackListOutputSchema, WelcomePackSchema, apiContract, createClient, createMockClient, fullApiContract };
|