Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
33 changes: 14 additions & 19 deletions Makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,18 @@ include $(BOLOS_SDK)/Makefile.defines
# Main app configuration

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

APPNAME = "Waves"
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

ifeq ($(TARGET_NAME),TARGET_BLUE)
ICONNAME=blue_app_waves.gif
else ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=nanos_app_waves.gif
else
ifeq ($(TARGET_NAME),TARGET_NANOX)
ICONNAME=nanox_app_waves.gif
else
ICONNAME = nanos_app_waves.gif
endif
ICONNAME = nanox_app_waves.gif
endif

APP_LOAD_PARAMS = --appFlags 0x240 --path "44'/5741564'" --curve secp256k1 --curve ed25519 $(COMMON_LOAD_PARAMS)
Expand All @@ -48,16 +46,11 @@ APP_SOURCE_PATH += src
SDK_SOURCE_PATH += lib_stusb #qrcode
#use the SDK U2F+HIDGEN USB profile
SDK_SOURCE_PATH += lib_u2f lib_stusb_impl
SDK_SOURCE_PATH += lib_ux
DEFINES += HAVE_UX_FLOW

ifeq ($(TARGET_NAME),TARGET_NANOX)
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
SDK_SOURCE_PATH += lib_ux
DEFINES += HAVE_UX_FLOW
endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
SDK_SOURCE_PATH += lib_ux
DEFINES += HAVE_UX_FLOW
endif

DEFINES += APPVERSION=\"$(APPVERSION)\"
Expand All @@ -83,28 +76,30 @@ 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
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE
endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_GLO096
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
endif

# Enabling debug PRINTF
DEBUG = 0
ifneq ($(DEBUG),0)

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf
else
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_PRINTF PRINTF=screen_printf
else
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf
endif
else
DEFINES += PRINTF\(...\)=
Expand Down
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;
}
Loading