chore(common): Rework AuthorizeCoinJoin message parameters.

[no changelog]
pull/2123/head
Andrew Kozlik 2 years ago committed by Andrew Kozlik
parent 556e8a147a
commit 8be6689150

@ -599,10 +599,11 @@ message AuthorizeCoinJoin {
option (unstable) = true;
required string coordinator = 1; // coordinator identifier to approve as a prefix in commitment data (max. 36 ASCII characters)
required uint64 max_total_fee = 2; // maximum total fees
optional uint32 fee_per_anonymity = 3 [default=0]; // fee per anonymity set in units of 10^-9 percent
repeated uint32 address_n = 4; // prefix of the BIP-32 path leading to the account (m / purpose' / coin_type' / account')
optional string coin_name = 5 [default='Bitcoin']; // coin to use
optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional AmountUnit amount_unit = 11 [default=BITCOIN]; // show amounts in
required uint64 max_rounds = 2; // maximum number of rounds that Trezor is authorized to take part in
required uint32 max_coordinator_fee_rate = 3; // maximum coordination fee rate in units of 10^-8 percent
required uint32 max_fee_per_kvbyte = 4; // maximum mining fee rate in units of satoshis per 1000 vbytes
repeated uint32 address_n = 5; // prefix of the BIP-32 path leading to the account (m / purpose' / coin_type' / account')
optional string coin_name = 6 [default='Bitcoin']; // coin to use
optional InputScriptType script_type = 7 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional AmountUnit amount_unit = 8 [default=BITCOIN]; // show amounts in
}

@ -926,8 +926,9 @@ if TYPE_CHECKING:
class AuthorizeCoinJoin(protobuf.MessageType):
coordinator: "str"
max_total_fee: "int"
fee_per_anonymity: "int"
max_rounds: "int"
max_coordinator_fee_rate: "int"
max_fee_per_kvbyte: "int"
address_n: "list[int]"
coin_name: "str"
script_type: "InputScriptType"
@ -937,9 +938,10 @@ if TYPE_CHECKING:
self,
*,
coordinator: "str",
max_total_fee: "int",
max_rounds: "int",
max_coordinator_fee_rate: "int",
max_fee_per_kvbyte: "int",
address_n: "list[int] | None" = None,
fee_per_anonymity: "int | None" = None,
coin_name: "str | None" = None,
script_type: "InputScriptType | None" = None,
amount_unit: "AmountUnit | None" = None,

@ -404,19 +404,21 @@ def sign_tx(
def authorize_coinjoin(
client: "TrezorClient",
coordinator: str,
max_total_fee: int,
max_rounds: int,
max_coordinator_fee_rate: int,
max_fee_per_kvbyte: int,
n: "Address",
coin_name: str,
fee_per_anonymity: Optional[int] = None,
script_type: messages.InputScriptType = messages.InputScriptType.SPENDADDRESS,
) -> "MessageType":
return client.call(
messages.AuthorizeCoinJoin(
coordinator=coordinator,
max_total_fee=max_total_fee,
max_rounds=max_rounds,
max_coordinator_fee_rate=max_coordinator_fee_rate,
max_fee_per_kvbyte=max_fee_per_kvbyte,
address_n=n,
coin_name=coin_name,
fee_per_anonymity=fee_per_anonymity,
script_type=script_type,
)
)

@ -1565,29 +1565,32 @@ class AuthorizeCoinJoin(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 51
FIELDS = {
1: protobuf.Field("coordinator", "string", repeated=False, required=True),
2: protobuf.Field("max_total_fee", "uint64", repeated=False, required=True),
3: protobuf.Field("fee_per_anonymity", "uint32", repeated=False, required=False),
4: protobuf.Field("address_n", "uint32", repeated=True, required=False),
5: protobuf.Field("coin_name", "string", repeated=False, required=False),
6: protobuf.Field("script_type", "InputScriptType", repeated=False, required=False),
11: protobuf.Field("amount_unit", "AmountUnit", repeated=False, required=False),
2: protobuf.Field("max_rounds", "uint64", repeated=False, required=True),
3: protobuf.Field("max_coordinator_fee_rate", "uint32", repeated=False, required=True),
4: protobuf.Field("max_fee_per_kvbyte", "uint32", repeated=False, required=True),
5: protobuf.Field("address_n", "uint32", repeated=True, required=False),
6: protobuf.Field("coin_name", "string", repeated=False, required=False),
7: protobuf.Field("script_type", "InputScriptType", repeated=False, required=False),
8: protobuf.Field("amount_unit", "AmountUnit", repeated=False, required=False),
}
def __init__(
self,
*,
coordinator: "str",
max_total_fee: "int",
max_rounds: "int",
max_coordinator_fee_rate: "int",
max_fee_per_kvbyte: "int",
address_n: Optional[Sequence["int"]] = None,
fee_per_anonymity: Optional["int"] = 0,
coin_name: Optional["str"] = 'Bitcoin',
script_type: Optional["InputScriptType"] = InputScriptType.SPENDADDRESS,
amount_unit: Optional["AmountUnit"] = AmountUnit.BITCOIN,
) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.coordinator = coordinator
self.max_total_fee = max_total_fee
self.fee_per_anonymity = fee_per_anonymity
self.max_rounds = max_rounds
self.max_coordinator_fee_rate = max_coordinator_fee_rate
self.max_fee_per_kvbyte = max_fee_per_kvbyte
self.coin_name = coin_name
self.script_type = script_type
self.amount_unit = amount_unit

Loading…
Cancel
Save