Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,9 @@ dkms.conf

# Project-level stuff
debug/
ledger-nanopb/
.DS_Store
*.pyc
*.pyc
src/glyphs.c
src/glyphs.h
bin
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include $(BOLOS_SDK)/Makefile.defines
# Main app configuration

APPVERSION_M=1
APPVERSION_N=1
APPVERSION_N=2
APPVERSION_P=0

APPNAME = "Waves"
Expand Down Expand Up @@ -81,7 +81,6 @@ DEFINES += MAX_DATA_SIZE=128

DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""


ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
Expand All @@ -103,6 +102,7 @@ ifneq ($(DEBUG),0)

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf
DEFINES += HAVE_PRINTF_PB PRINTF_PB=mcu_usb_printf
else
DEFINES += HAVE_PRINTF PRINTF=screen_printf
endif
Expand Down Expand Up @@ -156,6 +156,5 @@ include $(BOLOS_SDK)/Makefile.glyphs

include $(BOLOS_SDK)/Makefile.rules


listvariants:
@echo VARIANTS COIN waves
13 changes: 13 additions & 0 deletions generate_proto.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
NANOPB=../ledger-nanopb

pushd proto
protoc --plugin=protoc-gen-nanopb=${NANOPB}/generator/protoc-gen-nanopb --nanopb_out=../src/nanopb_stubs -I. -I${NANOPB}/generator/proto/ *.proto
protoc --python_out=../python -I. -I${NANOPB}/generator/proto/ *.proto
popd

if ! [ "$(ls src/nanopb)" ]; then
cd src/nanopb
cp ../../ledger-nanopb/*.c .
cp ../../ledger-nanopb/*.h .
cd ..
fi
9 changes: 9 additions & 0 deletions proto/amount.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";
package waves;
option java_package = "com.wavesplatform.protobuf";
option csharp_namespace = "Waves";

message Amount {
bytes asset_id = 1;
int64 amount = 2;
};
1 change: 1 addition & 0 deletions proto/order.options
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
waves.Order.proofs type: FT_IGNORE
31 changes: 31 additions & 0 deletions proto/order.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";
package waves;
option java_package = "com.wavesplatform.protobuf.order";
option csharp_namespace = "Waves";

import "amount.proto";

message AssetPair {
bytes amount_asset_id = 1;
bytes price_asset_id = 2;
};

message Order {
enum Side {
BUY = 0;
SELL = 1;
};

int32 chain_id = 1;
bytes sender_public_key = 2;
bytes matcher_public_key = 3;
AssetPair asset_pair = 4;
Side order_side = 5;
int64 amount = 6;
int64 price = 7;
int64 timestamp = 8;
int64 expiration = 9;
Amount matcher_fee = 10;
int32 version = 11;
repeated bytes proofs = 12;
};
2 changes: 2 additions & 0 deletions proto/recipient.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
waves.Recipient.public_key_hash max_size:20 fixed_length:true
waves.Recipient.alias max_size:31
12 changes: 12 additions & 0 deletions proto/recipient.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package waves;
option java_package = "com.wavesplatform.protobuf.transaction";
option csharp_namespace = "Waves";

message Recipient {
oneof recipient {
// First 20 bytes of the result of the Keccak256(Blake2b256(publicKey)) hashing function.
bytes public_key_hash = 1;
string alias = 2;
};
};
20 changes: 20 additions & 0 deletions proto/transaction.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#Transaction filed sizes
waves.Transaction.chain_id type: FT_IGNORE
waves.Transaction.timestamp type: FT_IGNORE
waves.Transaction.version type: FT_IGNORE

waves.GenesisTransactionData type: FT_IGNORE

waves.PaymentTransactionData type: FT_IGNORE

waves.ExchangeTransactionData type: FT_IGNORE

waves.SetAssetScriptTransactionData.script type: FT_IGNORE

waves.SetScriptTransactionData.script type: FT_IGNORE

waves.MassTransferTransactionData.transfers type: FT_IGNORE

waves.InvokeScriptTransactionData.payments max_count: 2

waves.DataTransactionData.data type: FT_IGNORE
151 changes: 151 additions & 0 deletions proto/transaction.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
syntax = "proto3";
package waves;

option java_package = "com.wavesplatform.protobuf.transaction";
option csharp_namespace = "Waves";

import "nanopb.proto";
import "amount.proto";
import "recipient.proto";
import "order.proto";

message SignedTransaction {
Transaction transaction = 1;
repeated bytes proofs = 2;
}

message Transaction {
option (nanopb_msgopt).submsg_callback = true;
int32 chain_id = 1;
bytes sender_public_key = 2;
Amount fee = 3;
int64 timestamp = 4;
int32 version = 5;

oneof data {
GenesisTransactionData genesis = 101;
PaymentTransactionData payment = 102;
IssueTransactionData issue = 103;
TransferTransactionData transfer = 104;
ReissueTransactionData reissue = 105;
BurnTransactionData burn = 106;
ExchangeTransactionData exchange = 107;
LeaseTransactionData lease = 108;
LeaseCancelTransactionData lease_cancel = 109;
CreateAliasTransactionData create_alias = 110;
MassTransferTransactionData mass_transfer = 111;
DataTransactionData data_transaction = 112;
SetScriptTransactionData set_script = 113;
SponsorFeeTransactionData sponsor_fee = 114;
SetAssetScriptTransactionData set_asset_script = 115;
InvokeScriptTransactionData invoke_script = 116;
UpdateAssetInfoTransactionData update_asset_info = 117;
};
};

message GenesisTransactionData {
bytes recipient_address = 1;
int64 amount = 2;
};

message PaymentTransactionData {
bytes recipient_address = 1;
int64 amount = 2;
};

message TransferTransactionData {
Recipient recipient = 1;
Amount amount = 2;
bytes attachment = 3;
};

message CreateAliasTransactionData {
string alias = 1;
};

message DataTransactionData {
message DataEntry {
option (nanopb_msgopt).skip_message = true;
string key = 1;
oneof value {
int64 int_value = 10;
bool bool_value = 11;
bytes binary_value = 12;
string string_value = 13;
};
};

repeated DataEntry data = 1;
};

message MassTransferTransactionData {
message Transfer {
option (nanopb_msgopt).skip_message = true;
Recipient recipient = 1;
int64 amount = 2;
};

bytes asset_id = 1;
repeated Transfer transfers = 2;
bytes attachment = 3;
};

message LeaseTransactionData {
Recipient recipient = 1;
int64 amount = 2;
};

message LeaseCancelTransactionData {
bytes lease_id = 1;
};

message BurnTransactionData {
Amount asset_amount = 1;
};

message IssueTransactionData {
string name = 1;
string description = 2;
int64 amount = 3;
int32 decimals = 4;
bool reissuable = 5;
bytes script = 6;
};

message ReissueTransactionData {
Amount asset_amount = 1;
bool reissuable = 2;
};

message SetAssetScriptTransactionData {
bytes asset_id = 1;
bytes script = 2;
};

message SetScriptTransactionData {
bytes script = 1;
};

message ExchangeTransactionData {
int64 amount = 1;
int64 price = 2;
int64 buy_matcher_fee = 3;
int64 sell_matcher_fee = 4;
repeated Order orders = 5;
};

message SponsorFeeTransactionData {
Amount min_fee = 1;
};

message InvokeScriptTransactionData {
Recipient d_app = 1;
bytes function_call = 2;
repeated Amount payments = 3;
}

message UpdateAssetInfoTransactionData {
bytes asset_id = 1;
string name = 2;
string description = 3;
}
76 changes: 76 additions & 0 deletions python/amount_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading