mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-20 01:24:31 +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.")
|
raise ValueError("Particl wallet seed is set from the Basicswap mnemonic.")
|
||||||
|
|
||||||
ci = swap_client.ci(coin)
|
ci = swap_client.ci(coin)
|
||||||
|
rv = {"coin": ci.ticker()}
|
||||||
if coin in (Coins.XMR, Coins.WOW):
|
if coin in (Coins.XMR, Coins.WOW):
|
||||||
key_view = swap_client.getWalletKey(coin, 1, for_ed25519=True)
|
key_view = swap_client.getWalletKey(coin, 1, for_ed25519=True)
|
||||||
key_spend = swap_client.getWalletKey(coin, 2, for_ed25519=True)
|
key_spend = swap_client.getWalletKey(coin, 2, for_ed25519=True)
|
||||||
address = ci.getAddressFromKeys(key_view, key_spend)
|
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)
|
expect_address = self.getCachedMainWalletAddress(ci)
|
||||||
seed_id = ci.getSeedHash(seed_key)
|
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(
|
return bytes(
|
||||||
json.dumps(
|
json.dumps(rv),
|
||||||
{"coin": ci.ticker(), "seed": seed_key.hex(), "seed_id": seed_id.hex()}
|
|
||||||
),
|
|
||||||
"UTF-8",
|
"UTF-8",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue