Skip to main content

Usage

Parameters

The hook accepts an object with:
  • params (RecordSendTransactionParams):
    • transactionHash (string): The hash of the transaction to record
    • chain (Chain): The blockchain network. Use Chain.STARKNET
    • expectedSender (string): The expected sender wallet address
    • expectedRecipient (string): The expected recipient wallet address
    • expectedToken (ChainToken): The expected token. Use ChainToken.USDC
    • expectedAmount (string): The expected transaction amount
  • bearerToken (string): Bearer token for authentication

Return Value

Returns an object containing:
  • recordSendTransaction: Function to record transaction (fire-and-forget)
  • recordSendTransactionAsync: Promise-based function that resolves with the transaction record
  • data: The recorded transaction data (Transaction | undefined)
  • isLoading: Boolean indicating if the operation is in progress
  • isError: Boolean indicating if an error occurred
  • error: Error instance when isError is true, otherwise null
  • isSuccess: Boolean indicating if the recording completed successfully
  • reset: Function to reset the mutation state

Example Implementation

Security Considerations

  • Always verify recipient addresses
  • Use encrypted private keys
  • Implement proper PIN validation
  • Monitor transaction status

Error Handling

  • Handle insufficient token balance
  • Validate wallet addresses
  • Monitor gas fees
  • Implement retry logic for failed transactions
Always verify recipient addresses. Transfers on StarkNet are irreversible.
  • useTransfer - Execute the transfer before recording it
  • useGetTransactionList - List all recorded transactions