infra-sdk-typescript 0.3.0 → 0.5.0

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.cts CHANGED
@@ -352,8 +352,27 @@ declare class WalletResource extends APIResource {
352
352
 
353
353
  type TokenType = "ASSET" | "YIELD_BEARING";
354
354
  type TokenStatus = LooseUnion<"PENDING" | "ACTIVE" | "PAUSED" | "RETIRED">;
355
- type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER" | "DEPLOY" | "REDEEM" | "SNAPSHOT">;
355
+ type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER" | "DEPLOY" | "REDEEM" | "SNAPSHOT" | "FORCED_TRANSFER" | "CLAIM" | "RECLAIM">;
356
356
  type TokenTransactionStatus = LooseUnion<"PENDING" | "CONFIRMED" | "FAILED">;
357
+ /**
358
+ * Where pushing a distribution's yield to investors stands, on a `SNAPSHOT` transaction created
359
+ * with `pushYield: true`.
360
+ *
361
+ * - `PENDING` — requested; the push runs once the snapshot confirms.
362
+ * - `SUBMITTED` — the push transaction was sent but hasn't settled yet.
363
+ * - `PUSHED` — the push transaction was mined and succeeded.
364
+ * - `FAILED` — the push failed; see `pushFailureReason`.
365
+ */
366
+ type YieldPushStatus = LooseUnion<"PENDING" | "SUBMITTED" | "PUSHED" | "FAILED">;
367
+ /**
368
+ * Outcome of a yield claim or reclaim when the call returns.
369
+ *
370
+ * - `COMPLETED` — the transaction was mined and succeeded.
371
+ * - `SUBMITTED` — the transaction was sent but hasn't settled yet. Poll
372
+ * {@link TokenizationResource.getTokenTransaction} with the result's `operationRef`; its `status`
373
+ * becomes `CONFIRMED` or `FAILED`.
374
+ */
375
+ type YieldSettlementStatus = LooseUnion<"COMPLETED" | "SUBMITTED">;
357
376
  /**
358
377
  * Chain id a token is deployed on, e.g. `84532` (Base Sepolia). The API accepts it as a number
359
378
  * or a numeric string; responses always return it as a string.
@@ -522,6 +541,11 @@ interface TokenOperationResult {
522
541
  /** Result of {@link TokenizationResource.transferToken}. */
523
542
  interface TokenTransferResult {
524
543
  tokenId: string;
544
+ /**
545
+ * `CONFIRMED` once mined. `FAILED` when the transfer was rejected or reverted on-chain; the call
546
+ * still resolves in that case, so check this rather than relying on an error. `txHash` is set
547
+ * when the failed transfer was mined.
548
+ */
525
549
  status: TokenTransactionStatus;
526
550
  transactionId: string;
527
551
  fromAddressIndex: number;
@@ -567,6 +591,24 @@ interface TokenWalletBalance {
567
591
  balance: string;
568
592
  decimals: number;
569
593
  }
594
+ interface GetPayoutBalanceParams {
595
+ chainId: TokenChainId;
596
+ walletAddress: string;
597
+ }
598
+ /**
599
+ * A wallet's balance of the chain's payout token, returned by
600
+ * {@link TokenizationResource.getPayoutBalance}. Coupons, yield and principal are all paid in it.
601
+ */
602
+ interface PayoutBalance {
603
+ chainId: string;
604
+ walletAddress: string;
605
+ payoutToken: YieldPayoutToken;
606
+ /** The payout token's contract address on this chain. */
607
+ tokenAddress: string;
608
+ /** Balance in payout-token units, as a decimal string, e.g. `"1234.56"`. */
609
+ balance: string;
610
+ decimals: number;
611
+ }
570
612
  interface ListTokenTransactionsParams {
571
613
  tokenId?: string;
572
614
  chainId?: TokenChainId;
@@ -579,7 +621,10 @@ interface ListTokenTransactionsParams {
579
621
  txHash?: string;
580
622
  operationRef?: string;
581
623
  }
582
- /** A recorded on-chain operation against a token (mint, burn, or transfer). */
624
+ /**
625
+ * A recorded on-chain operation against a token: a mint, burn or transfer, a deployment, a yield
626
+ * distribution (`SNAPSHOT`), or a yield claim (`CLAIM`) or reclaim (`RECLAIM`).
627
+ */
583
628
  interface TokenTransactionRecord {
584
629
  id: string;
585
630
  tokenId: string;
@@ -600,8 +645,18 @@ interface TokenTransactionRecord {
600
645
  memo?: string;
601
646
  createdAt?: string;
602
647
  confirmedAt?: string;
603
- /** Distribution snapshot id, set on `SNAPSHOT` transactions. */
648
+ /** Distribution snapshot id, set on `SNAPSHOT`, `CLAIM` and `RECLAIM` transactions. */
604
649
  snapshotId?: number;
650
+ /** Why the transaction failed, when `status` is `FAILED`. */
651
+ failureReason?: string;
652
+ /** Whether the distribution pushes yield to investors. Set on `SNAPSHOT` transactions. */
653
+ pushYield?: boolean;
654
+ /** Progress of the push, on `SNAPSHOT` transactions with `pushYield`. Absent when no push was requested or made. */
655
+ pushStatus?: YieldPushStatus;
656
+ /** Hash of the push transaction, once sent. */
657
+ pushTxHash?: string;
658
+ /** Why the push failed, when `pushStatus` is `FAILED`. */
659
+ pushFailureReason?: string;
605
660
  }
606
661
  interface UpdateTokenYieldParams {
607
662
  /** Yield-bearing token id. */
@@ -616,6 +671,7 @@ interface UpdateYieldResult {
616
671
  currentRate: number;
617
672
  /** Annual rate after the update, as a percentage. */
618
673
  newRate: number;
674
+ operationRef: string;
619
675
  txHash: string;
620
676
  }
621
677
  interface DistributeYieldParams {
@@ -654,12 +710,89 @@ interface RedeemPrincipalParams {
654
710
  tokenId: string;
655
711
  chainId: TokenChainId;
656
712
  }
657
- /** Result of {@link TokenizationResource.redeemPrincipal} — one transaction per redemption payout. */
713
+ /**
714
+ * Why a holder was left out of a redemption. Their principal is still owed once the cause is resolved.
715
+ *
716
+ * - `NOT_VERIFIED` — not KYC-verified in the token's identity registry.
717
+ * - `FROZEN` — the wallet is frozen.
718
+ * - `NOT_ALLOWLISTED` — removed from the compliance allowlist.
719
+ * - `SKIPPED_BY_CONTRACT` — eligible when read, but the contract skipped it when the batch executed
720
+ * (e.g. it became ineligible in between).
721
+ */
722
+ type RedemptionSkipReason = LooseUnion<"NOT_VERIFIED" | "FROZEN" | "NOT_ALLOWLISTED" | "SKIPPED_BY_CONTRACT">;
723
+ /** A holder {@link TokenizationResource.redeemPrincipal} did not redeem. */
724
+ interface RedemptionSkippedHolder {
725
+ address: string;
726
+ /** Unredeemed balance in the token's smallest unit, as an integer string. */
727
+ balance: string;
728
+ reasons: RedemptionSkipReason[];
729
+ }
730
+ /** Result of {@link TokenizationResource.redeemPrincipal}. */
658
731
  interface RedeemPrincipalResult {
659
732
  tokenId: string;
660
733
  operationRef: string;
734
+ /** Transaction records created by this run: the issuer-token burn (if any), then one per redemption batch. */
661
735
  transactionIds: string[];
736
+ /** Hashes in send order: the burn, each batch, then the seal that marks the principal repaid (if one was needed). */
662
737
  txHashes: string[];
738
+ /** Holders actually paid, from the contract's `PrincipalRedeemed` events. */
739
+ redeemedHolders: number;
740
+ /** Principal actually paid, in cNGN base units (6 decimals), as an integer string. */
741
+ paidPrincipal: string;
742
+ /** {@link paidPrincipal} as a decimal cNGN string, e.g. `"100000.0"`. */
743
+ paidPrincipalFormatted: string;
744
+ /**
745
+ * Indexes of batches whose receipt couldn't be read. Their transactions landed, but their paid amounts
746
+ * are the pre-transaction estimate rather than the on-chain events.
747
+ */
748
+ unreconciledBatches: number[];
749
+ /** Holders that were not redeemed, with their balances and why. */
750
+ skipped: RedemptionSkippedHolder[];
751
+ /** Issuer-held (treasury) tokens burned without a payout, or `null` when there were none. Frozen tokens are never burned. */
752
+ treasuryBurned: {
753
+ amount: string;
754
+ txHash: string;
755
+ } | null;
756
+ /** Supply left after the run, in the token's smallest unit, as an integer string. */
757
+ outstandingSupply: string;
758
+ /**
759
+ * `true` once supply is zero and the bond is marked principal-repaid. While `false`, the remaining
760
+ * supply belongs to {@link skipped} holders, frozen issuer tokens or the yield distributor.
761
+ */
762
+ closed: boolean;
763
+ }
764
+ interface GetNextCouponParams {
765
+ tokenId: string;
766
+ chainId: TokenChainId;
767
+ }
768
+ /**
769
+ * Where a bond stands on its coupon schedule.
770
+ *
771
+ * - `SCHEDULED` — the next coupon isn't due yet.
772
+ * - `DUE` — the coupon can be paid now with {@link TokenizationResource.payCoupon}.
773
+ * - `GRACE_EXPIRED` — the coupon was missed and its grace period has passed; it is still payable,
774
+ * but anyone can now flag the bond as defaulted.
775
+ * - `DEFAULTED` — the bond is in default; no further coupons can be scheduled.
776
+ * - `NO_MORE_COUPONS` — the schedule has run past maturity; only principal redemption remains.
777
+ * - `CLOSED` — principal has been repaid and the bond is closed.
778
+ */
779
+ type NextCouponStatus = LooseUnion<"SCHEDULED" | "DUE" | "GRACE_EXPIRED" | "DEFAULTED" | "NO_MORE_COUPONS" | "CLOSED">;
780
+ /** Result of {@link TokenizationResource.getNextCoupon}. Dates are ISO 8601 strings in UTC. */
781
+ interface NextCoupon {
782
+ tokenId: string;
783
+ chainId: string;
784
+ status: NextCouponStatus;
785
+ /** When the next coupon falls due. `null` once there are no more coupons (`NO_MORE_COUPONS` or `CLOSED`). */
786
+ nextCouponDate: string | null;
787
+ /** `nextCouponDate` plus the bond's grace period; after this a missed coupon allows a default. `null` with it. */
788
+ graceEndsAt: string | null;
789
+ /** `true` when a coupon can be paid now (`DUE` or `GRACE_EXPIRED`). */
790
+ isDue: boolean;
791
+ /** Seconds between coupons. */
792
+ couponPeriodSeconds: number;
793
+ maturityDate: string;
794
+ /** Coupon paid per whole token, in cNGN, as a decimal string. */
795
+ couponPerToken: string;
663
796
  }
664
797
  interface ReclaimUnclaimedYieldParams {
665
798
  tokenId: string;
@@ -670,16 +803,22 @@ interface ReclaimUnclaimedYieldParams {
670
803
  /** Result of {@link TokenizationResource.reclaimUnclaimedYield}. */
671
804
  interface ReclaimUnclaimedYieldResult {
672
805
  tokenId: string;
673
- /** Snapshot id, as a numeric string. */
674
- snapshotId: string;
675
- /** Amount reclaimed, as a decimal string. */
806
+ snapshotId: number;
807
+ /** Amount reclaimed, in cNGN base units (6 decimals), as an integer string. */
676
808
  reclaimed: string;
677
809
  operationRef: string;
810
+ /** Id of the `RECLAIM` transaction record. */
811
+ transactionId: string;
678
812
  txHash: string;
813
+ status: YieldSettlementStatus;
679
814
  }
680
815
  /** Result of {@link TokenizationResource.claimYield}. */
681
816
  interface YieldTxResult {
817
+ operationRef: string;
818
+ /** Id of the `CLAIM` transaction record. */
819
+ transactionId: string;
682
820
  txHash: string;
821
+ status: YieldSettlementStatus;
683
822
  }
684
823
  /** Result of {@link TokenizationResource.distributeYield} / {@link TokenizationResource.payCoupon}. */
685
824
  interface YieldOperationResult {
@@ -718,7 +857,10 @@ declare class TokenizationResource extends APIResource {
718
857
  mintToken(params: MintTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
719
858
  /** Burns units of a token from a holder address. */
720
859
  burnToken(params: BurnTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
721
- /** Transfers token units between holder addresses. */
860
+ /**
861
+ * Transfers token units between holder addresses. A transfer that is rejected or reverts
862
+ * on-chain still resolves, with `status: "FAILED"`, so check `status` rather than relying on an error.
863
+ */
722
864
  transferToken(params: TransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenTransferResult>;
723
865
  /**
724
866
  * Force-transfers token units out of a holder's address without the holder's signature
@@ -730,25 +872,57 @@ declare class TokenizationResource extends APIResource {
730
872
  registerWallet(params: RegisterTokenWalletParams, overrides?: IdempotentRequestOverrides): Promise<RegisterTokenWalletResult>;
731
873
  /** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
732
874
  getTokenHolders(params: GetTokenHoldersParams, overrides?: RequestOverrides): Promise<Page<TokenHolder>>;
733
- /** Returns a single wallet's balance of a token on a chain. */
875
+ /** Returns a single wallet's balance of a token on a chain. For its cNGN balance, use {@link getPayoutBalance}. */
734
876
  getWalletBalance(params: GetWalletBalanceParams, overrides?: RequestOverrides): Promise<TokenWalletBalance>;
877
+ /**
878
+ * Returns a wallet's balance of the chain's payout token (cNGN), in which coupons, yield and
879
+ * principal are paid. It depends only on the chain and wallet, so no token is needed.
880
+ */
881
+ getPayoutBalance(params: GetPayoutBalanceParams, overrides?: RequestOverrides): Promise<PayoutBalance>;
735
882
  /** Fetches a single token transaction by its reference. */
736
883
  getTokenTransaction(ref: string, overrides?: RequestOverrides): Promise<TokenTransactionRecord>;
737
884
  /** Returns token transactions, optionally filtered by token. */
738
885
  listTokenTransactions(params?: ListTokenTransactionsParams, overrides?: RequestOverrides): Promise<Page<TokenTransactionRecord>>;
739
- /** Updates the annual yield rate for a yield-bearing token. */
740
- updateYield(params: UpdateTokenYieldParams, overrides?: RequestOverrides): Promise<UpdateYieldResult>;
886
+ /**
887
+ * Updates the annual yield rate for a yield-bearing token. An `Idempotency-Key` is generated
888
+ * per call unless you pass your own.
889
+ */
890
+ updateYield(params: UpdateTokenYieldParams, overrides?: IdempotentRequestOverrides): Promise<UpdateYieldResult>;
741
891
  /** Funds and distributes a yield payout to holders. Unclaimed funds may be reclaimed after `reclaimAfter`. */
742
892
  distributeYield(params: DistributeYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
743
893
  /** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
744
894
  payCoupon(params: PayCouponParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
745
- /** Claims an investor's yield for a given distribution snapshot. */
895
+ /**
896
+ * Claims an investor's yield for a given distribution snapshot. `status` is `COMPLETED` once the
897
+ * claim is mined. If it's `SUBMITTED`, the outcome isn't known yet: poll
898
+ * {@link getTokenTransaction} with the result's `operationRef` until its `status` is `CONFIRMED` or `FAILED`.
899
+ */
746
900
  claimYield(params: ClaimYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
747
- /** Redeems principal to holders at maturity. */
901
+ /**
902
+ * Returns the bond's next coupon date and where it stands on its schedule. Whether a coupon is
903
+ * due is decided by the chain's clock, not yours, so check `status` (or `isDue`) rather than
904
+ * comparing `nextCouponDate` with local time. Works for paused tokens too.
905
+ *
906
+ * ```ts
907
+ * const next = await client.tokenization.getNextCoupon({ tokenId, chainId: "84532" });
908
+ * if (next.status === "DUE") await client.tokenization.payCoupon({ tokenId, chainId: "84532", ... });
909
+ * ```
910
+ */
911
+ getNextCoupon(params: GetNextCouponParams, overrides?: RequestOverrides): Promise<NextCoupon>;
912
+ /**
913
+ * Redeems principal to holders at maturity, paying from the cNGN deposited in the token contract.
914
+ * Issuer-held tokens are burned without a payout so the supply can reach zero and the bond close.
915
+ * Holders that can't be redeemed (frozen, unverified, not allowlisted) are left alone and listed in
916
+ * `skipped`; check `closed` to see whether the bond is done.
917
+ *
918
+ * If a run fails part-way, call it again: holders already redeemed are skipped, so it carries on
919
+ * where it stopped. Reusing the same `idempotencyKey` only replays the earlier response.
920
+ */
748
921
  redeemPrincipal(params: RedeemPrincipalParams, overrides?: IdempotentRequestOverrides): Promise<RedeemPrincipalResult>;
749
922
  /**
750
923
  * Returns a snapshot's unclaimed yield to the issuer once its `reclaimAfter` window has
751
- * passed. An `Idempotency-Key` is generated per call unless you pass your own.
924
+ * passed. An `Idempotency-Key` is generated per call unless you pass your own. As with
925
+ * {@link claimYield}, a `SUBMITTED` status means the outcome should be polled by `operationRef`.
752
926
  */
753
927
  reclaimUnclaimedYield(params: ReclaimUnclaimedYieldParams, overrides?: IdempotentRequestOverrides): Promise<ReclaimUnclaimedYieldResult>;
754
928
  }
@@ -1005,4 +1179,4 @@ declare function verifyIndexerWebhookSignature(options: VerifyIndexerWebhookOpti
1005
1179
  /** Generates a UUIDv4 suitable for use as an `Idempotency-Key` header value. */
1006
1180
  declare function generateIdempotencyKey(): string;
1007
1181
 
1008
- export { type AssetClass, AuthenticationError, BadRequestError, type BurnTokenParams, type Chain, type ChainType, type ClaimYieldParams, ConflictError, type CreateSubscriptionParams, type CreateTokenParams, type DeactivateWalletParams, type DistributeYieldParams, type EventCatalogEntry, type EventFamily, type EventKind, type FlatPaginatedResponse, type ForcedTransferTokenParams, type GenerateWalletsParams, type GeneratedWallet, type GetTokenHoldersParams, type GetTransactionHistoryParams, type GetWalletBalanceParams, type GetWalletByAddressIndexParams, type GetWalletByAddressParams, type GetWalletCountParams, type HdEnabledStatus, type HttpMethod, type IdempotentRequestOverrides, IndexerResource, type IndexerSubscription, type IndexerSubscriptionWithSecret, InfraAPIError, InfraAuthTokenError, InfraClient, type InfraClientOptions, InfraConnectionError, InfraConnectionTimeoutError, InfraError, type InitiateTransferParams, InternalServerError, type ListEventCatalogParams, type ListSubscriptionsParams, type ListTokenTransactionsParams, type ListTokensParams, type ListWalletsParams, type LooseUnion, type MetaPaginatedResponse, type MintTokenParams, type Network, NotFoundError, type OffsetPaginatedResponse, Page, type PayCouponParams, PaymentRequiredError, PermissionDeniedError, type QueryValue, RateLimitError, type ReclaimUnclaimedYieldParams, type ReclaimUnclaimedYieldResult, type RedeemPrincipalParams, type RedeemPrincipalResult, type RegisterTokenWalletParams, type RegisterTokenWalletResult, type RequestOptions, type RequestOverrides, ServiceUnavailableError, type SignTransactionParams, type SignTransactionRequest, type SignedTransactionResult, type SubscriptionStatus, type SupportedChain, type TokenChainDeployment, type TokenChainId, type TokenDeploymentResult, type TokenDetail, type TokenHolder, type TokenOperationResult, type TokenStatus, type TokenSummary, type TokenTransactionRecord, type TokenTransactionStatus, type TokenTransactionType, type TokenTransferResult, type TokenType, type TokenWalletBalance, TokenizationResource, type TransactionStatus, type TransferTokenParams, UnknownAPIError, UnprocessableEntityError, type UpdateSubscriptionParams, type UpdateTokenYieldParams, type UpdateYieldResult, type VerifyIndexerWebhookOptions, type VerifyWalletWebhookOptions, type Wallet, type WalletBalance, type WalletCount, WalletResource, type WalletTransaction, WebhookSignatureVerificationError, type YieldDayCount, type YieldOperationResult, type YieldParams, type YieldPayoutToken, type YieldTxResult, generateIdempotencyKey, verifyIndexerWebhookSignature, verifyWalletWebhookSignature };
1182
+ export { type AssetClass, AuthenticationError, BadRequestError, type BurnTokenParams, type Chain, type ChainType, type ClaimYieldParams, ConflictError, type CreateSubscriptionParams, type CreateTokenParams, type DeactivateWalletParams, type DistributeYieldParams, type EventCatalogEntry, type EventFamily, type EventKind, type FlatPaginatedResponse, type ForcedTransferTokenParams, type GenerateWalletsParams, type GeneratedWallet, type GetNextCouponParams, type GetPayoutBalanceParams, type GetTokenHoldersParams, type GetTransactionHistoryParams, type GetWalletBalanceParams, type GetWalletByAddressIndexParams, type GetWalletByAddressParams, type GetWalletCountParams, type HdEnabledStatus, type HttpMethod, type IdempotentRequestOverrides, IndexerResource, type IndexerSubscription, type IndexerSubscriptionWithSecret, InfraAPIError, InfraAuthTokenError, InfraClient, type InfraClientOptions, InfraConnectionError, InfraConnectionTimeoutError, InfraError, type InitiateTransferParams, InternalServerError, type ListEventCatalogParams, type ListSubscriptionsParams, type ListTokenTransactionsParams, type ListTokensParams, type ListWalletsParams, type LooseUnion, type MetaPaginatedResponse, type MintTokenParams, type Network, type NextCoupon, type NextCouponStatus, NotFoundError, type OffsetPaginatedResponse, Page, type PayCouponParams, PaymentRequiredError, type PayoutBalance, PermissionDeniedError, type QueryValue, RateLimitError, type ReclaimUnclaimedYieldParams, type ReclaimUnclaimedYieldResult, type RedeemPrincipalParams, type RedeemPrincipalResult, type RedemptionSkipReason, type RedemptionSkippedHolder, type RegisterTokenWalletParams, type RegisterTokenWalletResult, type RequestOptions, type RequestOverrides, ServiceUnavailableError, type SignTransactionParams, type SignTransactionRequest, type SignedTransactionResult, type SubscriptionStatus, type SupportedChain, type TokenChainDeployment, type TokenChainId, type TokenDeploymentResult, type TokenDetail, type TokenHolder, type TokenOperationResult, type TokenStatus, type TokenSummary, type TokenTransactionRecord, type TokenTransactionStatus, type TokenTransactionType, type TokenTransferResult, type TokenType, type TokenWalletBalance, TokenizationResource, type TransactionStatus, type TransferTokenParams, UnknownAPIError, UnprocessableEntityError, type UpdateSubscriptionParams, type UpdateTokenYieldParams, type UpdateYieldResult, type VerifyIndexerWebhookOptions, type VerifyWalletWebhookOptions, type Wallet, type WalletBalance, type WalletCount, WalletResource, type WalletTransaction, WebhookSignatureVerificationError, type YieldDayCount, type YieldOperationResult, type YieldParams, type YieldPayoutToken, type YieldPushStatus, type YieldSettlementStatus, type YieldTxResult, generateIdempotencyKey, verifyIndexerWebhookSignature, verifyWalletWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -352,8 +352,27 @@ declare class WalletResource extends APIResource {
352
352
 
353
353
  type TokenType = "ASSET" | "YIELD_BEARING";
354
354
  type TokenStatus = LooseUnion<"PENDING" | "ACTIVE" | "PAUSED" | "RETIRED">;
355
- type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER" | "DEPLOY" | "REDEEM" | "SNAPSHOT">;
355
+ type TokenTransactionType = LooseUnion<"MINT" | "BURN" | "TRANSFER" | "DEPLOY" | "REDEEM" | "SNAPSHOT" | "FORCED_TRANSFER" | "CLAIM" | "RECLAIM">;
356
356
  type TokenTransactionStatus = LooseUnion<"PENDING" | "CONFIRMED" | "FAILED">;
357
+ /**
358
+ * Where pushing a distribution's yield to investors stands, on a `SNAPSHOT` transaction created
359
+ * with `pushYield: true`.
360
+ *
361
+ * - `PENDING` — requested; the push runs once the snapshot confirms.
362
+ * - `SUBMITTED` — the push transaction was sent but hasn't settled yet.
363
+ * - `PUSHED` — the push transaction was mined and succeeded.
364
+ * - `FAILED` — the push failed; see `pushFailureReason`.
365
+ */
366
+ type YieldPushStatus = LooseUnion<"PENDING" | "SUBMITTED" | "PUSHED" | "FAILED">;
367
+ /**
368
+ * Outcome of a yield claim or reclaim when the call returns.
369
+ *
370
+ * - `COMPLETED` — the transaction was mined and succeeded.
371
+ * - `SUBMITTED` — the transaction was sent but hasn't settled yet. Poll
372
+ * {@link TokenizationResource.getTokenTransaction} with the result's `operationRef`; its `status`
373
+ * becomes `CONFIRMED` or `FAILED`.
374
+ */
375
+ type YieldSettlementStatus = LooseUnion<"COMPLETED" | "SUBMITTED">;
357
376
  /**
358
377
  * Chain id a token is deployed on, e.g. `84532` (Base Sepolia). The API accepts it as a number
359
378
  * or a numeric string; responses always return it as a string.
@@ -522,6 +541,11 @@ interface TokenOperationResult {
522
541
  /** Result of {@link TokenizationResource.transferToken}. */
523
542
  interface TokenTransferResult {
524
543
  tokenId: string;
544
+ /**
545
+ * `CONFIRMED` once mined. `FAILED` when the transfer was rejected or reverted on-chain; the call
546
+ * still resolves in that case, so check this rather than relying on an error. `txHash` is set
547
+ * when the failed transfer was mined.
548
+ */
525
549
  status: TokenTransactionStatus;
526
550
  transactionId: string;
527
551
  fromAddressIndex: number;
@@ -567,6 +591,24 @@ interface TokenWalletBalance {
567
591
  balance: string;
568
592
  decimals: number;
569
593
  }
594
+ interface GetPayoutBalanceParams {
595
+ chainId: TokenChainId;
596
+ walletAddress: string;
597
+ }
598
+ /**
599
+ * A wallet's balance of the chain's payout token, returned by
600
+ * {@link TokenizationResource.getPayoutBalance}. Coupons, yield and principal are all paid in it.
601
+ */
602
+ interface PayoutBalance {
603
+ chainId: string;
604
+ walletAddress: string;
605
+ payoutToken: YieldPayoutToken;
606
+ /** The payout token's contract address on this chain. */
607
+ tokenAddress: string;
608
+ /** Balance in payout-token units, as a decimal string, e.g. `"1234.56"`. */
609
+ balance: string;
610
+ decimals: number;
611
+ }
570
612
  interface ListTokenTransactionsParams {
571
613
  tokenId?: string;
572
614
  chainId?: TokenChainId;
@@ -579,7 +621,10 @@ interface ListTokenTransactionsParams {
579
621
  txHash?: string;
580
622
  operationRef?: string;
581
623
  }
582
- /** A recorded on-chain operation against a token (mint, burn, or transfer). */
624
+ /**
625
+ * A recorded on-chain operation against a token: a mint, burn or transfer, a deployment, a yield
626
+ * distribution (`SNAPSHOT`), or a yield claim (`CLAIM`) or reclaim (`RECLAIM`).
627
+ */
583
628
  interface TokenTransactionRecord {
584
629
  id: string;
585
630
  tokenId: string;
@@ -600,8 +645,18 @@ interface TokenTransactionRecord {
600
645
  memo?: string;
601
646
  createdAt?: string;
602
647
  confirmedAt?: string;
603
- /** Distribution snapshot id, set on `SNAPSHOT` transactions. */
648
+ /** Distribution snapshot id, set on `SNAPSHOT`, `CLAIM` and `RECLAIM` transactions. */
604
649
  snapshotId?: number;
650
+ /** Why the transaction failed, when `status` is `FAILED`. */
651
+ failureReason?: string;
652
+ /** Whether the distribution pushes yield to investors. Set on `SNAPSHOT` transactions. */
653
+ pushYield?: boolean;
654
+ /** Progress of the push, on `SNAPSHOT` transactions with `pushYield`. Absent when no push was requested or made. */
655
+ pushStatus?: YieldPushStatus;
656
+ /** Hash of the push transaction, once sent. */
657
+ pushTxHash?: string;
658
+ /** Why the push failed, when `pushStatus` is `FAILED`. */
659
+ pushFailureReason?: string;
605
660
  }
606
661
  interface UpdateTokenYieldParams {
607
662
  /** Yield-bearing token id. */
@@ -616,6 +671,7 @@ interface UpdateYieldResult {
616
671
  currentRate: number;
617
672
  /** Annual rate after the update, as a percentage. */
618
673
  newRate: number;
674
+ operationRef: string;
619
675
  txHash: string;
620
676
  }
621
677
  interface DistributeYieldParams {
@@ -654,12 +710,89 @@ interface RedeemPrincipalParams {
654
710
  tokenId: string;
655
711
  chainId: TokenChainId;
656
712
  }
657
- /** Result of {@link TokenizationResource.redeemPrincipal} — one transaction per redemption payout. */
713
+ /**
714
+ * Why a holder was left out of a redemption. Their principal is still owed once the cause is resolved.
715
+ *
716
+ * - `NOT_VERIFIED` — not KYC-verified in the token's identity registry.
717
+ * - `FROZEN` — the wallet is frozen.
718
+ * - `NOT_ALLOWLISTED` — removed from the compliance allowlist.
719
+ * - `SKIPPED_BY_CONTRACT` — eligible when read, but the contract skipped it when the batch executed
720
+ * (e.g. it became ineligible in between).
721
+ */
722
+ type RedemptionSkipReason = LooseUnion<"NOT_VERIFIED" | "FROZEN" | "NOT_ALLOWLISTED" | "SKIPPED_BY_CONTRACT">;
723
+ /** A holder {@link TokenizationResource.redeemPrincipal} did not redeem. */
724
+ interface RedemptionSkippedHolder {
725
+ address: string;
726
+ /** Unredeemed balance in the token's smallest unit, as an integer string. */
727
+ balance: string;
728
+ reasons: RedemptionSkipReason[];
729
+ }
730
+ /** Result of {@link TokenizationResource.redeemPrincipal}. */
658
731
  interface RedeemPrincipalResult {
659
732
  tokenId: string;
660
733
  operationRef: string;
734
+ /** Transaction records created by this run: the issuer-token burn (if any), then one per redemption batch. */
661
735
  transactionIds: string[];
736
+ /** Hashes in send order: the burn, each batch, then the seal that marks the principal repaid (if one was needed). */
662
737
  txHashes: string[];
738
+ /** Holders actually paid, from the contract's `PrincipalRedeemed` events. */
739
+ redeemedHolders: number;
740
+ /** Principal actually paid, in cNGN base units (6 decimals), as an integer string. */
741
+ paidPrincipal: string;
742
+ /** {@link paidPrincipal} as a decimal cNGN string, e.g. `"100000.0"`. */
743
+ paidPrincipalFormatted: string;
744
+ /**
745
+ * Indexes of batches whose receipt couldn't be read. Their transactions landed, but their paid amounts
746
+ * are the pre-transaction estimate rather than the on-chain events.
747
+ */
748
+ unreconciledBatches: number[];
749
+ /** Holders that were not redeemed, with their balances and why. */
750
+ skipped: RedemptionSkippedHolder[];
751
+ /** Issuer-held (treasury) tokens burned without a payout, or `null` when there were none. Frozen tokens are never burned. */
752
+ treasuryBurned: {
753
+ amount: string;
754
+ txHash: string;
755
+ } | null;
756
+ /** Supply left after the run, in the token's smallest unit, as an integer string. */
757
+ outstandingSupply: string;
758
+ /**
759
+ * `true` once supply is zero and the bond is marked principal-repaid. While `false`, the remaining
760
+ * supply belongs to {@link skipped} holders, frozen issuer tokens or the yield distributor.
761
+ */
762
+ closed: boolean;
763
+ }
764
+ interface GetNextCouponParams {
765
+ tokenId: string;
766
+ chainId: TokenChainId;
767
+ }
768
+ /**
769
+ * Where a bond stands on its coupon schedule.
770
+ *
771
+ * - `SCHEDULED` — the next coupon isn't due yet.
772
+ * - `DUE` — the coupon can be paid now with {@link TokenizationResource.payCoupon}.
773
+ * - `GRACE_EXPIRED` — the coupon was missed and its grace period has passed; it is still payable,
774
+ * but anyone can now flag the bond as defaulted.
775
+ * - `DEFAULTED` — the bond is in default; no further coupons can be scheduled.
776
+ * - `NO_MORE_COUPONS` — the schedule has run past maturity; only principal redemption remains.
777
+ * - `CLOSED` — principal has been repaid and the bond is closed.
778
+ */
779
+ type NextCouponStatus = LooseUnion<"SCHEDULED" | "DUE" | "GRACE_EXPIRED" | "DEFAULTED" | "NO_MORE_COUPONS" | "CLOSED">;
780
+ /** Result of {@link TokenizationResource.getNextCoupon}. Dates are ISO 8601 strings in UTC. */
781
+ interface NextCoupon {
782
+ tokenId: string;
783
+ chainId: string;
784
+ status: NextCouponStatus;
785
+ /** When the next coupon falls due. `null` once there are no more coupons (`NO_MORE_COUPONS` or `CLOSED`). */
786
+ nextCouponDate: string | null;
787
+ /** `nextCouponDate` plus the bond's grace period; after this a missed coupon allows a default. `null` with it. */
788
+ graceEndsAt: string | null;
789
+ /** `true` when a coupon can be paid now (`DUE` or `GRACE_EXPIRED`). */
790
+ isDue: boolean;
791
+ /** Seconds between coupons. */
792
+ couponPeriodSeconds: number;
793
+ maturityDate: string;
794
+ /** Coupon paid per whole token, in cNGN, as a decimal string. */
795
+ couponPerToken: string;
663
796
  }
664
797
  interface ReclaimUnclaimedYieldParams {
665
798
  tokenId: string;
@@ -670,16 +803,22 @@ interface ReclaimUnclaimedYieldParams {
670
803
  /** Result of {@link TokenizationResource.reclaimUnclaimedYield}. */
671
804
  interface ReclaimUnclaimedYieldResult {
672
805
  tokenId: string;
673
- /** Snapshot id, as a numeric string. */
674
- snapshotId: string;
675
- /** Amount reclaimed, as a decimal string. */
806
+ snapshotId: number;
807
+ /** Amount reclaimed, in cNGN base units (6 decimals), as an integer string. */
676
808
  reclaimed: string;
677
809
  operationRef: string;
810
+ /** Id of the `RECLAIM` transaction record. */
811
+ transactionId: string;
678
812
  txHash: string;
813
+ status: YieldSettlementStatus;
679
814
  }
680
815
  /** Result of {@link TokenizationResource.claimYield}. */
681
816
  interface YieldTxResult {
817
+ operationRef: string;
818
+ /** Id of the `CLAIM` transaction record. */
819
+ transactionId: string;
682
820
  txHash: string;
821
+ status: YieldSettlementStatus;
683
822
  }
684
823
  /** Result of {@link TokenizationResource.distributeYield} / {@link TokenizationResource.payCoupon}. */
685
824
  interface YieldOperationResult {
@@ -718,7 +857,10 @@ declare class TokenizationResource extends APIResource {
718
857
  mintToken(params: MintTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
719
858
  /** Burns units of a token from a holder address. */
720
859
  burnToken(params: BurnTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
721
- /** Transfers token units between holder addresses. */
860
+ /**
861
+ * Transfers token units between holder addresses. A transfer that is rejected or reverts
862
+ * on-chain still resolves, with `status: "FAILED"`, so check `status` rather than relying on an error.
863
+ */
722
864
  transferToken(params: TransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenTransferResult>;
723
865
  /**
724
866
  * Force-transfers token units out of a holder's address without the holder's signature
@@ -730,25 +872,57 @@ declare class TokenizationResource extends APIResource {
730
872
  registerWallet(params: RegisterTokenWalletParams, overrides?: IdempotentRequestOverrides): Promise<RegisterTokenWalletResult>;
731
873
  /** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
732
874
  getTokenHolders(params: GetTokenHoldersParams, overrides?: RequestOverrides): Promise<Page<TokenHolder>>;
733
- /** Returns a single wallet's balance of a token on a chain. */
875
+ /** Returns a single wallet's balance of a token on a chain. For its cNGN balance, use {@link getPayoutBalance}. */
734
876
  getWalletBalance(params: GetWalletBalanceParams, overrides?: RequestOverrides): Promise<TokenWalletBalance>;
877
+ /**
878
+ * Returns a wallet's balance of the chain's payout token (cNGN), in which coupons, yield and
879
+ * principal are paid. It depends only on the chain and wallet, so no token is needed.
880
+ */
881
+ getPayoutBalance(params: GetPayoutBalanceParams, overrides?: RequestOverrides): Promise<PayoutBalance>;
735
882
  /** Fetches a single token transaction by its reference. */
736
883
  getTokenTransaction(ref: string, overrides?: RequestOverrides): Promise<TokenTransactionRecord>;
737
884
  /** Returns token transactions, optionally filtered by token. */
738
885
  listTokenTransactions(params?: ListTokenTransactionsParams, overrides?: RequestOverrides): Promise<Page<TokenTransactionRecord>>;
739
- /** Updates the annual yield rate for a yield-bearing token. */
740
- updateYield(params: UpdateTokenYieldParams, overrides?: RequestOverrides): Promise<UpdateYieldResult>;
886
+ /**
887
+ * Updates the annual yield rate for a yield-bearing token. An `Idempotency-Key` is generated
888
+ * per call unless you pass your own.
889
+ */
890
+ updateYield(params: UpdateTokenYieldParams, overrides?: IdempotentRequestOverrides): Promise<UpdateYieldResult>;
741
891
  /** Funds and distributes a yield payout to holders. Unclaimed funds may be reclaimed after `reclaimAfter`. */
742
892
  distributeYield(params: DistributeYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
743
893
  /** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
744
894
  payCoupon(params: PayCouponParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
745
- /** Claims an investor's yield for a given distribution snapshot. */
895
+ /**
896
+ * Claims an investor's yield for a given distribution snapshot. `status` is `COMPLETED` once the
897
+ * claim is mined. If it's `SUBMITTED`, the outcome isn't known yet: poll
898
+ * {@link getTokenTransaction} with the result's `operationRef` until its `status` is `CONFIRMED` or `FAILED`.
899
+ */
746
900
  claimYield(params: ClaimYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
747
- /** Redeems principal to holders at maturity. */
901
+ /**
902
+ * Returns the bond's next coupon date and where it stands on its schedule. Whether a coupon is
903
+ * due is decided by the chain's clock, not yours, so check `status` (or `isDue`) rather than
904
+ * comparing `nextCouponDate` with local time. Works for paused tokens too.
905
+ *
906
+ * ```ts
907
+ * const next = await client.tokenization.getNextCoupon({ tokenId, chainId: "84532" });
908
+ * if (next.status === "DUE") await client.tokenization.payCoupon({ tokenId, chainId: "84532", ... });
909
+ * ```
910
+ */
911
+ getNextCoupon(params: GetNextCouponParams, overrides?: RequestOverrides): Promise<NextCoupon>;
912
+ /**
913
+ * Redeems principal to holders at maturity, paying from the cNGN deposited in the token contract.
914
+ * Issuer-held tokens are burned without a payout so the supply can reach zero and the bond close.
915
+ * Holders that can't be redeemed (frozen, unverified, not allowlisted) are left alone and listed in
916
+ * `skipped`; check `closed` to see whether the bond is done.
917
+ *
918
+ * If a run fails part-way, call it again: holders already redeemed are skipped, so it carries on
919
+ * where it stopped. Reusing the same `idempotencyKey` only replays the earlier response.
920
+ */
748
921
  redeemPrincipal(params: RedeemPrincipalParams, overrides?: IdempotentRequestOverrides): Promise<RedeemPrincipalResult>;
749
922
  /**
750
923
  * Returns a snapshot's unclaimed yield to the issuer once its `reclaimAfter` window has
751
- * passed. An `Idempotency-Key` is generated per call unless you pass your own.
924
+ * passed. An `Idempotency-Key` is generated per call unless you pass your own. As with
925
+ * {@link claimYield}, a `SUBMITTED` status means the outcome should be polled by `operationRef`.
752
926
  */
753
927
  reclaimUnclaimedYield(params: ReclaimUnclaimedYieldParams, overrides?: IdempotentRequestOverrides): Promise<ReclaimUnclaimedYieldResult>;
754
928
  }
@@ -1005,4 +1179,4 @@ declare function verifyIndexerWebhookSignature(options: VerifyIndexerWebhookOpti
1005
1179
  /** Generates a UUIDv4 suitable for use as an `Idempotency-Key` header value. */
1006
1180
  declare function generateIdempotencyKey(): string;
1007
1181
 
1008
- export { type AssetClass, AuthenticationError, BadRequestError, type BurnTokenParams, type Chain, type ChainType, type ClaimYieldParams, ConflictError, type CreateSubscriptionParams, type CreateTokenParams, type DeactivateWalletParams, type DistributeYieldParams, type EventCatalogEntry, type EventFamily, type EventKind, type FlatPaginatedResponse, type ForcedTransferTokenParams, type GenerateWalletsParams, type GeneratedWallet, type GetTokenHoldersParams, type GetTransactionHistoryParams, type GetWalletBalanceParams, type GetWalletByAddressIndexParams, type GetWalletByAddressParams, type GetWalletCountParams, type HdEnabledStatus, type HttpMethod, type IdempotentRequestOverrides, IndexerResource, type IndexerSubscription, type IndexerSubscriptionWithSecret, InfraAPIError, InfraAuthTokenError, InfraClient, type InfraClientOptions, InfraConnectionError, InfraConnectionTimeoutError, InfraError, type InitiateTransferParams, InternalServerError, type ListEventCatalogParams, type ListSubscriptionsParams, type ListTokenTransactionsParams, type ListTokensParams, type ListWalletsParams, type LooseUnion, type MetaPaginatedResponse, type MintTokenParams, type Network, NotFoundError, type OffsetPaginatedResponse, Page, type PayCouponParams, PaymentRequiredError, PermissionDeniedError, type QueryValue, RateLimitError, type ReclaimUnclaimedYieldParams, type ReclaimUnclaimedYieldResult, type RedeemPrincipalParams, type RedeemPrincipalResult, type RegisterTokenWalletParams, type RegisterTokenWalletResult, type RequestOptions, type RequestOverrides, ServiceUnavailableError, type SignTransactionParams, type SignTransactionRequest, type SignedTransactionResult, type SubscriptionStatus, type SupportedChain, type TokenChainDeployment, type TokenChainId, type TokenDeploymentResult, type TokenDetail, type TokenHolder, type TokenOperationResult, type TokenStatus, type TokenSummary, type TokenTransactionRecord, type TokenTransactionStatus, type TokenTransactionType, type TokenTransferResult, type TokenType, type TokenWalletBalance, TokenizationResource, type TransactionStatus, type TransferTokenParams, UnknownAPIError, UnprocessableEntityError, type UpdateSubscriptionParams, type UpdateTokenYieldParams, type UpdateYieldResult, type VerifyIndexerWebhookOptions, type VerifyWalletWebhookOptions, type Wallet, type WalletBalance, type WalletCount, WalletResource, type WalletTransaction, WebhookSignatureVerificationError, type YieldDayCount, type YieldOperationResult, type YieldParams, type YieldPayoutToken, type YieldTxResult, generateIdempotencyKey, verifyIndexerWebhookSignature, verifyWalletWebhookSignature };
1182
+ export { type AssetClass, AuthenticationError, BadRequestError, type BurnTokenParams, type Chain, type ChainType, type ClaimYieldParams, ConflictError, type CreateSubscriptionParams, type CreateTokenParams, type DeactivateWalletParams, type DistributeYieldParams, type EventCatalogEntry, type EventFamily, type EventKind, type FlatPaginatedResponse, type ForcedTransferTokenParams, type GenerateWalletsParams, type GeneratedWallet, type GetNextCouponParams, type GetPayoutBalanceParams, type GetTokenHoldersParams, type GetTransactionHistoryParams, type GetWalletBalanceParams, type GetWalletByAddressIndexParams, type GetWalletByAddressParams, type GetWalletCountParams, type HdEnabledStatus, type HttpMethod, type IdempotentRequestOverrides, IndexerResource, type IndexerSubscription, type IndexerSubscriptionWithSecret, InfraAPIError, InfraAuthTokenError, InfraClient, type InfraClientOptions, InfraConnectionError, InfraConnectionTimeoutError, InfraError, type InitiateTransferParams, InternalServerError, type ListEventCatalogParams, type ListSubscriptionsParams, type ListTokenTransactionsParams, type ListTokensParams, type ListWalletsParams, type LooseUnion, type MetaPaginatedResponse, type MintTokenParams, type Network, type NextCoupon, type NextCouponStatus, NotFoundError, type OffsetPaginatedResponse, Page, type PayCouponParams, PaymentRequiredError, type PayoutBalance, PermissionDeniedError, type QueryValue, RateLimitError, type ReclaimUnclaimedYieldParams, type ReclaimUnclaimedYieldResult, type RedeemPrincipalParams, type RedeemPrincipalResult, type RedemptionSkipReason, type RedemptionSkippedHolder, type RegisterTokenWalletParams, type RegisterTokenWalletResult, type RequestOptions, type RequestOverrides, ServiceUnavailableError, type SignTransactionParams, type SignTransactionRequest, type SignedTransactionResult, type SubscriptionStatus, type SupportedChain, type TokenChainDeployment, type TokenChainId, type TokenDeploymentResult, type TokenDetail, type TokenHolder, type TokenOperationResult, type TokenStatus, type TokenSummary, type TokenTransactionRecord, type TokenTransactionStatus, type TokenTransactionType, type TokenTransferResult, type TokenType, type TokenWalletBalance, TokenizationResource, type TransactionStatus, type TransferTokenParams, UnknownAPIError, UnprocessableEntityError, type UpdateSubscriptionParams, type UpdateTokenYieldParams, type UpdateYieldResult, type VerifyIndexerWebhookOptions, type VerifyWalletWebhookOptions, type Wallet, type WalletBalance, type WalletCount, WalletResource, type WalletTransaction, WebhookSignatureVerificationError, type YieldDayCount, type YieldOperationResult, type YieldParams, type YieldPayoutToken, type YieldPushStatus, type YieldSettlementStatus, type YieldTxResult, generateIdempotencyKey, verifyIndexerWebhookSignature, verifyWalletWebhookSignature };