butr
API reference

@usebutr/sui

Wallet Standard discovery, the adapter builder, and the Sui feature types.

Discovery

discoverSuiAdapters(onAdapter, loadModule?): () => void

Subscribes to Wallet Standard registrations for Sui wallets (Slush, Phantom, Suiet, Surf, …). Lazily imports @wallet-standard/app, an optional peer dependency; loadModule injects a registry for tests. It is a WalletSource as-is:

import type { WalletManagerConfig } from "@usebutr/core";
import { discoverSuiAdapters } from "@usebutr/sui";

const config: WalletManagerConfig = { sources: [discoverSuiAdapters] };

suiDiscoverer: PlatformDiscoverer

Wallet Standard only; Sui standardised on it from launch.

Adapter builder

buildSuiAdapter(wallet, registerDisconnector?): SuiAdapter | null

Wraps a WalletStandardWallet, or returns null when it speaks no Sui. The id is slugify("sui", wallet.name). Each optional method exists only when the wallet advertises its feature:

MethodFeatureResolves
sendTxsui:signAndExecuteTransactionThe transaction digest.
signMessagesui:signPersonalMessage{ signature, signedMessage }.
signTransactionsui:signTransaction{ bytes, signature } for executeTransactionBlock.

Transactions are a @mysten/sui Transaction, its JSON string, or BCS bytes (SuiTransactionInput). switchChain needs more than one advertised Sui network. There is no getBalance or getTransactionReceipt. See the Sui connector.

Signer

getSigner() resolves { kind: "wallet-standard", wallet }. Reach a feature with getFeature from @usebutr/wallet-standard-shared and the feature types below.

Types

  • SuiSignPersonalMessageFeature, SuiSignPersonalMessageInput, SuiSignPersonalMessageOutput
  • SuiSignTransactionFeature, SuiSignTransactionInput, SuiSignTransactionOutput
  • SuiSignAndExecuteTransactionFeature, SuiSignAndExecuteTransactionInput, SuiSignAndExecuteTransactionOutput

The Sui chain registry (SUI_CHAINS, SUI_CHAINS_LIST) lives in @usebutr/core.

Source: packages/sui/src/index.ts.