1
0

transaction: tx.sign API change: rm hex usage

This commit is contained in:
SomberNight
2024-04-29 16:32:19 +00:00
parent 2f1095510c
commit 13d9677e53
11 changed files with 59 additions and 42 deletions

View File

@@ -34,7 +34,7 @@ import base64
from functools import partial
import queue
import asyncio
from typing import Optional, TYPE_CHECKING, Sequence, List, Union, Dict, Set
from typing import Optional, TYPE_CHECKING, Sequence, List, Union, Dict, Set, Mapping
import concurrent.futures
from PyQt5.QtGui import QPixmap, QKeySequence, QIcon, QCursor, QFont, QFontMetrics
@@ -1106,7 +1106,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self,
tx: Transaction,
*,
external_keypairs=None,
external_keypairs: Mapping[bytes, bytes] = None,
payment_identifier: PaymentIdentifier = None,
):
show_transaction(tx, parent=self, external_keypairs=external_keypairs, payment_identifier=payment_identifier)
@@ -1269,10 +1269,24 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self.send_tab.broadcast_transaction(tx, payment_identifier=payment_identifier)
@protected
def sign_tx(self, tx, *, callback, external_keypairs, password):
def sign_tx(
self,
tx: PartialTransaction,
*,
callback,
external_keypairs: Optional[Mapping[bytes, bytes]],
password,
):
self.sign_tx_with_password(tx, callback=callback, password=password, external_keypairs=external_keypairs)
def sign_tx_with_password(self, tx: PartialTransaction, *, callback, password, external_keypairs=None):
def sign_tx_with_password(
self,
tx: PartialTransaction,
*,
callback,
password,
external_keypairs: Mapping[bytes, bytes] = None,
):
'''Sign the transaction in a separate thread. When done, calls
the callback with a success code of True or False.
'''

View File

@@ -3,7 +3,7 @@
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
from decimal import Decimal
from typing import Optional, TYPE_CHECKING, Sequence, List, Callable, Union
from typing import Optional, TYPE_CHECKING, Sequence, List, Callable, Union, Mapping
from PyQt5.QtCore import pyqtSignal, QPoint, QSize, Qt
from PyQt5.QtWidgets import (QLabel, QVBoxLayout, QGridLayout, QHBoxLayout,
QWidget, QToolTip, QPushButton, QApplication)
@@ -295,7 +295,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
outputs: List[PartialTxOutput],
*,
nonlocal_only=False,
external_keypairs=None,
external_keypairs: Mapping[bytes, bytes] = None,
get_coins: Callable[..., Sequence[PartialTxInput]] = None,
invoice: Optional[Invoice] = None
) -> None:

View File

@@ -30,7 +30,7 @@ import copy
import datetime
import traceback
import time
from typing import TYPE_CHECKING, Callable, Optional, List, Union, Tuple
from typing import TYPE_CHECKING, Callable, Optional, List, Union, Tuple, Mapping
from functools import partial
from decimal import Decimal
@@ -410,7 +410,7 @@ def show_transaction(
*,
parent: 'ElectrumWindow',
prompt_if_unsaved: bool = False,
external_keypairs=None,
external_keypairs: Mapping[bytes, bytes] = None,
payment_identifier: 'PaymentIdentifier' = None,
):
try:
@@ -438,7 +438,7 @@ class TxDialog(QDialog, MessageBoxMixin):
*,
parent: 'ElectrumWindow',
prompt_if_unsaved: bool,
external_keypairs=None,
external_keypairs: Mapping[bytes, bytes] = None,
payment_identifier: 'PaymentIdentifier' = None,
):
'''Transactions in the wallet will show their description.