infra-sdk-typescript 0.4.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" | "FORCED_TRANSFER">;
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;
@@ -566,8 +590,24 @@ interface TokenWalletBalance {
566
590
  /** Balance in token units, as a decimal string. */
567
591
  balance: string;
568
592
  decimals: number;
569
- /** The wallet's cNGN (payout token) balance, as a decimal string. Coupons, yield and principal are paid in cNGN. */
570
- cNgnBalance: string;
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;
571
611
  }
572
612
  interface ListTokenTransactionsParams {
573
613
  tokenId?: string;
@@ -581,7 +621,10 @@ interface ListTokenTransactionsParams {
581
621
  txHash?: string;
582
622
  operationRef?: string;
583
623
  }
584
- /** 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
+ */
585
628
  interface TokenTransactionRecord {
586
629
  id: string;
587
630
  tokenId: string;
@@ -602,8 +645,18 @@ interface TokenTransactionRecord {
602
645
  memo?: string;
603
646
  createdAt?: string;
604
647
  confirmedAt?: string;
605
- /** Distribution snapshot id, set on `SNAPSHOT` transactions. */
648
+ /** Distribution snapshot id, set on `SNAPSHOT`, `CLAIM` and `RECLAIM` transactions. */
606
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;
607
660
  }
608
661
  interface UpdateTokenYieldParams {
609
662
  /** Yield-bearing token id. */
@@ -750,17 +803,22 @@ interface ReclaimUnclaimedYieldParams {
750
803
  /** Result of {@link TokenizationResource.reclaimUnclaimedYield}. */
751
804
  interface ReclaimUnclaimedYieldResult {
752
805
  tokenId: string;
753
- /** Snapshot id, as a numeric string. */
754
- snapshotId: string;
755
- /** Amount reclaimed, as a decimal string. */
806
+ snapshotId: number;
807
+ /** Amount reclaimed, in cNGN base units (6 decimals), as an integer string. */
756
808
  reclaimed: string;
757
809
  operationRef: string;
810
+ /** Id of the `RECLAIM` transaction record. */
811
+ transactionId: string;
758
812
  txHash: string;
813
+ status: YieldSettlementStatus;
759
814
  }
760
815
  /** Result of {@link TokenizationResource.claimYield}. */
761
816
  interface YieldTxResult {
762
817
  operationRef: string;
818
+ /** Id of the `CLAIM` transaction record. */
819
+ transactionId: string;
763
820
  txHash: string;
821
+ status: YieldSettlementStatus;
764
822
  }
765
823
  /** Result of {@link TokenizationResource.distributeYield} / {@link TokenizationResource.payCoupon}. */
766
824
  interface YieldOperationResult {
@@ -799,7 +857,10 @@ declare class TokenizationResource extends APIResource {
799
857
  mintToken(params: MintTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
800
858
  /** Burns units of a token from a holder address. */
801
859
  burnToken(params: BurnTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
802
- /** 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
+ */
803
864
  transferToken(params: TransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenTransferResult>;
804
865
  /**
805
866
  * Force-transfers token units out of a holder's address without the holder's signature
@@ -811,8 +872,13 @@ declare class TokenizationResource extends APIResource {
811
872
  registerWallet(params: RegisterTokenWalletParams, overrides?: IdempotentRequestOverrides): Promise<RegisterTokenWalletResult>;
812
873
  /** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
813
874
  getTokenHolders(params: GetTokenHoldersParams, overrides?: RequestOverrides): Promise<Page<TokenHolder>>;
814
- /** Returns a single wallet's balance of a token on a chain, plus its cNGN (payout token) balance. */
875
+ /** Returns a single wallet's balance of a token on a chain. For its cNGN balance, use {@link getPayoutBalance}. */
815
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>;
816
882
  /** Fetches a single token transaction by its reference. */
817
883
  getTokenTransaction(ref: string, overrides?: RequestOverrides): Promise<TokenTransactionRecord>;
818
884
  /** Returns token transactions, optionally filtered by token. */
@@ -826,7 +892,11 @@ declare class TokenizationResource extends APIResource {
826
892
  distributeYield(params: DistributeYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
827
893
  /** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
828
894
  payCoupon(params: PayCouponParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
829
- /** 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
+ */
830
900
  claimYield(params: ClaimYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
831
901
  /**
832
902
  * Returns the bond's next coupon date and where it stands on its schedule. Whether a coupon is
@@ -851,7 +921,8 @@ declare class TokenizationResource extends APIResource {
851
921
  redeemPrincipal(params: RedeemPrincipalParams, overrides?: IdempotentRequestOverrides): Promise<RedeemPrincipalResult>;
852
922
  /**
853
923
  * Returns a snapshot's unclaimed yield to the issuer once its `reclaimAfter` window has
854
- * 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`.
855
926
  */
856
927
  reclaimUnclaimedYield(params: ReclaimUnclaimedYieldParams, overrides?: IdempotentRequestOverrides): Promise<ReclaimUnclaimedYieldResult>;
857
928
  }
@@ -1108,4 +1179,4 @@ declare function verifyIndexerWebhookSignature(options: VerifyIndexerWebhookOpti
1108
1179
  /** Generates a UUIDv4 suitable for use as an `Idempotency-Key` header value. */
1109
1180
  declare function generateIdempotencyKey(): string;
1110
1181
 
1111
- 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 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, 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 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" | "FORCED_TRANSFER">;
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;
@@ -566,8 +590,24 @@ interface TokenWalletBalance {
566
590
  /** Balance in token units, as a decimal string. */
567
591
  balance: string;
568
592
  decimals: number;
569
- /** The wallet's cNGN (payout token) balance, as a decimal string. Coupons, yield and principal are paid in cNGN. */
570
- cNgnBalance: string;
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;
571
611
  }
572
612
  interface ListTokenTransactionsParams {
573
613
  tokenId?: string;
@@ -581,7 +621,10 @@ interface ListTokenTransactionsParams {
581
621
  txHash?: string;
582
622
  operationRef?: string;
583
623
  }
584
- /** 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
+ */
585
628
  interface TokenTransactionRecord {
586
629
  id: string;
587
630
  tokenId: string;
@@ -602,8 +645,18 @@ interface TokenTransactionRecord {
602
645
  memo?: string;
603
646
  createdAt?: string;
604
647
  confirmedAt?: string;
605
- /** Distribution snapshot id, set on `SNAPSHOT` transactions. */
648
+ /** Distribution snapshot id, set on `SNAPSHOT`, `CLAIM` and `RECLAIM` transactions. */
606
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;
607
660
  }
608
661
  interface UpdateTokenYieldParams {
609
662
  /** Yield-bearing token id. */
@@ -750,17 +803,22 @@ interface ReclaimUnclaimedYieldParams {
750
803
  /** Result of {@link TokenizationResource.reclaimUnclaimedYield}. */
751
804
  interface ReclaimUnclaimedYieldResult {
752
805
  tokenId: string;
753
- /** Snapshot id, as a numeric string. */
754
- snapshotId: string;
755
- /** Amount reclaimed, as a decimal string. */
806
+ snapshotId: number;
807
+ /** Amount reclaimed, in cNGN base units (6 decimals), as an integer string. */
756
808
  reclaimed: string;
757
809
  operationRef: string;
810
+ /** Id of the `RECLAIM` transaction record. */
811
+ transactionId: string;
758
812
  txHash: string;
813
+ status: YieldSettlementStatus;
759
814
  }
760
815
  /** Result of {@link TokenizationResource.claimYield}. */
761
816
  interface YieldTxResult {
762
817
  operationRef: string;
818
+ /** Id of the `CLAIM` transaction record. */
819
+ transactionId: string;
763
820
  txHash: string;
821
+ status: YieldSettlementStatus;
764
822
  }
765
823
  /** Result of {@link TokenizationResource.distributeYield} / {@link TokenizationResource.payCoupon}. */
766
824
  interface YieldOperationResult {
@@ -799,7 +857,10 @@ declare class TokenizationResource extends APIResource {
799
857
  mintToken(params: MintTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
800
858
  /** Burns units of a token from a holder address. */
801
859
  burnToken(params: BurnTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenOperationResult>;
802
- /** 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
+ */
803
864
  transferToken(params: TransferTokenParams, overrides?: IdempotentRequestOverrides): Promise<TokenTransferResult>;
804
865
  /**
805
866
  * Force-transfers token units out of a holder's address without the holder's signature
@@ -811,8 +872,13 @@ declare class TokenizationResource extends APIResource {
811
872
  registerWallet(params: RegisterTokenWalletParams, overrides?: IdempotentRequestOverrides): Promise<RegisterTokenWalletResult>;
812
873
  /** Returns the paginated list of holder wallet addresses and balances for a token on a chain. */
813
874
  getTokenHolders(params: GetTokenHoldersParams, overrides?: RequestOverrides): Promise<Page<TokenHolder>>;
814
- /** Returns a single wallet's balance of a token on a chain, plus its cNGN (payout token) balance. */
875
+ /** Returns a single wallet's balance of a token on a chain. For its cNGN balance, use {@link getPayoutBalance}. */
815
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>;
816
882
  /** Fetches a single token transaction by its reference. */
817
883
  getTokenTransaction(ref: string, overrides?: RequestOverrides): Promise<TokenTransactionRecord>;
818
884
  /** Returns token transactions, optionally filtered by token. */
@@ -826,7 +892,11 @@ declare class TokenizationResource extends APIResource {
826
892
  distributeYield(params: DistributeYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
827
893
  /** Pays the scheduled coupon for a yield-bearing token. Set `pushYield` to push funds rather than let investors claim. */
828
894
  payCoupon(params: PayCouponParams, overrides?: IdempotentRequestOverrides): Promise<YieldOperationResult>;
829
- /** 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
+ */
830
900
  claimYield(params: ClaimYieldParams, overrides?: IdempotentRequestOverrides): Promise<YieldTxResult>;
831
901
  /**
832
902
  * Returns the bond's next coupon date and where it stands on its schedule. Whether a coupon is
@@ -851,7 +921,8 @@ declare class TokenizationResource extends APIResource {
851
921
  redeemPrincipal(params: RedeemPrincipalParams, overrides?: IdempotentRequestOverrides): Promise<RedeemPrincipalResult>;
852
922
  /**
853
923
  * Returns a snapshot's unclaimed yield to the issuer once its `reclaimAfter` window has
854
- * 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`.
855
926
  */
856
927
  reclaimUnclaimedYield(params: ReclaimUnclaimedYieldParams, overrides?: IdempotentRequestOverrides): Promise<ReclaimUnclaimedYieldResult>;
857
928
  }
@@ -1108,4 +1179,4 @@ declare function verifyIndexerWebhookSignature(options: VerifyIndexerWebhookOpti
1108
1179
  /** Generates a UUIDv4 suitable for use as an `Idempotency-Key` header value. */
1109
1180
  declare function generateIdempotencyKey(): string;
1110
1181
 
1111
- 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 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, 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 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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { randomUUID, createHmac, timingSafeEqual } from 'crypto';
2
2
 
3
3
  // src/core/version.ts
4
- var SDK_VERSION = "0.4.0";
4
+ var SDK_VERSION = "0.5.0";
5
5
 
6
6
  // src/core/errors.ts
7
7
  var InfraError = class extends Error {
@@ -626,7 +626,10 @@ var TokenizationResource = class extends APIResource {
626
626
  ...rest
627
627
  });
628
628
  }
629
- /** Transfers token units between holder addresses. */
629
+ /**
630
+ * Transfers token units between holder addresses. A transfer that is rejected or reverts
631
+ * on-chain still resolves, with `status: "FAILED"`, so check `status` rather than relying on an error.
632
+ */
630
633
  async transferToken(params, overrides = {}) {
631
634
  const { idempotencyKey, ...rest } = overrides;
632
635
  return this.client.request({
@@ -673,7 +676,7 @@ var TokenizationResource = class extends APIResource {
673
676
  }).then((raw) => pageFromFlatResponse(raw, fetchPage));
674
677
  return fetchPage({ page: params.page, pageSize: params.pageSize });
675
678
  }
676
- /** Returns a single wallet's balance of a token on a chain, plus its cNGN (payout token) balance. */
679
+ /** Returns a single wallet's balance of a token on a chain. For its cNGN balance, use {@link getPayoutBalance}. */
677
680
  async getWalletBalance(params, overrides = {}) {
678
681
  return this.client.request({
679
682
  method: "GET",
@@ -682,6 +685,18 @@ var TokenizationResource = class extends APIResource {
682
685
  ...overrides
683
686
  });
684
687
  }
688
+ /**
689
+ * Returns a wallet's balance of the chain's payout token (cNGN), in which coupons, yield and
690
+ * principal are paid. It depends only on the chain and wallet, so no token is needed.
691
+ */
692
+ async getPayoutBalance(params, overrides = {}) {
693
+ return this.client.request({
694
+ method: "GET",
695
+ path: "/v1/tokens/payout-balance",
696
+ query: { ...params },
697
+ ...overrides
698
+ });
699
+ }
685
700
  /** Fetches a single token transaction by its reference. */
686
701
  async getTokenTransaction(ref, overrides = {}) {
687
702
  return this.client.request({
@@ -736,7 +751,11 @@ var TokenizationResource = class extends APIResource {
736
751
  ...rest
737
752
  });
738
753
  }
739
- /** Claims an investor's yield for a given distribution snapshot. */
754
+ /**
755
+ * Claims an investor's yield for a given distribution snapshot. `status` is `COMPLETED` once the
756
+ * claim is mined. If it's `SUBMITTED`, the outcome isn't known yet: poll
757
+ * {@link getTokenTransaction} with the result's `operationRef` until its `status` is `CONFIRMED` or `FAILED`.
758
+ */
740
759
  async claimYield(params, overrides = {}) {
741
760
  const { idempotencyKey, ...rest } = overrides;
742
761
  return this.client.request({
@@ -786,7 +805,8 @@ var TokenizationResource = class extends APIResource {
786
805
  }
787
806
  /**
788
807
  * Returns a snapshot's unclaimed yield to the issuer once its `reclaimAfter` window has
789
- * passed. An `Idempotency-Key` is generated per call unless you pass your own.
808
+ * passed. An `Idempotency-Key` is generated per call unless you pass your own. As with
809
+ * {@link claimYield}, a `SUBMITTED` status means the outcome should be polled by `operationRef`.
790
810
  */
791
811
  async reclaimUnclaimedYield(params, overrides = {}) {
792
812
  const { idempotencyKey, ...rest } = overrides;