1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

feat(cardano): prepare protobuf messages for streamed tx signing

This commit is contained in:
gabrielkerekes 2021-06-30 14:06:23 +02:00 committed by matejcik
parent 395324a8ad
commit d2a5be4e38
10 changed files with 885 additions and 194 deletions

View File

@ -38,6 +38,21 @@ enum CardanoPoolRelayType {
MULTIPLE_HOST_NAME = 2;
}
enum CardanoTxAuxiliaryDataSupplementType {
NONE = 0;
CATALYST_REGISTRATION_SIGNATURE = 1;
}
enum CardanoTxSigningMode {
ORDINARY_TRANSACTION = 0;
POOL_REGISTRATION_AS_OWNER = 1;
}
enum CardanoTxWitnessType {
BYRON_WITNESS = 0;
SHELLEY_WITNESS = 1;
}
/**
* Structure representing cardano PointerAddress pointer,
* which points to a staking key registration certificate.
@ -109,6 +124,223 @@ message CardanoPublicKey {
required hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 public node
}
/**
* Request: Initiate the Cardano transaction signing process on the device
* @start
* @next CardanoTxItemAck
* @next Failure
*/
message CardanoSignTxInit {
required CardanoTxSigningMode signing_mode = 1;
required uint32 protocol_magic = 2; // network's protocol magic
required uint32 network_id = 3; // network id - mainnet or testnet
required uint32 inputs_count = 4;
required uint32 outputs_count = 5;
required uint64 fee = 6; // transaction fee - added in shelley
optional uint64 ttl = 7; // transaction ttl - added in shelley
required uint32 certificates_count = 8;
required uint32 withdrawals_count = 9;
required bool has_auxiliary_data = 10;
optional uint64 validity_interval_start = 11;
required uint32 witness_requests_count = 12;
}
/**
* Request: Transaction input data
* @next CardanoTxItemAck
*/
message CardanoTxInput {
required bytes prev_hash = 1; // hash of previous transaction output to spend by this input
required uint32 prev_index = 2; // index of previous output to spend
}
/**
* Request: Transaction output data
* @next CardanoTxItemAck
*/
message CardanoTxOutput {
optional string address = 1; // target coin address in bech32 or base58
optional CardanoAddressParametersType address_parameters = 2; // parameters used to derive the address
required uint64 amount = 3; // amount to spend
required uint32 asset_groups_count = 4;
}
/**
* Request: Transaction output asset group data
* @next CardanoTxItemAck
*/
message CardanoAssetGroup {
required bytes policy_id = 1; // asset group policy id
required uint32 tokens_count = 2;
}
/**
* Request: Transaction output asset group token data
* @next CardanoTxItemAck
*/
message CardanoToken {
required bytes asset_name_bytes = 1; // asset name as bytestring (may be either ascii string or hash)
required uint64 amount = 2; // asset amount
}
/**
* Request: Stake pool owner parameters
* @next CardanoTxItemAck
*/
message CardanoPoolOwner {
repeated uint32 staking_key_path = 1; // BIP-32-style path to derive staking key of the owner
optional bytes staking_key_hash = 2; // owner's staking key if it is an external owner
}
/**
* Request: Stake pool relay parameters
* @next CardanoTxItemAck
*/
message CardanoPoolRelayParameters {
required CardanoPoolRelayType type = 1; // pool relay type
optional bytes ipv4_address = 2; // ipv4 address of the relay given as 4 bytes
optional bytes ipv6_address = 3; // ipv6 address of the relay given as 16 bytes
optional string host_name = 4; // relay host name given as URL, at most 64 characters
optional uint32 port = 5; // relay port number in the range 0-65535
}
/**
* Stake pool metadata parameters
* @embed
*/
message CardanoPoolMetadataType {
required string url = 1; // stake pool url hosting metadata, at most 64 characters
required bytes hash = 2; // stake pool metadata hash
}
/**
* Stake pool parameters
* @embed
*/
message CardanoPoolParametersType {
required bytes pool_id = 1; // stake pool cold public key hash (28 bytes)
required bytes vrf_key_hash = 2; // VRF key hash (32 bytes)
required uint64 pledge = 3; // pledge amount in lovelace
required uint64 cost = 4; // cost in lovelace
required uint64 margin_numerator = 5; // pool margin numerator
required uint64 margin_denominator = 6; // pool margin denominator
required string reward_account = 7; // bech32 reward address where the pool receives rewards
repeated CardanoPoolOwner owners = 8 [deprecated = true]; // pool owners list
repeated CardanoPoolRelayParameters relays = 9 [deprecated = true]; // pool relays list
optional CardanoPoolMetadataType metadata = 10; // pool metadata
required uint32 owners_count = 11; // number of pool owners
required uint32 relays_count = 12; // number of pool relays
}
/**
* Request: Transaction certificate data
* @next CardanoTxItemAck
*/
message CardanoTxCertificate {
required CardanoCertificateType type = 1; // certificate type
repeated uint32 path = 2; // BIP-32 path to derive (staking) key
optional bytes pool = 3; // pool hash
optional CardanoPoolParametersType pool_parameters = 4; // used for stake pool registration certificate
}
/**
* Request: Transaction withdrawal data
* @next CardanoTxItemAck
*/
message CardanoTxWithdrawal {
repeated uint32 path = 1;
required uint64 amount = 2;
}
/**
* @embed
*/
message CardanoCatalystRegistrationParametersType {
required bytes voting_public_key = 1;
repeated uint32 staking_path = 2;
required CardanoAddressParametersType reward_address_parameters = 3;
required uint64 nonce = 4;
}
/**
* Request: Transaction auxiliary data
* @next CardanoTxItemAck
* @next CardanoTxAuxiliaryDataSupplement
*/
message CardanoTxAuxiliaryData {
optional CardanoCatalystRegistrationParametersType catalyst_registration_parameters = 1;
optional bytes hash = 2;
}
/**
* Response: Acknowledgement of the last transaction item received
* @next CardanoTxInput
* @next CardanoTxOutput
* @next CardanoAssetGroup
* @next CardanoToken
* @next CardanoTxCertificate
* @next CardanoPoolOwner
* @next CardanoPoolRelayParameters
* @next CardanoTxWithdrawal
* @next CardanoTxAuxiliaryData
* @next CardanoTxWitnessRequest
*/
message CardanoTxItemAck {
}
/**
* Response: Device-generated supplement for the auxiliary data
* @next CardanoTxWitnessRequest
*/
message CardanoTxAuxiliaryDataSupplement {
required CardanoTxAuxiliaryDataSupplementType type = 1;
optional bytes auxiliary_data_hash = 2;
optional bytes catalyst_signature = 3;
}
/**
* Request: Ask the device to sign a witness path
* @next CardanoTxWitnessResponse
*/
message CardanoTxWitnessRequest {
repeated uint32 path = 1;
}
/**
* Response: Signature corresponding to the requested witness path
* @next CardanoTxWitnessRequest
* @next CardanoTxHostAck
*/
message CardanoTxWitnessResponse {
required CardanoTxWitnessType type = 1;
required bytes pub_key = 2;
required bytes signature = 3;
optional bytes chain_code = 4;
}
/**
* Request: Acknowledgement of the last response received
* @next CardanoTxBodyHash
* @next CardanoSignTxFinished
*/
message CardanoTxHostAck {
}
/**
* Response: Hash of the serialized transaction body
* @next CardanoTxHostAck
*/
message CardanoTxBodyHash {
required bytes tx_hash = 1;
}
/**
* Response: Confirm the successful completion of the signing process
* @end
*/
message CardanoSignTxFinished {
}
/**
* Request: Ask device to sign Cardano transaction
* @start
@ -116,6 +348,8 @@ message CardanoPublicKey {
* @next Failure
*/
message CardanoSignTx {
option deprecated = true;
repeated CardanoTxInputType inputs = 1; // inputs to be used in transaction
repeated CardanoTxOutputType outputs = 2; // outputs to be used in transaction
// optional uint32 transactions_count = 3; // left as a comment so we know to skip the id 3 in the future
@ -146,7 +380,7 @@ message CardanoSignTx {
message CardanoTxOutputType {
optional string address = 1; // target coin address in bech32 or base58
// repeated uint32 address_n = 2; // moved to address_parameters
required uint64 amount = 3; // amount to spend
required uint64 amount = 3; // amount in Lovelace
optional CardanoAddressParametersType address_parameters = 4; // parameters used to derive the address
repeated CardanoAssetGroupType token_bundle = 5; // custom assets - added in mary
}
@ -180,30 +414,6 @@ message CardanoSignTx {
optional uint32 port = 5; // relay port number in the range 0-65535
}
/**
* Stake pool metadata parameters
*/
message CardanoPoolMetadataType {
required string url = 1; // stake pool url hosting metadata, at most 64 characters
required bytes hash = 2; // stake pool metadata hash
}
/**
* Stake pool parameters
*/
message CardanoPoolParametersType {
required bytes pool_id = 1; // stake pool cold public key hash (28 bytes)
required bytes vrf_key_hash = 2; // VRF key hash (32 bytes)
required uint64 pledge = 3; // pledge amount in lovelace
required uint64 cost = 4; // cost in lovelace
required uint64 margin_numerator = 5; // pool margin numerator
required uint64 margin_denominator = 6; // pool margin denominator
required string reward_account = 7; // bech32 reward address where the pool receives rewards
repeated CardanoPoolOwnerType owners = 8; // pool owners list
repeated CardanoPoolRelayParametersType relays = 9; // pool relays list
optional CardanoPoolMetadataType metadata = 10; // pool metadata
}
/**
* Structure representing cardano transaction certificate
*/
@ -221,13 +431,6 @@ message CardanoSignTx {
required uint64 amount = 2;
}
message CardanoCatalystRegistrationParametersType {
required bytes voting_public_key = 1;
repeated uint32 staking_path = 2;
required CardanoAddressParametersType reward_address_parameters = 3;
required uint64 nonce = 4;
}
message CardanoTxAuxiliaryDataType {
optional bytes blob = 1;
optional CardanoCatalystRegistrationParametersType catalyst_registration_parameters = 2;
@ -239,6 +442,8 @@ message CardanoSignTx {
* @next CardanoSignedTxChunkAck
*/
message CardanoSignedTxChunk {
option deprecated = true;
required bytes signed_tx_chunk = 1; // serialised, signed transaction chunk
}
@ -248,6 +453,7 @@ message CardanoSignedTxChunk {
* @next CardanoSignedTx
*/
message CardanoSignedTxChunkAck {
option deprecated = true;
}
/**
@ -255,6 +461,8 @@ message CardanoSignedTxChunkAck {
* @end
*/
message CardanoSignedTx {
option deprecated = true;
required bytes tx_hash = 1; // hash of the transaction body
optional bytes serialized_tx = 2; // deprecated since transaction is sent in chunks now - kept for backwards compatibility
}

View File

@ -241,6 +241,24 @@ enum MessageType {
MessageType_CardanoSignedTx = 310 [(wire_out) = true];
MessageType_CardanoSignedTxChunk = 311 [(wire_out) = true];
MessageType_CardanoSignedTxChunkAck = 312 [(wire_in) = true];
MessageType_CardanoTxItemAck = 313 [(wire_out) = true];
MessageType_CardanoTxAuxiliaryDataSupplement = 314 [(wire_out) = true];
MessageType_CardanoTxWitnessRequest = 315 [(wire_in) = true];
MessageType_CardanoTxWitnessResponse = 316 [(wire_out) = true];
MessageType_CardanoTxHostAck = 317 [(wire_in) = true];
MessageType_CardanoTxBodyHash = 318 [(wire_out) = true];
MessageType_CardanoSignTxFinished = 319 [(wire_out) = true];
MessageType_CardanoSignTxInit = 320 [(wire_in) = true];
MessageType_CardanoTxInput = 321 [(wire_in) = true];
MessageType_CardanoTxOutput = 322 [(wire_in) = true];
MessageType_CardanoAssetGroup = 323 [(wire_in) = true];
MessageType_CardanoToken = 324 [(wire_in) = true];
MessageType_CardanoTxCertificate = 325 [(wire_in) = true];
MessageType_CardanoTxWithdrawal = 326 [(wire_in) = true];
MessageType_CardanoTxAuxiliaryData = 327 [(wire_in) = true];
MessageType_CardanoPoolOwner = 328 [(wire_in) = true];
MessageType_CardanoPoolRelayParameters = 329 [(wire_in) = true];
// Ripple
MessageType_RippleGetAddress = 400 [(wire_in) = true];

View File

@ -394,6 +394,12 @@ if utils.BITCOIN_ONLY:
import trezor.enums.CardanoCertificateType
trezor.enums.CardanoPoolRelayType
import trezor.enums.CardanoPoolRelayType
trezor.enums.CardanoTxAuxiliaryDataSupplementType
import trezor.enums.CardanoTxAuxiliaryDataSupplementType
trezor.enums.CardanoTxSigningMode
import trezor.enums.CardanoTxSigningMode
trezor.enums.CardanoTxWitnessType
import trezor.enums.CardanoTxWitnessType
trezor.enums.NEMImportanceTransferMode
import trezor.enums.NEMImportanceTransferMode
trezor.enums.NEMModificationType

View File

@ -0,0 +1,6 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
NONE = 0
CATALYST_REGISTRATION_SIGNATURE = 1

View File

@ -0,0 +1,6 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
ORDINARY_TRANSACTION = 0
POOL_REGISTRATION_AS_OWNER = 1

View File

@ -0,0 +1,6 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
BYRON_WITNESS = 0
SHELLEY_WITNESS = 1

View File

@ -133,6 +133,23 @@ if not utils.BITCOIN_ONLY:
CardanoSignedTx = 310
CardanoSignedTxChunk = 311
CardanoSignedTxChunkAck = 312
CardanoTxItemAck = 313
CardanoTxAuxiliaryDataSupplement = 314
CardanoTxWitnessRequest = 315
CardanoTxWitnessResponse = 316
CardanoTxHostAck = 317
CardanoTxBodyHash = 318
CardanoSignTxFinished = 319
CardanoSignTxInit = 320
CardanoTxInput = 321
CardanoTxOutput = 322
CardanoAssetGroup = 323
CardanoToken = 324
CardanoTxCertificate = 325
CardanoTxWithdrawal = 326
CardanoTxAuxiliaryData = 327
CardanoPoolOwner = 328
CardanoPoolRelayParameters = 329
RippleGetAddress = 400
RippleAddress = 401
RippleSignTx = 402

View File

@ -138,6 +138,23 @@ if TYPE_CHECKING:
CardanoSignedTx = 310
CardanoSignedTxChunk = 311
CardanoSignedTxChunkAck = 312
CardanoTxItemAck = 313
CardanoTxAuxiliaryDataSupplement = 314
CardanoTxWitnessRequest = 315
CardanoTxWitnessResponse = 316
CardanoTxHostAck = 317
CardanoTxBodyHash = 318
CardanoSignTxFinished = 319
CardanoSignTxInit = 320
CardanoTxInput = 321
CardanoTxOutput = 322
CardanoAssetGroup = 323
CardanoToken = 324
CardanoTxCertificate = 325
CardanoTxWithdrawal = 326
CardanoTxAuxiliaryData = 327
CardanoPoolOwner = 328
CardanoPoolRelayParameters = 329
RippleGetAddress = 400
RippleAddress = 401
RippleSignTx = 402
@ -322,6 +339,18 @@ if TYPE_CHECKING:
SINGLE_HOST_NAME = 1
MULTIPLE_HOST_NAME = 2
class CardanoTxAuxiliaryDataSupplementType(IntEnum):
NONE = 0
CATALYST_REGISTRATION_SIGNATURE = 1
class CardanoTxSigningMode(IntEnum):
ORDINARY_TRANSACTION = 0
POOL_REGISTRATION_AS_OWNER = 1
class CardanoTxWitnessType(IntEnum):
BYRON_WITNESS = 0
SHELLEY_WITNESS = 1
class BackupType(IntEnum):
Bip39 = 0
Slip39_Basic = 1

View File

@ -28,6 +28,9 @@ if TYPE_CHECKING:
from trezor.enums import CardanoAddressType # noqa: F401
from trezor.enums import CardanoCertificateType # noqa: F401
from trezor.enums import CardanoPoolRelayType # noqa: F401
from trezor.enums import CardanoTxAuxiliaryDataSupplementType # noqa: F401
from trezor.enums import CardanoTxSigningMode # noqa: F401
from trezor.enums import CardanoTxWitnessType # noqa: F401
from trezor.enums import DebugSwipeDirection # noqa: F401
from trezor.enums import DecredStakingSpendType # noqa: F401
from trezor.enums import FailureType # noqa: F401
@ -1141,76 +1144,43 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoPublicKey"]:
return isinstance(msg, cls)
class CardanoSignTx(protobuf.MessageType):
inputs: "list[CardanoTxInputType]"
outputs: "list[CardanoTxOutputType]"
class CardanoSignTxInit(protobuf.MessageType):
signing_mode: "CardanoTxSigningMode"
protocol_magic: "int"
network_id: "int"
inputs_count: "int"
outputs_count: "int"
fee: "int"
ttl: "int | None"
network_id: "int"
certificates: "list[CardanoTxCertificateType]"
withdrawals: "list[CardanoTxWithdrawalType]"
certificates_count: "int"
withdrawals_count: "int"
has_auxiliary_data: "bool"
validity_interval_start: "int | None"
auxiliary_data: "CardanoTxAuxiliaryDataType | None"
witness_requests_count: "int"
def __init__(
self,
*,
signing_mode: "CardanoTxSigningMode",
protocol_magic: "int",
fee: "int",
network_id: "int",
inputs: "list[CardanoTxInputType] | None" = None,
outputs: "list[CardanoTxOutputType] | None" = None,
certificates: "list[CardanoTxCertificateType] | None" = None,
withdrawals: "list[CardanoTxWithdrawalType] | None" = None,
inputs_count: "int",
outputs_count: "int",
fee: "int",
certificates_count: "int",
withdrawals_count: "int",
has_auxiliary_data: "bool",
witness_requests_count: "int",
ttl: "int | None" = None,
validity_interval_start: "int | None" = None,
auxiliary_data: "CardanoTxAuxiliaryDataType | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoSignTx"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoSignTxInit"]:
return isinstance(msg, cls)
class CardanoSignedTxChunk(protobuf.MessageType):
signed_tx_chunk: "bytes"
def __init__(
self,
*,
signed_tx_chunk: "bytes",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoSignedTxChunk"]:
return isinstance(msg, cls)
class CardanoSignedTxChunkAck(protobuf.MessageType):
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoSignedTxChunkAck"]:
return isinstance(msg, cls)
class CardanoSignedTx(protobuf.MessageType):
tx_hash: "bytes"
serialized_tx: "bytes | None"
def __init__(
self,
*,
tx_hash: "bytes",
serialized_tx: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoSignedTx"]:
return isinstance(msg, cls)
class CardanoTxInputType(protobuf.MessageType):
address_n: "list[int]"
class CardanoTxInput(protobuf.MessageType):
prev_hash: "bytes"
prev_index: "int"
@ -1219,51 +1189,50 @@ if TYPE_CHECKING:
*,
prev_hash: "bytes",
prev_index: "int",
address_n: "list[int] | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxInputType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxInput"]:
return isinstance(msg, cls)
class CardanoTxOutputType(protobuf.MessageType):
class CardanoTxOutput(protobuf.MessageType):
address: "str | None"
amount: "int"
address_parameters: "CardanoAddressParametersType | None"
token_bundle: "list[CardanoAssetGroupType]"
amount: "int"
asset_groups_count: "int"
def __init__(
self,
*,
amount: "int",
token_bundle: "list[CardanoAssetGroupType] | None" = None,
asset_groups_count: "int",
address: "str | None" = None,
address_parameters: "CardanoAddressParametersType | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxOutputType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxOutput"]:
return isinstance(msg, cls)
class CardanoAssetGroupType(protobuf.MessageType):
class CardanoAssetGroup(protobuf.MessageType):
policy_id: "bytes"
tokens: "list[CardanoTokenType]"
tokens_count: "int"
def __init__(
self,
*,
policy_id: "bytes",
tokens: "list[CardanoTokenType] | None" = None,
tokens_count: "int",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoAssetGroupType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoAssetGroup"]:
return isinstance(msg, cls)
class CardanoTokenType(protobuf.MessageType):
class CardanoToken(protobuf.MessageType):
asset_name_bytes: "bytes"
amount: "int"
@ -1276,10 +1245,10 @@ if TYPE_CHECKING:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTokenType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoToken"]:
return isinstance(msg, cls)
class CardanoPoolOwnerType(protobuf.MessageType):
class CardanoPoolOwner(protobuf.MessageType):
staking_key_path: "list[int]"
staking_key_hash: "bytes | None"
@ -1292,10 +1261,10 @@ if TYPE_CHECKING:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoPoolOwnerType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoPoolOwner"]:
return isinstance(msg, cls)
class CardanoPoolRelayParametersType(protobuf.MessageType):
class CardanoPoolRelayParameters(protobuf.MessageType):
type: "CardanoPoolRelayType"
ipv4_address: "bytes | None"
ipv6_address: "bytes | None"
@ -1314,7 +1283,7 @@ if TYPE_CHECKING:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoPoolRelayParametersType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoPoolRelayParameters"]:
return isinstance(msg, cls)
class CardanoPoolMetadataType(protobuf.MessageType):
@ -1341,9 +1310,9 @@ if TYPE_CHECKING:
margin_numerator: "int"
margin_denominator: "int"
reward_account: "str"
owners: "list[CardanoPoolOwnerType]"
relays: "list[CardanoPoolRelayParametersType]"
metadata: "CardanoPoolMetadataType | None"
owners_count: "int"
relays_count: "int"
def __init__(
self,
@ -1355,8 +1324,8 @@ if TYPE_CHECKING:
margin_numerator: "int",
margin_denominator: "int",
reward_account: "str",
owners: "list[CardanoPoolOwnerType] | None" = None,
relays: "list[CardanoPoolRelayParametersType] | None" = None,
owners_count: "int",
relays_count: "int",
metadata: "CardanoPoolMetadataType | None" = None,
) -> None:
pass
@ -1365,7 +1334,7 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoPoolParametersType"]:
return isinstance(msg, cls)
class CardanoTxCertificateType(protobuf.MessageType):
class CardanoTxCertificate(protobuf.MessageType):
type: "CardanoCertificateType"
path: "list[int]"
pool: "bytes | None"
@ -1382,10 +1351,10 @@ if TYPE_CHECKING:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxCertificateType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxCertificate"]:
return isinstance(msg, cls)
class CardanoTxWithdrawalType(protobuf.MessageType):
class CardanoTxWithdrawal(protobuf.MessageType):
path: "list[int]"
amount: "int"
@ -1398,7 +1367,7 @@ if TYPE_CHECKING:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxWithdrawalType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxWithdrawal"]:
return isinstance(msg, cls)
class CardanoCatalystRegistrationParametersType(protobuf.MessageType):
@ -1421,20 +1390,104 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoCatalystRegistrationParametersType"]:
return isinstance(msg, cls)
class CardanoTxAuxiliaryDataType(protobuf.MessageType):
blob: "bytes | None"
class CardanoTxAuxiliaryData(protobuf.MessageType):
catalyst_registration_parameters: "CardanoCatalystRegistrationParametersType | None"
hash: "bytes | None"
def __init__(
self,
*,
blob: "bytes | None" = None,
catalyst_registration_parameters: "CardanoCatalystRegistrationParametersType | None" = None,
hash: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxAuxiliaryDataType"]:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxAuxiliaryData"]:
return isinstance(msg, cls)
class CardanoTxItemAck(protobuf.MessageType):
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxItemAck"]:
return isinstance(msg, cls)
class CardanoTxAuxiliaryDataSupplement(protobuf.MessageType):
type: "CardanoTxAuxiliaryDataSupplementType"
auxiliary_data_hash: "bytes | None"
catalyst_signature: "bytes | None"
def __init__(
self,
*,
type: "CardanoTxAuxiliaryDataSupplementType",
auxiliary_data_hash: "bytes | None" = None,
catalyst_signature: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxAuxiliaryDataSupplement"]:
return isinstance(msg, cls)
class CardanoTxWitnessRequest(protobuf.MessageType):
path: "list[int]"
def __init__(
self,
*,
path: "list[int] | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxWitnessRequest"]:
return isinstance(msg, cls)
class CardanoTxWitnessResponse(protobuf.MessageType):
type: "CardanoTxWitnessType"
pub_key: "bytes"
signature: "bytes"
chain_code: "bytes | None"
def __init__(
self,
*,
type: "CardanoTxWitnessType",
pub_key: "bytes",
signature: "bytes",
chain_code: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxWitnessResponse"]:
return isinstance(msg, cls)
class CardanoTxHostAck(protobuf.MessageType):
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxHostAck"]:
return isinstance(msg, cls)
class CardanoTxBodyHash(protobuf.MessageType):
tx_hash: "bytes"
def __init__(
self,
*,
tx_hash: "bytes",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoTxBodyHash"]:
return isinstance(msg, cls)
class CardanoSignTxFinished(protobuf.MessageType):
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["CardanoSignTxFinished"]:
return isinstance(msg, cls)
class CipherKeyValue(protobuf.MessageType):

View File

@ -159,6 +159,23 @@ class MessageType(IntEnum):
CardanoSignedTx = 310
CardanoSignedTxChunk = 311
CardanoSignedTxChunkAck = 312
CardanoTxItemAck = 313
CardanoTxAuxiliaryDataSupplement = 314
CardanoTxWitnessRequest = 315
CardanoTxWitnessResponse = 316
CardanoTxHostAck = 317
CardanoTxBodyHash = 318
CardanoSignTxFinished = 319
CardanoSignTxInit = 320
CardanoTxInput = 321
CardanoTxOutput = 322
CardanoAssetGroup = 323
CardanoToken = 324
CardanoTxCertificate = 325
CardanoTxWithdrawal = 326
CardanoTxAuxiliaryData = 327
CardanoPoolOwner = 328
CardanoPoolRelayParameters = 329
RippleGetAddress = 400
RippleAddress = 401
RippleSignTx = 402
@ -338,6 +355,21 @@ class CardanoPoolRelayType(IntEnum):
MULTIPLE_HOST_NAME = 2
class CardanoTxAuxiliaryDataSupplementType(IntEnum):
NONE = 0
CATALYST_REGISTRATION_SIGNATURE = 1
class CardanoTxSigningMode(IntEnum):
ORDINARY_TRANSACTION = 0
POOL_REGISTRATION_AS_OWNER = 1
class CardanoTxWitnessType(IntEnum):
BYRON_WITNESS = 0
SHELLEY_WITNESS = 1
class BackupType(IntEnum):
Bip39 = 0
Slip39_Basic = 1
@ -1919,6 +1951,397 @@ class CardanoPublicKey(protobuf.MessageType):
self.node = node
class CardanoSignTxInit(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 320
FIELDS = {
1: protobuf.Field("signing_mode", "CardanoTxSigningMode", repeated=False, required=True),
2: protobuf.Field("protocol_magic", "uint32", repeated=False, required=True),
3: protobuf.Field("network_id", "uint32", repeated=False, required=True),
4: protobuf.Field("inputs_count", "uint32", repeated=False, required=True),
5: protobuf.Field("outputs_count", "uint32", repeated=False, required=True),
6: protobuf.Field("fee", "uint64", repeated=False, required=True),
7: protobuf.Field("ttl", "uint64", repeated=False, required=False),
8: protobuf.Field("certificates_count", "uint32", repeated=False, required=True),
9: protobuf.Field("withdrawals_count", "uint32", repeated=False, required=True),
10: protobuf.Field("has_auxiliary_data", "bool", repeated=False, required=True),
11: protobuf.Field("validity_interval_start", "uint64", repeated=False, required=False),
12: protobuf.Field("witness_requests_count", "uint32", repeated=False, required=True),
}
def __init__(
self,
*,
signing_mode: "CardanoTxSigningMode",
protocol_magic: "int",
network_id: "int",
inputs_count: "int",
outputs_count: "int",
fee: "int",
certificates_count: "int",
withdrawals_count: "int",
has_auxiliary_data: "bool",
witness_requests_count: "int",
ttl: Optional["int"] = None,
validity_interval_start: Optional["int"] = None,
) -> None:
self.signing_mode = signing_mode
self.protocol_magic = protocol_magic
self.network_id = network_id
self.inputs_count = inputs_count
self.outputs_count = outputs_count
self.fee = fee
self.certificates_count = certificates_count
self.withdrawals_count = withdrawals_count
self.has_auxiliary_data = has_auxiliary_data
self.witness_requests_count = witness_requests_count
self.ttl = ttl
self.validity_interval_start = validity_interval_start
class CardanoTxInput(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 321
FIELDS = {
1: protobuf.Field("prev_hash", "bytes", repeated=False, required=True),
2: protobuf.Field("prev_index", "uint32", repeated=False, required=True),
}
def __init__(
self,
*,
prev_hash: "bytes",
prev_index: "int",
) -> None:
self.prev_hash = prev_hash
self.prev_index = prev_index
class CardanoTxOutput(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 322
FIELDS = {
1: protobuf.Field("address", "string", repeated=False, required=False),
2: protobuf.Field("address_parameters", "CardanoAddressParametersType", repeated=False, required=False),
3: protobuf.Field("amount", "uint64", repeated=False, required=True),
4: protobuf.Field("asset_groups_count", "uint32", repeated=False, required=True),
}
def __init__(
self,
*,
amount: "int",
asset_groups_count: "int",
address: Optional["str"] = None,
address_parameters: Optional["CardanoAddressParametersType"] = None,
) -> None:
self.amount = amount
self.asset_groups_count = asset_groups_count
self.address = address
self.address_parameters = address_parameters
class CardanoAssetGroup(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 323
FIELDS = {
1: protobuf.Field("policy_id", "bytes", repeated=False, required=True),
2: protobuf.Field("tokens_count", "uint32", repeated=False, required=True),
}
def __init__(
self,
*,
policy_id: "bytes",
tokens_count: "int",
) -> None:
self.policy_id = policy_id
self.tokens_count = tokens_count
class CardanoToken(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 324
FIELDS = {
1: protobuf.Field("asset_name_bytes", "bytes", repeated=False, required=True),
2: protobuf.Field("amount", "uint64", repeated=False, required=True),
}
def __init__(
self,
*,
asset_name_bytes: "bytes",
amount: "int",
) -> None:
self.asset_name_bytes = asset_name_bytes
self.amount = amount
class CardanoPoolOwner(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 328
FIELDS = {
1: protobuf.Field("staking_key_path", "uint32", repeated=True, required=False),
2: protobuf.Field("staking_key_hash", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
staking_key_path: Optional[List["int"]] = None,
staking_key_hash: Optional["bytes"] = None,
) -> None:
self.staking_key_path = staking_key_path if staking_key_path is not None else []
self.staking_key_hash = staking_key_hash
class CardanoPoolRelayParameters(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 329
FIELDS = {
1: protobuf.Field("type", "CardanoPoolRelayType", repeated=False, required=True),
2: protobuf.Field("ipv4_address", "bytes", repeated=False, required=False),
3: protobuf.Field("ipv6_address", "bytes", repeated=False, required=False),
4: protobuf.Field("host_name", "string", repeated=False, required=False),
5: protobuf.Field("port", "uint32", repeated=False, required=False),
}
def __init__(
self,
*,
type: "CardanoPoolRelayType",
ipv4_address: Optional["bytes"] = None,
ipv6_address: Optional["bytes"] = None,
host_name: Optional["str"] = None,
port: Optional["int"] = None,
) -> None:
self.type = type
self.ipv4_address = ipv4_address
self.ipv6_address = ipv6_address
self.host_name = host_name
self.port = port
class CardanoPoolMetadataType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("url", "string", repeated=False, required=True),
2: protobuf.Field("hash", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
url: "str",
hash: "bytes",
) -> None:
self.url = url
self.hash = hash
class CardanoPoolParametersType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("pool_id", "bytes", repeated=False, required=True),
2: protobuf.Field("vrf_key_hash", "bytes", repeated=False, required=True),
3: protobuf.Field("pledge", "uint64", repeated=False, required=True),
4: protobuf.Field("cost", "uint64", repeated=False, required=True),
5: protobuf.Field("margin_numerator", "uint64", repeated=False, required=True),
6: protobuf.Field("margin_denominator", "uint64", repeated=False, required=True),
7: protobuf.Field("reward_account", "string", repeated=False, required=True),
8: protobuf.Field("owners", "CardanoPoolOwner", repeated=True, required=False),
9: protobuf.Field("relays", "CardanoPoolRelayParameters", repeated=True, required=False),
10: protobuf.Field("metadata", "CardanoPoolMetadataType", repeated=False, required=False),
11: protobuf.Field("owners_count", "uint32", repeated=False, required=True),
12: protobuf.Field("relays_count", "uint32", repeated=False, required=True),
}
def __init__(
self,
*,
pool_id: "bytes",
vrf_key_hash: "bytes",
pledge: "int",
cost: "int",
margin_numerator: "int",
margin_denominator: "int",
reward_account: "str",
owners_count: "int",
relays_count: "int",
owners: Optional[List["CardanoPoolOwner"]] = None,
relays: Optional[List["CardanoPoolRelayParameters"]] = None,
metadata: Optional["CardanoPoolMetadataType"] = None,
) -> None:
self.owners = owners if owners is not None else []
self.relays = relays if relays is not None else []
self.pool_id = pool_id
self.vrf_key_hash = vrf_key_hash
self.pledge = pledge
self.cost = cost
self.margin_numerator = margin_numerator
self.margin_denominator = margin_denominator
self.reward_account = reward_account
self.owners_count = owners_count
self.relays_count = relays_count
self.metadata = metadata
class CardanoTxCertificate(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 325
FIELDS = {
1: protobuf.Field("type", "CardanoCertificateType", repeated=False, required=True),
2: protobuf.Field("path", "uint32", repeated=True, required=False),
3: protobuf.Field("pool", "bytes", repeated=False, required=False),
4: protobuf.Field("pool_parameters", "CardanoPoolParametersType", repeated=False, required=False),
}
def __init__(
self,
*,
type: "CardanoCertificateType",
path: Optional[List["int"]] = None,
pool: Optional["bytes"] = None,
pool_parameters: Optional["CardanoPoolParametersType"] = None,
) -> None:
self.path = path if path is not None else []
self.type = type
self.pool = pool
self.pool_parameters = pool_parameters
class CardanoTxWithdrawal(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 326
FIELDS = {
1: protobuf.Field("path", "uint32", repeated=True, required=False),
2: protobuf.Field("amount", "uint64", repeated=False, required=True),
}
def __init__(
self,
*,
amount: "int",
path: Optional[List["int"]] = None,
) -> None:
self.path = path if path is not None else []
self.amount = amount
class CardanoCatalystRegistrationParametersType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("voting_public_key", "bytes", repeated=False, required=True),
2: protobuf.Field("staking_path", "uint32", repeated=True, required=False),
3: protobuf.Field("reward_address_parameters", "CardanoAddressParametersType", repeated=False, required=True),
4: protobuf.Field("nonce", "uint64", repeated=False, required=True),
}
def __init__(
self,
*,
voting_public_key: "bytes",
reward_address_parameters: "CardanoAddressParametersType",
nonce: "int",
staking_path: Optional[List["int"]] = None,
) -> None:
self.staking_path = staking_path if staking_path is not None else []
self.voting_public_key = voting_public_key
self.reward_address_parameters = reward_address_parameters
self.nonce = nonce
class CardanoTxAuxiliaryData(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 327
FIELDS = {
1: protobuf.Field("catalyst_registration_parameters", "CardanoCatalystRegistrationParametersType", repeated=False, required=False),
2: protobuf.Field("hash", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
catalyst_registration_parameters: Optional["CardanoCatalystRegistrationParametersType"] = None,
hash: Optional["bytes"] = None,
) -> None:
self.catalyst_registration_parameters = catalyst_registration_parameters
self.hash = hash
class CardanoTxItemAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 313
class CardanoTxAuxiliaryDataSupplement(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 314
FIELDS = {
1: protobuf.Field("type", "CardanoTxAuxiliaryDataSupplementType", repeated=False, required=True),
2: protobuf.Field("auxiliary_data_hash", "bytes", repeated=False, required=False),
3: protobuf.Field("catalyst_signature", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
type: "CardanoTxAuxiliaryDataSupplementType",
auxiliary_data_hash: Optional["bytes"] = None,
catalyst_signature: Optional["bytes"] = None,
) -> None:
self.type = type
self.auxiliary_data_hash = auxiliary_data_hash
self.catalyst_signature = catalyst_signature
class CardanoTxWitnessRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 315
FIELDS = {
1: protobuf.Field("path", "uint32", repeated=True, required=False),
}
def __init__(
self,
*,
path: Optional[List["int"]] = None,
) -> None:
self.path = path if path is not None else []
class CardanoTxWitnessResponse(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 316
FIELDS = {
1: protobuf.Field("type", "CardanoTxWitnessType", repeated=False, required=True),
2: protobuf.Field("pub_key", "bytes", repeated=False, required=True),
3: protobuf.Field("signature", "bytes", repeated=False, required=True),
4: protobuf.Field("chain_code", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
type: "CardanoTxWitnessType",
pub_key: "bytes",
signature: "bytes",
chain_code: Optional["bytes"] = None,
) -> None:
self.type = type
self.pub_key = pub_key
self.signature = signature
self.chain_code = chain_code
class CardanoTxHostAck(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 317
class CardanoTxBodyHash(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 318
FIELDS = {
1: protobuf.Field("tx_hash", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
tx_hash: "bytes",
) -> None:
self.tx_hash = tx_hash
class CardanoSignTxFinished(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 319
class CardanoSignTx(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 303
FIELDS = {
@ -2115,64 +2538,6 @@ class CardanoPoolRelayParametersType(protobuf.MessageType):
self.port = port
class CardanoPoolMetadataType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("url", "string", repeated=False, required=True),
2: protobuf.Field("hash", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
url: "str",
hash: "bytes",
) -> None:
self.url = url
self.hash = hash
class CardanoPoolParametersType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("pool_id", "bytes", repeated=False, required=True),
2: protobuf.Field("vrf_key_hash", "bytes", repeated=False, required=True),
3: protobuf.Field("pledge", "uint64", repeated=False, required=True),
4: protobuf.Field("cost", "uint64", repeated=False, required=True),
5: protobuf.Field("margin_numerator", "uint64", repeated=False, required=True),
6: protobuf.Field("margin_denominator", "uint64", repeated=False, required=True),
7: protobuf.Field("reward_account", "string", repeated=False, required=True),
8: protobuf.Field("owners", "CardanoPoolOwnerType", repeated=True, required=False),
9: protobuf.Field("relays", "CardanoPoolRelayParametersType", repeated=True, required=False),
10: protobuf.Field("metadata", "CardanoPoolMetadataType", repeated=False, required=False),
}
def __init__(
self,
*,
pool_id: "bytes",
vrf_key_hash: "bytes",
pledge: "int",
cost: "int",
margin_numerator: "int",
margin_denominator: "int",
reward_account: "str",
owners: Optional[List["CardanoPoolOwnerType"]] = None,
relays: Optional[List["CardanoPoolRelayParametersType"]] = None,
metadata: Optional["CardanoPoolMetadataType"] = None,
) -> None:
self.owners = owners if owners is not None else []
self.relays = relays if relays is not None else []
self.pool_id = pool_id
self.vrf_key_hash = vrf_key_hash
self.pledge = pledge
self.cost = cost
self.margin_numerator = margin_numerator
self.margin_denominator = margin_denominator
self.reward_account = reward_account
self.metadata = metadata
class CardanoTxCertificateType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
@ -2213,29 +2578,6 @@ class CardanoTxWithdrawalType(protobuf.MessageType):
self.amount = amount
class CardanoCatalystRegistrationParametersType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {
1: protobuf.Field("voting_public_key", "bytes", repeated=False, required=True),
2: protobuf.Field("staking_path", "uint32", repeated=True, required=False),
3: protobuf.Field("reward_address_parameters", "CardanoAddressParametersType", repeated=False, required=True),
4: protobuf.Field("nonce", "uint64", repeated=False, required=True),
}
def __init__(
self,
*,
voting_public_key: "bytes",
reward_address_parameters: "CardanoAddressParametersType",
nonce: "int",
staking_path: Optional[List["int"]] = None,
) -> None:
self.staking_path = staking_path if staking_path is not None else []
self.voting_public_key = voting_public_key
self.reward_address_parameters = reward_address_parameters
self.nonce = nonce
class CardanoTxAuxiliaryDataType(protobuf.MessageType):
MESSAGE_WIRE_TYPE = None
FIELDS = {