Skip to main content

API Notes

This guide lists the UKey Wallet Cardano Provider's CIP-30 methods, experimental APIs, types, and error codes. Before calling the dApp API, please first obtain an authorized API instance through enable().


Wallet Interface (CIP-30)

Properties/Method listdescription
nameWallet name (UKey Wallet)
iconWallet Icon URL
apiVersionAPI version
isEnabled()Check if it is enabled
enable()Request wallet access

dApp API (after enable)

MethodDetails
getNetworkId()Get the Network (0=Testnet, 1=mainnet)
getBalance()Get total balance (CBOR)
getUtxos(amount?, paginate?)Get UTxO
getUsedAddresses()Get used address
getUnusedAddresses()Get unused addresses
getChangeAddress()Get change address
getRewardAddresses()Get the pledge address
signTx(tx, partialSign?)Sign transaction
signData(addr, payload)Signature data (CIP-8)
submitTx(tx)Submit transaction

Experimental API

MethodDetails
experimental.getCollateral()Get collateral UTxO
experimental.on(event, cb)Subscribe to events
experimental.off()Unsubscribe

Types

type Cbor = string; // CBOR encoded as hex

interface Paginate {
page: number;
limit: number;
}

interface Cip30DataSignature {
signature: string; // COSE_Sign1 in hex
key: string; // COSE_Key in hex
}

type NetworkId = 0 | 1; // 0 means testnet, 1 means mainnet

Events

EventDetails
accountChangeSelected account changed

error code

CodeDetails
-1User rejected the request
-2Account could not be found
-3Network selection is invalid