Getting Started with Sui & TypeScript
This is not the first or introductory piece I’m working on for Sui and TypeScript. If you need to get some basics to get more comfortable, please check out this introductory article on the Sui TypeScript SDK. Install the Sui TypeScript SDK in your project with this command:[Terminal]
Programmable Transactions Blocks
Programmable transaction blocks (PTB) allow you to combine multiple transactions into one block and execute them. Add these imports to your projects, let us send a programmable transaction.[index.ts]
[index.ts]
splitCoins
function like this.
[index.ts]
transfers.forEach
makes the transfers to each recipient and then you’ll sign the programmable transaction with the signAndExecuteTransaction
function by passing in the keypair and the transaction you’ve built.

Gas Management on Sui
By default, your transaction uses one of your owned SUI coins as the gas coin. The Sui TypeScript SDK automatically selects a coin not otherwise used in your transaction inputs. However, you can customize gas handling for special cases like sponsored transactions.Standard Gas Payments
You can explicitly control the gas settings on a transaction: Set a custom gas price:[index.ts]
[index.ts]
[index.ts]
[index.ts]
Sponsored Gas (Gasless Transactions)
In a sponsored transaction, another account (the sponsor) pays for the gas fees instead of the original sender. Here’s a typical example of sending a coin to a recipient where the sender pays for gas.[index.ts]
[index.ts]
tx.build({ onlyTransactionKind: true })
so no gas owner is assigned yet.
Next, we reload the transaction using Transaction.fromKind(kindBytes)
, set the sender again with sponsoredTx.setSender()
, and assign the sponsor as the gas payer with sponsoredTx.setGasOwner()
.
After building the final transaction bytes using sponsoredTx.build({ client })
, both the user and the sponsor sign the transaction with signTransaction()
, and finally, we submit the transaction along with both signatures using client.executeTransactionBlock()
.
On the explorer you’d be able to see that it’s a sponsored transaction like this:

Calling Smart Contracts
You’ll use themoveCall
function inside your transaction to call any Move function on-chain.
First, make sure you have your imports set:
[index.ts]
[index.ts]
moveCall
, you can sign and execute the transaction like before.