UNPKG

navi-sdk

Version:

The NAVI SDK Client provides tools for interacting with the Sui blockchain networks, designed for handling transactions, accounts, and smart contracts efficiently. This documentation covers the setup, account management, and transaction handling within th

25 lines (19 loc) 976 B
import {depositCoin, withdrawCoin} from "../src/libs/PTB"; import { pool } from "../src/address"; import { Pool, PoolConfig } from "../src/types"; import { describe, it, expect } from "vitest"; import { createTransaction, handleTransactionResult } from "./helper"; import { client, account } from "./client"; describe("withdraw test", () => { it("should success withdraw Sui to NAVI protocol", async () => { const testCaseName = expect.getState().currentTestName || "test_case"; const txb = createTransaction(account); const poolConfig: PoolConfig = pool["Sui" as keyof Pool]; const [toDeposit] = txb.splitCoins(txb.gas, [1e8]); await depositCoin(txb, poolConfig, toDeposit, 1e8); const [withdrawCoins] = await withdrawCoin(txb, poolConfig, 1e7); txb.transferObjects([withdrawCoins as any], account.address); const tsRes = await handleTransactionResult(txb, account, testCaseName); expect(tsRes).toEqual("success"); }, 500000) });