| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
"""Daemon class to make rpc calls and store state.""" |
| 31 |
|
| 32 |
from .rpc import JSONRPC |
| 33 |
|
| 34 |
class Wallet(object): |
| 35 |
|
| 36 |
def __init__(self, protocol='http', host='127.0.0.1', port=0, idx=0): |
| 37 |
self.host = host |
| 38 |
self.port = port |
| 39 |
self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18090+idx)) |
| 40 |
|
| 41 |
def transfer(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False, subtract_fee_from_outputs = []): |
| 42 |
transfer = { |
| 43 |
'method': 'transfer', |
| 44 |
'params': { |
| 45 |
'destinations': destinations, |
| 46 |
'account_index': account_index, |
| 47 |
'subaddr_indices': subaddr_indices, |
| 48 |
'subtract_fee_from_outputs': subtract_fee_from_outputs, |
| 49 |
'priority': priority, |
| 50 |
'ring_size' : ring_size, |
| 51 |
'unlock_time' : unlock_time, |
| 52 |
'payment_id' : payment_id, |
| 53 |
'get_tx_key' : get_tx_key, |
| 54 |
'do_not_relay' : do_not_relay, |
| 55 |
'get_tx_hex' : get_tx_hex, |
| 56 |
'get_tx_metadata' : get_tx_metadata, |
| 57 |
}, |
| 58 |
'jsonrpc': '2.0', |
| 59 |
'id': '0' |
| 60 |
} |
| 61 |
return self.rpc.send_json_rpc_request(transfer) |
| 62 |
|
| 63 |
def transfer_split(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False): |
| 64 |
transfer = { |
| 65 |
"method": "transfer_split", |
| 66 |
"params": { |
| 67 |
'destinations': destinations, |
| 68 |
'account_index': account_index, |
| 69 |
'subaddr_indices': subaddr_indices, |
| 70 |
'priority': priority, |
| 71 |
'ring_size' : ring_size, |
| 72 |
'unlock_time' : unlock_time, |
| 73 |
'payment_id' : payment_id, |
| 74 |
'get_tx_key' : get_tx_key, |
| 75 |
'do_not_relay' : do_not_relay, |
| 76 |
'get_tx_hex' : get_tx_hex, |
| 77 |
'get_tx_metadata' : get_tx_metadata, |
| 78 |
}, |
| 79 |
"jsonrpc": "2.0", |
| 80 |
"id": "0" |
| 81 |
} |
| 82 |
return self.rpc.send_json_rpc_request(transfer) |
| 83 |
|
| 84 |
def get_transfer_by_txid(self, txid, account_index = 0): |
| 85 |
get_transfer_by_txid = { |
| 86 |
'method': 'get_transfer_by_txid', |
| 87 |
'params': { |
| 88 |
'txid': txid, |
| 89 |
'account_index': account_index, |
| 90 |
}, |
| 91 |
'jsonrpc': '2.0', |
| 92 |
'id': '0' |
| 93 |
} |
| 94 |
return self.rpc.send_json_rpc_request(get_transfer_by_txid) |
| 95 |
|
| 96 |
def get_payments(self, payment_id): |
| 97 |
get_payments = { |
| 98 |
'method': 'get_payments', |
| 99 |
'params': { |
| 100 |
'payment_id': payment_id, |
| 101 |
}, |
| 102 |
'jsonrpc': '2.0', |
| 103 |
'id': '0' |
| 104 |
} |
| 105 |
return self.rpc.send_json_rpc_request(get_payments) |
| 106 |
|
| 107 |
def get_bulk_payments(self, payment_ids = [], min_block_height = 0): |
| 108 |
get_bulk_payments = { |
| 109 |
'method': 'get_bulk_payments', |
| 110 |
'params': { |
| 111 |
'payment_ids': payment_ids, |
| 112 |
'min_block_height': min_block_height, |
| 113 |
}, |
| 114 |
'jsonrpc': '2.0', |
| 115 |
'id': '0' |
| 116 |
} |
| 117 |
return self.rpc.send_json_rpc_request(get_bulk_payments) |
| 118 |
|
| 119 |
def describe_transfer(self, unsigned_txset = '', multisig_txset = ''): |
| 120 |
describe_transfer = { |
| 121 |
'method': 'describe_transfer', |
| 122 |
'params': { |
| 123 |
'unsigned_txset': unsigned_txset, |
| 124 |
'multisig_txset': multisig_txset, |
| 125 |
}, |
| 126 |
'jsonrpc': '2.0', |
| 127 |
'id': '0' |
| 128 |
} |
| 129 |
return self.rpc.send_json_rpc_request(describe_transfer) |
| 130 |
|
| 131 |
def create_wallet(self, filename='', password = '', language = 'English'): |
| 132 |
create_wallet = { |
| 133 |
'method': 'create_wallet', |
| 134 |
'params': { |
| 135 |
'filename': filename, |
| 136 |
'password': password, |
| 137 |
'language': language |
| 138 |
}, |
| 139 |
'jsonrpc': '2.0', |
| 140 |
'id': '0' |
| 141 |
} |
| 142 |
return self.rpc.send_json_rpc_request(create_wallet) |
| 143 |
|
| 144 |
def get_balance(self, account_index = 0, address_indices = [], all_accounts = False, strict = False): |
| 145 |
get_balance = { |
| 146 |
'method': 'get_balance', |
| 147 |
'params': { |
| 148 |
'account_index': account_index, |
| 149 |
'address_indices': address_indices, |
| 150 |
'all_accounts': all_accounts, |
| 151 |
'strict': strict, |
| 152 |
}, |
| 153 |
'jsonrpc': '2.0', |
| 154 |
'id': '0' |
| 155 |
} |
| 156 |
return self.rpc.send_json_rpc_request(get_balance) |
| 157 |
getbalance = get_balance |
| 158 |
|
| 159 |
def sweep_dust(self, get_tx_keys = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False): |
| 160 |
sweep_dust = { |
| 161 |
'method': 'sweep_dust', |
| 162 |
'params': { |
| 163 |
'get_tx_keys': get_tx_keys, |
| 164 |
'do_not_relay': do_not_relay, |
| 165 |
'get_tx_hex': get_tx_hex, |
| 166 |
'get_tx_metadata': get_tx_metadata, |
| 167 |
}, |
| 168 |
'jsonrpc': '2.0', |
| 169 |
'id': '0' |
| 170 |
} |
| 171 |
return self.rpc.send_json_rpc_request(sweep_dust) |
| 172 |
sweep_unmixable = sweep_dust |
| 173 |
|
| 174 |
def sweep_all(self, address = '', account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, outputs = 1, unlock_time = 0, payment_id = '', get_tx_keys = False, below_amount = 0, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False): |
| 175 |
sweep_all = { |
| 176 |
'method': 'sweep_all', |
| 177 |
'params' : { |
| 178 |
'address' : address, |
| 179 |
'account_index' : account_index, |
| 180 |
'subaddr_indices' : subaddr_indices, |
| 181 |
'priority' : priority, |
| 182 |
'ring_size' : ring_size, |
| 183 |
'outputs' : outputs, |
| 184 |
'unlock_time' : unlock_time, |
| 185 |
'payment_id' : payment_id, |
| 186 |
'get_tx_keys' : get_tx_keys, |
| 187 |
'below_amount' : below_amount, |
| 188 |
'do_not_relay' : do_not_relay, |
| 189 |
'get_tx_hex' : get_tx_hex, |
| 190 |
'get_tx_metadata' : get_tx_metadata, |
| 191 |
}, |
| 192 |
'jsonrpc': '2.0', |
| 193 |
'id': '0' |
| 194 |
} |
| 195 |
return self.rpc.send_json_rpc_request(sweep_all) |
| 196 |
|
| 197 |
def sweep_single(self, address = '', priority = 0, ring_size = 0, outputs = 1, unlock_time = 0, payment_id = '', get_tx_keys = False, key_image = "", do_not_relay = False, get_tx_hex = False, get_tx_metadata = False): |
| 198 |
sweep_single = { |
| 199 |
'method': 'sweep_single', |
| 200 |
'params' : { |
| 201 |
'address' : address, |
| 202 |
'priority' : priority, |
| 203 |
'ring_size' : ring_size, |
| 204 |
'outputs' : outputs, |
| 205 |
'unlock_time' : unlock_time, |
| 206 |
'payment_id' : payment_id, |
| 207 |
'get_tx_keys' : get_tx_keys, |
| 208 |
'key_image' : key_image, |
| 209 |
'do_not_relay' : do_not_relay, |
| 210 |
'get_tx_hex' : get_tx_hex, |
| 211 |
'get_tx_metadata' : get_tx_metadata, |
| 212 |
}, |
| 213 |
'jsonrpc': '2.0', |
| 214 |
'id': '0' |
| 215 |
} |
| 216 |
return self.rpc.send_json_rpc_request(sweep_single) |
| 217 |
|
| 218 |
def get_address(self, account_index = 0, subaddresses = []): |
| 219 |
get_address = { |
| 220 |
'method': 'get_address', |
| 221 |
'params' : { |
| 222 |
'account_index' : account_index, |
| 223 |
'address_index': subaddresses |
| 224 |
}, |
| 225 |
'jsonrpc': '2.0', |
| 226 |
'id': '0' |
| 227 |
} |
| 228 |
return self.rpc.send_json_rpc_request(get_address) |
| 229 |
getaddress = get_address |
| 230 |
|
| 231 |
def create_account(self, label = ""): |
| 232 |
create_account = { |
| 233 |
'method': 'create_account', |
| 234 |
'params' : { |
| 235 |
'label': label |
| 236 |
}, |
| 237 |
'jsonrpc': '2.0', |
| 238 |
'id': '0' |
| 239 |
} |
| 240 |
return self.rpc.send_json_rpc_request(create_account) |
| 241 |
|
| 242 |
def create_address(self, account_index = 0, label = "", count = 1): |
| 243 |
create_address = { |
| 244 |
'method': 'create_address', |
| 245 |
'params' : { |
| 246 |
'account_index': account_index, |
| 247 |
'label': label, |
| 248 |
'count': count |
| 249 |
}, |
| 250 |
'jsonrpc': '2.0', |
| 251 |
'id': '0' |
| 252 |
} |
| 253 |
return self.rpc.send_json_rpc_request(create_address) |
| 254 |
|
| 255 |
def label_address(self, subaddress_index, label): |
| 256 |
label_address = { |
| 257 |
'method': 'label_address', |
| 258 |
'params' : { |
| 259 |
'index': { 'major': subaddress_index[0], 'minor': subaddress_index[1]}, |
| 260 |
'label': label |
| 261 |
}, |
| 262 |
'jsonrpc': '2.0', |
| 263 |
'id': '0' |
| 264 |
} |
| 265 |
return self.rpc.send_json_rpc_request(label_address) |
| 266 |
|
| 267 |
def label_account(self, account_index, label): |
| 268 |
label_account = { |
| 269 |
'method': 'label_account', |
| 270 |
'params' : { |
| 271 |
'account_index': account_index, |
| 272 |
'label': label |
| 273 |
}, |
| 274 |
'jsonrpc': '2.0', |
| 275 |
'id': '0' |
| 276 |
} |
| 277 |
return self.rpc.send_json_rpc_request(label_account) |
| 278 |
|
| 279 |
def get_address_index(self, address): |
| 280 |
get_address_index = { |
| 281 |
'method': 'get_address_index', |
| 282 |
'params' : { |
| 283 |
'address': address |
| 284 |
}, |
| 285 |
'jsonrpc': '2.0', |
| 286 |
'id': '0' |
| 287 |
} |
| 288 |
return self.rpc.send_json_rpc_request(get_address_index) |
| 289 |
|
| 290 |
def query_key(self, key_type): |
| 291 |
query_key = { |
| 292 |
'method': 'query_key', |
| 293 |
'params' : { |
| 294 |
'key_type': key_type |
| 295 |
}, |
| 296 |
'jsonrpc': '2.0', |
| 297 |
'id': '0' |
| 298 |
} |
| 299 |
return self.rpc.send_json_rpc_request(query_key) |
| 300 |
|
| 301 |
def restore_deterministic_wallet(self, seed = '', seed_offset = '', filename = '', restore_height = 0, password = '', language = '', autosave_current = True, enable_multisig_experimental = False): |
| 302 |
restore_deterministic_wallet = { |
| 303 |
'method': 'restore_deterministic_wallet', |
| 304 |
'params' : { |
| 305 |
'restore_height': restore_height, |
| 306 |
'filename': filename, |
| 307 |
'seed': seed, |
| 308 |
'seed_offset': seed_offset, |
| 309 |
'password': password, |
| 310 |
'language': language, |
| 311 |
'autosave_current': autosave_current, |
| 312 |
'enable_multisig_experimental': enable_multisig_experimental |
| 313 |
}, |
| 314 |
'jsonrpc': '2.0', |
| 315 |
'id': '0' |
| 316 |
} |
| 317 |
return self.rpc.send_json_rpc_request(restore_deterministic_wallet) |
| 318 |
|
| 319 |
def generate_from_keys(self, restore_height = 0, filename = "", password = "", address = "", spendkey = "", viewkey = "", autosave_current = True): |
| 320 |
generate_from_keys = { |
| 321 |
'method': 'generate_from_keys', |
| 322 |
'params' : { |
| 323 |
'restore_height': restore_height, |
| 324 |
'filename': filename, |
| 325 |
'address': address, |
| 326 |
'spendkey': spendkey, |
| 327 |
'viewkey': viewkey, |
| 328 |
'password': password, |
| 329 |
'autosave_current': autosave_current, |
| 330 |
}, |
| 331 |
'jsonrpc': '2.0', |
| 332 |
'id': '0' |
| 333 |
} |
| 334 |
return self.rpc.send_json_rpc_request(generate_from_keys) |
| 335 |
|
| 336 |
def set_subaddress_lookahead(self, major_idx: int, minor_idx: int, password = ""): |
| 337 |
lookahead = { |
| 338 |
'method': 'set_subaddress_lookahead', |
| 339 |
'jsonrpc': '2.0', |
| 340 |
'params' : { |
| 341 |
'password': password, |
| 342 |
'major_idx': major_idx, |
| 343 |
'minor_idx': minor_idx |
| 344 |
}, |
| 345 |
'id': '0' |
| 346 |
} |
| 347 |
return self.rpc.send_json_rpc_request(lookahead) |
| 348 |
|
| 349 |
def open_wallet(self, filename, password='', autosave_current = True): |
| 350 |
open_wallet = { |
| 351 |
'method': 'open_wallet', |
| 352 |
'params' : { |
| 353 |
'filename': filename, |
| 354 |
'password': password, |
| 355 |
'autosave_current': autosave_current, |
| 356 |
}, |
| 357 |
'jsonrpc': '2.0', |
| 358 |
'id': '0' |
| 359 |
} |
| 360 |
return self.rpc.send_json_rpc_request(open_wallet) |
| 361 |
|
| 362 |
def close_wallet(self, autosave_current = True): |
| 363 |
close_wallet = { |
| 364 |
'method': 'close_wallet', |
| 365 |
'params' : { |
| 366 |
'autosave_current': autosave_current |
| 367 |
}, |
| 368 |
'jsonrpc': '2.0', |
| 369 |
'id': '0' |
| 370 |
} |
| 371 |
return self.rpc.send_json_rpc_request(close_wallet) |
| 372 |
|
| 373 |
def change_wallet_password(self, old_password, new_password): |
| 374 |
change_wallet_password = { |
| 375 |
'method': 'change_wallet_password', |
| 376 |
'params' : { |
| 377 |
'old_password': old_password, |
| 378 |
'new_password': new_password, |
| 379 |
}, |
| 380 |
'jsonrpc': '2.0', |
| 381 |
'id': '0' |
| 382 |
} |
| 383 |
return self.rpc.send_json_rpc_request(change_wallet_password) |
| 384 |
|
| 385 |
def store(self): |
| 386 |
store = { |
| 387 |
'method': 'store', |
| 388 |
'jsonrpc': '2.0', |
| 389 |
'id': '0' |
| 390 |
} |
| 391 |
return self.rpc.send_json_rpc_request(store) |
| 392 |
|
| 393 |
def stop_wallet(self): |
| 394 |
stop_wallet = { |
| 395 |
'method': 'stop_wallet', |
| 396 |
'jsonrpc': '2.0', |
| 397 |
'id': '0' |
| 398 |
} |
| 399 |
return self.rpc.send_json_rpc_request(stop_wallet) |
| 400 |
|
| 401 |
def refresh(self): |
| 402 |
refresh = { |
| 403 |
'method': 'refresh', |
| 404 |
'params' : { |
| 405 |
}, |
| 406 |
'jsonrpc': '2.0', |
| 407 |
'id': '0' |
| 408 |
} |
| 409 |
return self.rpc.send_json_rpc_request(refresh) |
| 410 |
|
| 411 |
def incoming_transfers(self, transfer_type='all', account_index = 0, subaddr_indices = []): |
| 412 |
incoming_transfers = { |
| 413 |
'method': 'incoming_transfers', |
| 414 |
'params' : { |
| 415 |
'transfer_type': transfer_type, |
| 416 |
'account_index': account_index, |
| 417 |
'subaddr_indices': subaddr_indices, |
| 418 |
}, |
| 419 |
'jsonrpc': '2.0', |
| 420 |
'id': '0' |
| 421 |
} |
| 422 |
return self.rpc.send_json_rpc_request(incoming_transfers) |
| 423 |
|
| 424 |
def get_transfers(self, in_ = True, out = True, pending = True, failed = True, pool = True, min_height = None, max_height = None, account_index = 0, subaddr_indices = [], all_accounts = False): |
| 425 |
get_transfers = { |
| 426 |
'method': 'get_transfers', |
| 427 |
'params' : { |
| 428 |
'in': in_, |
| 429 |
'out': out, |
| 430 |
'pending': pending, |
| 431 |
'failed': failed, |
| 432 |
'pool': pool, |
| 433 |
'min_height': min_height, |
| 434 |
'max_height': max_height, |
| 435 |
'filter_by_height': min_height or max_height, |
| 436 |
'account_index': account_index, |
| 437 |
'subaddr_indices': subaddr_indices, |
| 438 |
'all_accounts': all_accounts, |
| 439 |
}, |
| 440 |
'jsonrpc': '2.0', |
| 441 |
'id': '0' |
| 442 |
} |
| 443 |
return self.rpc.send_json_rpc_request(get_transfers) |
| 444 |
|
| 445 |
def make_integrated_address(self, standard_address = '', payment_id = ''): |
| 446 |
make_integrated_address = { |
| 447 |
'method': 'make_integrated_address', |
| 448 |
'params' : { |
| 449 |
'standard_address': standard_address, |
| 450 |
'payment_id': payment_id, |
| 451 |
}, |
| 452 |
'jsonrpc': '2.0', |
| 453 |
'id': '0' |
| 454 |
} |
| 455 |
return self.rpc.send_json_rpc_request(make_integrated_address) |
| 456 |
|
| 457 |
def split_integrated_address(self, integrated_address): |
| 458 |
split_integrated_address = { |
| 459 |
'method': 'split_integrated_address', |
| 460 |
'params' : { |
| 461 |
'integrated_address': integrated_address, |
| 462 |
}, |
| 463 |
'jsonrpc': '2.0', |
| 464 |
'id': '0' |
| 465 |
} |
| 466 |
return self.rpc.send_json_rpc_request(split_integrated_address) |
| 467 |
|
| 468 |
def auto_refresh(self, enable, period = 0): |
| 469 |
auto_refresh = { |
| 470 |
'method': 'auto_refresh', |
| 471 |
'params' : { |
| 472 |
'enable': enable, |
| 473 |
'period': period |
| 474 |
}, |
| 475 |
'jsonrpc': '2.0', |
| 476 |
'id': '0' |
| 477 |
} |
| 478 |
return self.rpc.send_json_rpc_request(auto_refresh) |
| 479 |
|
| 480 |
def set_daemon(self, address, trusted = False, ssl_support = "autodetect", ssl_private_key_path = "", ssl_certificate_path = "", ssl_allowed_certificates = [], ssl_allowed_fingerprints = [], ssl_allow_any_cert = False): |
| 481 |
set_daemon = { |
| 482 |
'method': 'set_daemon', |
| 483 |
'params' : { |
| 484 |
'address': address, |
| 485 |
'trusted': trusted, |
| 486 |
'ssl_support': ssl_support, |
| 487 |
'ssl_private_key_path': ssl_private_key_path, |
| 488 |
'ssl_certificate_path': ssl_certificate_path, |
| 489 |
'ssl_allowed_certificates': ssl_allowed_certificates, |
| 490 |
'ssl_allowed_fingerprints': ssl_allowed_fingerprints, |
| 491 |
'ssl_allow_any_cert': ssl_allow_any_cert, |
| 492 |
}, |
| 493 |
'jsonrpc': '2.0', |
| 494 |
'id': '0' |
| 495 |
} |
| 496 |
return self.rpc.send_json_rpc_request(set_daemon) |
| 497 |
|
| 498 |
def is_multisig(self): |
| 499 |
is_multisig = { |
| 500 |
'method': 'is_multisig', |
| 501 |
'params' : { |
| 502 |
}, |
| 503 |
'jsonrpc': '2.0', |
| 504 |
'id': '0' |
| 505 |
} |
| 506 |
return self.rpc.send_json_rpc_request(is_multisig) |
| 507 |
|
| 508 |
def prepare_multisig(self, enable_multisig_experimental = False): |
| 509 |
prepare_multisig = { |
| 510 |
'method': 'prepare_multisig', |
| 511 |
'params' : { |
| 512 |
'enable_multisig_experimental': enable_multisig_experimental, |
| 513 |
}, |
| 514 |
'jsonrpc': '2.0', |
| 515 |
'id': '0' |
| 516 |
} |
| 517 |
return self.rpc.send_json_rpc_request(prepare_multisig) |
| 518 |
|
| 519 |
def make_multisig(self, multisig_info, threshold, password = ''): |
| 520 |
make_multisig = { |
| 521 |
'method': 'make_multisig', |
| 522 |
'params' : { |
| 523 |
'multisig_info': multisig_info, |
| 524 |
'threshold': threshold, |
| 525 |
'password': password, |
| 526 |
}, |
| 527 |
'jsonrpc': '2.0', |
| 528 |
'id': '0' |
| 529 |
} |
| 530 |
return self.rpc.send_json_rpc_request(make_multisig) |
| 531 |
|
| 532 |
def finalize_multisig(self): |
| 533 |
finalize_multisig = { |
| 534 |
'method': 'finalize_multisig', |
| 535 |
'params' : { |
| 536 |
}, |
| 537 |
'jsonrpc': '2.0', |
| 538 |
'id': '0' |
| 539 |
} |
| 540 |
return self.rpc.send_json_rpc_request(finalize_multisig) |
| 541 |
|
| 542 |
def exchange_multisig_keys(self, multisig_info, password = '', force_update_use_with_caution = False): |
| 543 |
exchange_multisig_keys = { |
| 544 |
'method': 'exchange_multisig_keys', |
| 545 |
'params' : { |
| 546 |
'multisig_info': multisig_info, |
| 547 |
'password': password, |
| 548 |
'force_update_use_with_caution': force_update_use_with_caution, |
| 549 |
}, |
| 550 |
'jsonrpc': '2.0', |
| 551 |
'id': '0' |
| 552 |
} |
| 553 |
return self.rpc.send_json_rpc_request(exchange_multisig_keys) |
| 554 |
|
| 555 |
def export_multisig_info(self): |
| 556 |
export_multisig_info = { |
| 557 |
'method': 'export_multisig_info', |
| 558 |
'params' : { |
| 559 |
}, |
| 560 |
'jsonrpc': '2.0', |
| 561 |
'id': '0' |
| 562 |
} |
| 563 |
return self.rpc.send_json_rpc_request(export_multisig_info) |
| 564 |
|
| 565 |
def import_multisig_info(self, info = []): |
| 566 |
import_multisig_info = { |
| 567 |
'method': 'import_multisig_info', |
| 568 |
'params' : { |
| 569 |
'info': info |
| 570 |
}, |
| 571 |
'jsonrpc': '2.0', |
| 572 |
'id': '0' |
| 573 |
} |
| 574 |
return self.rpc.send_json_rpc_request(import_multisig_info) |
| 575 |
|
| 576 |
def sign_multisig(self, tx_data_hex): |
| 577 |
sign_multisig = { |
| 578 |
'method': 'sign_multisig', |
| 579 |
'params' : { |
| 580 |
'tx_data_hex': tx_data_hex |
| 581 |
}, |
| 582 |
'jsonrpc': '2.0', |
| 583 |
'id': '0' |
| 584 |
} |
| 585 |
return self.rpc.send_json_rpc_request(sign_multisig) |
| 586 |
|
| 587 |
def submit_multisig(self, tx_data_hex): |
| 588 |
submit_multisig = { |
| 589 |
'method': 'submit_multisig', |
| 590 |
'params' : { |
| 591 |
'tx_data_hex': tx_data_hex |
| 592 |
}, |
| 593 |
'jsonrpc': '2.0', |
| 594 |
'id': '0' |
| 595 |
} |
| 596 |
return self.rpc.send_json_rpc_request(submit_multisig) |
| 597 |
|
| 598 |
def sign_transfer(self, unsigned_txset, export_raw = False, get_tx_keys = False): |
| 599 |
sign_transfer = { |
| 600 |
'method': 'sign_transfer', |
| 601 |
'params' : { |
| 602 |
'unsigned_txset': unsigned_txset, |
| 603 |
'export_raw': export_raw, |
| 604 |
'get_tx_keys': get_tx_keys, |
| 605 |
}, |
| 606 |
'jsonrpc': '2.0', |
| 607 |
'id': '0' |
| 608 |
} |
| 609 |
return self.rpc.send_json_rpc_request(sign_transfer) |
| 610 |
|
| 611 |
def submit_transfer(self, tx_data_hex): |
| 612 |
submit_transfer = { |
| 613 |
'method': 'submit_transfer', |
| 614 |
'params' : { |
| 615 |
'tx_data_hex': tx_data_hex, |
| 616 |
}, |
| 617 |
'jsonrpc': '2.0', |
| 618 |
'id': '0' |
| 619 |
} |
| 620 |
return self.rpc.send_json_rpc_request(submit_transfer) |
| 621 |
|
| 622 |
def get_tx_key(self, txid): |
| 623 |
get_tx_key = { |
| 624 |
'method': 'get_tx_key', |
| 625 |
'params' : { |
| 626 |
'txid': txid, |
| 627 |
}, |
| 628 |
'jsonrpc': '2.0', |
| 629 |
'id': '0' |
| 630 |
} |
| 631 |
return self.rpc.send_json_rpc_request(get_tx_key) |
| 632 |
|
| 633 |
def check_tx_key(self, txid = '', tx_key = '', address = ''): |
| 634 |
check_tx_key = { |
| 635 |
'method': 'check_tx_key', |
| 636 |
'params' : { |
| 637 |
'txid': txid, |
| 638 |
'tx_key': tx_key, |
| 639 |
'address': address, |
| 640 |
}, |
| 641 |
'jsonrpc': '2.0', |
| 642 |
'id': '0' |
| 643 |
} |
| 644 |
return self.rpc.send_json_rpc_request(check_tx_key) |
| 645 |
|
| 646 |
def get_tx_proof(self, txid = '', address = '', message = ''): |
| 647 |
get_tx_proof = { |
| 648 |
'method': 'get_tx_proof', |
| 649 |
'params' : { |
| 650 |
'txid': txid, |
| 651 |
'address': address, |
| 652 |
'message': message, |
| 653 |
}, |
| 654 |
'jsonrpc': '2.0', |
| 655 |
'id': '0' |
| 656 |
} |
| 657 |
return self.rpc.send_json_rpc_request(get_tx_proof) |
| 658 |
|
| 659 |
def check_tx_proof(self, txid = '', address = '', message = '', signature = ''): |
| 660 |
check_tx_proof = { |
| 661 |
'method': 'check_tx_proof', |
| 662 |
'params' : { |
| 663 |
'txid': txid, |
| 664 |
'address': address, |
| 665 |
'message': message, |
| 666 |
'signature': signature, |
| 667 |
}, |
| 668 |
'jsonrpc': '2.0', |
| 669 |
'id': '0' |
| 670 |
} |
| 671 |
return self.rpc.send_json_rpc_request(check_tx_proof) |
| 672 |
|
| 673 |
def get_spend_proof(self, txid = '', message = ''): |
| 674 |
get_spend_proof = { |
| 675 |
'method': 'get_spend_proof', |
| 676 |
'params' : { |
| 677 |
'txid': txid, |
| 678 |
'message': message, |
| 679 |
}, |
| 680 |
'jsonrpc': '2.0', |
| 681 |
'id': '0' |
| 682 |
} |
| 683 |
return self.rpc.send_json_rpc_request(get_spend_proof) |
| 684 |
|
| 685 |
def check_spend_proof(self, txid = '', message = '', signature = ''): |
| 686 |
check_spend_proof = { |
| 687 |
'method': 'check_spend_proof', |
| 688 |
'params' : { |
| 689 |
'txid': txid, |
| 690 |
'message': message, |
| 691 |
'signature': signature, |
| 692 |
}, |
| 693 |
'jsonrpc': '2.0', |
| 694 |
'id': '0' |
| 695 |
} |
| 696 |
return self.rpc.send_json_rpc_request(check_spend_proof) |
| 697 |
|
| 698 |
def get_reserve_proof(self, all_ = True, account_index = 0, amount = 0, message = ''): |
| 699 |
get_reserve_proof = { |
| 700 |
'method': 'get_reserve_proof', |
| 701 |
'params' : { |
| 702 |
'all': all_, |
| 703 |
'account_index': account_index, |
| 704 |
'amount': amount, |
| 705 |
'message': message, |
| 706 |
}, |
| 707 |
'jsonrpc': '2.0', |
| 708 |
'id': '0' |
| 709 |
} |
| 710 |
return self.rpc.send_json_rpc_request(get_reserve_proof) |
| 711 |
|
| 712 |
def check_reserve_proof(self, address = '', message = '', signature = ''): |
| 713 |
check_reserve_proof = { |
| 714 |
'method': 'check_reserve_proof', |
| 715 |
'params' : { |
| 716 |
'address': address, |
| 717 |
'message': message, |
| 718 |
'signature': signature, |
| 719 |
}, |
| 720 |
'jsonrpc': '2.0', |
| 721 |
'id': '0' |
| 722 |
} |
| 723 |
return self.rpc.send_json_rpc_request(check_reserve_proof) |
| 724 |
|
| 725 |
def sign(self, data, account_index = 0, address_index = 0, signature_type = ""): |
| 726 |
sign = { |
| 727 |
'method': 'sign', |
| 728 |
'params' : { |
| 729 |
'data': data, |
| 730 |
'account_index': account_index, |
| 731 |
'address_index': address_index, |
| 732 |
'signature_type': signature_type, |
| 733 |
}, |
| 734 |
'jsonrpc': '2.0', |
| 735 |
'id': '0' |
| 736 |
} |
| 737 |
return self.rpc.send_json_rpc_request(sign) |
| 738 |
|
| 739 |
def verify(self, data, address, signature): |
| 740 |
verify = { |
| 741 |
'method': 'verify', |
| 742 |
'params' : { |
| 743 |
'data': data, |
| 744 |
'address': address, |
| 745 |
'signature': signature, |
| 746 |
}, |
| 747 |
'jsonrpc': '2.0', |
| 748 |
'id': '0' |
| 749 |
} |
| 750 |
return self.rpc.send_json_rpc_request(verify) |
| 751 |
|
| 752 |
def get_height(self): |
| 753 |
get_height = { |
| 754 |
'method': 'get_height', |
| 755 |
'jsonrpc': '2.0', |
| 756 |
'id': '0' |
| 757 |
} |
| 758 |
return self.rpc.send_json_rpc_request(get_height) |
| 759 |
getheight = get_height |
| 760 |
|
| 761 |
def relay_tx(self, hex_): |
| 762 |
relay_tx = { |
| 763 |
'method': 'relay_tx', |
| 764 |
'params': { |
| 765 |
'hex': hex_, |
| 766 |
}, |
| 767 |
'jsonrpc': '2.0', |
| 768 |
'id': '0' |
| 769 |
} |
| 770 |
return self.rpc.send_json_rpc_request(relay_tx) |
| 771 |
|
| 772 |
def get_languages(self): |
| 773 |
get_languages = { |
| 774 |
'method': 'get_languages', |
| 775 |
'params': { |
| 776 |
}, |
| 777 |
'jsonrpc': '2.0', |
| 778 |
'id': '0' |
| 779 |
} |
| 780 |
return self.rpc.send_json_rpc_request(get_languages) |
| 781 |
|
| 782 |
def export_outputs(self, all = False, start = 0, count = 0xffffffff): |
| 783 |
export_outputs = { |
| 784 |
'method': 'export_outputs', |
| 785 |
'params': { |
| 786 |
'all': all, |
| 787 |
'start': start, |
| 788 |
'count': count, |
| 789 |
}, |
| 790 |
'jsonrpc': '2.0', |
| 791 |
'id': '0' |
| 792 |
} |
| 793 |
return self.rpc.send_json_rpc_request(export_outputs) |
| 794 |
|
| 795 |
def import_outputs(self, outputs_data_hex): |
| 796 |
import_outputs = { |
| 797 |
'method': 'import_outputs', |
| 798 |
'params': { |
| 799 |
'outputs_data_hex': outputs_data_hex |
| 800 |
}, |
| 801 |
'jsonrpc': '2.0', |
| 802 |
'id': '0' |
| 803 |
} |
| 804 |
return self.rpc.send_json_rpc_request(import_outputs) |
| 805 |
|
| 806 |
def export_key_images(self, all_ = False): |
| 807 |
export_key_images = { |
| 808 |
'method': 'export_key_images', |
| 809 |
'params': { |
| 810 |
'all': all_ |
| 811 |
}, |
| 812 |
'jsonrpc': '2.0', |
| 813 |
'id': '0' |
| 814 |
} |
| 815 |
return self.rpc.send_json_rpc_request(export_key_images) |
| 816 |
|
| 817 |
def import_key_images(self, signed_key_images, offset = 0): |
| 818 |
import_key_images = { |
| 819 |
'method': 'import_key_images', |
| 820 |
'params': { |
| 821 |
'offset': offset, |
| 822 |
'signed_key_images': signed_key_images, |
| 823 |
}, |
| 824 |
'jsonrpc': '2.0', |
| 825 |
'id': '0' |
| 826 |
} |
| 827 |
return self.rpc.send_json_rpc_request(import_key_images) |
| 828 |
|
| 829 |
def set_log_level(self, level): |
| 830 |
set_log_level = { |
| 831 |
'method': 'set_log_level', |
| 832 |
'params': { |
| 833 |
'level': level, |
| 834 |
}, |
| 835 |
'jsonrpc': '2.0', |
| 836 |
'id': '0' |
| 837 |
} |
| 838 |
return self.rpc.send_json_rpc_request(set_log_level) |
| 839 |
|
| 840 |
def set_log_categories(self, categories): |
| 841 |
set_log_categories = { |
| 842 |
'method': 'set_log_categories', |
| 843 |
'params': { |
| 844 |
'categories': categories, |
| 845 |
}, |
| 846 |
'jsonrpc': '2.0', |
| 847 |
'id': '0' |
| 848 |
} |
| 849 |
return self.rpc.send_json_rpc_request(set_log_categories) |
| 850 |
|
| 851 |
def validate_address(self, address, any_net_type = False, allow_openalias = False): |
| 852 |
validate_address = { |
| 853 |
'method': 'validate_address', |
| 854 |
'params': { |
| 855 |
'address': address, |
| 856 |
'any_net_type': any_net_type, |
| 857 |
'allow_openalias': allow_openalias, |
| 858 |
}, |
| 859 |
'jsonrpc': '2.0', |
| 860 |
'id': '0' |
| 861 |
} |
| 862 |
return self.rpc.send_json_rpc_request(validate_address) |
| 863 |
|
| 864 |
def get_accounts(self, tag, strict_balances = False): |
| 865 |
get_accounts = { |
| 866 |
'method': 'get_accounts', |
| 867 |
'params': { |
| 868 |
'tag': tag, |
| 869 |
'strict_balances': strict_balances, |
| 870 |
}, |
| 871 |
'jsonrpc': '2.0', |
| 872 |
'id': '0' |
| 873 |
} |
| 874 |
return self.rpc.send_json_rpc_request(get_accounts) |
| 875 |
|
| 876 |
def get_account_tags(self): |
| 877 |
get_account_tags = { |
| 878 |
'method': 'get_account_tags', |
| 879 |
'params': { |
| 880 |
}, |
| 881 |
'jsonrpc': '2.0', |
| 882 |
'id': '0' |
| 883 |
} |
| 884 |
return self.rpc.send_json_rpc_request(get_account_tags) |
| 885 |
|
| 886 |
def tag_accounts(self, tag, accounts = []): |
| 887 |
tag_accounts = { |
| 888 |
'method': 'tag_accounts', |
| 889 |
'params': { |
| 890 |
'tag': tag, |
| 891 |
'accounts': accounts, |
| 892 |
}, |
| 893 |
'jsonrpc': '2.0', |
| 894 |
'id': '0' |
| 895 |
} |
| 896 |
return self.rpc.send_json_rpc_request(tag_accounts) |
| 897 |
|
| 898 |
def untag_accounts(self, accounts = []): |
| 899 |
untag_accounts = { |
| 900 |
'method': 'untag_accounts', |
| 901 |
'params': { |
| 902 |
'accounts': accounts, |
| 903 |
}, |
| 904 |
'jsonrpc': '2.0', |
| 905 |
'id': '0' |
| 906 |
} |
| 907 |
return self.rpc.send_json_rpc_request(untag_accounts) |
| 908 |
|
| 909 |
def set_account_tag_description(self, tag, description): |
| 910 |
set_account_tag_description = { |
| 911 |
'method': 'set_account_tag_description', |
| 912 |
'params': { |
| 913 |
'tag': tag, |
| 914 |
'description': description, |
| 915 |
}, |
| 916 |
'jsonrpc': '2.0', |
| 917 |
'id': '0' |
| 918 |
} |
| 919 |
return self.rpc.send_json_rpc_request(set_account_tag_description) |
| 920 |
|
| 921 |
def rescan_blockchain(self, hard = False): |
| 922 |
rescan_blockchain = { |
| 923 |
'method': 'rescan_blockchain', |
| 924 |
'jsonrpc': '2.0', |
| 925 |
'params': { |
| 926 |
'hard': hard, |
| 927 |
}, |
| 928 |
'id': '0' |
| 929 |
} |
| 930 |
return self.rpc.send_json_rpc_request(rescan_blockchain) |
| 931 |
|
| 932 |
def rescan_spent(self): |
| 933 |
rescan_spent = { |
| 934 |
'method': 'rescan_spent', |
| 935 |
'jsonrpc': '2.0', |
| 936 |
'params': { |
| 937 |
}, |
| 938 |
'id': '0' |
| 939 |
} |
| 940 |
return self.rpc.send_json_rpc_request(rescan_spent) |
| 941 |
|
| 942 |
def set_tx_notes(self, txids = [], notes = []): |
| 943 |
set_tx_notes = { |
| 944 |
'method': 'set_tx_notes', |
| 945 |
'jsonrpc': '2.0', |
| 946 |
'params': { |
| 947 |
'txids': txids, |
| 948 |
'notes': notes, |
| 949 |
}, |
| 950 |
'id': '0' |
| 951 |
} |
| 952 |
return self.rpc.send_json_rpc_request(set_tx_notes) |
| 953 |
|
| 954 |
def get_tx_notes(self, txids = []): |
| 955 |
get_tx_notes = { |
| 956 |
'method': 'get_tx_notes', |
| 957 |
'jsonrpc': '2.0', |
| 958 |
'params': { |
| 959 |
'txids': txids, |
| 960 |
}, |
| 961 |
'id': '0' |
| 962 |
} |
| 963 |
return self.rpc.send_json_rpc_request(get_tx_notes) |
| 964 |
|
| 965 |
def set_attribute(self, key, value): |
| 966 |
set_attribute = { |
| 967 |
'method': 'set_attribute', |
| 968 |
'jsonrpc': '2.0', |
| 969 |
'params': { |
| 970 |
'key': key, |
| 971 |
'value': value, |
| 972 |
}, |
| 973 |
'id': '0' |
| 974 |
} |
| 975 |
return self.rpc.send_json_rpc_request(set_attribute) |
| 976 |
|
| 977 |
def get_attribute(self, key): |
| 978 |
get_attribute = { |
| 979 |
'method': 'get_attribute', |
| 980 |
'jsonrpc': '2.0', |
| 981 |
'params': { |
| 982 |
'key': key, |
| 983 |
}, |
| 984 |
'id': '0' |
| 985 |
} |
| 986 |
return self.rpc.send_json_rpc_request(get_attribute) |
| 987 |
|
| 988 |
def make_uri(self, address = '', payment_id = '', amount = 0, tx_description = '', recipient_name = ''): |
| 989 |
make_uri = { |
| 990 |
'method': 'make_uri', |
| 991 |
'jsonrpc': '2.0', |
| 992 |
'params': { |
| 993 |
'address': address, |
| 994 |
'payment_id': payment_id, |
| 995 |
'amount': amount, |
| 996 |
'tx_description': tx_description, |
| 997 |
'recipient_name': recipient_name, |
| 998 |
}, |
| 999 |
'id': '0' |
| 1000 |
} |
| 1001 |
return self.rpc.send_json_rpc_request(make_uri) |
| 1002 |
|
| 1003 |
def parse_uri(self, uri): |
| 1004 |
parse_uri = { |
| 1005 |
'method': 'parse_uri', |
| 1006 |
'jsonrpc': '2.0', |
| 1007 |
'params': { |
| 1008 |
'uri': uri, |
| 1009 |
}, |
| 1010 |
'id': '0' |
| 1011 |
} |
| 1012 |
return self.rpc.send_json_rpc_request(parse_uri) |
| 1013 |
|
| 1014 |
def add_address_book(self, address = '', payment_id = '', description = ''): |
| 1015 |
add_address_book = { |
| 1016 |
'method': 'add_address_book', |
| 1017 |
'jsonrpc': '2.0', |
| 1018 |
'params': { |
| 1019 |
'address': address, |
| 1020 |
'payment_id': payment_id, |
| 1021 |
'description': description, |
| 1022 |
}, |
| 1023 |
'id': '0' |
| 1024 |
} |
| 1025 |
return self.rpc.send_json_rpc_request(add_address_book) |
| 1026 |
|
| 1027 |
def edit_address_book(self, index, address = None, payment_id = None, description = None): |
| 1028 |
edit_address_book = { |
| 1029 |
'method': 'edit_address_book', |
| 1030 |
'jsonrpc': '2.0', |
| 1031 |
'params': { |
| 1032 |
'index': index, |
| 1033 |
'set_address': address != None, |
| 1034 |
'address': address or '', |
| 1035 |
'set_payment_id': payment_id != None, |
| 1036 |
'payment_id': payment_id or '', |
| 1037 |
'set_description': description != None, |
| 1038 |
'description': description or '', |
| 1039 |
}, |
| 1040 |
'id': '0' |
| 1041 |
} |
| 1042 |
return self.rpc.send_json_rpc_request(edit_address_book) |
| 1043 |
|
| 1044 |
def get_address_book(self, entries = []): |
| 1045 |
get_address_book = { |
| 1046 |
'method': 'get_address_book', |
| 1047 |
'jsonrpc': '2.0', |
| 1048 |
'params': { |
| 1049 |
'entries': entries, |
| 1050 |
}, |
| 1051 |
'id': '0' |
| 1052 |
} |
| 1053 |
return self.rpc.send_json_rpc_request(get_address_book) |
| 1054 |
|
| 1055 |
def delete_address_book(self, index): |
| 1056 |
delete_address_book = { |
| 1057 |
'method': 'delete_address_book', |
| 1058 |
'jsonrpc': '2.0', |
| 1059 |
'params': { |
| 1060 |
'index': index, |
| 1061 |
}, |
| 1062 |
'id': '0' |
| 1063 |
} |
| 1064 |
return self.rpc.send_json_rpc_request(delete_address_book) |
| 1065 |
|
| 1066 |
def start_mining(self, threads_count, do_background_mining = False, ignore_battery = False): |
| 1067 |
start_mining = { |
| 1068 |
'method': 'start_mining', |
| 1069 |
'jsonrpc': '2.0', |
| 1070 |
'params': { |
| 1071 |
'threads_count': threads_count, |
| 1072 |
'do_background_mining': do_background_mining, |
| 1073 |
'ignore_battery': ignore_battery, |
| 1074 |
}, |
| 1075 |
'id': '0' |
| 1076 |
} |
| 1077 |
return self.rpc.send_json_rpc_request(start_mining) |
| 1078 |
|
| 1079 |
def stop_mining(self): |
| 1080 |
stop_mining = { |
| 1081 |
'method': 'stop_mining', |
| 1082 |
'jsonrpc': '2.0', |
| 1083 |
'params': { |
| 1084 |
}, |
| 1085 |
'id': '0' |
| 1086 |
} |
| 1087 |
return self.rpc.send_json_rpc_request(stop_mining) |
| 1088 |
|
| 1089 |
def estimate_tx_size_and_weight(self, n_inputs, n_outputs, ring_size = 0, rct = True): |
| 1090 |
estimate_tx_size_and_weight = { |
| 1091 |
'method': 'estimate_tx_size_and_weight', |
| 1092 |
'jsonrpc': '2.0', |
| 1093 |
'params': { |
| 1094 |
'n_inputs': n_inputs, |
| 1095 |
'n_outputs': n_outputs, |
| 1096 |
'ring_size': ring_size, |
| 1097 |
'rct': rct, |
| 1098 |
}, |
| 1099 |
'id': '0' |
| 1100 |
} |
| 1101 |
return self.rpc.send_json_rpc_request(estimate_tx_size_and_weight) |
| 1102 |
|
| 1103 |
def get_default_fee_priority(self): |
| 1104 |
get_default_fee_priority = { |
| 1105 |
'method': 'get_default_fee_priority', |
| 1106 |
'jsonrpc': '2.0', |
| 1107 |
'params': { |
| 1108 |
}, |
| 1109 |
'id': '0' |
| 1110 |
} |
| 1111 |
return self.rpc.send_json_rpc_request(get_default_fee_priority) |
| 1112 |
|
| 1113 |
def get_version(self): |
| 1114 |
get_version = { |
| 1115 |
'method': 'get_version', |
| 1116 |
'jsonrpc': '2.0', |
| 1117 |
'id': '0' |
| 1118 |
} |
| 1119 |
return self.rpc.send_json_rpc_request(get_version) |
| 1120 |
|
| 1121 |
def scan_tx(self, txids): |
| 1122 |
scan_tx = { |
| 1123 |
'method': 'scan_tx', |
| 1124 |
'jsonrpc': '2.0', |
| 1125 |
'params' : { |
| 1126 |
'txids': txids, |
| 1127 |
}, |
| 1128 |
'id': '0' |
| 1129 |
} |
| 1130 |
return self.rpc.send_json_rpc_request(scan_tx) |
| 1131 |
|
| 1132 |
def freeze(self, key_image): |
| 1133 |
freeze = { |
| 1134 |
'method': 'freeze', |
| 1135 |
'jsonrpc': '2.0', |
| 1136 |
'params' : { |
| 1137 |
'key_image': key_image, |
| 1138 |
}, |
| 1139 |
'id': '0' |
| 1140 |
} |
| 1141 |
return self.rpc.send_json_rpc_request(freeze) |
| 1142 |
|
| 1143 |
def thaw(self, key_image): |
| 1144 |
thaw = { |
| 1145 |
'method': 'thaw', |
| 1146 |
'jsonrpc': '2.0', |
| 1147 |
'params' : { |
| 1148 |
'key_image': key_image, |
| 1149 |
}, |
| 1150 |
'id': '0' |
| 1151 |
} |
| 1152 |
return self.rpc.send_json_rpc_request(thaw) |
| 1153 |
|
| 1154 |
def frozen(self, key_image): |
| 1155 |
frozen = { |
| 1156 |
'method': 'frozen', |
| 1157 |
'jsonrpc': '2.0', |
| 1158 |
'params' : { |
| 1159 |
'key_image': key_image, |
| 1160 |
}, |
| 1161 |
'id': '0' |
| 1162 |
} |
| 1163 |
return self.rpc.send_json_rpc_request(frozen) |
| 1164 |
|
| 1165 |
class BackgroundSyncOptions(object): |
| 1166 |
def __init__(self): |
| 1167 |
self.off = 'off' |
| 1168 |
self.reuse_password = 'reuse-wallet-password' |
| 1169 |
self.custom_password = 'custom-background-password' |
| 1170 |
background_sync_options = BackgroundSyncOptions() |
| 1171 |
|
| 1172 |
def setup_background_sync(self, background_sync_type = background_sync_options.off, wallet_password = '', background_cache_password = ''): |
| 1173 |
setup_background_sync = { |
| 1174 |
'method': 'setup_background_sync', |
| 1175 |
'jsonrpc': '2.0', |
| 1176 |
'params' : { |
| 1177 |
'background_sync_type': background_sync_type, |
| 1178 |
'wallet_password': wallet_password, |
| 1179 |
'background_cache_password': background_cache_password, |
| 1180 |
}, |
| 1181 |
'id': '0' |
| 1182 |
} |
| 1183 |
return self.rpc.send_json_rpc_request(setup_background_sync) |
| 1184 |
|
| 1185 |
def start_background_sync(self): |
| 1186 |
start_background_sync = { |
| 1187 |
'method': 'start_background_sync', |
| 1188 |
'jsonrpc': '2.0', |
| 1189 |
'params' : {}, |
| 1190 |
'id': '0' |
| 1191 |
} |
| 1192 |
return self.rpc.send_json_rpc_request(start_background_sync) |
| 1193 |
|
| 1194 |
def stop_background_sync(self, wallet_password = '', seed = '', seed_offset = ''): |
| 1195 |
stop_background_sync = { |
| 1196 |
'method': 'stop_background_sync', |
| 1197 |
'jsonrpc': '2.0', |
| 1198 |
'params' : { |
| 1199 |
'wallet_password': wallet_password, |
| 1200 |
'seed': seed, |
| 1201 |
'seed_offset': seed_offset, |
| 1202 |
}, |
| 1203 |
'id': '0' |
| 1204 |
} |
| 1205 |
return self.rpc.send_json_rpc_request(stop_background_sync) |