mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-21 23:18:13 +00:00
feat(common): strong typing for Stellar protobuf messages
BREAKING CHANGE: StellarAssetType is renamed to StellarAsset. The name StellarAssetType is reused for the corresponding enum. Enums are introduced in several other places. Their values correspond to allowed values of (previously int) fields so this should not pose a compatibility problem. Many fields are now required. We believe that this should not pose a compatibility problem, because all known interfaces to Stellar signing actually accept Stellar XDR on input, whose required fields match the protobuf schema.
This commit is contained in:
parent
dcb1cab481
commit
1b601b3e08
@ -5,14 +5,22 @@ package hw.trezor.messages.stellar;
|
||||
option java_package = "com.satoshilabs.trezor.lib.protobuf";
|
||||
option java_outer_classname = "TrezorMessageStellar";
|
||||
|
||||
// https://github.com/stellar/stellar-core/blob/02d26858069de7c0eefe065056fb0a19bf72ea56/src/xdr/Stellar-ledger-entries.x#L25-L31
|
||||
enum StellarAssetType {
|
||||
NATIVE = 0;
|
||||
ALPHANUM4 = 1;
|
||||
ALPHANUM12 = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a Stellar asset
|
||||
* @embed
|
||||
*/
|
||||
message StellarAssetType {
|
||||
required uint32 type = 1; // 0 = native asset (XLM), 1 = alphanum 4, 2 = alphanum 12
|
||||
message StellarAsset {
|
||||
required StellarAssetType type = 1;
|
||||
optional string code = 2; // for non-native assets, string describing the code
|
||||
optional string issuer = 3; // issuing address
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,18 +47,27 @@ message StellarAddress {
|
||||
* @next StellarTxOpRequest
|
||||
*/
|
||||
message StellarSignTx {
|
||||
repeated uint32 address_n = 2; // BIP-32 path. For compatibility with other wallets, must be m/44'/148'/index'
|
||||
optional string network_passphrase = 3; // passphrase for signing messages on the destination network
|
||||
optional string source_account = 4; // source account address
|
||||
optional uint32 fee = 5; // Fee (in stroops) for the transaction
|
||||
optional uint64 sequence_number = 6; // transaction sequence number
|
||||
optional uint32 timebounds_start = 8; // unix timestamp (client must truncate this to 32 bytes)
|
||||
optional uint32 timebounds_end = 9; // unix timestamp (client must truncate this to 32 bytes)
|
||||
optional uint32 memo_type = 10; // 0 = none, 1 = text, 2 = id, 3 = hash, 4 = return
|
||||
optional string memo_text = 11; // up to 28 characters (4 bytes are for length)
|
||||
optional uint64 memo_id = 12; // 8-byte uint64
|
||||
optional bytes memo_hash = 13; // 32 bytes representing a hash
|
||||
optional uint32 num_operations = 14; // number of operations in this transaction
|
||||
repeated uint32 address_n = 2; // BIP-32 path. For compatibility with other wallets, must be m/44'/148'/index'
|
||||
required string network_passphrase = 3; // passphrase for signing messages on the destination network
|
||||
required string source_account = 4; // source account address
|
||||
required uint32 fee = 5; // Fee (in stroops) for the transaction
|
||||
required uint64 sequence_number = 6; // transaction sequence number
|
||||
optional uint32 timebounds_start = 8; // unix timestamp (client must truncate this to 32 bytes)
|
||||
optional uint32 timebounds_end = 9; // unix timestamp (client must truncate this to 32 bytes)
|
||||
required StellarMemoType memo_type = 10; // type of memo attached to the transaction
|
||||
optional string memo_text = 11; // up to 28 characters (4 bytes are for length)
|
||||
optional uint64 memo_id = 12; // 8-byte uint64
|
||||
optional bytes memo_hash = 13; // 32 bytes representing a hash
|
||||
required uint32 num_operations = 14; // number of operations in this transaction
|
||||
|
||||
// https://github.com/stellar/stellar-core/blob/02d26858069de7c0eefe065056fb0a19bf72ea56/src/xdr/Stellar-transaction.x#L506-L513
|
||||
enum StellarMemoType {
|
||||
NONE = 0;
|
||||
TEXT = 1;
|
||||
ID = 2;
|
||||
HASH = 3;
|
||||
RETURN = 4;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,9 +94,9 @@ message StellarTxOpRequest {
|
||||
*/
|
||||
message StellarPaymentOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional string destination_account = 2; // destination account address
|
||||
optional StellarAssetType asset = 3; // asset involved in the operation
|
||||
optional sint64 amount = 4; // amount of the given asset to pay
|
||||
required string destination_account = 2; // destination account address
|
||||
required StellarAsset asset = 3; // asset involved in the operation
|
||||
required sint64 amount = 4; // amount of the given asset to pay
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +106,8 @@ message StellarPaymentOp {
|
||||
*/
|
||||
message StellarCreateAccountOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional string new_account = 2; // account address to create
|
||||
optional sint64 starting_balance = 3; // initial starting balance for the new account
|
||||
required string new_account = 2; // account address to create
|
||||
required sint64 starting_balance = 3; // initial starting balance for the new account
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,12 +117,12 @@ message StellarCreateAccountOp {
|
||||
*/
|
||||
message StellarPathPaymentOp {
|
||||
optional string source_account = 1; // (optional) source address
|
||||
optional StellarAssetType send_asset = 2;
|
||||
optional sint64 send_max = 3;
|
||||
optional string destination_account = 4;
|
||||
optional StellarAssetType destination_asset = 5;
|
||||
optional sint64 destination_amount = 6;
|
||||
repeated StellarAssetType paths = 7;
|
||||
required StellarAsset send_asset = 2;
|
||||
required sint64 send_max = 3;
|
||||
required string destination_account = 4;
|
||||
required StellarAsset destination_asset = 5;
|
||||
required sint64 destination_amount = 6;
|
||||
repeated StellarAsset paths = 7;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,12 +132,12 @@ message StellarPathPaymentOp {
|
||||
*/
|
||||
message StellarManageOfferOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional StellarAssetType selling_asset = 2;
|
||||
optional StellarAssetType buying_asset = 3;
|
||||
optional sint64 amount = 4;
|
||||
optional uint32 price_n = 5; // Price numerator
|
||||
optional uint32 price_d = 6; // Price denominator
|
||||
optional uint64 offer_id = 7; // Offer ID for updating an existing offer
|
||||
required StellarAsset selling_asset = 2;
|
||||
required StellarAsset buying_asset = 3;
|
||||
required sint64 amount = 4;
|
||||
required uint32 price_n = 5; // Price numerator
|
||||
required uint32 price_d = 6; // Price denominator
|
||||
required uint64 offer_id = 7; // Offer ID for updating an existing offer
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,11 +147,11 @@ message StellarManageOfferOp {
|
||||
*/
|
||||
message StellarCreatePassiveOfferOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional StellarAssetType selling_asset = 2;
|
||||
optional StellarAssetType buying_asset = 3;
|
||||
optional sint64 amount = 4;
|
||||
optional uint32 price_n = 5; // Price numerator
|
||||
optional uint32 price_d = 6; // Price denominator
|
||||
required StellarAsset selling_asset = 2;
|
||||
required StellarAsset buying_asset = 3;
|
||||
required sint64 amount = 4;
|
||||
required uint32 price_n = 5; // Price numerator
|
||||
required uint32 price_d = 6; // Price denominator
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,9 +169,16 @@ message StellarSetOptionsOp {
|
||||
optional uint32 medium_threshold = 7;
|
||||
optional uint32 high_threshold = 8;
|
||||
optional string home_domain = 9;
|
||||
optional uint32 signer_type = 10;
|
||||
optional StellarSignerType signer_type = 10;
|
||||
optional bytes signer_key = 11;
|
||||
optional uint32 signer_weight = 12;
|
||||
|
||||
// https://github.com/stellar/stellar-core/blob/02d26858069de7c0eefe065056fb0a19bf72ea56/src/xdr/Stellar-types.x#L32-L37
|
||||
enum StellarSignerType {
|
||||
ACCOUNT = 0;
|
||||
PRE_AUTH = 1;
|
||||
HASH = 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,8 +188,8 @@ message StellarSetOptionsOp {
|
||||
*/
|
||||
message StellarChangeTrustOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional StellarAssetType asset = 2;
|
||||
optional uint64 limit = 3;
|
||||
required StellarAsset asset = 2;
|
||||
required uint64 limit = 3;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,10 +199,10 @@ message StellarChangeTrustOp {
|
||||
*/
|
||||
message StellarAllowTrustOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional string trusted_account = 2; // The account being allowed to hold the asset
|
||||
optional uint32 asset_type = 3; // 1 = 4-character, 2 = 12-character
|
||||
required string trusted_account = 2; // The account being allowed to hold the asset
|
||||
required StellarAssetType asset_type = 3;
|
||||
optional string asset_code = 4; // human-readable asset code
|
||||
optional uint32 is_authorized = 5;
|
||||
required bool is_authorized = 5;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,7 +212,7 @@ message StellarAllowTrustOp {
|
||||
*/
|
||||
message StellarAccountMergeOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional string destination_account = 2; // destination account address
|
||||
required string destination_account = 2; // destination account address
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,7 +222,7 @@ message StellarAccountMergeOp {
|
||||
*/
|
||||
message StellarManageDataOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional string key = 2;
|
||||
required string key = 2;
|
||||
optional bytes value = 3; // 64 bytes of arbitrary data
|
||||
}
|
||||
|
||||
@ -209,7 +233,7 @@ message StellarManageDataOp {
|
||||
*/
|
||||
message StellarBumpSequenceOp {
|
||||
optional string source_account = 1; // (optional) source account address
|
||||
optional uint64 bump_to = 2; // new sequence number
|
||||
required uint64 bump_to = 2; // new sequence number
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -408,6 +408,12 @@ if utils.BITCOIN_ONLY:
|
||||
import trezor.enums.NEMMosaicLevy
|
||||
trezor.enums.NEMSupplyChangeType
|
||||
import trezor.enums.NEMSupplyChangeType
|
||||
trezor.enums.StellarAssetType
|
||||
import trezor.enums.StellarAssetType
|
||||
trezor.enums.StellarMemoType
|
||||
import trezor.enums.StellarMemoType
|
||||
trezor.enums.StellarSignerType
|
||||
import trezor.enums.StellarSignerType
|
||||
trezor.enums.TezosBallotType
|
||||
import trezor.enums.TezosBallotType
|
||||
trezor.enums.TezosContractType
|
||||
|
7
core/src/trezor/enums/StellarAssetType.py
Normal file
7
core/src/trezor/enums/StellarAssetType.py
Normal file
@ -0,0 +1,7 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
# isort:skip_file
|
||||
|
||||
NATIVE = 0
|
||||
ALPHANUM4 = 1
|
||||
ALPHANUM12 = 2
|
9
core/src/trezor/enums/StellarMemoType.py
Normal file
9
core/src/trezor/enums/StellarMemoType.py
Normal file
@ -0,0 +1,9 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
# isort:skip_file
|
||||
|
||||
NONE = 0
|
||||
TEXT = 1
|
||||
ID = 2
|
||||
HASH = 3
|
||||
RETURN = 4
|
7
core/src/trezor/enums/StellarSignerType.py
Normal file
7
core/src/trezor/enums/StellarSignerType.py
Normal file
@ -0,0 +1,7 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
# isort:skip_file
|
||||
|
||||
ACCOUNT = 0
|
||||
PRE_AUTH = 1
|
||||
HASH = 2
|
@ -416,6 +416,23 @@ if TYPE_CHECKING:
|
||||
ImportanceTransfer_Activate = 1
|
||||
ImportanceTransfer_Deactivate = 2
|
||||
|
||||
class StellarAssetType(IntEnum):
|
||||
NATIVE = 0
|
||||
ALPHANUM4 = 1
|
||||
ALPHANUM12 = 2
|
||||
|
||||
class StellarMemoType(IntEnum):
|
||||
NONE = 0
|
||||
TEXT = 1
|
||||
ID = 2
|
||||
HASH = 3
|
||||
RETURN = 4
|
||||
|
||||
class StellarSignerType(IntEnum):
|
||||
ACCOUNT = 0
|
||||
PRE_AUTH = 1
|
||||
HASH = 2
|
||||
|
||||
class TezosContractType(IntEnum):
|
||||
Implicit = 0
|
||||
Originated = 1
|
||||
|
@ -46,6 +46,9 @@ if TYPE_CHECKING:
|
||||
from trezor.enums import RequestType # noqa: F401
|
||||
from trezor.enums import SafetyCheckLevel # noqa: F401
|
||||
from trezor.enums import SdProtectOperationType # noqa: F401
|
||||
from trezor.enums import StellarAssetType # noqa: F401
|
||||
from trezor.enums import StellarMemoType # noqa: F401
|
||||
from trezor.enums import StellarSignerType # noqa: F401
|
||||
from trezor.enums import TezosBallotType # noqa: F401
|
||||
from trezor.enums import TezosContractType # noqa: F401
|
||||
from trezor.enums import WordRequestType # noqa: F401
|
||||
@ -4428,22 +4431,22 @@ if TYPE_CHECKING:
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["RipplePayment"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class StellarAssetType(protobuf.MessageType):
|
||||
type: "int"
|
||||
class StellarAsset(protobuf.MessageType):
|
||||
type: "StellarAssetType"
|
||||
code: "str | None"
|
||||
issuer: "str | None"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: "int",
|
||||
type: "StellarAssetType",
|
||||
code: "str | None" = None,
|
||||
issuer: "str | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarAssetType"]:
|
||||
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["StellarAsset"]:
|
||||
return isinstance(msg, cls)
|
||||
|
||||
class StellarGetAddress(protobuf.MessageType):
|
||||
@ -4478,33 +4481,33 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarSignTx(protobuf.MessageType):
|
||||
address_n: "list[int]"
|
||||
network_passphrase: "str | None"
|
||||
source_account: "str | None"
|
||||
fee: "int | None"
|
||||
sequence_number: "int | None"
|
||||
network_passphrase: "str"
|
||||
source_account: "str"
|
||||
fee: "int"
|
||||
sequence_number: "int"
|
||||
timebounds_start: "int | None"
|
||||
timebounds_end: "int | None"
|
||||
memo_type: "int | None"
|
||||
memo_type: "StellarMemoType"
|
||||
memo_text: "str | None"
|
||||
memo_id: "int | None"
|
||||
memo_hash: "bytes | None"
|
||||
num_operations: "int | None"
|
||||
num_operations: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
network_passphrase: "str",
|
||||
source_account: "str",
|
||||
fee: "int",
|
||||
sequence_number: "int",
|
||||
memo_type: "StellarMemoType",
|
||||
num_operations: "int",
|
||||
address_n: "list[int] | None" = None,
|
||||
network_passphrase: "str | None" = None,
|
||||
source_account: "str | None" = None,
|
||||
fee: "int | None" = None,
|
||||
sequence_number: "int | None" = None,
|
||||
timebounds_start: "int | None" = None,
|
||||
timebounds_end: "int | None" = None,
|
||||
memo_type: "int | None" = None,
|
||||
memo_text: "str | None" = None,
|
||||
memo_id: "int | None" = None,
|
||||
memo_hash: "bytes | None" = None,
|
||||
num_operations: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4520,17 +4523,17 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarPaymentOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
destination_account: "str | None"
|
||||
asset: "StellarAssetType | None"
|
||||
amount: "int | None"
|
||||
destination_account: "str"
|
||||
asset: "StellarAsset"
|
||||
amount: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
destination_account: "str",
|
||||
asset: "StellarAsset",
|
||||
amount: "int",
|
||||
source_account: "str | None" = None,
|
||||
destination_account: "str | None" = None,
|
||||
asset: "StellarAssetType | None" = None,
|
||||
amount: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4540,15 +4543,15 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarCreateAccountOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
new_account: "str | None"
|
||||
starting_balance: "int | None"
|
||||
new_account: "str"
|
||||
starting_balance: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
new_account: "str",
|
||||
starting_balance: "int",
|
||||
source_account: "str | None" = None,
|
||||
new_account: "str | None" = None,
|
||||
starting_balance: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4558,23 +4561,23 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarPathPaymentOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
send_asset: "StellarAssetType | None"
|
||||
send_max: "int | None"
|
||||
destination_account: "str | None"
|
||||
destination_asset: "StellarAssetType | None"
|
||||
destination_amount: "int | None"
|
||||
paths: "list[StellarAssetType]"
|
||||
send_asset: "StellarAsset"
|
||||
send_max: "int"
|
||||
destination_account: "str"
|
||||
destination_asset: "StellarAsset"
|
||||
destination_amount: "int"
|
||||
paths: "list[StellarAsset]"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
paths: "list[StellarAssetType] | None" = None,
|
||||
send_asset: "StellarAsset",
|
||||
send_max: "int",
|
||||
destination_account: "str",
|
||||
destination_asset: "StellarAsset",
|
||||
destination_amount: "int",
|
||||
paths: "list[StellarAsset] | None" = None,
|
||||
source_account: "str | None" = None,
|
||||
send_asset: "StellarAssetType | None" = None,
|
||||
send_max: "int | None" = None,
|
||||
destination_account: "str | None" = None,
|
||||
destination_asset: "StellarAssetType | None" = None,
|
||||
destination_amount: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4584,23 +4587,23 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarManageOfferOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
selling_asset: "StellarAssetType | None"
|
||||
buying_asset: "StellarAssetType | None"
|
||||
amount: "int | None"
|
||||
price_n: "int | None"
|
||||
price_d: "int | None"
|
||||
offer_id: "int | None"
|
||||
selling_asset: "StellarAsset"
|
||||
buying_asset: "StellarAsset"
|
||||
amount: "int"
|
||||
price_n: "int"
|
||||
price_d: "int"
|
||||
offer_id: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
selling_asset: "StellarAsset",
|
||||
buying_asset: "StellarAsset",
|
||||
amount: "int",
|
||||
price_n: "int",
|
||||
price_d: "int",
|
||||
offer_id: "int",
|
||||
source_account: "str | None" = None,
|
||||
selling_asset: "StellarAssetType | None" = None,
|
||||
buying_asset: "StellarAssetType | None" = None,
|
||||
amount: "int | None" = None,
|
||||
price_n: "int | None" = None,
|
||||
price_d: "int | None" = None,
|
||||
offer_id: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4610,21 +4613,21 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarCreatePassiveOfferOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
selling_asset: "StellarAssetType | None"
|
||||
buying_asset: "StellarAssetType | None"
|
||||
amount: "int | None"
|
||||
price_n: "int | None"
|
||||
price_d: "int | None"
|
||||
selling_asset: "StellarAsset"
|
||||
buying_asset: "StellarAsset"
|
||||
amount: "int"
|
||||
price_n: "int"
|
||||
price_d: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
selling_asset: "StellarAsset",
|
||||
buying_asset: "StellarAsset",
|
||||
amount: "int",
|
||||
price_n: "int",
|
||||
price_d: "int",
|
||||
source_account: "str | None" = None,
|
||||
selling_asset: "StellarAssetType | None" = None,
|
||||
buying_asset: "StellarAssetType | None" = None,
|
||||
amount: "int | None" = None,
|
||||
price_n: "int | None" = None,
|
||||
price_d: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4642,7 +4645,7 @@ if TYPE_CHECKING:
|
||||
medium_threshold: "int | None"
|
||||
high_threshold: "int | None"
|
||||
home_domain: "str | None"
|
||||
signer_type: "int | None"
|
||||
signer_type: "StellarSignerType | None"
|
||||
signer_key: "bytes | None"
|
||||
signer_weight: "int | None"
|
||||
|
||||
@ -4658,7 +4661,7 @@ if TYPE_CHECKING:
|
||||
medium_threshold: "int | None" = None,
|
||||
high_threshold: "int | None" = None,
|
||||
home_domain: "str | None" = None,
|
||||
signer_type: "int | None" = None,
|
||||
signer_type: "StellarSignerType | None" = None,
|
||||
signer_key: "bytes | None" = None,
|
||||
signer_weight: "int | None" = None,
|
||||
) -> None:
|
||||
@ -4670,15 +4673,15 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarChangeTrustOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
asset: "StellarAssetType | None"
|
||||
limit: "int | None"
|
||||
asset: "StellarAsset"
|
||||
limit: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
asset: "StellarAsset",
|
||||
limit: "int",
|
||||
source_account: "str | None" = None,
|
||||
asset: "StellarAssetType | None" = None,
|
||||
limit: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4688,19 +4691,19 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarAllowTrustOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
trusted_account: "str | None"
|
||||
asset_type: "int | None"
|
||||
trusted_account: "str"
|
||||
asset_type: "StellarAssetType"
|
||||
asset_code: "str | None"
|
||||
is_authorized: "int | None"
|
||||
is_authorized: "bool"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
trusted_account: "str",
|
||||
asset_type: "StellarAssetType",
|
||||
is_authorized: "bool",
|
||||
source_account: "str | None" = None,
|
||||
trusted_account: "str | None" = None,
|
||||
asset_type: "int | None" = None,
|
||||
asset_code: "str | None" = None,
|
||||
is_authorized: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4710,13 +4713,13 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarAccountMergeOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
destination_account: "str | None"
|
||||
destination_account: "str"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
destination_account: "str",
|
||||
source_account: "str | None" = None,
|
||||
destination_account: "str | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
@ -4726,14 +4729,14 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarManageDataOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
key: "str | None"
|
||||
key: "str"
|
||||
value: "bytes | None"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
key: "str",
|
||||
source_account: "str | None" = None,
|
||||
key: "str | None" = None,
|
||||
value: "bytes | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
@ -4744,13 +4747,13 @@ if TYPE_CHECKING:
|
||||
|
||||
class StellarBumpSequenceOp(protobuf.MessageType):
|
||||
source_account: "str | None"
|
||||
bump_to: "int | None"
|
||||
bump_to: "int"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
bump_to: "int",
|
||||
source_account: "str | None" = None,
|
||||
bump_to: "int | None" = None,
|
||||
) -> None:
|
||||
pass
|
||||
|
||||
|
@ -446,6 +446,26 @@ class NEMImportanceTransferMode(IntEnum):
|
||||
ImportanceTransfer_Deactivate = 2
|
||||
|
||||
|
||||
class StellarAssetType(IntEnum):
|
||||
NATIVE = 0
|
||||
ALPHANUM4 = 1
|
||||
ALPHANUM12 = 2
|
||||
|
||||
|
||||
class StellarMemoType(IntEnum):
|
||||
NONE = 0
|
||||
TEXT = 1
|
||||
ID = 2
|
||||
HASH = 3
|
||||
RETURN = 4
|
||||
|
||||
|
||||
class StellarSignerType(IntEnum):
|
||||
ACCOUNT = 0
|
||||
PRE_AUTH = 1
|
||||
HASH = 2
|
||||
|
||||
|
||||
class TezosContractType(IntEnum):
|
||||
Implicit = 0
|
||||
Originated = 1
|
||||
@ -5887,10 +5907,10 @@ class RipplePayment(protobuf.MessageType):
|
||||
self.destination_tag = destination_tag
|
||||
|
||||
|
||||
class StellarAssetType(protobuf.MessageType):
|
||||
class StellarAsset(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = None
|
||||
FIELDS = {
|
||||
1: protobuf.Field("type", "uint32", repeated=False, required=True),
|
||||
1: protobuf.Field("type", "StellarAssetType", repeated=False, required=True),
|
||||
2: protobuf.Field("code", "string", repeated=False, required=False),
|
||||
3: protobuf.Field("issuer", "string", repeated=False, required=False),
|
||||
}
|
||||
@ -5898,7 +5918,7 @@ class StellarAssetType(protobuf.MessageType):
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
type: "int",
|
||||
type: "StellarAssetType",
|
||||
code: Optional["str"] = None,
|
||||
issuer: Optional["str"] = None,
|
||||
) -> None:
|
||||
@ -5942,47 +5962,47 @@ class StellarSignTx(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 202
|
||||
FIELDS = {
|
||||
2: protobuf.Field("address_n", "uint32", repeated=True, required=False),
|
||||
3: protobuf.Field("network_passphrase", "string", repeated=False, required=False),
|
||||
4: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
5: protobuf.Field("fee", "uint32", repeated=False, required=False),
|
||||
6: protobuf.Field("sequence_number", "uint64", repeated=False, required=False),
|
||||
3: protobuf.Field("network_passphrase", "string", repeated=False, required=True),
|
||||
4: protobuf.Field("source_account", "string", repeated=False, required=True),
|
||||
5: protobuf.Field("fee", "uint32", repeated=False, required=True),
|
||||
6: protobuf.Field("sequence_number", "uint64", repeated=False, required=True),
|
||||
8: protobuf.Field("timebounds_start", "uint32", repeated=False, required=False),
|
||||
9: protobuf.Field("timebounds_end", "uint32", repeated=False, required=False),
|
||||
10: protobuf.Field("memo_type", "uint32", repeated=False, required=False),
|
||||
10: protobuf.Field("memo_type", "StellarMemoType", repeated=False, required=True),
|
||||
11: protobuf.Field("memo_text", "string", repeated=False, required=False),
|
||||
12: protobuf.Field("memo_id", "uint64", repeated=False, required=False),
|
||||
13: protobuf.Field("memo_hash", "bytes", repeated=False, required=False),
|
||||
14: protobuf.Field("num_operations", "uint32", repeated=False, required=False),
|
||||
14: protobuf.Field("num_operations", "uint32", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
network_passphrase: "str",
|
||||
source_account: "str",
|
||||
fee: "int",
|
||||
sequence_number: "int",
|
||||
memo_type: "StellarMemoType",
|
||||
num_operations: "int",
|
||||
address_n: Optional[List["int"]] = None,
|
||||
network_passphrase: Optional["str"] = None,
|
||||
source_account: Optional["str"] = None,
|
||||
fee: Optional["int"] = None,
|
||||
sequence_number: Optional["int"] = None,
|
||||
timebounds_start: Optional["int"] = None,
|
||||
timebounds_end: Optional["int"] = None,
|
||||
memo_type: Optional["int"] = None,
|
||||
memo_text: Optional["str"] = None,
|
||||
memo_id: Optional["int"] = None,
|
||||
memo_hash: Optional["bytes"] = None,
|
||||
num_operations: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.address_n = address_n if address_n is not None else []
|
||||
self.network_passphrase = network_passphrase
|
||||
self.source_account = source_account
|
||||
self.fee = fee
|
||||
self.sequence_number = sequence_number
|
||||
self.memo_type = memo_type
|
||||
self.num_operations = num_operations
|
||||
self.timebounds_start = timebounds_start
|
||||
self.timebounds_end = timebounds_end
|
||||
self.memo_type = memo_type
|
||||
self.memo_text = memo_text
|
||||
self.memo_id = memo_id
|
||||
self.memo_hash = memo_hash
|
||||
self.num_operations = num_operations
|
||||
|
||||
|
||||
class StellarTxOpRequest(protobuf.MessageType):
|
||||
@ -5993,136 +6013,136 @@ class StellarPaymentOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 211
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("destination_account", "string", repeated=False, required=False),
|
||||
3: protobuf.Field("asset", "StellarAssetType", repeated=False, required=False),
|
||||
4: protobuf.Field("amount", "sint64", repeated=False, required=False),
|
||||
2: protobuf.Field("destination_account", "string", repeated=False, required=True),
|
||||
3: protobuf.Field("asset", "StellarAsset", repeated=False, required=True),
|
||||
4: protobuf.Field("amount", "sint64", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
destination_account: "str",
|
||||
asset: "StellarAsset",
|
||||
amount: "int",
|
||||
source_account: Optional["str"] = None,
|
||||
destination_account: Optional["str"] = None,
|
||||
asset: Optional["StellarAssetType"] = None,
|
||||
amount: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.destination_account = destination_account
|
||||
self.asset = asset
|
||||
self.amount = amount
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarCreateAccountOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 210
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("new_account", "string", repeated=False, required=False),
|
||||
3: protobuf.Field("starting_balance", "sint64", repeated=False, required=False),
|
||||
2: protobuf.Field("new_account", "string", repeated=False, required=True),
|
||||
3: protobuf.Field("starting_balance", "sint64", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
new_account: "str",
|
||||
starting_balance: "int",
|
||||
source_account: Optional["str"] = None,
|
||||
new_account: Optional["str"] = None,
|
||||
starting_balance: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.new_account = new_account
|
||||
self.starting_balance = starting_balance
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarPathPaymentOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 212
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("send_asset", "StellarAssetType", repeated=False, required=False),
|
||||
3: protobuf.Field("send_max", "sint64", repeated=False, required=False),
|
||||
4: protobuf.Field("destination_account", "string", repeated=False, required=False),
|
||||
5: protobuf.Field("destination_asset", "StellarAssetType", repeated=False, required=False),
|
||||
6: protobuf.Field("destination_amount", "sint64", repeated=False, required=False),
|
||||
7: protobuf.Field("paths", "StellarAssetType", repeated=True, required=False),
|
||||
2: protobuf.Field("send_asset", "StellarAsset", repeated=False, required=True),
|
||||
3: protobuf.Field("send_max", "sint64", repeated=False, required=True),
|
||||
4: protobuf.Field("destination_account", "string", repeated=False, required=True),
|
||||
5: protobuf.Field("destination_asset", "StellarAsset", repeated=False, required=True),
|
||||
6: protobuf.Field("destination_amount", "sint64", repeated=False, required=True),
|
||||
7: protobuf.Field("paths", "StellarAsset", repeated=True, required=False),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
paths: Optional[List["StellarAssetType"]] = None,
|
||||
send_asset: "StellarAsset",
|
||||
send_max: "int",
|
||||
destination_account: "str",
|
||||
destination_asset: "StellarAsset",
|
||||
destination_amount: "int",
|
||||
paths: Optional[List["StellarAsset"]] = None,
|
||||
source_account: Optional["str"] = None,
|
||||
send_asset: Optional["StellarAssetType"] = None,
|
||||
send_max: Optional["int"] = None,
|
||||
destination_account: Optional["str"] = None,
|
||||
destination_asset: Optional["StellarAssetType"] = None,
|
||||
destination_amount: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.paths = paths if paths is not None else []
|
||||
self.source_account = source_account
|
||||
self.send_asset = send_asset
|
||||
self.send_max = send_max
|
||||
self.destination_account = destination_account
|
||||
self.destination_asset = destination_asset
|
||||
self.destination_amount = destination_amount
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarManageOfferOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 213
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("selling_asset", "StellarAssetType", repeated=False, required=False),
|
||||
3: protobuf.Field("buying_asset", "StellarAssetType", repeated=False, required=False),
|
||||
4: protobuf.Field("amount", "sint64", repeated=False, required=False),
|
||||
5: protobuf.Field("price_n", "uint32", repeated=False, required=False),
|
||||
6: protobuf.Field("price_d", "uint32", repeated=False, required=False),
|
||||
7: protobuf.Field("offer_id", "uint64", repeated=False, required=False),
|
||||
2: protobuf.Field("selling_asset", "StellarAsset", repeated=False, required=True),
|
||||
3: protobuf.Field("buying_asset", "StellarAsset", repeated=False, required=True),
|
||||
4: protobuf.Field("amount", "sint64", repeated=False, required=True),
|
||||
5: protobuf.Field("price_n", "uint32", repeated=False, required=True),
|
||||
6: protobuf.Field("price_d", "uint32", repeated=False, required=True),
|
||||
7: protobuf.Field("offer_id", "uint64", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
selling_asset: "StellarAsset",
|
||||
buying_asset: "StellarAsset",
|
||||
amount: "int",
|
||||
price_n: "int",
|
||||
price_d: "int",
|
||||
offer_id: "int",
|
||||
source_account: Optional["str"] = None,
|
||||
selling_asset: Optional["StellarAssetType"] = None,
|
||||
buying_asset: Optional["StellarAssetType"] = None,
|
||||
amount: Optional["int"] = None,
|
||||
price_n: Optional["int"] = None,
|
||||
price_d: Optional["int"] = None,
|
||||
offer_id: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.selling_asset = selling_asset
|
||||
self.buying_asset = buying_asset
|
||||
self.amount = amount
|
||||
self.price_n = price_n
|
||||
self.price_d = price_d
|
||||
self.offer_id = offer_id
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarCreatePassiveOfferOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 214
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("selling_asset", "StellarAssetType", repeated=False, required=False),
|
||||
3: protobuf.Field("buying_asset", "StellarAssetType", repeated=False, required=False),
|
||||
4: protobuf.Field("amount", "sint64", repeated=False, required=False),
|
||||
5: protobuf.Field("price_n", "uint32", repeated=False, required=False),
|
||||
6: protobuf.Field("price_d", "uint32", repeated=False, required=False),
|
||||
2: protobuf.Field("selling_asset", "StellarAsset", repeated=False, required=True),
|
||||
3: protobuf.Field("buying_asset", "StellarAsset", repeated=False, required=True),
|
||||
4: protobuf.Field("amount", "sint64", repeated=False, required=True),
|
||||
5: protobuf.Field("price_n", "uint32", repeated=False, required=True),
|
||||
6: protobuf.Field("price_d", "uint32", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
selling_asset: "StellarAsset",
|
||||
buying_asset: "StellarAsset",
|
||||
amount: "int",
|
||||
price_n: "int",
|
||||
price_d: "int",
|
||||
source_account: Optional["str"] = None,
|
||||
selling_asset: Optional["StellarAssetType"] = None,
|
||||
buying_asset: Optional["StellarAssetType"] = None,
|
||||
amount: Optional["int"] = None,
|
||||
price_n: Optional["int"] = None,
|
||||
price_d: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.selling_asset = selling_asset
|
||||
self.buying_asset = buying_asset
|
||||
self.amount = amount
|
||||
self.price_n = price_n
|
||||
self.price_d = price_d
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarSetOptionsOp(protobuf.MessageType):
|
||||
@ -6137,7 +6157,7 @@ class StellarSetOptionsOp(protobuf.MessageType):
|
||||
7: protobuf.Field("medium_threshold", "uint32", repeated=False, required=False),
|
||||
8: protobuf.Field("high_threshold", "uint32", repeated=False, required=False),
|
||||
9: protobuf.Field("home_domain", "string", repeated=False, required=False),
|
||||
10: protobuf.Field("signer_type", "uint32", repeated=False, required=False),
|
||||
10: protobuf.Field("signer_type", "StellarSignerType", repeated=False, required=False),
|
||||
11: protobuf.Field("signer_key", "bytes", repeated=False, required=False),
|
||||
12: protobuf.Field("signer_weight", "uint32", repeated=False, required=False),
|
||||
}
|
||||
@ -6154,7 +6174,7 @@ class StellarSetOptionsOp(protobuf.MessageType):
|
||||
medium_threshold: Optional["int"] = None,
|
||||
high_threshold: Optional["int"] = None,
|
||||
home_domain: Optional["str"] = None,
|
||||
signer_type: Optional["int"] = None,
|
||||
signer_type: Optional["StellarSignerType"] = None,
|
||||
signer_key: Optional["bytes"] = None,
|
||||
signer_weight: Optional["int"] = None,
|
||||
) -> None:
|
||||
@ -6176,82 +6196,82 @@ class StellarChangeTrustOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 216
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("asset", "StellarAssetType", repeated=False, required=False),
|
||||
3: protobuf.Field("limit", "uint64", repeated=False, required=False),
|
||||
2: protobuf.Field("asset", "StellarAsset", repeated=False, required=True),
|
||||
3: protobuf.Field("limit", "uint64", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
asset: "StellarAsset",
|
||||
limit: "int",
|
||||
source_account: Optional["str"] = None,
|
||||
asset: Optional["StellarAssetType"] = None,
|
||||
limit: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.asset = asset
|
||||
self.limit = limit
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarAllowTrustOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 217
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("trusted_account", "string", repeated=False, required=False),
|
||||
3: protobuf.Field("asset_type", "uint32", repeated=False, required=False),
|
||||
2: protobuf.Field("trusted_account", "string", repeated=False, required=True),
|
||||
3: protobuf.Field("asset_type", "StellarAssetType", repeated=False, required=True),
|
||||
4: protobuf.Field("asset_code", "string", repeated=False, required=False),
|
||||
5: protobuf.Field("is_authorized", "uint32", repeated=False, required=False),
|
||||
5: protobuf.Field("is_authorized", "bool", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
trusted_account: "str",
|
||||
asset_type: "StellarAssetType",
|
||||
is_authorized: "bool",
|
||||
source_account: Optional["str"] = None,
|
||||
trusted_account: Optional["str"] = None,
|
||||
asset_type: Optional["int"] = None,
|
||||
asset_code: Optional["str"] = None,
|
||||
is_authorized: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.trusted_account = trusted_account
|
||||
self.asset_type = asset_type
|
||||
self.asset_code = asset_code
|
||||
self.is_authorized = is_authorized
|
||||
self.source_account = source_account
|
||||
self.asset_code = asset_code
|
||||
|
||||
|
||||
class StellarAccountMergeOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 218
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("destination_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("destination_account", "string", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
destination_account: "str",
|
||||
source_account: Optional["str"] = None,
|
||||
destination_account: Optional["str"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.destination_account = destination_account
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarManageDataOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 220
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("key", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("key", "string", repeated=False, required=True),
|
||||
3: protobuf.Field("value", "bytes", repeated=False, required=False),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
key: "str",
|
||||
source_account: Optional["str"] = None,
|
||||
key: Optional["str"] = None,
|
||||
value: Optional["bytes"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.key = key
|
||||
self.source_account = source_account
|
||||
self.value = value
|
||||
|
||||
|
||||
@ -6259,17 +6279,17 @@ class StellarBumpSequenceOp(protobuf.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 221
|
||||
FIELDS = {
|
||||
1: protobuf.Field("source_account", "string", repeated=False, required=False),
|
||||
2: protobuf.Field("bump_to", "uint64", repeated=False, required=False),
|
||||
2: protobuf.Field("bump_to", "uint64", repeated=False, required=True),
|
||||
}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
bump_to: "int",
|
||||
source_account: Optional["str"] = None,
|
||||
bump_to: Optional["int"] = None,
|
||||
) -> None:
|
||||
self.source_account = source_account
|
||||
self.bump_to = bump_to
|
||||
self.source_account = source_account
|
||||
|
||||
|
||||
class StellarSignedTx(protobuf.MessageType):
|
||||
|
Loading…
Reference in New Issue
Block a user