0.0.9 • Published 1 year ago

cellana-protocol-sdk v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Cellana zUSDT Redemption SDK

This SDK allows developers to integrate the functionality of redeeming zUSDT (a protocol-issued synthetic token) for native USDT on the Cellana blockchain. It provides functions to query the protocol's USDT pool, check user balances, and generate transactions to redeem zUSDT.

Features

  • Redeem zUSDT for Native USDT
    A straightforward interface for redeeming synthetic zUSDT tokens for real USDT on the Cellana blockchain.

  • Check Available USDT in the Protocol Pool
    Query the total amount of native USDT available in the protocol pool before initiating transactions.

  • Get User's USDT Balance
    Check the native USDT balance in a user’s wallet on the Cellana network.

Installation

You can install the SDK via npm:

npm install cellana-protocol-sdk

Usage

import { getTotalTetherAvailableInPool,generateRedeemPayload,getTetherBalance } from 'cellana-protocol-sdk';
import { Network } from "@aptos-labs/ts-sdk";


// 1. Check total USDT available in the pool
``const getTotalTetherAvailableInPool = async () => {
  const network = Network.Mainnet;  // or Network.Testnet
  const totalUSDTInPool = await getTotalTetherAvailableInPool(network);
  console.log(`Total USDT in the pool: ${totalUSDTInPool}`);
}``

// 2. Check the user's native USDT balance
const getTetherBalance = async () => {
  const network = Network.Mainnet;  // or Network.Testnet
  const userWalletAddress = "0x1...2x6b";
  const userBalance = getTetherBalance(userWalletAddress,network);
  console.log(`User's USDT balance: ${userBalance}`);
}

// 3. Generate and submit a redeem transaction
const generatePayload = async () =>{
  const network = Network.Mainnet;  // or Network.Testnet
  const amountToRedeem = 1000;  // Amount of zUSDT to redeem
  const redeemPayload = generateRedeemPayload(amountToRedeem,network);
  console.log('Redeem Payload:', redeemPayload);
  // Submit transaction to the network
}

// Submit redeemPayload to Cellana network (handled by your application)
0.0.9

1 year ago