Permalink
Fetching contributors…
Cannot retrieve contributors at this time
167 lines (145 sloc) 5.44 KB
// JSON-RPC 2.0
// Parameters are passed by position, parameter names are capitalized for Java generated code
// Barrister IDL does not have dictionary/map type structure
// Method names are all lowercase so easier to type
// Java class names and methods follow Java convention
// Syncing and last seen block is actually on a per wallet basis rather than system-wide
struct JSONRPCWalletStatus {
name string
synced bool
blocks int
}
struct JSONRPCStatusResponse {
version string
testnet bool
connections int
wallets []JSONRPCWalletStatus
}
struct JSONRPCAddressBookEntry {
label string
bitcoin_address string
coinspark_address string
}
struct JSONRPCTransactionAmount {
asset_ref string
raw int
qty float
display string
name string
name_short string
}
struct JSONRPCTransaction {
unixtime int
confirmations int
category string
amounts []JSONRPCTransactionAmount
fee float [optional]
txid string
address string
payment_ref int
message string [optional]
}
struct JSONRPCBalanceAmount {
raw int
qty float
display string
}
// If we subclass with JSONRPCAssetBalance, the returned json is treated as parent class so fields are missing
struct JSONRPCBalance {
asset_ref string
// you must either set the amount here
amount JSONRPCBalanceAmount [optional]
// or set both the total and spendable amounts here
total JSONRPCBalanceAmount [optional]
spendable JSONRPCBalanceAmount [optional]
name string [optional]
name_short string [optional]
domain string [optional]
url string [optional]
issuer string [optional]
description string [optional]
units string [optional]
multiple float [optional]
status string [optional]
valid bool
checked_unixtime int [optional]
contract_url string [optional]
contract_file string [optional]
genesis_txid string [optional]
added_unixtime int [optional]
issue_date string [optional]
issue_unixtime int [optional]
expiry_date string [optional]
expiry_unixtime int [optional]
tracker_urls []string [optional]
icon_url string [optional]
image_url string [optional]
feed_url string [optional]
redemption_url string [optional]
visible bool
refreshing bool
}
// bitcoind has an 'account' field
struct JSONRPCUnspentTransactionOutput {
txid string
vout int
bitcoin_address string
coinspark_address string [optional]
scriptPubKey string
amounts []JSONRPCBalance
confirmations int
}
// Experimental
//struct JSONRPCTestParams {
// walletname string
// address string
// amount float
// txid string [optional]
// vout string [optional]
// message string [optional]
// assetref string [optional]
// assetamount float [optional]
// assetsenderpays bool [optional]
//}
interface sparkbit {
createwallet(walletname string) bool
sendasset(walletname string, address string, assetref string, quantity float, senderpays bool) string
// string is the hash of successful transaction
// rounding mode could be a parameter? but we currently ROUND DOWN in our code.
getstatus() JSONRPCStatusResponse
listwallets() []string
deleteasset(walletname string, assetref string) bool
deletewallet(walletname string) bool
setassetvisible(walletname string, assetref string, visibility bool) bool
addasset(walletname string, assetref string) bool
refreshasset(walletname string, assetref string) bool
listaddresses(walletname string) []JSONRPCAddressBookEntry
createaddresses(walletname string, quantity int) []JSONRPCAddressBookEntry
setaddresslabel(walletname string, address string, label string) bool
listtransactions(walletname string, limit int) []JSONRPCTransaction
listbalances(walletname string, onlyvisible bool) []JSONRPCBalance
sendbitcoin(walletname string, address string, amount float) string
stop() bool
// stop() can only be invoked from same computer as sparkbit
// onlyvisible bool <--- would be useful
listunspent(walletname string, minconf int, maxconf int, addresses []string) []JSONRPCUnspentTransactionOutput
// 0.9.3, deprecated from 0.9.4, replaced with sentbitcoinusing and sendassetusing
sendbitcoinwith(walletname string, txid string, vout int, address string, amount float) string
sendassetwith(walletname string, txid string, vout int, address string, assetref string, quantity float, senderpays bool) string
// 0.9.4 and later
sendbitcoinusing(walletname string, txid string, vout int, address string, amount float) string
sendassetusing(walletname string, txid string, vout int, address string, assetref string, quantity float, senderpays bool) string
// 0.9.4 and later
sendbitcoinasset(walletname string, address string, btc_amount float, assetref string, asset_qty float, senderpays bool) string
sendassetmessage(walletname string, address string, assetref string, quantity float, senderpays bool, message string) string
sendbitcoinmessage(walletname string, address string, amount float, message string) string
sendbitcoinassetmessage(walletname string, address string, btc_amount float, assetref string, asset_qty float, senderpays bool, message string) string
// Experimental
// Return a reference, unique to the wallet
//createmessage(walletname string, reuse bool, message string) string
// Add an attachment to a message, attachment must be base64 encoded
//appendtomessage(walletname string, messageid string, attachment string) bool
//sendmsgbitcoin(walletname string, address string, amount float, messageid string) string
//sendmsgshortbitcoin(walletname string, address string, amount float, message string) string
//test(params JSONRPCTestParams) bool
}