Skip to content

FordefiHQ/api-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

559 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fordefi API Examples

Code examples for using the Fordefi API in Python and TypeScript.

Prerequisites

  • Fordefi API credentials (API User token and API Signer, see here)
  • Python 3.9+ or Node.js (depending on example)

Python Examples 🐍

  • Programmatic swaps using Fordefi's In-app Swap feature
  • Programmatic EVM contract calls (with option to broadcast to a custom RPC)
  • Simple API Transfers:
    • BTC transfers on Bitcoin mainnet
    • Native EVM assets (ETH, BNB, etc.) transfers
    • ERC20 token transfers
    • ERC20 transfers with delegated gas payment from another vault ("sponsored" transactions)
    • Solana SOL transfers
    • Solana SPL token transfers
    • Solana SPL token transfers with delegated fee payment from another vault ("sponsored" transactions)
    • Solana SOL and SPL transfers with Solders
    • Tron TRX and TRC10/20 transfers
    • Native APT and MOVE transfers on Aptos and Movement
    • Native SUI transfers
    • SUI token transfers with delegated fee payment from another vault ("sponsored" transactions)
    • Aptos APT and Fungible Assets transfers
    • Aptos Fungible Assets transfers with delegated fee payment from another vault ("sponsored" transactions)
  • Exchange transfers
  • Setting up Fordefi Webhooks
  • Programatically signing Bitcoin PSBT with a Segwit or Taproot address
  • Custom Co-Signer example
  • Signing EIP-712 typed messages and EIP-191 personal messages with an EVM Fordefi vault
  • Signing Solana Personal messages
  • Programmatically adding a contact address or a batch of contact addresses to your Fordefi organization's Address Book

TypeScript Examples 🟦

  • Setting up Fordefi Webhooks
  • Setting up a server that listens and reacts to Hypernative Risk Insights
  • Calling EVM contracts with a Fordefi vault
  • Cross-chain USDC transfers using Circle's CCTP
  • On EVM chains (Ethereum, Base, Arbitrum, etc.):
    • Deploying EVM smart contracts from your Fordefi vault using Hardhat or Foundry
    • Deploying Morpho VaultsV2
    • Swapping tokens programmatically with CowSwap
    • Swapping tokens programmatically with Uniswap v3
    • Minting/Redeeming USDe with Ethena
    • Programmatic EVM transfers using the Fordefi API
    • Deploying and call contracts on a local Hardhat node for developers
  • On Solana:
    • SPL token transfers with delegated fee payment from another vault ("sponsored" transactions)
    • With @solana/web3.js:
      • Programmatic token swaps using Jupiter's Ultra API
      • Programmatic SOL staking with Marinade
      • Programmatic token swaps and pool management using Raydium
      • Programmatic SOL and SPL batch transfers
      • Programmatically buying and selling PT tokens on Exponent Finance
    • With @solana/kit:
      • Programmatic token swaps and pool management using Orca
      • Programmatic SPL token transfers
      • Programmatically restake SOL for fragSOL using Fragmetric
      • Programmatic SPL token batch transfers using a transaction planner and executor
      • Programmatically deploy an Anchor program using a transaction planner and executor
      • Programmatically stake, unstake and withdraw SOL from any validator
    • With gill:
      • SPL token transfers
  • On Sui:
    • Programmatic token swaps and pool creation using the Bluefin API
  • On Hyperliquid L1 (HyperCore):
    • Programmatic deposits, withdrawals, vault deposits and USDC transfers
  • On Cosmos:
    • Programmatic smart contract deployments on Archway
  • On Initia:
    • Programmatic INIT transfers
  • On NEAR:
    • Programmatic transfer and staking using Black Box signatures
  • On Stacks:
    • Calling smart contracts with a Fordefi Stacks Vault
  • On Aptos:
    • Sponsored fungible asset transfers with external Geomi gas station
    • Withdrawing an LP position on Hyperion
    • Key rotation from external Aptos wallet to Fordefi Black Box vault

Getting Started

  1. Clone this repository
  2. Follow the setup instructions in each example directory

Documentation

For more information, see the Fordefi API Documentation and Fordefi API reference page.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors