Sui Provider

After setting up your wallet, you can have access to the Sui provider:

// react
const { providers } = useTomo()
const { suiProvider } = providers;

// pure js
const suiProvider = window.tomo_sui

Get Sui Address

The Sui address is from the wallet state or provider. In the React framework:

import { useTomo, getWalletState } from '@tomo-inc/tomo-web-sdk';
const { walletState, providers } = useTomo()

// get from wallet state
const suiAddress = walletState.suiAddress

// or get from provider
const suiAddress = await providers.suiProvider.getAddress()

Or Pure JS:

Provider Functions

Signing a Message

The Sui provider signs messages in bytes and outputs the message and signature:

Sign Transaction

We follow the standard from Mysten Lab for signing transactions. The user needs to provide a SuiSignTransactionInput and get a signedtransaction.

Sign and Execute Transaction

We support standard sign and execute a transaction through one call, which requires SuiSignTransactionInput as inputs.

Example

We provide an example of a transfer transaction as follows:

React

Pure JS

Last updated