mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-19 17:14:33 +00:00
api: getcoinseed shows expected seed ids.
This commit is contained in:
parent
9eacd35319
commit
0c01dcf2f5
1 changed files with 20 additions and 16 deletions
|
@ -832,28 +832,32 @@ def js_getcoinseed(self, url_split, post_string, is_json) -> bytes:
|
|||
raise ValueError("Particl wallet seed is set from the Basicswap mnemonic.")
|
||||
|
||||
ci = swap_client.ci(coin)
|
||||
rv = {"coin": ci.ticker()}
|
||||
if coin in (Coins.XMR, Coins.WOW):
|
||||
key_view = swap_client.getWalletKey(coin, 1, for_ed25519=True)
|
||||
key_spend = swap_client.getWalletKey(coin, 2, for_ed25519=True)
|
||||
address = ci.getAddressFromKeys(key_view, key_spend)
|
||||
return bytes(
|
||||
json.dumps(
|
||||
{
|
||||
"coin": ci.ticker(),
|
||||
"key_view": ci.encodeKey(key_view),
|
||||
"key_spend": ci.encodeKey(key_spend),
|
||||
"address": address,
|
||||
}
|
||||
),
|
||||
"UTF-8",
|
||||
)
|
||||
|
||||
seed_key = swap_client.getWalletKey(coin, 1)
|
||||
seed_id = ci.getSeedHash(seed_key)
|
||||
expect_address = self.getCachedMainWalletAddress(ci)
|
||||
rv.update({
|
||||
"key_view": ci.encodeKey(key_view),
|
||||
"key_spend": ci.encodeKey(key_spend),
|
||||
"address": address,
|
||||
"expected_address": "Unset" if expect_address is None else expect_address
|
||||
})
|
||||
else:
|
||||
seed_key = swap_client.getWalletKey(coin, 1)
|
||||
seed_id = ci.getSeedHash(seed_key)
|
||||
expect_seedid = swap_client.getStringKV("main_wallet_seedid_" + ci.coin_name().lower())
|
||||
|
||||
rv.update({
|
||||
"seed": seed_key.hex(),
|
||||
"seed_id": seed_id.hex(),
|
||||
"expected_seed_id": "Unset" if expect_seedid is None else expect_seedid
|
||||
})
|
||||
|
||||
return bytes(
|
||||
json.dumps(
|
||||
{"coin": ci.ticker(), "seed": seed_key.hex(), "seed_id": seed_id.hex()}
|
||||
),
|
||||
json.dumps(rv),
|
||||
"UTF-8",
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue