Wallet: add CLI flag --force-swap flag and force swapping all inactive keysets (#580)

* Wallet: add flag --force-swap to send command

* Reame split to swap across codebase

* rename remaining splits to swap

* fix restore index with multiple keysets

* fix wallet api restore
This commit is contained in:
callebtc
2024-07-11 23:08:36 +02:00
committed by GitHub
parent 77697c52ee
commit 3077ca4c7d
26 changed files with 226 additions and 170 deletions

View File

@@ -39,8 +39,8 @@ from ..core.models import (
PostMintRequest,
PostMintResponse,
PostRestoreResponse,
PostSplitRequest,
PostSplitResponse,
PostSwapRequest,
PostSwapResponse,
)
from ..core.settings import settings
from ..tor.tor import TorProxy
@@ -465,7 +465,7 @@ class LedgerAPI(LedgerAPIDeprecated, object):
) -> List[BlindedSignature]:
"""Consume proofs and create new promises based on amount split."""
logger.debug("Calling split. POST /v1/swap")
split_payload = PostSplitRequest(inputs=proofs, outputs=outputs)
split_payload = PostSwapRequest(inputs=proofs, outputs=outputs)
# construct payload
def _splitrequest_include_fields(proofs: List[Proof]):
@@ -494,7 +494,7 @@ class LedgerAPI(LedgerAPIDeprecated, object):
# END backwards compatibility < 0.15.0
self.raise_on_error_request(resp)
promises_dict = resp.json()
mint_response = PostSplitResponse.parse_obj(promises_dict)
mint_response = PostSwapResponse.parse_obj(promises_dict)
promises = [BlindedSignature(**p.dict()) for p in mint_response.signatures]
if len(promises) == 0: