@brahmafi/cards-sdk
Version:
Official SDK for integrating Swype payment and credit services
995 lines (970 loc) • 32.6 kB
text/typescript
import { JSX } from 'react';
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as zustand from 'zustand';
interface KycModalProps {
eoaAddress: string;
onClose?: () => void;
onComplete?: () => void;
}
declare function KycModal({ eoaAddress, onClose, onComplete, }: KycModalProps): JSX.Element | null;
type CreditTypeClassification = "spend" | "borrow";
interface CreditProvider {
id: CreditProviderId;
storeKey: StoreCreditType;
providerKey: ProviderKey;
displayName: string;
chainId: number;
decimals: number;
creditType: CreditTypeClassification;
config: {
borrowTokenAddress?: string;
borrowVaultAddress?: string;
aTokenAddress?: string;
vaultTokenAddress?: string;
};
minDelegateAmount?: number;
icon: string;
canDCA: boolean;
}
declare const CREDIT_REGISTRY: {
readonly "aave-v3": {
readonly id: "aave-v3";
readonly storeKey: "aave";
readonly providerKey: "aave";
readonly displayName: "Aave";
readonly chainId: 8453;
readonly decimals: 6;
readonly creditType: "borrow";
readonly config: {
readonly borrowTokenAddress: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
};
readonly minDelegateAmount: 1;
readonly icon: "AaveIcon";
readonly canDCA: false;
};
readonly euler: {
readonly id: "euler";
readonly storeKey: "euler";
readonly providerKey: "euler";
readonly displayName: "Euler";
readonly chainId: 8453;
readonly decimals: 18;
readonly creditType: "borrow";
readonly config: {
readonly borrowVaultAddress: "0x0A1a3b5f2041F33522C4efc754a7D096f880eE16";
};
readonly icon: "EulerIcon";
readonly canDCA: false;
};
readonly hypurrFi: {
readonly id: "hypurrFi";
readonly storeKey: "hypurrFi";
readonly providerKey: "hypurrfi";
readonly displayName: "HypurrFi";
readonly chainId: 999;
readonly decimals: 6;
readonly creditType: "borrow";
readonly config: {
readonly borrowTokenAddress: "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb";
};
readonly minDelegateAmount: 1;
readonly icon: "HypurrFiIcon";
readonly canDCA: false;
};
readonly "hypurrFi-withdraw": {
readonly id: "hypurrFi-withdraw";
readonly storeKey: "hypurrFiWithdraw";
readonly providerKey: "hypurrFi-withdraw";
readonly displayName: "HypurrFi";
readonly chainId: 999;
readonly decimals: 6;
readonly creditType: "spend";
readonly config: {
readonly aTokenAddress: "0x0000000000000000000000000000000000000000";
};
readonly minDelegateAmount: 1;
readonly icon: "HypurrFiIcon";
readonly canDCA: true;
};
readonly "felix-withdraw": {
readonly id: "felix-withdraw";
readonly storeKey: "felixWithdraw";
readonly providerKey: "felix-withdraw";
readonly displayName: "Felix";
readonly chainId: 999;
readonly decimals: 6;
readonly creditType: "spend";
readonly config: {
readonly vaultTokenAddress: "0x0000000000000000000000000000000000000000";
};
readonly minDelegateAmount: 1;
readonly icon: "FelixIcon";
readonly canDCA: true;
};
readonly "hyperBeat-withdraw": {
readonly id: "hyperBeat-withdraw";
readonly storeKey: "hyperBeatWithdraw";
readonly providerKey: "hyperBeat-withdraw";
readonly displayName: "HyperBeat";
readonly chainId: 999;
readonly decimals: 6;
readonly creditType: "spend";
readonly config: {
readonly vaultTokenAddress: "0x0000000000000000000000000000000000000000";
};
readonly minDelegateAmount: 1;
readonly icon: "HyperBeatIcon";
readonly canDCA: true;
};
readonly "hyperLend-withdraw": {
readonly id: "hyperLend-withdraw";
readonly storeKey: "hyperLendWithdraw";
readonly providerKey: "hyperLend-withdraw";
readonly displayName: "HyperLend";
readonly chainId: 999;
readonly decimals: 6;
readonly creditType: "spend";
readonly config: {
readonly aTokenAddress: "0x0000000000000000000000000000000000000000";
};
readonly minDelegateAmount: 1;
readonly icon: "HyperLendIcon";
readonly canDCA: true;
};
};
type CreditProviderId = keyof typeof CREDIT_REGISTRY;
type StoreCreditType = (typeof CREDIT_REGISTRY)[keyof typeof CREDIT_REGISTRY]["storeKey"];
type ProviderKey = (typeof CREDIT_REGISTRY)[keyof typeof CREDIT_REGISTRY]["providerKey"];
/**
* Get a specific credit provider by ID
* @param id - Credit provider ID
* @returns Credit provider configuration or null if not found
*/
declare const getCreditProvider: (id: CreditProviderId) => CreditProvider | null;
/**
* Get all available credit providers
* @returns Array of all credit provider configurations
*/
declare const getAllCreditProviders: () => CreditProvider[];
/**
* Get credit provider by store key
* @param storeKey - Store key to lookup
* @returns Credit provider configuration or undefined
*/
declare const getCreditProviderByStoreKey: (storeKey: string) => CreditProvider | undefined;
/**
* Get credit provider by provider key (UI key)
* @param providerKey - Provider key to lookup
* @returns Credit provider configuration or undefined
*/
declare const getCreditProviderByProviderKey: (providerKey: string) => CreditProvider | undefined;
/**
* Get credit providers by type classification
* @param creditType - Credit type classification (spend or borrow)
* @param chainId - Optional chain ID to filter by
* @returns Array of credit provider configurations
*/
declare const getCreditProvidersByType: (creditType: CreditTypeClassification, chainId?: number) => CreditProvider[];
/**
* Check if a credit provider is of a specific type
* @param creditProviderId - Credit provider ID
* @param creditType - Credit type classification to check
* @returns Boolean indicating if provider matches the type
*/
declare const isCreditProviderOfType: (creditProviderId: CreditProviderId, creditType: CreditTypeClassification) => boolean;
interface ClaimReferralResponse {
status: string;
}
interface ReferralEarning {
referredAddress: string;
totalXpAmount: number;
transactionCount: number;
firstEarned: string;
lastEarned: string;
}
type XPTierType = "tier1" | "tier2" | "tier3" | "tier4";
type XPTransactionType = "credit" | "debit";
type XPReason = "transaction_fee" | "referral_reward" | "milestone";
interface XPHistoryEntry {
id: string;
userAddress: string;
tenantId: string;
amountInCents: number;
xpAmount: number;
transactionType: XPTransactionType;
sourceService: string;
xpReason: XPReason;
description: string;
metadata: Record<string, any>;
createdAt: string;
}
type MilestoneType = "card_creation" | "referral_count" | "transaction_volume";
interface Milestone {
id: string;
tenantId: string;
name: string;
description: string;
type: MilestoneType;
xpReward: number;
isActive: boolean;
validationConfig: Record<string, any>;
centsValue: number;
createdAt: string;
updatedAt: string;
createdBy: string;
}
interface MilestoneClaim {
id: string;
userAddress: string;
tenantId: string;
milestoneId: string;
name: string;
description: string;
type: MilestoneType;
xpAwarded: number;
centsAwarded: number;
claimedAt: string;
xpLedgerId: string;
}
interface XPLedgerEntry {
id: string;
userAddress: string;
amount: number;
transactionType: XPTransactionType;
sourceService: string;
description: string;
}
interface ClaimMilestoneResponse {
claim: MilestoneClaim;
xpLedgerEntry: XPLedgerEntry;
}
interface MilestoneStatus {
milestone: Milestone;
isClaimed: boolean;
claimedAt: string | null;
isEligible: boolean;
eligibilityInfo: Record<string, any>;
}
type CardStatus = "initiated" | "pending" | "approved" | "userNotExisting" | "rejected" | "error" | "submitted" | "resubmit";
type UserParams = {
vaults: string[];
borrowVaultAddress: string;
} | {
borrowTokenAddress: string;
} | {
aTokenAddress?: string;
vaultTokenAddress?: string;
purchaseBaseTokenAddress: string;
};
interface UserCard {
cardID: string;
chainID: number;
type: "virtual" | "physical";
status: "active" | "inactive" | "pending" | "locked";
last4: string;
expirationMonth: string;
expirationYear: string;
solverType: CreditProviderId;
solverConfig: UserConfig["config"];
solverCreditProviderAddress: string;
hookType?: HookType;
hookConfig?: HookConfig<HookType>;
hookChainID?: number;
}
interface SuppliedAsset {
UsageAsCollateralEnabledOnUser: boolean;
amount: number;
amountUSD: number;
collateralAmountBase: string;
collateralAmountBig: number;
supplyRate: number;
underlyingAsset: string;
}
interface HypurrFiWithdrawSuppliedAsset extends SuppliedAsset {
name: string;
symbol: string;
aToken: string;
netAPY: string;
}
interface BorrowedAsset {
amount: number;
amountUSD: number;
borrowRate: number;
debtAmountBase: string;
debtAmountBig: number;
underlyingAsset: string;
}
interface AaveCreditMetadata {
availableBorrowsBase: number;
borrowPower: number;
borrowValue: number;
eModeCategory: number;
healthFactor: number;
liquidationThreshold: number;
ltv: number;
netAPY: number;
stableBorrowAPY: number;
stableBorrowedAssets: any[];
suppliedAssets: SuppliedAsset[];
suppliedValue: number;
supplyAPY: number;
totalCollateralBase: number;
totalDebtBase: number;
variableBorrowAPY: number;
variableBorrowedAssets: BorrowedAsset[];
maxDelegateAmount: number;
}
interface EulerPosition {
vault: {
address: string;
name: string;
symbol: string;
token: string;
};
collateralValue: string;
}
interface EulerCreditMetadata {
userPosition: EulerPosition[];
undelegatedPositions: EulerPosition[];
debt: string;
subAccount: string;
}
interface HypurrFiWithdrawCreditMetadata {
availableBorrowsBase: number;
borrowPower: number;
borrowValue: number;
eModeCategory: number;
healthFactor: number;
liquidationThreshold: number;
ltv: number;
netAPY: number;
stableBorrowAPY: number;
stableBorrowedAssets: any[];
suppliedAssets: HypurrFiWithdrawSuppliedAsset[];
suppliedValue: number;
supplyAPY: number;
totalCollateralBase: number;
totalDebtBase: number;
variableBorrowAPY: number;
variableBorrowedAssets: BorrowedAsset[];
maxDelegateAmount: number | null;
}
type MorphoCreditAsset = {
amount: string;
sharesAmount: string;
underlyingAsset: string;
vaultAsset: string;
name: string;
symbol: string;
netApy: string;
decimals: number;
};
type FelixWithdrawCreditMetadata = MorphoCreditAsset[];
type HyperBeatWithdrawCreditMetadata = MorphoCreditAsset[];
type HyperLendWithdrawCreditMetadata = MorphoCreditAsset[];
interface CreditInformationResponse {
data: {
metadata: AaveCreditMetadata | EulerCreditMetadata | HypurrFiWithdrawCreditMetadata | FelixWithdrawCreditMetadata | HyperBeatWithdrawCreditMetadata | HyperLendWithdrawCreditMetadata;
availableLimit: number;
amountDelegated: number;
SupportedChainIDs: number[];
} | null;
}
interface SwypeSDKConfig {
apiKey: string;
baseUrl?: string;
apiPath?: string;
jwt?: JWT;
tenantId?: string;
}
type TransactionType = "spend";
type TransactionStatus = "pending" | "declined" | "reversed" | "completed";
type TransactionFlow = "debit" | "refund" | "declined";
type OnchainDirection = "credit" | "debit";
type OnchainStatus = "pending" | "processing" | "completed" | "failed";
type OnchainPurpose = "authorization" | "increment" | "settlement" | "reversal" | "refund" | "recovery";
interface OnchainTransaction {
transaction_hash: string;
chain_id: string;
amount: number;
direction: OnchainDirection;
status: OnchainStatus;
purpose: OnchainPurpose;
created_at: string;
}
interface Merchant {
name: string;
city: string;
country: string;
icon: string;
category: string;
}
interface Transaction {
id: string;
type: TransactionType;
status: TransactionStatus;
flow: TransactionFlow;
amount: number;
currency: string;
local_amount?: number;
local_currency: string;
merchant: Merchant;
declined_reason?: string;
created_at: string;
authorized_at?: string;
posted_at?: string | null;
onchain_transactions?: OnchainTransaction[];
}
interface OnchainTransactionDetail {
id: string;
transaction_id: string;
direction: OnchainDirection;
chain_id: string;
from_address: string;
to_address: string;
transaction_hash: string;
amount: number;
amount_raw: string;
fee_raw: string;
token: string;
status: OnchainStatus;
purpose: OnchainPurpose;
error_details?: string;
created_at: string;
completed_at?: string;
}
interface OnchainTransactionDetailsResponse {
data: OnchainTransactionDetail[];
}
interface EulerTotalAssetResponse {
data: {
totalAssetsUSD: number;
};
}
interface JWT {
accessToken: string | null;
refreshToken: string | null;
expiresIn: number | null;
tokenType: string | null;
eoa: string | null;
createdAt: number | null;
}
type UserConfig = {
ownerAddress: string;
chainID: number;
solverType: CreditProviderId;
config: Record<string, string>;
createdAt: string;
updatedAt: string;
};
type Hook = {
type: "swap";
config: {
inputTokenAddress: string;
outputTokenAddress: string;
allocationBPS: number;
slippage: number;
};
};
type HookType = Hook["type"];
type HookConfig<T extends HookType> = Extract<Hook, {
type: T;
}>["config"];
type HookTransaction = {
id: string;
onchainTransactionId: string;
transactionID: string;
cardId: string;
hookType: HookType;
chainId: number;
toAddress: string;
calldata: string;
relayerTaskId?: string | null;
relayerError?: string | null;
relayerMessage: string;
hookTransactionHash: string;
hookStatus: "processing" | "completed" | "failed" | "cancelled" | "pending";
hookError?: string | null;
config: HookConfig<HookType>;
metadata: {
inputToken: string;
inputAmount: string;
outputToken: string;
outputAmount: string;
};
createdAt: string;
relayedAt?: string | null;
completedAt?: string | null;
updatedAt: string;
};
interface PasskeyRegistrationBeginResponse {
challenge: string;
rp: {
id: string;
name: string;
};
user: {
id: string;
name: string;
displayName: string;
};
pubKeyCredParams: Array<{
type: string;
alg: number;
}>;
timeout?: number;
attestation?: string;
authenticatorSelection?: {
authenticatorAttachment?: string;
userVerification?: string;
requireResidentKey?: boolean;
};
}
interface PasskeyRegistrationFinishOptions {
response: {
id: string;
rawId: string;
type: string;
response: {
clientDataJSON: string;
attestationObject: string;
};
};
credentialName: string;
}
interface PasskeyLoginBeginResponse {
challenge: string;
timeout?: number;
rpId?: string;
allowCredentials?: Array<{
type: string;
id: string;
transports?: string[];
}>;
userVerification?: string;
}
interface PasskeyDiscoverableLoginBeginResponse {
options: {
publicKey: PasskeyLoginBeginResponse;
};
sessionId: string;
}
interface PasskeyDiscoverableLoginFinishOptions {
sessionId: string;
response: {
id: string;
rawId: string;
type: string;
response: {
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle?: string;
};
};
}
type WebAuthnCredential = {
id: string;
owner_address: string;
tenant_id: string;
credential_name: string;
created_at: string;
updated_at: string;
last_used_at: string | null;
};
declare global {
interface Window {
rain?: {
generateSessionId: (pemKey: string) => Promise<{
secretKey: string;
sessionId: string;
}>;
decryptSecret: (data: string, iv: string, secretKey: string) => Promise<string>;
};
}
}
interface CardDetailsCallbacks {
onToast: (message: {
title: string;
description: string;
icon: string;
}) => void;
signTypedData: (params: any) => Promise<string>;
}
interface ManageCardModalProps {
title: string;
onClose: () => void;
callbacks: CardDetailsCallbacks;
address: string;
}
declare function ManageCardModal({ title, onClose, callbacks, address, }: ManageCardModalProps): react_jsx_runtime.JSX.Element;
/**
* Creates a new user card if one does not already exist, signs the operation,
* and updates the local card store with the created card.
*
* This function performs the following steps:
* 1. Fetches existing user cards and updates the card store.
* 2. If no card exists, signs a typed message and creates a new card.
* 3. Verifies the card creation by fetching updated cards.
* 4. Ensures that the newly created card belongs to the user (EOA).
* 5. Updates the store with the new card if creation was successful.
*
* @param {CreateCardActionParams} params - Parameters for creating the card.
* @param {CreditType} params.creditType - Type of credit to be associated with the card.
*
* @returns {Promise<{ success: boolean; message: string }>} - Result indicating success or failure and a message.
*/
declare function createCardAction({ creditType, }: {
creditType: CreditProviderId;
}): Promise<{
success: boolean;
message: string;
}>;
interface DelegateCardParams {
creditType: CreditProviderId;
creditLimit: number;
sendTransactionAsync: (params: {
to: string;
value: bigint;
data: string;
}) => Promise<string>;
userParams?: UserParams;
chainID: number;
}
interface DelegationResult {
success: boolean;
message: string;
transactionHash?: string;
}
declare function delegateAmount({ creditLimit, creditType, sendTransactionAsync, userParams, chainID, }: DelegateCardParams): Promise<DelegationResult>;
interface UpdateCardProviderParams {
creditType: CreditProviderId;
chainId: number;
config?: {
aTokenAddress?: string;
vaultTokenAddress?: string;
purchaseBaseTokenAddress: string;
};
}
declare function updateCardProvider({ creditType, chainId, config, }: UpdateCardProviderParams): Promise<{
success: boolean;
message: string;
}>;
/**
* Handles updating a card hook by signing and sending the update request.
*
* @param chainId - Blockchain chain ID.
* @param hookType - The type of hook to update (e.g., "yield_buy").
* @param config - The configuration object for the hook.
*/
declare const handleUpdateCardHook: ({ chainId, hookType, config, }: {
chainId: number;
hookType: HookType;
config: HookConfig<HookType>;
}) => Promise<{
success: boolean;
message: string;
}>;
/**
* Handles deleting a card hook by signing and sending the delete request.
*
* @return A promise that resolves to an object indicating success or failure,
* along with a message.
*/
declare const handleDeleteCardHook: () => Promise<{
success: boolean;
message: string;
}>;
declare global {
interface Window {
rain?: {
generateSessionId: (pemKey: string) => Promise<{
secretKey: string;
sessionId: string;
}>;
decryptSecret: (data: string, iv: string, secretKey: string) => Promise<string>;
};
}
}
declare const ensureRainScriptLoaded: () => Promise<boolean>;
interface DecryptedCardDetails {
cardNumber: string;
cvc: string;
expiryMonth: string;
expiryYear: string;
}
interface SignTypedDataFunction {
(params: any): Promise<string>;
}
/**
* Retrieves and decrypts credit card details (PAN, CVC, Expiry).
* This function handles the secure key exchange and decryption process.
*
* @param signTypedData - A function (e.g., from wagmi) to sign EIP-712 typed data.
* @param address - The wallet address of the user.
* @returns A promise that resolves to `DecryptedCardDetails` on success, or throws an error.
*/
declare function showCardDetails(signTypedData: SignTypedDataFunction, address: string): Promise<DecryptedCardDetails>;
/**
* Updates the PIN for the user's card.
* This function handles the secure key exchange and PIN update process.
*
* @param updatedPin - The new PIN (string of digits).
* @param signTypedData - A function (e.g., from wagmi) to sign EIP-712 typed data.
* @param address - The wallet address of the user.
* @returns A promise that resolves to `true` on success, or throws an error.
*/
declare function updateCardPin(updatedPin: string, signTypedData: SignTypedDataFunction, address: string): Promise<boolean>;
declare function initializeSwypeSDK(config: SwypeSDKConfig): Promise<void>;
/**
* Generates a new authentication signature and timestamp using EIP-712 signing.
*
* @param signTypedData - A function that signs typed data and returns a signature.
* @returns An object containing the generated `signature` and the `timestamp`.
*/
declare function generateAuthSign(tenantID: string, signTypedData: (typedData: any) => Promise<string>): Promise<{
signature: string;
timestamp: number;
}>;
/**
* Initializes authentication with the Swype API using the provided signature and timestamp.
* This is a standalone function that doesn't require SDK initialization.
*
* @param signature - The signed authentication signature
* @param timestamp - The timestamp used in signing
* @param config - Configuration object containing necessary auth parameters
* @throws If authentication fails or the response is missing required fields.
*/
declare function initializeAuth(signature: string, timestamp: number, config: {
eoaAddress: string;
tenantId: string;
apiKey: string;
baseUrl: string;
apiPath: string;
}): Promise<JWT>;
/**
* Refreshes the authentication tokens using the stored refresh token.
* This function attempts to obtain new access and refresh tokens from the authentication server
* using a provided refresh token. It handles potential errors during the API call
* and ensures all necessary configuration fields are present.
*
* @param refreshToken The refresh token to use for obtaining new tokens.
* @param config Configuration object containing necessary API details:
* - `eoaAddress`: EOA for user address.
* - `tenantId`: The tenant ID.
* - `apiKey`: The API key for authentication.
* - `baseUrl`: The base URL of the authentication service.
* - `apiPath`: The API path for authentication endpoints.
* @returns A Promise that resolves to a JWT object containing the new access token,
* refresh token, expiration details, token type, and creation timestamp.
* @throws {Error} If the SDK is not initialized, the refresh token is missing,
* required configuration fields are missing, or the API request fails.
*/
declare function refreshAuth(refreshToken: string, config: {
eoaAddress: string;
tenantId: string;
apiKey: string;
baseUrl: string;
apiPath: string;
}): Promise<JWT>;
declare function beginPasskeyRegistration(): Promise<PasskeyRegistrationBeginResponse>;
declare function finishPasskeyRegistration(options: PasskeyRegistrationFinishOptions): Promise<{
success: boolean;
message: string;
}>;
declare function beginDiscoverablePasskeyLogin(): Promise<PasskeyDiscoverableLoginBeginResponse>;
declare function finishDiscoverablePasskeyLogin(options: PasskeyDiscoverableLoginFinishOptions): Promise<JWT>;
/**
* Retrieves all registered passkeys for the authenticated user.
*
* @returns A promise that resolves to an array of WebAuthnCredential.
*/
declare const getPasskeys: () => Promise<WebAuthnCredential[]>;
/**
* Deletes a specific passkey by its ID for the authenticated user.
*
* @param id - The UUID of the passkey to delete.
* @returns A promise that resolves to a success message.
*/
declare const deletePasskey: (id: string) => Promise<{
status: string;
}>;
/**
* Fetches on-chain transaction details for a given card transaction.
*
* @param transactionID - The transaction identifier.
* @returns An `OnchainTransactionDetailsResponse` object.
*/
declare const getOnchainTransactionDetails: (transactionID: string) => Promise<OnchainTransactionDetailsResponse>;
/**
* Retrieves a preview of Euler credit and collateral amounts for specific vaults.
*
* @param vaults - List of vault addresses to preview.
* @param creditType - The type of credit (defaults to `"euler"`).
* @returns An object containing credit and collateral amounts as strings.
*/
declare const getEulerCardPreview: (vaults: string[]) => Promise<{
data: {
credit: string;
collateral: string;
};
}>;
/**
* Fetches the Euler health factor for the user.
*
* @returns An object containing the health factor as a string.
*/
declare const getEulerHealthFactor: () => Promise<{
data: {
healthFactor: string;
};
}>;
/**
* Fetches the pending transaction balance for a specific card.
*
* @param cardID - The UUID of the card.
* @returns An object containing the status and USD balance of pending transactions.
*/
declare const getPendingTransactionBalance: (cardID: string) => Promise<{
data: {
status: string;
balances: {
USD: number;
};
};
}>;
/**
* Retrieves the total Euler assets for a specific blockchain network.
*
* @returns An `EulerTotalAssetResponse` containing total assets in USD.
*/
declare const getEulerTotalAsset: () => Promise<EulerTotalAssetResponse>;
interface KycStoreState {
acceptedRainTerms: boolean;
isKycModalOpen: boolean;
isSumsubProfileVerified: boolean;
setAcceptedRainTerms: (accepted: boolean) => void;
setKycModalOpen: (open: boolean) => void;
setIsSumsubProfileVerified: (verified: boolean) => void;
}
declare const useKycStore: zustand.UseBoundStore<zustand.StoreApi<KycStoreState>>;
interface UseCardDataReturn {
status: CardStatus | null;
userCard: UserCard | null;
isUserCardDelegated: boolean;
isLoading: boolean;
error: string | null;
refreshCardStatus: () => Promise<void>;
}
declare const useCardData: () => UseCardDataReturn;
interface UseCreditDataReturn {
creditInfo: Record<StoreCreditType, CreditInformationResponse | null>;
isLoading: boolean;
error: string | null;
userConfig: UserConfig["config"] | null;
refreshPositions: (creditTypes: StoreCreditType[]) => Promise<void>;
isRefreshingPositions: boolean;
}
declare function useCreditData(): UseCreditDataReturn;
interface UseGetTransactionsReturn {
transactions: Transaction[];
isLoading: boolean;
loadingNextPage: boolean;
error: string | null;
hasNext: boolean;
pendingTxnAmount: number;
loadMore: () => Promise<void>;
refetch: () => Promise<void>;
resetError: () => void;
}
/**
* Hook for managing transactions
* Automatically fetches transactions on mount using SDK internal state
* Provides pagination and onchain details functionality
*/
declare const useGetTransactions: () => UseGetTransactionsReturn;
interface UseGetHookTransactionsReturn {
transactions: HookTransaction[];
isLoading: boolean;
loadingNextPage: boolean;
error: string | null;
hasNext: boolean;
loadMore: () => Promise<void>;
refetch: () => Promise<void>;
resetError: () => void;
}
declare const useGetHookTransactions: () => UseGetHookTransactionsReturn;
interface ApiState<T> {
isLoading: boolean;
error: string | null;
data: T | null;
}
declare const useRewardsData: () => {
referralStats: ApiState<{
totalReferrals: number;
referralCode: string;
isReferred: boolean;
referredBy?: string;
referredByCode?: string;
}>;
milestoneStatus: ApiState<{
milestones: MilestoneStatus[];
totalCount: number;
hasMore: boolean;
}>;
xpBalance: ApiState<{
userAddress: string;
tenantId: string;
xpBalance: number;
balanceInCents: number;
lastUpdated: string;
tier: XPTierType;
feeRebateBps: number;
transactionVolumeCents: number;
}>;
isLoading: boolean;
hasError: boolean;
claimMilestone: (milestoneId: string) => Promise<ClaimMilestoneResponse>;
claimReferral: (referrerCode: string) => Promise<ClaimReferralResponse>;
refreshReferralStats: () => Promise<void>;
refreshMilestoneStatus: () => Promise<void>;
refreshXPBalance: () => Promise<void>;
};
interface UseXPHistoryReturn {
entries: XPHistoryEntry[];
isLoading: boolean;
isLoadingMore: boolean;
error: string | null;
hasMore: boolean;
totalCount: number;
loadMore: () => Promise<void>;
fetch: () => Promise<void>;
refetch: () => Promise<void>;
reset: () => void;
}
/**
* Hook for managing XP history with pagination
* Only fetches when explicitly called (lazy loading)
* Caches results in store to prevent refetching
*/
declare const useXPHistory: () => UseXPHistoryReturn;
interface UseReferralEarningsReturn {
earnings: ReferralEarning[];
isLoading: boolean;
isLoadingMore: boolean;
error: string | null;
hasMore: boolean;
totalXp: number;
totalReferrals: number;
loadMore: () => Promise<void>;
refetch: () => Promise<void>;
fetch: () => Promise<void>;
reset: () => void;
}
/**
* Hook for managing referral earnings with pagination
* Only fetches when explicitly called (lazy loading)
* Caches results in store to prevent refetching
*/
declare const useReferralEarnings: () => UseReferralEarningsReturn;
export { type AaveCreditMetadata, type BorrowedAsset, CREDIT_REGISTRY, type CardDetailsCallbacks, type CardStatus, type ClaimMilestoneResponse, type CreditInformationResponse, type CreditProvider, type CreditProviderId, type CreditTypeClassification, type EulerCreditMetadata, type EulerPosition, type EulerTotalAssetResponse, type FelixWithdrawCreditMetadata, type HookConfig, type HookTransaction, type HookType, type HyperBeatWithdrawCreditMetadata, type HyperLendWithdrawCreditMetadata, type HypurrFiWithdrawCreditMetadata, type HypurrFiWithdrawSuppliedAsset, type JWT, KycModal, ManageCardModal, type MorphoCreditAsset, type OnchainTransactionDetail, type PasskeyDiscoverableLoginBeginResponse, type PasskeyLoginBeginResponse, type PasskeyRegistrationBeginResponse, type ProviderKey, type ReferralEarning, type StoreCreditType, type SuppliedAsset, type Transaction, type UpdateCardProviderParams, type UserCard, type UserParams, type WebAuthnCredential, type XPHistoryEntry, type XPTierType, type XPTransactionType, beginDiscoverablePasskeyLogin, beginPasskeyRegistration, createCardAction, delegateAmount, deletePasskey, ensureRainScriptLoaded, finishDiscoverablePasskeyLogin, finishPasskeyRegistration, generateAuthSign, getAllCreditProviders, getCreditProvider, getCreditProviderByProviderKey, getCreditProviderByStoreKey, getCreditProvidersByType, getEulerCardPreview, getEulerHealthFactor, getEulerTotalAsset, getOnchainTransactionDetails, getPasskeys, getPendingTransactionBalance, handleDeleteCardHook, handleUpdateCardHook, initializeAuth, initializeSwypeSDK, isCreditProviderOfType, refreshAuth, showCardDetails, updateCardPin, updateCardProvider, useCardData, useCreditData, useGetHookTransactions, useGetTransactions, useKycStore, useReferralEarnings, useRewardsData, useXPHistory };