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 list | description |
|---|---|
name | Wallet name (UKey Wallet) |
icon | Wallet Icon URL |
apiVersion | API version |
isEnabled() | Check if it is enabled |
enable() | Request wallet access |
dApp API (after enable)
| Method | Details |
|---|---|
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
| Method | Details |
|---|---|
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
| Event | Details |
|---|---|
accountChange | Selected account changed |
error code
| Code | Details |
|---|---|
| -1 | User rejected the request |
| -2 | Account could not be found |
| -3 | Network selection is invalid |