mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
290 lines
10 KiB
Protocol Buffer
290 lines
10 KiB
Protocol Buffer
syntax = "proto2";
|
|
package hw.trezor.messages.stellar;
|
|
|
|
// Sugar for easier handling in Java
|
|
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 StellarAsset {
|
|
required StellarAssetType type = 1;
|
|
optional string code = 2; // for non-native assets, string describing the code
|
|
optional string issuer = 3; // issuing address
|
|
|
|
}
|
|
|
|
/**
|
|
* Request: Address at the specified index
|
|
* @start
|
|
* @next StellarAddress
|
|
*/
|
|
message StellarGetAddress {
|
|
repeated uint32 address_n = 1; // BIP-32 path. For compatibility with other wallets, must be m/44'/148'/index'
|
|
optional bool show_display = 2; // optionally show on display before sending the result
|
|
optional bool chunkify = 3; // display the address in chunks of 4 characters
|
|
}
|
|
|
|
/**
|
|
* Response: Address for the given index
|
|
* @end
|
|
*/
|
|
message StellarAddress {
|
|
required string address = 1; // Address in Stellar format (base32 of a pubkey with checksum)
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to sign Stellar transaction
|
|
* @start
|
|
* @next StellarTxOpRequest
|
|
*/
|
|
message StellarSignTx {
|
|
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
|
|
required uint32 timebounds_start = 8; // unix timestamp (client must truncate this to 32 bytes)
|
|
required 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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Response: device is ready for client to send the next operation
|
|
* @next StellarPaymentOp
|
|
* @next StellarCreateAccountOp
|
|
* @next StellarPathPaymentStrictReceiveOp
|
|
* @next StellarPathPaymentStrictSendOp
|
|
* @next StellarManageSellOfferOp
|
|
* @next StellarManageBuyOfferOp
|
|
* @next StellarCreatePassiveSellOfferOp
|
|
* @next StellarSetOptionsOp
|
|
* @next StellarChangeTrustOp
|
|
* @next StellarAllowTrustOp
|
|
* @next StellarAccountMergeOp
|
|
* @next StellarManageDataOp
|
|
* @next StellarBumpSequenceOp
|
|
*/
|
|
message StellarTxOpRequest {
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarPaymentOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
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
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarCreateAccountOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
required string new_account = 2; // account address to create
|
|
required sint64 starting_balance = 3; // initial starting balance for the new account
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarPathPaymentStrictReceiveOp {
|
|
optional string source_account = 1; // (optional) source address
|
|
required StellarAsset send_asset = 2; // asset we pay with
|
|
required sint64 send_max = 3; // the maximum amount of sendAsset to send (excluding fees)
|
|
required string destination_account = 4; // recipient of the payment
|
|
required StellarAsset destination_asset = 5; // what they end up with
|
|
required sint64 destination_amount = 6; // amount they end up with
|
|
repeated StellarAsset paths = 7; // additional hops it must go through to get there
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarPathPaymentStrictSendOp {
|
|
optional string source_account = 1; // (optional) source address
|
|
required StellarAsset send_asset = 2; // asset we pay with
|
|
required sint64 send_amount = 3; // amount of sendAsset to send (excluding fees)
|
|
required string destination_account = 4; // recipient of the payment
|
|
required StellarAsset destination_asset = 5; // what they end up with
|
|
required sint64 destination_min = 6; // the minimum amount of dest asset to be received
|
|
repeated StellarAsset paths = 7; //additional hops it must go through to get there
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarManageSellOfferOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
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
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarManageBuyOfferOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
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
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarCreatePassiveSellOfferOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
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
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarSetOptionsOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
optional string inflation_destination_account = 2; // (optional) inflation destination address
|
|
optional uint32 clear_flags = 3;
|
|
optional uint32 set_flags = 4;
|
|
optional uint32 master_weight = 5;
|
|
optional uint32 low_threshold = 6;
|
|
optional uint32 medium_threshold = 7;
|
|
optional uint32 high_threshold = 8;
|
|
optional string home_domain = 9;
|
|
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;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarChangeTrustOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
required StellarAsset asset = 2;
|
|
required uint64 limit = 3;
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarAllowTrustOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
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
|
|
required bool is_authorized = 5;
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarAccountMergeOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
required string destination_account = 2; // destination account address
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarManageDataOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
required string key = 2;
|
|
optional bytes value = 3; // 64 bytes of arbitrary data
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarBumpSequenceOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
required uint64 bump_to = 2; // new sequence number
|
|
}
|
|
|
|
/**
|
|
* Request: ask device to confirm this operation type
|
|
* @next StellarTxOpRequest
|
|
* @next StellarSignedTx
|
|
*/
|
|
message StellarClaimClaimableBalanceOp {
|
|
optional string source_account = 1; // (optional) source account address
|
|
required bytes balance_id = 2; // balance id, 4 bytes of type flag, 32 bytes of data
|
|
}
|
|
|
|
/**
|
|
* Response: signature for transaction
|
|
* @end
|
|
*/
|
|
message StellarSignedTx {
|
|
required bytes public_key = 1; // public key for the private key used to sign data
|
|
required bytes signature = 2; // signature suitable for sending to the Stellar network
|
|
}
|