API Reference
Complete reference for every method, type, and event on the window.starkey.supra provider. See the linked pages for full explanations and examples of each.
No method on this provider rejects. A declined prompt resolves to null. See Errors for the full
failure model before writing error handling.
Methods
| Method | Signature | Returns | Docs |
|---|---|---|---|
connect(options?) | (options?: ConnectOptions) => Promise<string[] | null> | Connected addresses, null if declined | Establish a Connection |
isConnected() | () => Promise<boolean> | Whether an active connection exists | Establish a Connection |
disconnect() | () => Promise<void> | none | Establish a Connection |
accounts() | () => Promise<string[]> | Connected addresses, [] if none | Accounts |
account() — deprecated | () => Promise<string[]> | Same as accounts() | Accounts |
getActiveAccount() | () => Promise<ActiveAccount> | Active address + public key | Accounts |
balance() | () => Promise<Balance> | Active account’s balance | Accounts |
getChainId() | () => Promise<ChainId | null> | Current chain, null if disconnected | Network |
changeNetwork(params) | (params: { chainId: string }) => Promise<ChainId | null> | Updated chain, null if not switched | Network |
sendTransaction(params) | (params: SendTransactionParams) => Promise<string | null> | Transaction hash, null if declined | Sending a Transaction |
sendAutomationTransaction(params) | (params: SendTransactionParams) => Promise<string | null> | Transaction hash, null if declined | Sending a Transaction |
signTransaction(tx) | (tx: SendTransactionParams) => Promise<Ed25519Authenticator | null> | Signer authenticator (unbroadcast) | Sending a Transaction |
waitForTransactionWithResult(params) | (params: { hash: string }) => Promise<TransactionResult | null> | Final tx status, null if invalid hash | Sending a Transaction |
signMessage(params) | (params: { message: string }) => Promise<SignedMessage | null> | Signed UTF-8-hex message, null if declined | Signing Messages |
signHexMessage(params) | (params: { message: string }) => Promise<SignedMessage | null> | Signed raw-hex message, null if declined | Signing Messages |
createRawTransactionData(payload) — deprecated | — | — | Use SupraClient.createSerializedRawTxObject from supra-l1-sdk instead — see Sending a Transaction |
on(event, handler) | (event: string, handler: Function) => void | — | Events |
Types
interface ConnectOptions {
chainId?: string
multiple?: boolean
}
interface ActiveAccount {
address: string
publicKey: string
}
interface Balance {
balance: number
formattedBalance: number
decimal: number
displayUnit: string
}
interface ChainId {
chainId: string
}
interface SendTransactionParams {
data?: string
from: string
to: string
value: string
chainId: string
options?: {
waitForTransaction: boolean
}
}
interface Ed25519Authenticator {
Ed25519: {
public_key: string
signature: string
}
}
interface TransactionResult {
hash: string
status: 'Success' | 'Failed'
vmStatus: string
}
interface SignedMessage {
address: string
publicKey: string
signature: string
}Events
| Event | Payload | Docs |
|---|---|---|
accountChanged | string[] | Events |
networkChanged | { chainId: string } | Events |
disconnect | none | Events |
starkey-extension-installed (browser message event, not provider.on) | none | Events |
Supporting supra-l1-sdk / supra-l1-sdk-core calls
These aren’t part of the window.starkey.supra provider — they come from the companion supra-l1-sdk package (npm install supra-l1-sdk) and are used alongside the provider to build raw transactions and sponsor flows. Full worked examples in the SDK’s own example.ts .
| Call | Purpose |
|---|---|
SupraClient.init(rpcUrl) | Create an RPC client for the selected network |
supraClient.getAccountInfo(address) | Fetch sequence_number for building a raw tx |
supraClient.createSerializedRawTxObject(...) | Build + BCS-serialize an entry-function raw transaction |
supraClient.createRawTxObject(...) | Build an unserialized raw transaction object (used for sponsor flows) |
supraClient.signSupraMultiTransaction(feePayerAccount, payload) | Sign the fee-payer side of a sponsor transaction |
supraClient.sendSponsorTransaction(...) | Broadcast a signed sponsor (fee-payer) transaction |
new TypeTagParser(typeStr).parseTypeTag() | Resolve a Move type tag string (e.g. 0x1::supra_coin::SupraCoin) |
BCS.bcsSerializeUint64 / BCS.bcsSerializeU256 | Serialize numeric function args to BCS bytes |
HexString.ensure(address) | Normalize an address string into a HexString |
TxnBuilderTypes.FeePayerRawTransaction / AccountAuthenticatorEd25519 / Ed25519PublicKey / Ed25519Signature | Build the sponsor tx payload + sender authenticator manually |
Reference docs
- Supra Network Information — chain IDs, public RPC endpoints, explorers
- supra-l1-sdk / example.ts — raw transaction construction, sponsor transactions
Related pages
Last updated on