@helium/blockchain-api 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +265 -438
  2. package/dist/index.js +115 -106
  3. package/package.json +2 -2
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: z.string().min(32)
110
+ walletAddress: WalletAddressSchema
110
111
  });
111
112
  var TransferInputSchema = z.object({
112
- walletAddress: z.string().min(32),
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: z.string().min(32)
120
+ walletAddress: WalletAddressSchema
120
121
  });
121
122
  var TokenAccountSchema = z.object({
122
123
  mint: z.string(),
@@ -171,31 +172,31 @@ var HotspotSchema = z.object({
171
172
  ownershipType: z.string()
172
173
  });
173
174
  var GetHotspotsInputSchema = z.object({
174
- walletAddress: z.string().min(32),
175
+ walletAddress: WalletAddressSchema,
175
176
  type: HotspotTypeSchema.optional(),
176
177
  page: z.coerce.number().int().min(1).default(1),
177
178
  limit: z.coerce.number().int().min(1).max(100).default(10)
178
179
  });
179
180
  var ClaimRewardsInputSchema = z.object({
180
- walletAddress: z.string().min(32)
181
+ walletAddress: WalletAddressSchema
181
182
  });
182
183
  var GetPendingRewardsInputSchema = z.object({
183
- walletAddress: z.string().min(32)
184
+ walletAddress: WalletAddressSchema
184
185
  });
185
186
  var TransferHotspotInputSchema = z.object({
186
- walletAddress: z.string().min(32),
187
- hotspotPubkey: z.string().min(1),
187
+ walletAddress: WalletAddressSchema,
188
+ hotspotPubkey: HeliumPublicKeySchema,
188
189
  recipient: z.string().min(32)
189
190
  });
190
191
  var UpdateRewardsDestinationInputSchema = z.object({
191
- walletAddress: z.string().min(32),
192
- hotspotPubkey: z.string().min(1),
192
+ walletAddress: WalletAddressSchema,
193
+ hotspotPubkey: HeliumPublicKeySchema,
193
194
  destination: z.string().min(32),
194
195
  lazyDistributors: z.array(z.string().min(32)).min(1)
195
196
  });
196
197
  var GetSplitInputSchema = z.object({
197
- walletAddress: z.string().min(32),
198
- hotspotPubkey: z.string().min(1)
198
+ walletAddress: WalletAddressSchema,
199
+ hotspotPubkey: HeliumPublicKeySchema
199
200
  });
200
201
  var RewardSplitInputSchema = z.object({
201
202
  address: z.string().min(32),
@@ -210,15 +211,15 @@ var ScheduleInputSchema = z.object({
210
211
  dayOfMonth: z.string().optional()
211
212
  });
212
213
  var CreateSplitInputSchema = z.object({
213
- walletAddress: z.string().min(32),
214
- hotspotPubkey: z.string().min(1),
214
+ walletAddress: WalletAddressSchema,
215
+ hotspotPubkey: HeliumPublicKeySchema,
215
216
  rewardsSplit: z.array(RewardSplitInputSchema),
216
217
  schedule: ScheduleInputSchema,
217
218
  lazyDistributor: z.string().min(32)
218
219
  });
219
220
  var DeleteSplitInputSchema = z.object({
220
- walletAddress: z.string().min(32),
221
- hotspotPubkey: z.string().min(1)
221
+ walletAddress: WalletAddressSchema,
222
+ hotspotPubkey: HeliumPublicKeySchema
222
223
  });
223
224
  var HotspotsDataSchema = z.object({
224
225
  hotspots: z.array(HotspotSchema),
@@ -256,6 +257,18 @@ var DeleteSplitOutputSchema = z.object({
256
257
  var PendingRewardsOutputSchema = z.object({
257
258
  pending: z.string()
258
259
  });
260
+ var ReassertLocationRequestSchema = z.object({
261
+ entityPubKey: HeliumPublicKeySchema,
262
+ walletAddress: WalletAddressSchema,
263
+ location: z.object({
264
+ lat: z.number().min(-90).max(90),
265
+ lng: z.number().min(-180).max(180)
266
+ }),
267
+ azimuth: z.number().min(0).max(360).optional()
268
+ });
269
+ var ReassertLocationResponseSchema = z.object({
270
+ transactionData: TransactionDataSchema
271
+ });
259
272
  var GetTokensInputSchema = z.object({
260
273
  limit: z.coerce.number().int().min(1).max(100).default(50)
261
274
  });
@@ -390,10 +403,10 @@ var PayerBatchesOutputSchema = z.object({
390
403
  })
391
404
  });
392
405
  var WelcomePackListInputSchema = z.object({
393
- walletAddress: z.string().min(32)
406
+ walletAddress: WalletAddressSchema
394
407
  });
395
408
  var WelcomePackCreateInputSchema = z.object({
396
- walletAddress: z.string().min(32),
409
+ walletAddress: WalletAddressSchema,
397
410
  assetId: z.string(),
398
411
  solAmount: z.number(),
399
412
  rentRefund: z.string(),
@@ -403,11 +416,11 @@ var WelcomePackCreateInputSchema = z.object({
403
416
  lazyDistributor: z.string()
404
417
  });
405
418
  var WelcomePackGetInputSchema = z.object({
406
- walletAddress: z.string().min(32),
419
+ walletAddress: WalletAddressSchema,
407
420
  packId: z.number()
408
421
  });
409
422
  var WelcomePackDeleteInputSchema = z.object({
410
- walletAddress: z.string().min(32),
423
+ walletAddress: WalletAddressSchema,
411
424
  packId: z.number()
412
425
  });
413
426
  var WelcomePackGetByAddressInputSchema = z.object({
@@ -415,13 +428,13 @@ var WelcomePackGetByAddressInputSchema = z.object({
415
428
  });
416
429
  var WelcomePackClaimInputSchema = z.object({
417
430
  packAddress: z.string().min(32),
418
- walletAddress: z.string().min(32),
431
+ walletAddress: WalletAddressSchema,
419
432
  signature: z.string(),
420
433
  expirationTs: z.string()
421
434
  });
422
435
  var WelcomePackInviteInputSchema = z.object({
423
436
  packAddress: z.string().min(32),
424
- walletAddress: z.string().min(32),
437
+ walletAddress: WalletAddressSchema,
425
438
  expirationDays: z.number().int().positive().max(365).default(7)
426
439
  });
427
440
  var WelcomePackSchema = z.object({
@@ -475,6 +488,10 @@ var BAD_REQUEST = {
475
488
  fields: z.array(z.string()).optional()
476
489
  }).optional()
477
490
  };
491
+ var INVALID_WALLET_ADDRESS = {
492
+ status: 400,
493
+ message: "The provided wallet address is invalid."
494
+ };
478
495
  var RATE_LIMITED = {
479
496
  status: 429,
480
497
  message: "Too many requests. Please try again later."
@@ -507,139 +524,132 @@ var SIMULATION_FAILED = {
507
524
  link: z.string().optional()
508
525
  })
509
526
  };
510
- var protectedOc = oc.errors({
511
- UNAUTHENTICATED,
512
- UNAUTHORIZED
513
- });
514
- var publicOc = oc.errors({
515
- INVALID_WALLET_ADDRESS: { message: "Invalid wallet address", status: 400 }
527
+ var healthContract = oc.tag("Health").router({
528
+ check: oc.route({ method: "GET", path: "/health", summary: "Health check" }).output(HealthResponseSchema)
516
529
  });
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 = {
530
+ var tokensContract = oc.tag("Tokens").router({
525
531
  /** Public: Get token balances for a wallet */
526
- getBalances: publicOc.route({ method: "GET", path: "/tokens/{walletAddress}", tags: ["Tokens"], summary: "Get token balances for a wallet" }).input(GetBalancesInputSchema).output(TokenBalanceDataSchema).errors({}),
532
+ getBalances: oc.route({ method: "GET", path: "/tokens/{walletAddress}", summary: "Get token balances for a wallet" }).input(GetBalancesInputSchema).output(TokenBalanceDataSchema).errors({
533
+ INVALID_WALLET_ADDRESS
534
+ }),
527
535
  /** Protected: Transfer tokens */
528
- transfer: publicOc.route({ method: "POST", path: "/tokens/transfer", tags: ["Tokens"], summary: "Transfer tokens" }).input(TransferInputSchema).output(TransferOutputSchema).errors({
536
+ transfer: oc.route({ method: "POST", path: "/tokens/transfer", summary: "Transfer tokens" }).input(TransferInputSchema).output(TransferOutputSchema).errors({
529
537
  BAD_REQUEST,
530
538
  INSUFFICIENT_FUNDS
531
539
  }),
532
540
  /** Protected: Create HNT account */
533
- createHntAccount: publicOc.route({ method: "POST", path: "/tokens/hnt-account", tags: ["Tokens"], summary: "Create HNT account" }).input(CreateHntAccountInputSchema).output(CreateHntAccountOutputSchema).errors({})
534
- };
535
-
536
- // src/contracts/hotspots.ts
537
- var hotspotsContract = {
541
+ createHntAccount: oc.route({ method: "POST", path: "/tokens/hnt-account", summary: "Create HNT account" }).input(CreateHntAccountInputSchema).output(CreateHntAccountOutputSchema).errors({
542
+ INVALID_WALLET_ADDRESS
543
+ })
544
+ });
545
+ var hotspotsContract = oc.tag("Hotspot").prefix("/hotspots").router({
538
546
  /** Public: Get hotspots for a wallet */
539
- getHotspots: publicOc.route({ method: "GET", path: "/hotspots/wallet/{walletAddress}", tags: ["Hotspots"], summary: "Get hotspots for a wallet" }).input(GetHotspotsInputSchema).output(HotspotsDataSchema).errors({}),
547
+ getHotspots: oc.route({ method: "GET", path: "/wallet/{walletAddress}", summary: "Get hotspots for a wallet" }).input(GetHotspotsInputSchema).output(HotspotsDataSchema).errors({
548
+ INVALID_WALLET_ADDRESS
549
+ }),
540
550
  /** Protected: Claim rewards for hotspots */
541
- claimRewards: publicOc.route({ method: "POST", path: "/hotspots/claim-rewards", tags: ["Hotspots"], summary: "Claim all hotspot rewards" }).input(ClaimRewardsInputSchema).output(ClaimRewardsOutputSchema).errors({
551
+ claimRewards: oc.route({ method: "POST", path: "/claim-rewards", summary: "Claim all hotspot rewards" }).input(ClaimRewardsInputSchema).output(ClaimRewardsOutputSchema).errors({
542
552
  INSUFFICIENT_FUNDS
543
553
  }),
544
554
  /** Public: Get pending rewards for a wallet */
545
- getPendingRewards: publicOc.route({ method: "GET", path: "/hotspots/pending-rewards/{walletAddress}", tags: ["Hotspots"], summary: "Get pending rewards" }).input(GetPendingRewardsInputSchema).output(PendingRewardsOutputSchema).errors({
546
- BAD_REQUEST: { message: "Invalid wallet address", status: 400 }
555
+ getPendingRewards: oc.route({ method: "GET", path: "/pending-rewards/{walletAddress}", summary: "Get pending rewards" }).input(GetPendingRewardsInputSchema).output(PendingRewardsOutputSchema).errors({
556
+ BAD_REQUEST: { message: "Invalid wallet address", status: 400 },
557
+ INVALID_WALLET_ADDRESS
547
558
  }),
548
559
  /** Protected: Transfer hotspot ownership */
549
- transferHotspot: publicOc.route({ method: "POST", path: "/hotspots/transfer", tags: ["Hotspots"], summary: "Transfer ownership" }).input(TransferHotspotInputSchema).output(TransferHotspotOutputSchema).errors({
560
+ transferHotspot: oc.route({ method: "POST", path: "/transfer", summary: "Transfer ownership" }).input(TransferHotspotInputSchema).output(TransferHotspotOutputSchema).errors({
550
561
  UNAUTHORIZED,
551
562
  NOT_FOUND,
552
563
  BAD_REQUEST: { message: "Invalid transfer parameters", status: 400 }
553
564
  }),
554
565
  /** Protected: Update rewards destination */
555
- updateRewardsDestination: publicOc.route({ method: "POST", path: "/hotspots/update-rewards-destination", tags: ["Hotspots"], summary: "Update rewards destination" }).input(UpdateRewardsDestinationInputSchema).output(UpdateRewardsDestinationOutputSchema).errors({
566
+ updateRewardsDestination: oc.route({ method: "POST", path: "/update-rewards-destination", summary: "Update rewards destination" }).input(UpdateRewardsDestinationInputSchema).output(UpdateRewardsDestinationOutputSchema).errors({
556
567
  BAD_REQUEST: { message: "Invalid parameters", status: 400 },
557
568
  NOT_FOUND
558
569
  }),
559
570
  /** Public: Get split configuration for a hotspot */
560
- getSplit: publicOc.route({ method: "GET", path: "/hotspots/split/{walletAddress}/{hotspotPubkey}", tags: ["Hotspots"], summary: "Get reward split" }).input(GetSplitInputSchema).output(SplitResponseSchema).errors({
561
- NOT_FOUND: { message: "Split not found", status: 404 }
571
+ getSplit: oc.route({ method: "GET", path: "/split/{walletAddress}/{hotspotPubkey}", summary: "Get reward split" }).input(GetSplitInputSchema).output(SplitResponseSchema).errors({
572
+ NOT_FOUND: { message: "Split not found", status: 404 },
573
+ INVALID_WALLET_ADDRESS
562
574
  }),
563
575
  /** Protected: Create a split configuration */
564
- createSplit: publicOc.route({ method: "POST", path: "/hotspots/split", tags: ["Hotspots"], summary: "Create a reward split" }).input(CreateSplitInputSchema).output(CreateSplitOutputSchema).errors({
576
+ createSplit: oc.route({ method: "POST", path: "/split", summary: "Create a reward split" }).input(CreateSplitInputSchema).output(CreateSplitOutputSchema).errors({
565
577
  NOT_FOUND,
566
578
  BAD_REQUEST: { message: "Invalid split configuration", status: 400 },
567
579
  INSUFFICIENT_FUNDS
568
580
  }),
569
581
  /** Protected: Delete a split configuration */
570
- deleteSplit: publicOc.route({ method: "DELETE", path: "/hotspots/split", tags: ["Hotspots"], summary: "Delete a reward split" }).input(DeleteSplitInputSchema).output(DeleteSplitOutputSchema).errors({
582
+ deleteSplit: oc.route({ method: "DELETE", path: "/split", summary: "Delete a reward split" }).input(DeleteSplitInputSchema).output(DeleteSplitOutputSchema).errors({
571
583
  NOT_FOUND
572
584
  })
573
- };
574
-
575
- // src/contracts/swap.ts
576
- var swapContract = {
577
- getTokens: publicOc.route({ method: "GET", path: "/swap/tokens", tags: ["Swap"] }).input(GetTokensInputSchema).output(TokenListOutputSchema).errors({
585
+ });
586
+ var swapContract = oc.tag("Swap").router({
587
+ getTokens: oc.route({ method: "GET", path: "/swap/tokens" }).input(GetTokensInputSchema).output(TokenListOutputSchema).errors({
578
588
  JUPITER_ERROR: { message: "Failed to fetch tokens from Jupiter" }
579
589
  }),
580
- getQuote: publicOc.route({ method: "GET", path: "/swap/quote", tags: ["Swap"] }).input(GetQuoteInputSchema).output(QuoteResponseSchema).errors({
590
+ getQuote: oc.route({ method: "GET", path: "/swap/quote" }).input(GetQuoteInputSchema).output(QuoteResponseSchema).errors({
581
591
  BAD_REQUEST: { message: "Invalid quote parameters", status: 400 },
582
592
  JUPITER_ERROR: { message: "Failed to get quote from Jupiter" }
583
593
  }),
584
- getInstructions: publicOc.route({ method: "POST", path: "/swap/instructions", tags: ["Swap"] }).input(GetInstructionsInputSchema).output(TransactionDataSchema).errors({
594
+ getInstructions: oc.route({ method: "POST", path: "/swap/instructions" }).input(GetInstructionsInputSchema).output(TransactionDataSchema).errors({
585
595
  BAD_REQUEST: { message: "Invalid instruction parameters", status: 400 },
586
596
  JUPITER_ERROR: { message: "Failed to get swap instructions from Jupiter" }
587
597
  })
588
- };
589
-
590
- // src/contracts/transactions.ts
591
- var transactionsContract = {
592
- submit: publicOc.route({ method: "POST", path: "/transactions", tags: ["Transactions"], summary: "Submit a transaction" }).input(SubmitInputSchema).output(SubmitOutputSchema).errors({
598
+ });
599
+ var transactionsContract = oc.tag("Transactions").router({
600
+ submit: oc.route({ method: "POST", path: "/transactions", summary: "Submit a transaction" }).input(SubmitInputSchema).output(SubmitOutputSchema).errors({
593
601
  BAD_REQUEST,
594
602
  CONFLICT,
595
603
  SIMULATION_FAILED
596
604
  }),
597
- get: publicOc.route({ method: "GET", path: "/transactions/{id}", tags: ["Transactions"], summary: "Get transaction status" }).input(GetInputSchema).output(BatchStatusOutputSchema).errors({
605
+ get: oc.route({ method: "GET", path: "/transactions/{id}", summary: "Get transaction status" }).input(GetInputSchema).output(BatchStatusOutputSchema).errors({
598
606
  NOT_FOUND
599
607
  }),
600
- resubmit: publicOc.route({ method: "POST", path: "/transactions/{id}/resubmit", tags: ["Transactions"], summary: "Resubmit a transaction" }).input(ResubmitInputSchema).output(ResubmitOutputSchema).errors({
608
+ resubmit: oc.route({ method: "POST", path: "/transactions/{id}/resubmit", summary: "Resubmit a transaction" }).input(ResubmitInputSchema).output(ResubmitOutputSchema).errors({
601
609
  NOT_FOUND,
602
610
  BAD_REQUEST
603
611
  }),
604
- getByPayer: publicOc.route({ method: "GET", path: "/transactions/payer/{payer}", tags: ["Transactions"], summary: "Get transactions by payer" }).input(GetByPayerInputSchema).output(PayerBatchesOutputSchema).errors({
612
+ getByPayer: oc.route({ method: "GET", path: "/transactions/payer/{payer}", summary: "Get transactions by payer" }).input(GetByPayerInputSchema).output(PayerBatchesOutputSchema).errors({
605
613
  BAD_REQUEST
606
614
  }),
607
- getByPayerAndTag: publicOc.route({ method: "GET", path: "/transactions/payer/{payer}/tag/{tag}", tags: ["Transactions"], summary: "Get transactions by payer and tag" }).input(GetByPayerAndTagInputSchema).output(PayerBatchesOutputSchema).errors({
615
+ getByPayerAndTag: oc.route({ method: "GET", path: "/transactions/payer/{payer}/tag/{tag}", summary: "Get transactions by payer and tag" }).input(GetByPayerAndTagInputSchema).output(PayerBatchesOutputSchema).errors({
608
616
  BAD_REQUEST
609
617
  })
610
- };
611
-
612
- // src/contracts/welcome-packs.ts
613
- var welcomePacksContract = {
618
+ });
619
+ var welcomePacksContract = oc.tag("Welcome Packs").router({
614
620
  /** Public: List welcome packs for a wallet */
615
- list: publicOc.route({ method: "GET", path: "/welcome-packs/{walletAddress}", tags: ["Welcome Packs"], summary: "List welcome packs for a wallet" }).input(WelcomePackListInputSchema).output(WelcomePackListOutputSchema).errors({}),
621
+ list: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}", summary: "List welcome packs for a wallet" }).input(WelcomePackListInputSchema).output(WelcomePackListOutputSchema).errors({
622
+ INVALID_WALLET_ADDRESS
623
+ }),
616
624
  /** Protected: Create a new welcome pack */
617
- create: publicOc.route({ method: "POST", path: "/welcome-packs", tags: ["Welcome Packs"], summary: "Create a new welcome pack" }).input(WelcomePackCreateInputSchema).output(WelcomePackCreateOutputSchema).errors({
625
+ create: oc.route({ method: "POST", path: "/welcome-packs", summary: "Create a new welcome pack" }).input(WelcomePackCreateInputSchema).output(WelcomePackCreateOutputSchema).errors({
618
626
  BAD_REQUEST
619
627
  }),
620
628
  /** Public: Get a specific welcome pack */
621
- get: publicOc.route({ method: "GET", path: "/welcome-packs/{walletAddress}/{packId}", tags: ["Welcome Packs"], summary: "Get a specific welcome pack" }).input(WelcomePackGetInputSchema).output(WelcomePackSchema).errors({
622
- NOT_FOUND
629
+ get: oc.route({ method: "GET", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Get a specific welcome pack" }).input(WelcomePackGetInputSchema).output(WelcomePackSchema).errors({
630
+ NOT_FOUND,
631
+ INVALID_WALLET_ADDRESS
623
632
  }),
624
633
  /** Protected: Delete a welcome pack */
625
- delete: publicOc.route({ method: "DELETE", path: "/welcome-packs/{walletAddress}/{packId}", tags: ["Welcome Packs"], summary: "Delete a welcome pack" }).input(WelcomePackDeleteInputSchema).output(WelcomePackDeleteOutputSchema).errors({
626
- BAD_REQUEST
634
+ delete: oc.route({ method: "DELETE", path: "/welcome-packs/{walletAddress}/{packId}", summary: "Delete a welcome pack" }).input(WelcomePackDeleteInputSchema).output(WelcomePackDeleteOutputSchema).errors({
635
+ BAD_REQUEST,
636
+ INVALID_WALLET_ADDRESS
627
637
  }),
628
638
  /** Public: Get welcome pack by pack address */
629
- getByAddress: publicOc.route({ method: "GET", path: "/welcome-packs/address/{packAddress}", tags: ["Welcome Packs"], summary: "Get welcome pack by pack address" }).input(WelcomePackGetByAddressInputSchema).output(WelcomePackSchema).errors({
639
+ getByAddress: oc.route({ method: "GET", path: "/welcome-packs/address/{packAddress}", summary: "Get welcome pack by pack address" }).input(WelcomePackGetByAddressInputSchema).output(WelcomePackSchema).errors({
630
640
  NOT_FOUND
631
641
  }),
632
642
  /** Public: Claim a welcome pack (no auth needed, uses claim token) */
633
- claim: publicOc.route({ method: "POST", path: "/welcome-packs/claim", tags: ["Welcome Packs"], summary: "Claim a welcome pack" }).input(WelcomePackClaimInputSchema).output(WelcomePackClaimOutputSchema).errors({
643
+ claim: oc.route({ method: "POST", path: "/welcome-packs/claim", summary: "Claim a welcome pack" }).input(WelcomePackClaimInputSchema).output(WelcomePackClaimOutputSchema).errors({
634
644
  BAD_REQUEST,
635
645
  EXPIRED: { message: "Claim link has expired", status: 410 }
636
646
  }),
637
647
  /** Protected: Send an invite for a welcome pack */
638
- invite: publicOc.route({ method: "POST", path: "/welcome-packs/invite", tags: ["Welcome Packs"], summary: "Send an invite for a welcome pack" }).input(WelcomePackInviteInputSchema).output(WelcomePackInviteOutputSchema).errors({
648
+ invite: oc.route({ method: "POST", path: "/welcome-packs/invite", summary: "Send an invite for a welcome pack" }).input(WelcomePackInviteInputSchema).output(WelcomePackInviteOutputSchema).errors({
639
649
  BAD_REQUEST,
640
650
  NOT_FOUND
641
651
  })
642
- };
652
+ });
643
653
  var InitKycInputSchema = z.object({
644
654
  type: z.enum(["individual", "business"]).optional()
645
655
  });
@@ -732,41 +742,42 @@ var UpdateTransferOutputSchema = z.object({
732
742
  success: z.boolean()
733
743
  });
734
744
  var QuoteOutputSchema = QuoteResponseSchema;
735
-
736
- // src/contracts/fiat.ts
737
- var fiatContract = {
738
- getKycStatus: protectedOc.route({ method: "GET", path: "/fiat/kyc/status" }).output(KycStatusOutputSchema).errors({
745
+ var fiatContract = oc.errors({
746
+ UNAUTHENTICATED,
747
+ UNAUTHORIZED
748
+ }).tag("Fiat").router({
749
+ getKycStatus: oc.route({ method: "GET", path: "/fiat/kyc/status" }).output(KycStatusOutputSchema).errors({
739
750
  EMAIL_NOT_LINKED: { status: 401, message: "Email not linked." }
740
751
  }),
741
- initKyc: protectedOc.route({ method: "POST", path: "/fiat/kyc/init" }).input(InitKycInputSchema).output(KycStatusOutputSchema).errors({
752
+ initKyc: oc.route({ method: "POST", path: "/fiat/kyc/init" }).input(InitKycInputSchema).output(KycStatusOutputSchema).errors({
742
753
  EMAIL_NOT_LINKED: { status: 401, message: "Email not linked." },
743
754
  BRIDGE_ERROR: { message: "Failed to create Bridge KYC link", status: 500 }
744
755
  }),
745
- getFees: protectedOc.route({ method: "GET", path: "/fiat/fees" }).output(FeesOutputSchema).errors({}),
746
- listBankAccounts: protectedOc.route({ method: "GET", path: "/fiat/bank-accounts" }).output(BankAccountListOutputSchema).errors({
756
+ getFees: oc.route({ method: "GET", path: "/fiat/fees" }).output(FeesOutputSchema).errors({}),
757
+ listBankAccounts: oc.route({ method: "GET", path: "/fiat/bank-accounts" }).output(BankAccountListOutputSchema).errors({
747
758
  NOT_FOUND: { message: "Bridge customer ID not found", status: 404 }
748
759
  }),
749
- createBankAccount: protectedOc.route({ method: "POST", path: "/fiat/bank-accounts" }).input(CreateBankAccountInputSchema).output(BankAccountSchema).errors({
760
+ createBankAccount: oc.route({ method: "POST", path: "/fiat/bank-accounts" }).input(CreateBankAccountInputSchema).output(BankAccountSchema).errors({
750
761
  NO_CUSTOMER: { message: "Bridge customer ID not found", status: 404 },
751
762
  BRIDGE_ERROR: { message: "Failed to create Bridge KYC link", status: 500 }
752
763
  }),
753
- deleteBankAccount: protectedOc.route({ method: "DELETE", path: "/fiat/bank-accounts/{id}" }).input(DeleteBankAccountInputSchema).output(DeleteBankAccountOutputSchema).errors({
764
+ deleteBankAccount: oc.route({ method: "DELETE", path: "/fiat/bank-accounts/{id}" }).input(DeleteBankAccountInputSchema).output(DeleteBankAccountOutputSchema).errors({
754
765
  NO_CUSTOMER: { message: "Bridge customer ID not found", status: 404 },
755
766
  BRIDGE_ERROR: { message: "Failed to delete bank account", status: 500 }
756
767
  }),
757
- getSendQuote: protectedOc.route({ method: "GET", path: "/fiat/quote/{id}" }).input(GetSendQuoteInputSchema).output(QuoteOutputSchema).errors({
768
+ getSendQuote: oc.route({ method: "GET", path: "/fiat/quote/{id}" }).input(GetSendQuoteInputSchema).output(QuoteOutputSchema).errors({
758
769
  BAD_REQUEST,
759
770
  JUPITER_ERROR: { message: "Failed to get quote from Jupiter", status: 500 }
760
771
  }),
761
- sendFunds: protectedOc.route({ method: "POST", path: "/fiat/send" }).input(SendFundsInputSchema).output(SendFundsOutputSchema).errors({
772
+ sendFunds: oc.route({ method: "POST", path: "/fiat/send" }).input(SendFundsInputSchema).output(SendFundsOutputSchema).errors({
762
773
  NOT_FOUND,
763
774
  BRIDGE_ERROR: { message: "Failed to create Bridge transfer", status: 500 },
764
775
  JUPITER_ERROR: { message: "Failed to get quote from Jupiter", status: 500 }
765
776
  }),
766
- updateTransfer: protectedOc.route({ method: "PUT", path: "/fiat/transfer/{id}" }).input(UpdateTransferInputSchema).output(UpdateTransferOutputSchema).errors({
777
+ updateTransfer: oc.route({ method: "PUT", path: "/fiat/transfer/{id}" }).input(UpdateTransferInputSchema).output(UpdateTransferOutputSchema).errors({
767
778
  NOT_FOUND: { message: "Transfer not found", status: 404 }
768
779
  })
769
- };
780
+ });
770
781
  var BridgeWebhookInputSchema = z.object({
771
782
  type: z.string(),
772
783
  kyc_link_id: z.string().optional(),
@@ -780,26 +791,24 @@ var BridgeWebhookOutputSchema = z.object({
780
791
  });
781
792
 
782
793
  // src/contracts/webhooks.ts
783
- var webhooksContract = {
784
- bridge: publicOc.route({ method: "POST", path: "/webhooks/bridge" }).input(BridgeWebhookInputSchema).output(BridgeWebhookOutputSchema).errors({
794
+ var webhooksContract = oc.tag("Webhooks").router({
795
+ bridge: oc.route({ method: "POST", path: "/webhooks/bridge" }).input(BridgeWebhookInputSchema).output(BridgeWebhookOutputSchema).errors({
785
796
  NOT_FOUND,
786
797
  INVALID_PAYLOAD: { message: "Invalid webhook payload", status: 400 }
787
798
  })
788
- };
789
-
790
- // src/contracts/index.ts
791
- var apiContract = {
799
+ });
800
+ var apiContract = oc.router({
792
801
  health: healthContract,
793
802
  tokens: tokensContract,
794
803
  hotspots: hotspotsContract,
795
804
  swap: swapContract,
796
805
  transactions: transactionsContract,
797
806
  welcomePacks: welcomePacksContract
798
- };
799
- var fullApiContract = {
807
+ });
808
+ var fullApiContract = oc.router({
800
809
  ...apiContract,
801
810
  fiat: fiatContract,
802
811
  webhooks: webhooksContract
803
- };
812
+ });
804
813
 
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 };
814
+ 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, 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, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helium/blockchain-api",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "TypeScript client and schemas for the Helium Blockchain API",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,4 +42,4 @@
42
42
  "tsup": "^8.0.0",
43
43
  "typescript": "^5.0.0"
44
44
  }
45
- }
45
+ }