βœ‰οΈFetch Quote

The fetchQuote method retrieves a quote for the specified amount in USD. The quote is used to calculate the corresponding token amount required for the card purchase. It expires in about 30 seconds.

Code Example:

const amount = "150.55"; // Amount in USD
const quote = await service.fetchQuote(amount);

Response:

The fetchQuote method returns a quote object with the following fields:

  • id: Unique quote identifier.

  • token: Name or symbol of the token used to purchase the card. (e.g., "USDC", "TAO")

  • targetCurrency: Currency code for the amount. (e.g., "USD")

  • amountRequested: Amount of USD the card is being purchased for.

  • pricePerUnitCurrency: Price of the token per unit USD.

  • totalPrice: Total token amount needed for purchase.

  • platformFee: Any additional fees charged by the platform.

  • expiresIn: Time in milliseconds before the quote expires.

  • timestamp: Timestamp when the quote was generated.

  • status: Quote status.

Purchase Card

The purchaseCard method initiates a virtual card purchase. It performs four main operations:

  1. Approves token spending to the ZebecCard smart contract. (ERC20 tokens only)

  2. Deposits tokens into the user's Zebec vault.

  3. Initiates the card purchase on-chain. (ERC20 tokens only)

  4. Posts transaction data, along with metadata, to the Zebec backend.

The method returns a tuple with responses from each stage of the process.

Code Example

For EVM compatible networks:

For Bittensor Network:

Last updated