api: getcoinseed shows expected seed ids.

This commit is contained in:
tecnovert 2025-01-07 18:39:13 +02:00
parent 9eacd35319
commit 0c01dcf2f5
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93

View file

@ -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",
)