# How to transfer all sui

**URL:** <https://forums.sui.io/t/how-to-transfer-all-sui/44877>\
**Category:** SDK\
**Tags:** sui\
**Created:** [July 24, 2023, 4:12pm UTC](https://forums.sui.io/t/how-to-transfer-all-sui/44877 "2023-07-24T16:12:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lly835](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@lly835](https://forums.sui.io/u/lly835)\
**Post date:** [July 24, 2023, 4:12pm UTC](https://forums.sui.io/t/how-to-transfer-all-sui/44877/1 "2023-07-24T16:12:56Z")

</div>

> <https://github.com/MystenLabs/sui/tree/main/sdk/typescript>
>
> //github.com/MystenLabs/sui/tree/main/sdk/typescript

```auto
const tx = new TransactionBlock();
const [coin] = tx.splitCoins(tx.gas, [tx.pure(1000)]);

```

How to set gas to transfer all the balance in the wallet.  
Alternatively, can we set gas as another wallet for payment?

---

<div class="post-metadata">

**Author:** ![atha](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@atha](https://forums.sui.io/u/atha)\
**Post date:** [July 25, 2023, 2:05pm UTC](https://forums.sui.io/t/how-to-transfer-all-sui/44877/2 "2023-07-25T14:05:25Z")

</div>

We can use the RPC call **unsafe\_payAllSui** to build the transaction bytes, and then sign and execute this transaction via the TS SDK.  
I scaffolded a small ts-node project to test the whole flow in the following GitHub repo: [https://github.com/John-Atha/sui-dev-forum/tree/main/transfer-all-sui](https://github.com/John-Atha/sui-dev-forum/tree/main/transfer-all-sui)
