DEV Community

loading...

Radix DLT - Alpha desktop wallet API documentation

radixdlt profile image Radix ・3 min read

Introduction

The Radix Wallet provides a localhost websocket server which allows any application running either natively or in the browser to perform actions on the ledger through the user's wallet without the user exposing their private keys to the application.

These actions include sending and receiving transactions, messages and custom application data.

The user must explicitly approve any application that wants to do this.

Overview

The server is running at ws://localhost:54345

It is a JsonRPC 2.0 server.

Before making any requests, an application must register it's permissions. This will prompt the user with a dialog to give your app permission to do certain things. If successful, this request will return a token used for authenticating any further request. The lifetime of the token is 30min and it is reset after every successful request.

Afterwards, include the token as token in the request parameters.

API

Register

Register your application. The user will see a popup with your application details and can either approve or deny your access.

method: register

params:

{
name: 'Cashgrab',
description: 'Takes all your money, I don't even know why you would accept this',
permissions: [
  'address',
  'balance',
  'send_transactions'
  ]
}

Successful response:

{
result: { token: 'asdfg' }
...
}

Ping

Check if the Radix Wallet is running and whether a token is still valid.

method: ping

params:

{
token: 'asdfg'
}

Successful response:

{
result: 'pong'
...
}

Send Transaction

Returns the hid of the sent atom

method: send_transaction

permissions: ['send_transactions']

params:

{
token: 'asdfgh',
recipient: '9i9hgAyBQuKvkw7Tg5FEbML59gDmtiwbJwAjBgq5mAU4iaA1ykM',
asset: 'TEST',
quantity: 123.45
}

Successful response:

{
result: {hid: 123}
...
}

Send Message

Send a chat message. Returns the hid of the sent atom.

method: send_message

permissions: ['send_messages']

params:

{
token: 'asdfgh',
recipient: '9i9hgAyBQuKvkw7Tg5FEbML59gDmtiwbJwAjBgq5mAU4iaA1ykM',
message: 'Hi honey, I'm home'
}

Successful response:

{
result: {hid: 123}
...
}

Send application message

Send an application message. Application messages allow storing arbitrary data on the ledger. Returns the hid of the sent atom

method: address

permissions: ['address']

params:

{
token: 'asdfgh',
application_id: 'custom-app',
recipients: [
  '9egJPK7zk2LhPok8VM4noAwVGGS7LKtvTYGJvtF41wrwZAMxjKj',
  '9hFccFfB3Y3A7gToBcD3b9y1ZRnoZfSdHTWVdRPCn3zpKSoVubf',
 ],
payload: {//anything}
}

Successful response:

{
result: {
  result: {hid: 123}
  }
...
}

Get Balance

This is a subscription that will send you an update every time the balance is updated

method: balance

permissions: ['balance']

params:

{
token: 'asdfgh',
}

Successful response:

{
result: 'OK'
...
}

Update notification:

{
jsonrpc: '2.0',
method: 'balance.update',
params: { balance: {TEST: 123.45} }
}

Get Transactions

This is a subscription that will send you an update every time a new transaction occurs

method: transactions

permissions: ['transactions']

params:

{
token: 'asdfgh',
}

Successful response:

{
result: 'OK'
...
}

Update notification:

{
jsonrpc: '2.0',
method: 'transaction.update',
params: { //transaction details }
}

Get Messages

This is a subscription that will send you an update every time a new message is sent or received

method: messages

permissions: ['messages']

params:

{
token: 'asdfgh',
}

Successful response:

{
result: 'OK'
...
}

Update notification:

{
jsonrpc: '2.0',
method: 'message.update',
params: { //message details }
}

Get Application Messages

This is a subscription that will send you an update every time a new message is sent or received

method: application_messages

permissions: ['application_messages']

params:

{
token: 'asdfgh',
application_id: 'custom-app'
}

Successful response:

{
result: 'OK'
...
}

Update notification:

{
jsonrpc: '2.0',
method: 'application_message.update',
params: { 
  applicationId: 'custom-app',
  payload: {//anything}
 }
}

Join The Radix Community

Telegram for general chat
​Discord for developers chat
​Reddit for general discussion
Forum for technical discussion
Twitter for announcements
​Email newsletter for weekly updates
Mail to hello@radixdlt.com for general enquiries

Discussion (0)

pic
Editor guide