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
22 lines (19 loc) • 940 B
text/typescript
import { depositCoin, borrowCoin } 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("borrow test", () => {
it("should success borrow Sui", 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, [1e9]);
await depositCoin(txb, poolConfig, toDeposit, 1e9);
const [borrowCoins] =await borrowCoin(txb, poolConfig, 0.1e9);
txb.transferObjects([borrowCoins as any], account.address);
const tsRes = await handleTransactionResult(txb, account, testCaseName);
expect(tsRes).toEqual("success");
});
});