Skip to main content

API Notes

This guide lists common methods, types, events and error codes of UKey Wallet Aptos Provider. Before implementing business, please confirm whether the account is connected and check whether the current network meets expectations.


Methods

MethodDetails
connect()Request access and return the connected account
disconnect()Close the current wallet connection
isConnected()Check connection status
account()Fetch the active account info
network()Fetch the current Network name
getNetwork()Fetch the full Network details
getNetworkURL()Fetch the Network RPC URL
signMessage(request)Ask the device to sign the message
signAndSubmitTransaction(payload, options?)Sign and then submit the transaction
signTransaction(payload, options?)Sign only, without submitting it
signTransactionV2(params)Sign a BCS-serialized transaction
signAndSubmitTransactionV2(params)Sign and submit Standard V1.1.0 transactions
signIn(payload)Aptos AIP login process
onAccountChange(callback)Watch account changes
onNetworkChange(callback)Watch Network changes
onDisconnect(callback)Listen for disconnect events

Types

Account information

interface AptosAccountInfo {
address: string; // Note: Hex address starting with 0x
publicKey: string; // Note: Ed25519 public key
}

Network information

interface AptosNetwork {
name: string; // Note: network name
chainId: string; // Note: Chain ID
url: string; // Note: RPC URL
}

Sign message request

interface SignMessageRequest {
message: string; // Note: message to sign
nonce?: string; // Note: optional nonce
address?: boolean; // Note: Include address in message
application?: boolean; // Note: Contains application information
chainId?: boolean; // Note: Contains chain ID
}

Sign message response

interface SignMessageResponse {
signature: string; // Note: Hexadecimal signature
fullMessage: string; // Note: Complete signed message
kaspa: string; // Note: APTOS prefix
address?: string; // address expected to produce the signature
application?: string; // Note: Application information
chainId?: number; // Note: Chain ID
nonce: string; // Note: nonce used
}

Transaction Payload

interface TransactionPayload {
type: "entry_function_payload" | "script_payload" | "module_bundle_payload";
function: string; // keep the Module::function shape
type_arguments: string[];
arguments: any[];
}

Sign Transaction V2 input fields

interface SignTransactionV2Params {
transaction: string; // Note: BCS serialized transactions
transactionType: "simple" | "multi_agent";
asFeePayer?: boolean; // Note: Sign as payor
}

Supported networks

Networkdetails
Mainnetmain network
Testnettesting Network
Devnetdevelopment Network

Events

EventCallback inputsDetails
accountChangedaddress: string | nullSelected account changed
accountChangedV2account: AptosAccountInfo | nullAccount changed (complete information)
networkChangenetwork: string | nullNetwork updated
disconnect-Wallet session closed

error code

CodeDetails
4001User rejected the request
4100Authorization required
4200Action is unavailable
4201Network is unavailable
-32603Provider internal failure