百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

sui-kit

> 编程语言
开源

在 TypeScript 中与 SUI 网络交互的工具包

189 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

在 TypeScript 中与 SUI 网络交互的工具包

Toolkit for interacting with SUI network

Features

  • Transfer SUI, Custom Coin and objects.
  • Move call
  • Programmable transaction
  • Query on-chain data
  • HD wallet multi-accounts

Pre-requisites

@mysten/sui is a peer dependency, so install it alongside sui-kit:

bash
npm install @scallop-io/sui-kit @mysten/sui

How to use

Init SuiKit

…

Transfer

You can use SuiKit to transfer SUI, custom coins, and any objects.

…

Stake SUI

You can use SuiKit to stake SUI.

typescript
/**
 * This is an example of using SuiKit to stake SUI
 */
const stakeAmount = 1000;
const validatorAddress = '0x123'; // replace with real address
suiKit.stakeSui(stakeAmount, validatorAddress).then(() => {
  console.log('Stake SUI success');
});

Move call

You can use SuiKit to call move functions.

typescript
const res = await suiKit.moveCall({
  target: '0x2::coin::join',
  arguments: [coin0, coin1],
  typeArguments: [coinType],
});
console.log(res);

How to pass arguments? Suppose you have a move function like this:

move
public entry fun test_args(
  addrs: vector,
  name: vector,
  numbers: vector,
  bools: vector,
  coins: vector>,
  ctx: &mut TxContext,
) {
  // ...
}

You can pass the arguments like this:

…

All the supported types are:

  • address
  • u8
  • u16
  • u32
  • u64
  • u128
  • u256
  • bool
  • object

Programmable transaction

With programmable transaction, you can send a transaction with multiple actions. The following is an example using flashloan to make arbitrage. (check here for the corresponding Move contract code)

…

SuiTxBlock and Transaction

SuiTxBlock extends Transaction from @mysten/sui, so every base method and property is available directly on it — there is no wrapped .txBlock to reach through.

typescript
const tx = new SuiTxBlock();
tx.setSender(sender);
const coin = tx.object('');
const [amount] = tx.splitCoins(tx.gas, [1000]);
const bytes = await tx.build({ client: suiKit.client });

You can also copy or restore a transaction as a SuiTxBlock:

typescript
import { Transaction } from '@mysten/sui/transactions';

// copy an existing Transaction (or SuiTxBlock)
const copy = new SuiTxBlock(new Transaction());
// restore from `toJSON()` output or BCS transaction bytes
const restored = SuiTxBlock.from(await tx.toJSON());
// restore from transaction kind bytes
const kind = SuiTxBlock.fromKind(
  await tx.build({ client: suiKit.client, onlyTransactionKind: true })
);

The overridden helpers accept sui-kit's looser argument types, so object ids, object refs and shared object refs work anywhere an object is expected:

typescript
tx.splitCoins({ objectId: '', version: '1', digest: '' }, [1000]);
tx.mergeCoins('', ['', '']);
tx.transferObjects([''], recipient);

Two differences from the base class to keep in mind:

  • moveCall takes positional arguments (target, args, typeArgs) as shown above; the base { target, arguments, typeArguments } object form is not accepted.
  • Because moveCall narrows the base signature, TypeScript may require a cast when passing a SuiTxBlock to an API typed as Transaction. SuiKit methods such as signTxn, signAndSendTxn, dryRunTxn and inspectTxn accept it directly.

Multi-accounts

SuiKit follows bip32 & bip39 standard, so you can use it to manage multiple accounts. When init SuiKit, you can pass in your mnemonics to create a wallet with multiple accounts.

…

Publish & upgrade Move package

We have a standalone npm package to help you publish and upgrade Move package based on sui-kit.

Please refer to the repository: sui-package-kit

Migration Guide

If you're upgrading from v1.x to v2.0.0, please refer to the Migration Guide.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptsuitypescript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言