Merge Starkware branch
This commit is contained in:
58
src/apdu_constants.h
Normal file
58
src/apdu_constants.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "shared_context.h"
|
||||
|
||||
#define APP_FLAG_DATA_ALLOWED 0x01
|
||||
#define APP_FLAG_EXTERNAL_TOKEN_NEEDED 0x02
|
||||
#define APP_FLAG_STARKWARE 0x04
|
||||
|
||||
#define CLA 0xE0
|
||||
#define INS_GET_PUBLIC_KEY 0x02
|
||||
#define INS_SIGN 0x04
|
||||
#define INS_GET_APP_CONFIGURATION 0x06
|
||||
#define INS_SIGN_PERSONAL_MESSAGE 0x08
|
||||
#define INS_PROVIDE_ERC20_TOKEN_INFORMATION 0x0A
|
||||
#define P1_CONFIRM 0x01
|
||||
#define P1_NON_CONFIRM 0x00
|
||||
#define P2_NO_CHAINCODE 0x00
|
||||
#define P2_CHAINCODE 0x01
|
||||
#define P1_FIRST 0x00
|
||||
#define P1_MORE 0x80
|
||||
|
||||
#define COMMON_CLA 0xB0
|
||||
#define COMMON_INS_GET_WALLET_ID 0x04
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
#define STARKWARE_CLA 0xF0
|
||||
#define STARKWARE_INS_GET_PUBLIC_KEY 0x02
|
||||
#define STARKWARE_INS_SIGN_MESSAGE 0x04
|
||||
#define STARKWARE_INS_PROVIDE_QUANTUM 0x08
|
||||
|
||||
#define P1_STARK_ORDER 0x01
|
||||
#define P1_STARK_TRANSFER 0x02
|
||||
|
||||
#define STARK_ORDER_TYPE 0
|
||||
#define STARK_TRANSFER_TYPE 1
|
||||
|
||||
#endif
|
||||
|
||||
#define OFFSET_CLA 0
|
||||
#define OFFSET_INS 1
|
||||
#define OFFSET_P1 2
|
||||
#define OFFSET_P2 3
|
||||
#define OFFSET_LC 4
|
||||
#define OFFSET_CDATA 5
|
||||
|
||||
void handleGetPublicKey(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
void handleProvideErc20TokenInformation(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
void handleSign(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
void handleGetAppConfiguration(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
void handleSignPersonalMessage(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
void handleStarkwareGetPublicKey(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
void handleStarkwareSignMessage(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
void handleStarkwareProvideQuantum(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, unsigned int *flags, unsigned int *tx);
|
||||
|
||||
#endif
|
||||
|
||||
2305
src/main.c
2305
src/main.c
File diff suppressed because it is too large
Load Diff
43
src/poorstream.c
Normal file
43
src/poorstream.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
#include "poorstream.h"
|
||||
|
||||
void poorstream_init(poorstream_t *stream, uint8_t *buffer) {
|
||||
os_memset((void*)stream, 0, sizeof(poorstream_t));
|
||||
stream->pointer = buffer;
|
||||
}
|
||||
|
||||
void poorstream_flush(poorstream_t *stream) {
|
||||
//PRINTF("Flush\n");
|
||||
*(stream->pointer + 0) = (stream->accumulator >> 56);
|
||||
*(stream->pointer + 1) = (stream->accumulator >> 48);
|
||||
*(stream->pointer + 2) = (stream->accumulator >> 40);
|
||||
*(stream->pointer + 3) = (stream->accumulator >> 32);
|
||||
*(stream->pointer + 4) = (stream->accumulator >> 24);
|
||||
*(stream->pointer + 5) = (stream->accumulator >> 16);
|
||||
*(stream->pointer + 6) = (stream->accumulator >> 8);
|
||||
*(stream->pointer + 7) = (stream->accumulator >> 0);
|
||||
}
|
||||
|
||||
void poorstream_write_bits(poorstream_t *stream, uint64_t bits, uint32_t num_bits) {
|
||||
stream->offset += num_bits;
|
||||
if (stream->offset < 64) {
|
||||
stream->accumulator |= (bits << (64 - stream->offset));
|
||||
//PRINTF("ACC |= << %d\n", (64 - stream->offset));
|
||||
} else {
|
||||
stream->offset -= 64;
|
||||
stream->mask = ((1 << (num_bits - stream->offset)) - 1);
|
||||
//PRINTF("Mask %lx\n", stream->mask);
|
||||
//PRINTF("Offset %d\n", stream->offset);
|
||||
stream->accumulator |= ((bits >> stream->offset) & stream->mask);
|
||||
poorstream_flush(stream);
|
||||
stream->accumulator = 0;
|
||||
stream->pointer += 8;
|
||||
if (stream->offset) {
|
||||
stream->mask = ((1 << stream->offset) - 1);
|
||||
stream->accumulator |= ((bits & stream->mask) << (64 - stream->offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
21
src/poorstream.h
Normal file
21
src/poorstream.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef __POORSTREAM_H__
|
||||
#define __POORSTREAM_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "os.h"
|
||||
|
||||
typedef struct poorstream_t {
|
||||
uint8_t *pointer;
|
||||
uint32_t offset;
|
||||
uint64_t mask;
|
||||
uint64_t accumulator;
|
||||
} poorstream_t;
|
||||
|
||||
void poorstream_init(poorstream_t *stream, uint8_t *buffer);
|
||||
void poorstream_flush(poorstream_t *stream);
|
||||
void poorstream_write_bits(poorstream_t *stream, uint64_t bits, uint32_t num_bits);
|
||||
|
||||
#endif
|
||||
169
src/shared_context.h
Normal file
169
src/shared_context.h
Normal file
@@ -0,0 +1,169 @@
|
||||
#ifndef __SHARED_CONTEXT_H__
|
||||
|
||||
#define __SHARED_CONTEXT_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "cx.h"
|
||||
#include "os_io_seproxyhal.h"
|
||||
#include "ethUstream.h"
|
||||
#include "ethUtils.h"
|
||||
#include "uint256.h"
|
||||
#include "tokens.h"
|
||||
#include "chainConfig.h"
|
||||
|
||||
#define MAX_BIP32_PATH 10
|
||||
|
||||
#define MAX_TOKEN 2
|
||||
|
||||
#define WEI_TO_ETHER 18
|
||||
|
||||
#define N_storage (*(volatile internalStorage_t*) PIC(&N_storage_real))
|
||||
|
||||
typedef struct internalStorage_t {
|
||||
unsigned char dataAllowed;
|
||||
unsigned char contractDetails;
|
||||
uint8_t initialized;
|
||||
} internalStorage_t;
|
||||
|
||||
typedef struct tokenContext_t {
|
||||
#ifdef HAVE_STARKWARE
|
||||
uint8_t data[4 + 32 + 32 + 32 + 32];
|
||||
#else
|
||||
uint8_t data[4 + 32 + 32];
|
||||
#endif
|
||||
uint32_t dataFieldPos;
|
||||
#ifdef HAVE_STARKWARE
|
||||
uint8_t quantum[32];
|
||||
uint8_t quantumIndex;
|
||||
#endif
|
||||
} tokenContext_t;
|
||||
|
||||
typedef struct rawDataContext_t {
|
||||
uint8_t data[32];
|
||||
uint8_t fieldIndex;
|
||||
uint8_t fieldOffset;
|
||||
} rawDataContext_t;
|
||||
|
||||
typedef struct publicKeyContext_t {
|
||||
cx_ecfp_public_key_t publicKey;
|
||||
uint8_t address[41];
|
||||
uint8_t chainCode[32];
|
||||
bool getChaincode;
|
||||
} publicKeyContext_t;
|
||||
|
||||
typedef struct transactionContext_t {
|
||||
uint8_t pathLength;
|
||||
uint32_t bip32Path[MAX_BIP32_PATH];
|
||||
uint8_t hash[32];
|
||||
tokenDefinition_t tokens[MAX_TOKEN];
|
||||
uint8_t tokenSet[MAX_TOKEN];
|
||||
uint8_t currentTokenIndex;
|
||||
} transactionContext_t;
|
||||
|
||||
typedef struct messageSigningContext_t {
|
||||
uint8_t pathLength;
|
||||
uint32_t bip32Path[MAX_BIP32_PATH];
|
||||
uint8_t hash[32];
|
||||
uint32_t remainingLength;
|
||||
} messageSigningContext_t;
|
||||
|
||||
typedef union {
|
||||
publicKeyContext_t publicKeyContext;
|
||||
transactionContext_t transactionContext;
|
||||
messageSigningContext_t messageSigningContext;
|
||||
} tmpCtx_t;
|
||||
|
||||
typedef union {
|
||||
txContent_t txContent;
|
||||
cx_sha256_t sha2;
|
||||
char tmp[100];
|
||||
} tmpContent_t;
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
typedef struct starkContext_t {
|
||||
uint8_t w1[32];
|
||||
uint8_t w2[32];
|
||||
uint8_t w3[32];
|
||||
} starkContext_t;
|
||||
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
tokenContext_t tokenContext;
|
||||
rawDataContext_t rawDataContext;
|
||||
#ifdef HAVE_STARKWARE
|
||||
starkContext_t starkContext;
|
||||
#endif
|
||||
} dataContext_t;
|
||||
|
||||
typedef enum {
|
||||
APP_STATE_IDLE,
|
||||
APP_STATE_SIGNING_TX,
|
||||
APP_STATE_SIGNING_MESSAGE
|
||||
} app_state_t;
|
||||
|
||||
typedef enum {
|
||||
CONTRACT_NONE,
|
||||
CONTRACT_ERC20,
|
||||
CONTRACT_ALLOWANCE,
|
||||
#ifdef HAVE_STARKWARE
|
||||
CONTRACT_STARKWARE_REGISTER,
|
||||
CONTRACT_STARKWARE_DEPOSIT_TOKEN,
|
||||
CONTRACT_STARKWARE_DEPOSIT_ETH,
|
||||
CONTRACT_STARKWARE_WITHDRAW,
|
||||
CONTRACT_STARKWARE_DEPOSIT_CANCEL,
|
||||
CONTRACT_STARKWARE_DEPOSIT_RECLAIM,
|
||||
CONTRACT_STARKWARE_FULL_WITHDRAWAL,
|
||||
CONTRACT_STARKWARE_FREEZE,
|
||||
CONTRACT_STARKWARE_ESCAPE,
|
||||
CONTRACT_STARKWARE_VERIFY_ESCAPE
|
||||
#endif
|
||||
} contract_call_t;
|
||||
|
||||
typedef struct strData_t {
|
||||
char fullAddress[43];
|
||||
char fullAmount[50];
|
||||
char maxFee[50];
|
||||
} strData_t;
|
||||
|
||||
typedef struct strDataTmp_t {
|
||||
char tmp[100];
|
||||
char tmp2[40];
|
||||
} strDataTmp_t;
|
||||
|
||||
typedef union {
|
||||
strData_t common;
|
||||
strDataTmp_t tmp;
|
||||
} strings_t;
|
||||
|
||||
extern chain_config_t *chainConfig;
|
||||
|
||||
extern tmpCtx_t tmpCtx;
|
||||
extern txContext_t txContext;
|
||||
extern tmpContent_t tmpContent;
|
||||
extern dataContext_t dataContext;
|
||||
extern strings_t strings;
|
||||
extern cx_sha3_t sha3;
|
||||
extern const internalStorage_t N_storage_real;
|
||||
|
||||
#ifdef TARGET_BLUE
|
||||
extern bagl_element_t tmp_element;
|
||||
extern char addressSummary[32];
|
||||
#endif
|
||||
|
||||
extern bool dataPresent;
|
||||
extern uint8_t appState;
|
||||
extern contract_call_t contractProvisioned;
|
||||
#ifdef HAVE_STARKWARE
|
||||
extern bool quantumSet;
|
||||
#endif
|
||||
|
||||
void reset_app_context(void);
|
||||
|
||||
#endif // __SHARED_CONTEXT_H__
|
||||
|
||||
85
src/stark_crypto.c
Normal file
85
src/stark_crypto.c
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
#include "shared_context.h"
|
||||
#include "stark_utils.h"
|
||||
#include "ui_callbacks.h"
|
||||
#include "utils.h"
|
||||
|
||||
static unsigned char const C_cx_Stark256_n[] = {
|
||||
//n: 0x0800000000000010ffffffffffffffffb781126dcae7b2321e66a241adc64d2f
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xb7, 0x81, 0x12, 0x6d, 0xca, 0xe7, 0xb2, 0x32, 0x1e, 0x66, 0xa2, 0x41, 0xad, 0xc6, 0x4d, 0x2f};
|
||||
|
||||
// C_cx_secp256k1_n - (C_cx_secp256k1_n % C_cx_Stark256_n)
|
||||
static unsigned char const STARK_DERIVE_BIAS[] = {
|
||||
0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7,
|
||||
0x38, 0xa1, 0x3b, 0x4b, 0x92, 0x0e, 0x94, 0x11, 0xae, 0x6d, 0xa5, 0xf4, 0x0b, 0x03, 0x58, 0xb1
|
||||
};
|
||||
|
||||
void starkDerivePrivateKey(uint32_t *bip32Path, uint32_t bip32PathLength, uint8_t *privateKeyData) {
|
||||
#if 0
|
||||
// Sanity check
|
||||
if (bip32Path[0] != STARK_BIP32_PATH_0) {
|
||||
PRINTF("Invalid Stark derivation path %d\n", bip32Path[0]);
|
||||
THROW(0x6a80);
|
||||
}
|
||||
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32Path, bip32PathLength, privateKeyData, NULL);
|
||||
PRINTF("Private key before processing %.*H\n", 32, privateKeyData);
|
||||
// TODO - support additional schemes
|
||||
cx_math_modm(privateKeyData, 32, C_cx_Stark256_n, 32);
|
||||
PRINTF("Private key after processing %.*H\n", 32, privateKeyData);
|
||||
#else
|
||||
uint8_t tmp[33];
|
||||
uint8_t index = 0;
|
||||
// Sanity check
|
||||
if ((bip32PathLength < 2) || (bip32Path[0] != STARK_BIP32_PATH_0) || (bip32Path[1] != STARK_BIP32_PATH_1)) {
|
||||
PRINTF("Invalid Stark derivation path %d %d\n", bip32Path[0], bip32Path[1]);
|
||||
THROW(0x6a80);
|
||||
}
|
||||
os_perso_derive_node_bip32(CX_CURVE_256K1, bip32Path, bip32PathLength, tmp, NULL);
|
||||
PRINTF("Private key before processing %.*H\n", 32, tmp);
|
||||
for(;;) {
|
||||
tmp[32] = index;
|
||||
cx_hash_sha256(tmp, 33, privateKeyData, 32);
|
||||
if (cx_math_cmp(privateKeyData, STARK_DERIVE_BIAS, 32) < 0) {
|
||||
cx_math_modm(privateKeyData, 32, C_cx_Stark256_n, 32);
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void stark_get_amount_string(uint8_t *contractAddress, uint8_t *quantum256, uint8_t *amount64, char *tmp100, char *target100) {
|
||||
uint256_t amountPre, quantum, amount;
|
||||
uint8_t decimals;
|
||||
char *ticker = (char*)PIC(chainConfig->coinName);
|
||||
|
||||
PRINTF("stark_get_amount_string %.*H\n", 20, contractAddress);
|
||||
|
||||
if (allzeroes(contractAddress, 20)) {
|
||||
decimals = WEI_TO_ETHER;
|
||||
PRINTF("stark_get_amount_string - ETH\n");
|
||||
}
|
||||
else {
|
||||
tokenDefinition_t *token = getKnownToken(contractAddress);
|
||||
if (token == NULL) { // caught earlier
|
||||
THROW(0x6A80);
|
||||
}
|
||||
decimals = token->decimals;
|
||||
ticker = (char*)token->ticker;
|
||||
PRINTF("stark_get_amount_string - decimals %d ticker %s\n", decimals, ticker);
|
||||
}
|
||||
convertUint256BE(amount64, 8, &amountPre);
|
||||
readu256BE(quantum256, &quantum);
|
||||
mul256(&amountPre, &quantum, &amount);
|
||||
tostring256(&amount, 10, tmp100, 100);
|
||||
PRINTF("stark_get_amount_string - mul256 %s\n", tmp100);
|
||||
strcpy(target100, ticker);
|
||||
adjustDecimals(tmp100, strlen(tmp100), target100 + strlen(ticker), 100, decimals);
|
||||
PRINTF("get_amount_string %s\n", target100);
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_STARK
|
||||
25
src/stark_crypto.h
Normal file
25
src/stark_crypto.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __STARK_CRYPTO_H__
|
||||
#define __STARK_CRYPTO_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "cx.h"
|
||||
|
||||
|
||||
/* EC points */
|
||||
#define FIELD_ELEMENT_SIZE (32)
|
||||
#define EC_POINT_SIZE (2 * FIELD_ELEMENT_SIZE + 1)
|
||||
typedef unsigned char FieldElement[FIELD_ELEMENT_SIZE];
|
||||
typedef unsigned char ECPoint[EC_POINT_SIZE];
|
||||
|
||||
void pedersen(FieldElement res, /* out */
|
||||
FieldElement a, FieldElement b);
|
||||
|
||||
int stark_sign(uint8_t *signautre, /* out */
|
||||
uint8_t *privateKeyData, FieldElement token1,
|
||||
FieldElement token2, FieldElement msg);
|
||||
|
||||
#endif
|
||||
141
src/stark_utils.c
Normal file
141
src/stark_utils.c
Normal file
@@ -0,0 +1,141 @@
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
#include "stark_crypto.h"
|
||||
#include "ethUtils.h"
|
||||
|
||||
#include "os_io_seproxyhal.h"
|
||||
|
||||
#define SIGNATURE_MAX_LEN (72)
|
||||
|
||||
static const ECPoint PEDERSEN_SHIFT[] = { {
|
||||
0x04,
|
||||
|
||||
0x04, 0x9e, 0xe3, 0xeb, 0xa8, 0xc1, 0x60, 0x07, 0x00, 0xee, 0x1b,
|
||||
0x87, 0xeb, 0x59, 0x9f, 0x16, 0x71, 0x6b, 0x0b, 0x10, 0x22, 0x94,
|
||||
0x77, 0x33, 0x55, 0x1f, 0xde, 0x40, 0x50, 0xca, 0x68, 0x04,
|
||||
|
||||
0x03, 0xca, 0x0c, 0xfe, 0x4b, 0x3b, 0xc6, 0xdd, 0xf3, 0x46, 0xd4,
|
||||
0x9d, 0x06, 0xea, 0x0e, 0xd3, 0x4e, 0x62, 0x10, 0x62, 0xc0, 0xe0,
|
||||
0x56, 0xc1, 0xd0, 0x40, 0x5d, 0x26, 0x6e, 0x10, 0x26, 0x8a,
|
||||
}};
|
||||
|
||||
static const ECPoint PEDERSEN_POINTS[4] = {
|
||||
{
|
||||
0x04,
|
||||
|
||||
0x02, 0x34, 0x28, 0x7d, 0xcb, 0xaf, 0xfe, 0x7f, 0x96, 0x9c, 0x74,
|
||||
0x86, 0x55, 0xfc, 0xa9, 0xe5, 0x8f, 0xa8, 0x12, 0x0b, 0x6d, 0x56,
|
||||
0xeb, 0x0c, 0x10, 0x80, 0xd1, 0x79, 0x57, 0xeb, 0xe4, 0x7b,
|
||||
|
||||
0x03, 0xb0, 0x56, 0xf1, 0x00, 0xf9, 0x6f, 0xb2, 0x1e, 0x88, 0x95,
|
||||
0x27, 0xd4, 0x1f, 0x4e, 0x39, 0x94, 0x01, 0x35, 0xdd, 0x7a, 0x6c,
|
||||
0x94, 0xcc, 0x6e, 0xd0, 0x26, 0x8e, 0xe8, 0x9e, 0x56, 0x15,
|
||||
},
|
||||
{
|
||||
0x04,
|
||||
|
||||
0x04, 0xfa, 0x56, 0xf3, 0x76, 0xc8, 0x3d, 0xb3, 0x3f, 0x9d, 0xab,
|
||||
0x26, 0x56, 0x55, 0x8f, 0x33, 0x99, 0x09, 0x9e, 0xc1, 0xde, 0x5e,
|
||||
0x30, 0x18, 0xb7, 0xa6, 0x93, 0x2d, 0xba, 0x8a, 0xa3, 0x78,
|
||||
|
||||
0x03, 0xfa, 0x09, 0x84, 0xc9, 0x31, 0xc9, 0xe3, 0x81, 0x13, 0xe0,
|
||||
0xc0, 0xe4, 0x7e, 0x44, 0x01, 0x56, 0x27, 0x61, 0xf9, 0x2a, 0x7a,
|
||||
0x23, 0xb4, 0x51, 0x68, 0xf4, 0xe8, 0x0f, 0xf5, 0xb5, 0x4d,
|
||||
},
|
||||
{
|
||||
0x04,
|
||||
|
||||
0x04, 0xba, 0x4c, 0xc1, 0x66, 0xbe, 0x8d, 0xec, 0x76, 0x49, 0x10,
|
||||
0xf7, 0x5b, 0x45, 0xf7, 0x4b, 0x40, 0xc6, 0x90, 0xc7, 0x47, 0x09,
|
||||
0xe9, 0x0f, 0x3a, 0xa3, 0x72, 0xf0, 0xbd, 0x2d, 0x69, 0x97,
|
||||
|
||||
0x00, 0x40, 0x30, 0x1c, 0xf5, 0xc1, 0x75, 0x1f, 0x4b, 0x97, 0x1e,
|
||||
0x46, 0xc4, 0xed, 0xe8, 0x5f, 0xca, 0xc5, 0xc5, 0x9a, 0x5c, 0xe5,
|
||||
0xae, 0x7c, 0x48, 0x15, 0x1f, 0x27, 0xb2, 0x4b, 0x21, 0x9c,
|
||||
},
|
||||
{
|
||||
0x04,
|
||||
|
||||
0x05, 0x43, 0x02, 0xdc, 0xb0, 0xe6, 0xcc, 0x1c, 0x6e, 0x44, 0xcc,
|
||||
0xa8, 0xf6, 0x1a, 0x63, 0xbb, 0x2c, 0xa6, 0x50, 0x48, 0xd5, 0x3f,
|
||||
0xb3, 0x25, 0xd3, 0x6f, 0xf1, 0x2c, 0x49, 0xa5, 0x82, 0x02,
|
||||
|
||||
0x01, 0xb7, 0x7b, 0x3e, 0x37, 0xd1, 0x35, 0x04, 0xb3, 0x48, 0x04,
|
||||
0x62, 0x68, 0xd8, 0xae, 0x25, 0xce, 0x98, 0xad, 0x78, 0x3c, 0x25,
|
||||
0x56, 0x1a, 0x87, 0x9d, 0xcc, 0x77, 0xe9, 0x9c, 0x24, 0x26,
|
||||
}};
|
||||
|
||||
void accum_ec_mul(ECPoint *hash, uint8_t *buf, int len, int pedersen_idx) {
|
||||
ECPoint tmp;
|
||||
if (!allzeroes(buf, len)) {
|
||||
memcpy(tmp, PEDERSEN_POINTS[pedersen_idx], sizeof(ECPoint));
|
||||
io_seproxyhal_io_heartbeat();
|
||||
cx_ecfp_scalar_mult(CX_CURVE_Stark256, tmp, sizeof(ECPoint), buf, len);
|
||||
io_seproxyhal_io_heartbeat();
|
||||
cx_ecfp_add_point(CX_CURVE_Stark256, *hash, *hash, tmp, sizeof(ECPoint));
|
||||
}
|
||||
}
|
||||
|
||||
void pedersen(FieldElement res, /* out */
|
||||
FieldElement a, FieldElement b) {
|
||||
ECPoint hash;
|
||||
|
||||
memcpy(hash, PEDERSEN_SHIFT, sizeof(hash));
|
||||
|
||||
accum_ec_mul(&hash, a, 1, 1);
|
||||
accum_ec_mul(&hash, a+1, FIELD_ELEMENT_SIZE-1, 0);
|
||||
accum_ec_mul(&hash, b, 1, 3);
|
||||
accum_ec_mul(&hash, b+1, FIELD_ELEMENT_SIZE-1, 2);
|
||||
|
||||
memcpy(res, hash + 1, FIELD_ELEMENT_SIZE);
|
||||
}
|
||||
|
||||
int stark_sign(uint8_t *signature, /* out */
|
||||
uint8_t *privateKeyData,
|
||||
FieldElement token1,
|
||||
FieldElement token2,
|
||||
FieldElement msg) {
|
||||
unsigned int info = 0;
|
||||
FieldElement hash;
|
||||
cx_ecfp_private_key_t privateKey;
|
||||
PRINTF("Stark sign msg w1 %.*H\n", 32, token1);
|
||||
PRINTF("Stark sign msg w2 %.*H\n", 32, token2);
|
||||
PRINTF("Stark sign w3 %.*H\n", 32, msg);
|
||||
pedersen(hash, token1, token2);
|
||||
PRINTF("Pedersen hash 1 %.*H\n", 32, hash);
|
||||
pedersen(hash, hash, msg);
|
||||
PRINTF("Pedersen hash 2 %.*H\n", 32, hash);
|
||||
cx_ecfp_init_private_key(CX_CURVE_Stark256, privateKeyData, 32, &privateKey);
|
||||
io_seproxyhal_io_heartbeat();
|
||||
int signatureLength = cx_ecdsa_sign(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256,
|
||||
hash, sizeof(hash), signature, SIGNATURE_MAX_LEN, &info);
|
||||
PRINTF("Stark signature %.*H\n", signatureLength, signature);
|
||||
return signatureLength;
|
||||
}
|
||||
|
||||
// ERC20Token(address)
|
||||
static const uint8_t ERC20_SELECTOR[] = { 0xf4, 0x72, 0x61, 0xb0 };
|
||||
// ETH()
|
||||
static const uint8_t ETH_SELECTOR[] = { 0x83, 0x22, 0xff, 0xf2 };
|
||||
|
||||
void compute_token_id(cx_sha3_t *sha3, uint8_t *contractAddress, uint8_t *quantum, uint8_t *output) {
|
||||
uint8_t tmp[36];
|
||||
cx_keccak_init(sha3, 256);
|
||||
if ((contractAddress != NULL) && (!allzeroes(contractAddress, 20))) {
|
||||
PRINTF("compute_token_id for %.*H\n", 20, contractAddress);
|
||||
os_memset(tmp, 0, sizeof(tmp));
|
||||
os_memmove(tmp, ERC20_SELECTOR, 4);
|
||||
os_memmove(tmp + 16, contractAddress, 20);
|
||||
cx_hash((cx_hash_t*)sha3, 0, tmp, sizeof(tmp), NULL, 0);
|
||||
}
|
||||
else {
|
||||
PRINTF("compute_token_id for ETH\n");
|
||||
cx_hash((cx_hash_t*)sha3, 0, ETH_SELECTOR, sizeof(ETH_SELECTOR), NULL, 0);
|
||||
}
|
||||
PRINTF("compute_token_id quantum %.*H\n", 32, quantum);
|
||||
cx_hash((cx_hash_t*)sha3, CX_LAST, quantum, 32, output, 32);
|
||||
output[0] &= 0x03;
|
||||
PRINTF("compute_token_id computed token %.*H\n", 32, output);
|
||||
}
|
||||
|
||||
#endif // HAVE_STARK
|
||||
25
src/stark_utils.h
Normal file
25
src/stark_utils.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef __STARK_UTILS_H__
|
||||
#define __STARK_UTILS_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "cx.h"
|
||||
#include "stark_crypto.h"
|
||||
|
||||
void compute_token_id(cx_sha3_t *sha3, uint8_t *contractAddress, uint8_t *quantum, uint8_t *output);
|
||||
|
||||
void starkDerivePrivateKey(uint32_t *bip32Path, uint32_t bip32PathLength, uint8_t *privateKeyData);
|
||||
|
||||
void stark_get_amount_string(uint8_t *contractAddress, uint8_t *quantum256, uint8_t *amount64, char *tmp100, char *target100);
|
||||
|
||||
int stark_sign(uint8_t *signature, /* out */
|
||||
uint8_t *privateKeyData,
|
||||
FieldElement token1,
|
||||
FieldElement token2,
|
||||
FieldElement msg);
|
||||
|
||||
#endif
|
||||
|
||||
15
src/tokens.c
15
src/tokens.c
@@ -15,6 +15,21 @@
|
||||
* limitations under the License.
|
||||
********************************************************************************/
|
||||
|
||||
#ifdef HAVE_TOKENS_EXTRA_LIST
|
||||
|
||||
#include "tokens.h"
|
||||
|
||||
const tokenDefinition_t const TOKENS_EXTRA[NUM_TOKENS_EXTRA] = {
|
||||
|
||||
{{0x4c,0x5f,0x66,0x59,0x61,0x97,0xa8,0x6f,0xb3,0x0a,0x24,0x35,0xe2,0xef,0x4d,0xdc,0xb3,0x93,0x42,0xc9}, "tUSDT ", 6},
|
||||
{{0xcd,0x07,0x7a,0xbe,0xdd,0x83,0x1a,0x34,0x43,0xff,0xbe,0x24,0xfb,0x76,0x66,0x1b,0xbb,0x17,0xeb,0x69}, "tZRX ", 18},
|
||||
{{0x40,0xd8,0x97,0x85,0x00,0xbf,0x68,0x32,0x4a,0x51,0x53,0x3c,0xd6,0xa2,0x1e,0x3e,0x59,0xbe,0x32,0x4a}, "tBTC ", 18},
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOKENS_LIST
|
||||
|
||||
#include "tokens.h"
|
||||
|
||||
13
src/tokens.h
13
src/tokens.h
@@ -21,11 +21,22 @@
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct tokenDefinition_t {
|
||||
#ifdef HAVE_CONTRACT_NAME_IN_DESCRIPTOR
|
||||
uint8_t contractName[20];
|
||||
#endif
|
||||
uint8_t address[20];
|
||||
uint8_t ticker[10];
|
||||
uint8_t ticker[12]; // 10 characters + ' \0'
|
||||
uint8_t decimals;
|
||||
} tokenDefinition_t;
|
||||
|
||||
#ifdef HAVE_TOKENS_EXTRA_LIST
|
||||
|
||||
#define NUM_TOKENS_EXTRA 3
|
||||
|
||||
extern tokenDefinition_t const TOKENS_EXTRA[NUM_TOKENS_EXTRA];
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TOKENS_LIST
|
||||
|
||||
#define NUM_TOKENS_AKROMA 0
|
||||
|
||||
564
src/ui_blue.c
Normal file
564
src/ui_blue.c
Normal file
@@ -0,0 +1,564 @@
|
||||
#include "shared_context.h"
|
||||
|
||||
#ifdef TARGET_BLUE
|
||||
|
||||
#include "ui_blue.h"
|
||||
#include "ui_callbacks.h"
|
||||
#include "glyphs.h"
|
||||
|
||||
#define BAGL_FONT_OPEN_SANS_LIGHT_16_22PX_AVG_WIDTH 10
|
||||
#define BAGL_FONT_OPEN_SANS_REGULAR_10_13PX_AVG_WIDTH 8
|
||||
#define MAX_CHAR_PER_LINE 25
|
||||
|
||||
void io_seproxyhal_io_heartbeat(void) {
|
||||
}
|
||||
|
||||
bagl_element_t tmp_element;
|
||||
|
||||
const bagl_element_t* ui_menu_item_out_over(const bagl_element_t* e) {
|
||||
// the selection rectangle is after the none|touchable
|
||||
e = (const bagl_element_t*)(((unsigned int)e)+sizeof(bagl_element_t));
|
||||
return e;
|
||||
}
|
||||
|
||||
unsigned int map_color(unsigned int color) {
|
||||
switch(color) {
|
||||
case COLOR_APP:
|
||||
return chainConfig->color_header;
|
||||
|
||||
case COLOR_APP_LIGHT:
|
||||
return chainConfig->color_dashboard;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
void copy_element_and_map_coin_colors(const bagl_element_t* element) {
|
||||
os_memmove(&tmp_element, element, sizeof(bagl_element_t));
|
||||
tmp_element.component.fgcolor = map_color(tmp_element.component.fgcolor);
|
||||
tmp_element.component.bgcolor = map_color(tmp_element.component.bgcolor);
|
||||
tmp_element.overfgcolor = map_color(tmp_element.overfgcolor);
|
||||
tmp_element.overbgcolor = map_color(tmp_element.overbgcolor);
|
||||
}
|
||||
|
||||
const bagl_element_t *ui_idle_blue_prepro(const bagl_element_t *element) {
|
||||
copy_element_and_map_coin_colors(element);
|
||||
if (element->component.userid == 0x01) {
|
||||
tmp_element.text = chainConfig->header_text;
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
|
||||
const bagl_element_t ui_idle_blue[9] = {
|
||||
// type userid x y w h str rad fill fg bg fid iid txt touchparams... ]
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x01, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, CHAINID_UPCASE, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 0, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, BAGL_FONT_SYMBOLS_0_SETTINGS, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_settings, NULL, NULL},
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 264, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, BAGL_FONT_SYMBOLS_0_DASHBOARD, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_exit, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 0, 270, 320, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_LIGHT_16_22PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "Open your wallet", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x00, 0, 308, 320, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "Connect your Ledger Blue and open your", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x00, 0, 331, 320, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "preferred wallet to view your accounts.", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 0, 450, 320, 14, 0, 0, 0 , 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_8_11PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "Validation requests will show automatically.", 10, 0, COLOR_BG_1, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
unsigned int ui_idle_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bagl_element_t * ui_settings_blue_toggle_data(const bagl_element_t * e) {
|
||||
// swap setting and request redraw of settings elements
|
||||
uint8_t setting = N_storage.dataAllowed?0:1;
|
||||
nvm_write(&N_storage.dataAllowed, (void*)&setting, sizeof(uint8_t));
|
||||
|
||||
// only refresh settings mutable drawn elements
|
||||
UX_REDISPLAY_IDX(7);
|
||||
|
||||
// won't redisplay the bagl_none
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bagl_element_t * ui_settings_blue_toggle_details(const bagl_element_t * e) {
|
||||
// swap setting and request redraw of settings elements
|
||||
uint8_t setting = N_storage.contractDetails?0:1;
|
||||
nvm_write(&N_storage.contractDetails, (void*)&setting, sizeof(uint8_t));
|
||||
|
||||
// only refresh settings mutable drawn elements
|
||||
UX_REDISPLAY_IDX(7);
|
||||
|
||||
// won't redisplay the bagl_none
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// don't perform any draw/color change upon finger event over settings
|
||||
const bagl_element_t* ui_settings_out_over(const bagl_element_t* e) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned int ui_settings_back_callback(const bagl_element_t* e) {
|
||||
// go back to idle
|
||||
ui_idle();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bagl_element_t ui_settings_blue[13] = {
|
||||
// type userid x y w h str rad fill fg bg fid iid txt touchparams... ]
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x00, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "SETTINGS", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 0, 19, 50, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, BAGL_FONT_SYMBOLS_0_LEFT, 0, COLOR_APP, 0xFFFFFF, ui_settings_back_callback, NULL, NULL},
|
||||
//{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 264, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, BAGL_FONT_SYMBOLS_0_DASHBOARD, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_exit, NULL, NULL},
|
||||
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 30, 105, 160, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, "Contract data", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x00, 30, 126, 260, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_8_11PX, 0 }, "Allow contract data in transactions", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_NONE | BAGL_FLAG_TOUCHABLE , 0x00, 0, 78, 320, 68, 0, 0, BAGL_FILL, 0xFFFFFF, 0x000000, 0 , 0 }, NULL, 0, 0xEEEEEE, 0x000000, ui_settings_blue_toggle_data, ui_settings_out_over, ui_settings_out_over },
|
||||
|
||||
{{BAGL_RECTANGLE, 0x00, 30, 146, 260, 1, 1, 0, 0, 0xEEEEEE, COLOR_BG_1, 0, 0}, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE, 0x00, 30, 174, 160, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0}, "Display data", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE, 0x00, 30, 195, 260, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_8_11PX, 0}, "Display contract data details", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_NONE | BAGL_FLAG_TOUCHABLE, 0x00, 0, 147, 320, 68, 0, 0, BAGL_FILL, 0xFFFFFF, 0x000000, 0, 0}, NULL, 0, 0xEEEEEE, 0x000000, ui_settings_blue_toggle_details, ui_settings_out_over, ui_settings_out_over},
|
||||
|
||||
{{BAGL_ICON, 0x02, 258, 167, 32, 18, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, 0, 0}, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_ICON , 0x01, 258, 98, 32, 18, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, 0, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
};
|
||||
|
||||
const bagl_element_t * ui_settings_blue_prepro(const bagl_element_t * e) {
|
||||
copy_element_and_map_coin_colors(e);
|
||||
// none elements are skipped
|
||||
if ((e->component.type&(~BAGL_FLAG_TOUCHABLE)) == BAGL_NONE) {
|
||||
return 0;
|
||||
}
|
||||
// swap icon buffer to be displayed depending on if corresponding setting is enabled or not.
|
||||
if (e->component.userid) {
|
||||
switch(e->component.userid) {
|
||||
case 0x01:
|
||||
// swap icon content
|
||||
if (N_storage.dataAllowed) {
|
||||
tmp_element.text = &C_icon_toggle_set;
|
||||
}
|
||||
else {
|
||||
tmp_element.text = &C_icon_toggle_reset;
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
// swap icon content
|
||||
if (N_storage.contractDetails) {
|
||||
tmp_element.text = &C_icon_toggle_set;
|
||||
}
|
||||
else {
|
||||
tmp_element.text = &C_icon_toggle_reset;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
|
||||
unsigned int ui_settings_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// reuse addressSummary for each line content
|
||||
const char* ui_details_title;
|
||||
const char* ui_details_content;
|
||||
typedef void (*callback_t)(void);
|
||||
callback_t ui_details_back_callback;
|
||||
|
||||
const bagl_element_t* ui_details_blue_back_callback(const bagl_element_t* element) {
|
||||
ui_details_back_callback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const bagl_element_t ui_details_blue[16] = {
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x01, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 0, 19, 50, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, BAGL_FONT_SYMBOLS_0_LEFT, 0, COLOR_APP, 0xFFFFFF, ui_details_blue_back_callback, NULL, NULL},
|
||||
//{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 264, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, " " /*BAGL_FONT_SYMBOLS_0_DASHBOARD*/, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_exit, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 30, 106, 320, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, "VALUE", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x10, 30, 136, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x11, 30, 159, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x12, 30, 182, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x13, 30, 205, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x14, 30, 228, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x15, 30, 251, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x16, 30, 274, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x17, 30, 297, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x18, 30, 320, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
//"..." at the end if too much
|
||||
{{BAGL_LABELINE , 0x19, 30, 343, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 0, 450, 320, 14, 0, 0, 0 , 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_8_11PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "Review the whole value before continuing.", 10, 0, COLOR_BG_1, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
const bagl_element_t* ui_details_blue_prepro(const bagl_element_t* element) {
|
||||
copy_element_and_map_coin_colors(element);
|
||||
if (element->component.userid == 1) {
|
||||
tmp_element.text = ui_details_title;
|
||||
return &tmp_element;
|
||||
}
|
||||
else if(element->component.userid > 0) {
|
||||
unsigned int length = strlen(ui_details_content);
|
||||
if (length >= (element->component.userid & 0xF) * MAX_CHAR_PER_LINE) {
|
||||
os_memset(addressSummary, 0, MAX_CHAR_PER_LINE+1);
|
||||
os_memmove(addressSummary, ui_details_content+(element->component.userid & 0xF) * MAX_CHAR_PER_LINE, MIN(length - (element->component.userid & 0xF) * MAX_CHAR_PER_LINE, MAX_CHAR_PER_LINE));
|
||||
return &tmp_element;
|
||||
}
|
||||
// nothing to draw for this line
|
||||
return 0;
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
|
||||
unsigned int ui_details_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ui_details_init(const char* title, const char* content, callback_t back_callback) {
|
||||
ui_details_title = title;
|
||||
ui_details_content = content;
|
||||
ui_details_back_callback = back_callback;
|
||||
UX_DISPLAY(ui_details_blue, ui_details_blue_prepro);
|
||||
}
|
||||
|
||||
void ui_approval_blue_init(void);
|
||||
|
||||
bagl_element_callback_t ui_approval_blue_ok;
|
||||
bagl_element_callback_t ui_approval_blue_cancel;
|
||||
|
||||
const bagl_element_t* ui_approval_blue_ok_callback(const bagl_element_t* e) {
|
||||
return ui_approval_blue_ok(e);
|
||||
}
|
||||
|
||||
const bagl_element_t* ui_approval_blue_cancel_callback(const bagl_element_t* e) {
|
||||
return ui_approval_blue_cancel(e);
|
||||
}
|
||||
|
||||
ui_approval_blue_state_t G_ui_approval_blue_state;
|
||||
// pointer to value to be displayed
|
||||
const char* ui_approval_blue_values[3];
|
||||
// variable part of the structure
|
||||
const char* const ui_approval_blue_details_name[][5] = {
|
||||
/*APPROVAL_TRANSACTION*/
|
||||
{"AMOUNT", "ADDRESS", "MAX FEES","CONFIRM TRANSACTION","Transaction details",},
|
||||
|
||||
/*APPROVAL_MESSAGE*/
|
||||
{"HASH", NULL, NULL, "SIGN MESSAGE", "Message signature", },
|
||||
};
|
||||
|
||||
const bagl_element_t* ui_approval_blue_1_details(const bagl_element_t* e) {
|
||||
if (strlen(ui_approval_blue_values[0])*BAGL_FONT_OPEN_SANS_LIGHT_16_22PX_AVG_WIDTH >= 160) {
|
||||
// display details screen
|
||||
ui_details_init(ui_approval_blue_details_name[G_ui_approval_blue_state][0], ui_approval_blue_values[0], ui_approval_blue_init);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
const bagl_element_t* ui_approval_blue_2_details(const bagl_element_t* e) {
|
||||
if (strlen(ui_approval_blue_values[1])*BAGL_FONT_OPEN_SANS_REGULAR_10_13PX_AVG_WIDTH >= 160) {
|
||||
ui_details_init(ui_approval_blue_details_name[G_ui_approval_blue_state][1], ui_approval_blue_values[1], ui_approval_blue_init);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
const bagl_element_t* ui_approval_blue_3_details(const bagl_element_t* e) {
|
||||
if (strlen(ui_approval_blue_values[2])*BAGL_FONT_OPEN_SANS_REGULAR_10_13PX_AVG_WIDTH >= 160) {
|
||||
ui_details_init(ui_approval_blue_details_name[G_ui_approval_blue_state][2], ui_approval_blue_values[2], ui_approval_blue_init);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
const bagl_element_t ui_approval_blue[29] = {
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x60, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
// BADGE_TRANSACTION.GIF
|
||||
{{BAGL_ICON , 0x40, 30, 98, 50, 50, 0, 0, BAGL_FILL, 0 , COLOR_BG_1, 0 , 0 } , &C_badge_transaction, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
{{BAGL_LABELINE , 0x50, 100, 117, 320, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 100, 138, 320, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_8_11PX, 0 }, "Check and confirm values", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
|
||||
{{BAGL_LABELINE , 0x70, 30, 196, 100, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL}, // AMOUNT
|
||||
// x-18 when ...
|
||||
{{BAGL_LABELINE , 0x10, 130, 200, 160, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_LIGHT_16_22PX|BAGL_FONT_ALIGNMENT_RIGHT, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL}, // fullAmount
|
||||
{{BAGL_LABELINE , 0x20, 284, 196, 6, 16, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_RIGHT, 0 }, BAGL_FONT_SYMBOLS_0_MINIRIGHT, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_NONE | BAGL_FLAG_TOUCHABLE , 0x00, 0, 168, 320, 48, 0, 9, BAGL_FILL, 0xFFFFFF, 0x000000, 0 , 0 }, NULL, 0, 0xEEEEEE, 0x000000, ui_approval_blue_1_details, ui_menu_item_out_over, ui_menu_item_out_over },
|
||||
{{BAGL_RECTANGLE , 0x20, 0, 168, 5, 48, 0, 0, BAGL_FILL, COLOR_BG_1, COLOR_BG_1, 0 , 0 }, NULL, 0, 0x41CCB4, 0, NULL, NULL, NULL },
|
||||
|
||||
{{BAGL_RECTANGLE , 0x31, 30, 216, 260, 1, 1, 0, 0 , 0xEEEEEE, COLOR_BG_1, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
|
||||
{{BAGL_LABELINE , 0x71, 30, 245, 100, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL}, // ADDRESS
|
||||
// x-18 when ...
|
||||
{{BAGL_LABELINE , 0x11, 130, 245, 160, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX|BAGL_FONT_ALIGNMENT_RIGHT, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL}, // fullAddress
|
||||
{{BAGL_LABELINE , 0x21, 284, 245, 6, 16, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_RIGHT, 0 }, BAGL_FONT_SYMBOLS_0_MINIRIGHT, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_NONE | BAGL_FLAG_TOUCHABLE , 0x00, 0, 217, 320, 48, 0, 9, BAGL_FILL, 0xFFFFFF, 0x000000, 0 , 0 }, NULL, 0, 0xEEEEEE, 0x000000, ui_approval_blue_2_details, ui_menu_item_out_over, ui_menu_item_out_over },
|
||||
{{BAGL_RECTANGLE , 0x21, 0, 217, 5, 48, 0, 0, BAGL_FILL, COLOR_BG_1, COLOR_BG_1, 0 , 0 }, NULL, 0, 0x41CCB4, 0, NULL, NULL, NULL },
|
||||
|
||||
{{BAGL_RECTANGLE , 0x32, 30, 265, 260, 1, 1, 0, 0 , 0xEEEEEE, COLOR_BG_1, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
|
||||
{{BAGL_LABELINE , 0x72, 30, 294, 100, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL}, // MAX FEES
|
||||
// x-18 when ...
|
||||
{{BAGL_LABELINE , 0x12, 130, 294, 160, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX|BAGL_FONT_ALIGNMENT_RIGHT, 0 }, NULL, 0, 0, 0, NULL, NULL, NULL}, //maxFee
|
||||
{{BAGL_LABELINE , 0x22, 284, 294, 6, 16, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_RIGHT, 0 }, BAGL_FONT_SYMBOLS_0_MINIRIGHT, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_NONE | BAGL_FLAG_TOUCHABLE , 0x00, 0, 266, 320, 48, 0, 9, BAGL_FILL, 0xFFFFFF, 0x000000, 0 , 0 }, NULL, 0, 0xEEEEEE, 0x000000, ui_approval_blue_3_details, ui_menu_item_out_over, ui_menu_item_out_over },
|
||||
{{BAGL_RECTANGLE , 0x22, 0, 266, 5, 48, 0, 0, BAGL_FILL, COLOR_BG_1, COLOR_BG_1, 0 , 0 }, NULL, 0, 0x41CCB4, 0, NULL, NULL, NULL },
|
||||
|
||||
{{BAGL_RECTANGLE, 0x90, 30, 314, 260, 1, 1, 0, 0, 0xEEEEEE, COLOR_BG_1, 0, 0}, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE, 0x90, 30, 343, 120, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0}, "CONTRACT DATA", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE, 0x90, 133, 343, 140, 30, 0, 0, BAGL_FILL, 0x666666, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX | BAGL_FONT_ALIGNMENT_RIGHT, 0}, "Present", 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_ICON, 0x90, 278, 333, 12, 12, 0, 0, BAGL_FILL, 0, COLOR_BG_1, 0, 0}, &C_icon_warning, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 40, 414, 115, 36, 0,18, BAGL_FILL, 0xCCCCCC, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "REJECT", 0, 0xB7B7B7, COLOR_BG_1, ui_approval_blue_cancel_callback, NULL, NULL},
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 165, 414, 115, 36, 0,18, BAGL_FILL, 0x41ccb4, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "CONFIRM", 0, 0x3ab7a2, COLOR_BG_1, ui_approval_blue_ok_callback, NULL, NULL},
|
||||
|
||||
};
|
||||
|
||||
const bagl_element_t* ui_approval_blue_prepro(const bagl_element_t* element) {
|
||||
copy_element_and_map_coin_colors(element);
|
||||
if (element->component.userid == 0) {
|
||||
return &tmp_element;
|
||||
}
|
||||
// none elements are skipped
|
||||
if ((element->component.type&(~BAGL_FLAG_TOUCHABLE)) == BAGL_NONE) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
switch(element->component.userid&0xF0) {
|
||||
|
||||
// icon
|
||||
case 0x40:
|
||||
return &tmp_element;
|
||||
break;
|
||||
|
||||
// TITLE
|
||||
case 0x60:
|
||||
tmp_element.text = ui_approval_blue_details_name[G_ui_approval_blue_state][3];
|
||||
return &tmp_element;
|
||||
break;
|
||||
|
||||
// SUBLINE
|
||||
case 0x50:
|
||||
tmp_element.text = ui_approval_blue_details_name[G_ui_approval_blue_state][4];
|
||||
return &tmp_element;
|
||||
|
||||
// details label
|
||||
case 0x70:
|
||||
if (!ui_approval_blue_details_name[G_ui_approval_blue_state][element->component.userid&0xF]) {
|
||||
return NULL;
|
||||
}
|
||||
tmp_element.text = ui_approval_blue_details_name[G_ui_approval_blue_state][element->component.userid&0xF];
|
||||
return &tmp_element;
|
||||
|
||||
// detail value
|
||||
case 0x10:
|
||||
// won't display
|
||||
if (!ui_approval_blue_details_name[G_ui_approval_blue_state][element->component.userid&0xF]) {
|
||||
return NULL;
|
||||
}
|
||||
// always display the value
|
||||
tmp_element.text = ui_approval_blue_values[(element->component.userid&0xF)];
|
||||
|
||||
// x -= 18 when overflow is detected
|
||||
if (strlen(ui_approval_blue_values[(element->component.userid&0xF)])*BAGL_FONT_OPEN_SANS_LIGHT_16_22PX_AVG_WIDTH >= 160) {
|
||||
tmp_element.component.x -= 18;
|
||||
}
|
||||
return &tmp_element;
|
||||
break;
|
||||
|
||||
// right arrow and left selection rectangle
|
||||
case 0x20:
|
||||
if (!ui_approval_blue_details_name[G_ui_approval_blue_state][element->component.userid&0xF]) {
|
||||
return NULL;
|
||||
}
|
||||
if (strlen(ui_approval_blue_values[(element->component.userid&0xF)])*BAGL_FONT_OPEN_SANS_LIGHT_16_22PX_AVG_WIDTH < 160) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// horizontal delimiter
|
||||
case 0x30:
|
||||
return ui_approval_blue_details_name[G_ui_approval_blue_state][element->component.userid&0xF]!=NULL?&tmp_element:NULL;
|
||||
|
||||
case 0x90:
|
||||
return (dataPresent && !N_storage.contractDetails);
|
||||
}
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
unsigned int ui_approval_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
const bagl_element_t ui_address_blue[8] = {
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x00, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "CONFIRM ACCOUNT", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
//{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 264, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, " " /*BAGL_FONT_SYMBOLS_0_DASHBOARD*/, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_exit, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 30, 106, 320, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, "ACCOUNT", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x10, 30, 136, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x11, 30, 159, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 40, 414, 115, 36, 0,18, BAGL_FILL, 0xCCCCCC, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "REJECT", 0, 0xB7B7B7, COLOR_BG_1, io_seproxyhal_touch_address_cancel, NULL, NULL},
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 165, 414, 115, 36, 0,18, BAGL_FILL, 0x41ccb4, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "CONFIRM", 0, 0x3ab7a2, COLOR_BG_1, io_seproxyhal_touch_address_ok, NULL, NULL},
|
||||
};
|
||||
|
||||
unsigned int ui_address_blue_prepro(const bagl_element_t* element) {
|
||||
copy_element_and_map_coin_colors(element);
|
||||
if(element->component.userid > 0) {
|
||||
unsigned int length = strlen(strings.common.fullAddress);
|
||||
if (length >= (element->component.userid & 0xF) * MAX_CHAR_PER_LINE) {
|
||||
os_memset(addressSummary, 0, MAX_CHAR_PER_LINE+1);
|
||||
os_memmove(addressSummary, strings.common.fullAddress+(element->component.userid & 0xF) * MAX_CHAR_PER_LINE, MIN(length - (element->component.userid & 0xF) * MAX_CHAR_PER_LINE, MAX_CHAR_PER_LINE));
|
||||
return &tmp_element;
|
||||
}
|
||||
// nothing to draw for this line
|
||||
return 0;
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
|
||||
unsigned int ui_address_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
const bagl_element_t ui_data_selector_blue[7] = {
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x00, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "CONFIRM SELECTOR", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
//{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 264, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, " " /*BAGL_FONT_SYMBOLS_0_DASHBOARD*/, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_exit, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 30, 106, 320, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, "SELECTOR", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x10, 30, 136, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, strings.tmp.tmp, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 40, 414, 115, 36, 0,18, BAGL_FILL, 0xCCCCCC, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "REJECT", 0, 0xB7B7B7, COLOR_BG_1, io_seproxyhal_touch_data_cancel, NULL, NULL},
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 165, 414, 115, 36, 0,18, BAGL_FILL, 0x41ccb4, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "CONFIRM", 0, 0x3ab7a2, COLOR_BG_1, io_seproxyhal_touch_data_ok, NULL, NULL},
|
||||
};
|
||||
|
||||
unsigned int ui_data_selector_blue_prepro(const bagl_element_t* element) {
|
||||
copy_element_and_map_coin_colors(element);
|
||||
if(element->component.userid > 0) {
|
||||
unsigned int length = strlen(strings.tmp.tmp);
|
||||
unsigned int offset = (element->component.userid & 0xF) * 24;
|
||||
if (length >= offset) {
|
||||
unsigned int copyLength = ((offset + 24) > length ? length - offset : 24);
|
||||
os_memset(addressSummary, 0, 25);
|
||||
os_memmove(addressSummary, strings.tmp.tmp + offset, copyLength);
|
||||
return &tmp_element;
|
||||
}
|
||||
// nothing to draw for this line
|
||||
return 0;
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
|
||||
unsigned int ui_data_selector_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
const bagl_element_t ui_data_parameter_blue[11] = {
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 68, 320, 413, 0, 0, BAGL_FILL, COLOR_BG_1, 0x000000, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
|
||||
// erase screen (only under the status bar)
|
||||
{{BAGL_RECTANGLE , 0x00, 0, 20, 320, 48, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP, 0 , 0 }, NULL, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
/// TOP STATUS BAR
|
||||
{{BAGL_LABELINE , 0x00, 0, 45, 320, 30, 0, 0, BAGL_FILL, 0xFFFFFF, COLOR_APP, BAGL_FONT_OPEN_SANS_SEMIBOLD_10_13PX|BAGL_FONT_ALIGNMENT_CENTER, 0 }, "CONFIRM PARAMETER", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
//{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 264, 19, 56, 44, 0, 0, BAGL_FILL, COLOR_APP, COLOR_APP_LIGHT, BAGL_FONT_SYMBOLS_0|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, " " /*BAGL_FONT_SYMBOLS_0_DASHBOARD*/, 0, COLOR_APP, 0xFFFFFF, io_seproxyhal_touch_exit, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 30, 106, 320, 30, 0, 0, BAGL_FILL, 0x999999, COLOR_BG_1, BAGL_FONT_OPEN_SANS_SEMIBOLD_8_11PX, 0 }, "PARAMETER", 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_LABELINE , 0x00, 30, 136, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, strings.tmp.tmp2, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x10, 30, 159, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x11, 30, 182, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x12, 30, 205, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
{{BAGL_LABELINE , 0x13, 30, 228, 260, 30, 0, 0, BAGL_FILL, 0x000000, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_10_13PX, 0 }, addressSummary, 0, 0, 0, NULL, NULL, NULL},
|
||||
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 40, 414, 115, 36, 0,18, BAGL_FILL, 0xCCCCCC, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "REJECT", 0, 0xB7B7B7, COLOR_BG_1, io_seproxyhal_touch_data_cancel, NULL, NULL},
|
||||
{{BAGL_RECTANGLE | BAGL_FLAG_TOUCHABLE, 0x00, 165, 414, 115, 36, 0,18, BAGL_FILL, 0x41ccb4, COLOR_BG_1, BAGL_FONT_OPEN_SANS_REGULAR_11_14PX|BAGL_FONT_ALIGNMENT_CENTER|BAGL_FONT_ALIGNMENT_MIDDLE, 0 }, "CONFIRM", 0, 0x3ab7a2, COLOR_BG_1, io_seproxyhal_touch_data_ok, NULL, NULL},
|
||||
};
|
||||
|
||||
unsigned int ui_data_parameter_blue_prepro(const bagl_element_t* element) {
|
||||
copy_element_and_map_coin_colors(element);
|
||||
if(element->component.userid > 0) {
|
||||
unsigned int pos = (element->component.userid & 0xF);
|
||||
unsigned int i;
|
||||
unsigned int offset = 0;
|
||||
unsigned int copyLength;
|
||||
for (i=0; i<pos; i++) {
|
||||
offset += local_strchr(strings.tmp.tmp + offset, ':');
|
||||
if (offset < 0) {
|
||||
THROW(EXCEPTION);
|
||||
}
|
||||
offset = offset + 1;
|
||||
}
|
||||
if (pos == 3) {
|
||||
copyLength = strlen(strings.tmp.tmp) - offset;
|
||||
}
|
||||
else {
|
||||
unsigned int endOffset;
|
||||
endOffset = offset + local_strchr(strings.tmp.tmp + offset, ':');
|
||||
copyLength = endOffset - offset;
|
||||
}
|
||||
os_memmove(addressSummary, strings.tmp.tmp + offset, copyLength);
|
||||
addressSummary[copyLength] = '\0';
|
||||
}
|
||||
return &tmp_element;
|
||||
}
|
||||
|
||||
unsigned int ui_data_parameter_blue_button(unsigned int button_mask, unsigned int button_mask_counter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
45
src/ui_blue.h
Normal file
45
src/ui_blue.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "shared_context.h"
|
||||
|
||||
#include "os_io_seproxyhal.h"
|
||||
|
||||
typedef enum {
|
||||
APPROVAL_TRANSACTION,
|
||||
APPROVAL_MESSAGE,
|
||||
} ui_approval_blue_state_t;
|
||||
|
||||
#define COLOR_BG_1 0xF9F9F9
|
||||
#define COLOR_APP 0x0ebdcf
|
||||
#define COLOR_APP_LIGHT 0x87dee6
|
||||
|
||||
extern const bagl_element_t ui_idle_blue[9];
|
||||
unsigned int ui_idle_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
const bagl_element_t *ui_idle_blue_prepro(const bagl_element_t *element);
|
||||
|
||||
extern const bagl_element_t ui_settings_blue[13];
|
||||
unsigned int ui_settings_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
const bagl_element_t * ui_settings_blue_prepro(const bagl_element_t * e);
|
||||
|
||||
extern const bagl_element_t ui_details_blue[16];
|
||||
unsigned int ui_details_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
const bagl_element_t* ui_details_blue_prepro(const bagl_element_t* element);
|
||||
|
||||
extern const bagl_element_t ui_approval_blue[29];
|
||||
unsigned int ui_approval_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
const bagl_element_t* ui_approval_blue_prepro(const bagl_element_t* element);
|
||||
|
||||
extern const bagl_element_t ui_address_blue[8];
|
||||
unsigned int ui_address_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
unsigned int ui_address_blue_prepro(const bagl_element_t* element);
|
||||
|
||||
extern const bagl_element_t ui_data_selector_blue[7];
|
||||
unsigned int ui_data_selector_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
unsigned int ui_data_selector_blue_prepro(const bagl_element_t* element);
|
||||
|
||||
extern const bagl_element_t ui_data_parameter_blue[11];
|
||||
unsigned int ui_data_parameter_blue_button(unsigned int button_mask, unsigned int button_mask_counter);
|
||||
unsigned int ui_data_parameter_blue_prepro(const bagl_element_t* element);
|
||||
|
||||
extern bagl_element_callback_t ui_approval_blue_ok;
|
||||
extern bagl_element_callback_t ui_approval_blue_cancel;
|
||||
extern ui_approval_blue_state_t G_ui_approval_blue_state;
|
||||
extern const char* ui_approval_blue_values[3];
|
||||
20
src/ui_callbacks.h
Normal file
20
src/ui_callbacks.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "shared_context.h"
|
||||
|
||||
unsigned int io_seproxyhal_touch_settings(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_exit(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_tx_ok(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_tx_cancel(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_address_ok(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_address_cancel(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_signMessage_ok(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_signMessage_cancel(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_data_ok(const bagl_element_t *e);
|
||||
unsigned int io_seproxyhal_touch_data_cancel(const bagl_element_t *e);
|
||||
|
||||
void ui_idle(void);
|
||||
|
||||
void io_seproxyhal_send_status(uint32_t sw);
|
||||
void format_signature_out(const uint8_t* signature);
|
||||
void finalizeParsing(bool direct);
|
||||
tokenDefinition_t* getKnownToken(uint8_t *contractAddress);
|
||||
|
||||
131
src/ui_flow.c
Normal file
131
src/ui_flow.c
Normal file
@@ -0,0 +1,131 @@
|
||||
#include "shared_context.h"
|
||||
#include "ui_callbacks.h"
|
||||
|
||||
#ifdef HAVE_UX_FLOW
|
||||
|
||||
void display_settings(void);
|
||||
void switch_settings_contract_data(void);
|
||||
void switch_settings_display_data(void);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
UX_FLOW_DEF_NOCB(
|
||||
ux_idle_flow_1_step,
|
||||
nn, //pnn,
|
||||
{
|
||||
//"", //&C_icon_dashboard,
|
||||
"Application",
|
||||
"is ready",
|
||||
});
|
||||
UX_FLOW_DEF_NOCB(
|
||||
ux_idle_flow_2_step,
|
||||
bn,
|
||||
{
|
||||
"Version",
|
||||
APPVERSION,
|
||||
});
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_idle_flow_3_step,
|
||||
pb,
|
||||
display_settings(),
|
||||
{
|
||||
&C_icon_eye,
|
||||
"Settings",
|
||||
});
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_idle_flow_4_step,
|
||||
pb,
|
||||
os_sched_exit(-1),
|
||||
{
|
||||
&C_icon_dashboard_x,
|
||||
"Quit",
|
||||
});
|
||||
const ux_flow_step_t * const ux_idle_flow [] = {
|
||||
&ux_idle_flow_1_step,
|
||||
&ux_idle_flow_2_step,
|
||||
&ux_idle_flow_3_step,
|
||||
&ux_idle_flow_4_step,
|
||||
FLOW_END_STEP,
|
||||
};
|
||||
|
||||
#if defined(TARGET_NANOS)
|
||||
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_settings_flow_1_step,
|
||||
bnnn_paging,
|
||||
switch_settings_contract_data(),
|
||||
{
|
||||
.title = "Contract data",
|
||||
.text = strings.common.fullAddress,
|
||||
});
|
||||
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_settings_flow_2_step,
|
||||
bnnn_paging,
|
||||
switch_settings_display_data(),
|
||||
{
|
||||
.title = "Debug data",
|
||||
.text = strings.common.fullAddress + 20
|
||||
});
|
||||
|
||||
#else
|
||||
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_settings_flow_1_step,
|
||||
bnnn,
|
||||
switch_settings_contract_data(),
|
||||
{
|
||||
"Contract data",
|
||||
"Allow contract data",
|
||||
"in transactions",
|
||||
strings.common.fullAddress,
|
||||
});
|
||||
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_settings_flow_2_step,
|
||||
bnnn,
|
||||
switch_settings_display_data(),
|
||||
{
|
||||
"Debug data",
|
||||
"Display contract data",
|
||||
"details",
|
||||
strings.common.fullAddress + 20
|
||||
});
|
||||
|
||||
#endif
|
||||
|
||||
UX_FLOW_DEF_VALID(
|
||||
ux_settings_flow_3_step,
|
||||
pb,
|
||||
ui_idle(),
|
||||
{
|
||||
&C_icon_back_x,
|
||||
"Back",
|
||||
});
|
||||
|
||||
const ux_flow_step_t * const ux_settings_flow [] = {
|
||||
&ux_settings_flow_1_step,
|
||||
&ux_settings_flow_2_step,
|
||||
&ux_settings_flow_3_step,
|
||||
FLOW_END_STEP,
|
||||
};
|
||||
|
||||
void display_settings() {
|
||||
strcpy(strings.common.fullAddress, (N_storage.dataAllowed ? "Allowed" : "NOT Allowed"));
|
||||
strcpy(strings.common.fullAddress + 20, (N_storage.contractDetails ? "Displayed" : "NOT Displayed"));
|
||||
ux_flow_init(0, ux_settings_flow, NULL);
|
||||
}
|
||||
|
||||
void switch_settings_contract_data() {
|
||||
uint8_t value = (N_storage.dataAllowed ? 0 : 1);
|
||||
nvm_write((void*)&N_storage.dataAllowed, (void*)&value, sizeof(uint8_t));
|
||||
display_settings();
|
||||
}
|
||||
|
||||
void switch_settings_display_data() {
|
||||
uint8_t value = (N_storage.contractDetails ? 0 : 1);
|
||||
nvm_write((void*)&N_storage.contractDetails, (void*)&value, sizeof(uint8_t));
|
||||
display_settings();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
46
src/ui_flow.h
Normal file
46
src/ui_flow.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "shared_context.h"
|
||||
|
||||
#include "os_io_seproxyhal.h"
|
||||
|
||||
extern const ux_flow_step_t * const ux_idle_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_settings_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_display_public_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_confirm_selector_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_confirm_parameter_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_tx_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_tx_data_warning_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_allowance_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_sign_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_display_stark_public_flow [];
|
||||
|
||||
#ifdef HAVE_STARKWARE
|
||||
|
||||
extern const ux_flow_step_t * const ux_stark_limit_order_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_stark_transfer_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_stark_self_transfer_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_starkware_register_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_starkware_deposit_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_starkware_withdraw_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_starkware_verify_vault_id_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_starkware_escape_flow [];
|
||||
|
||||
extern const ux_flow_step_t * const ux_approval_starkware_verify_escape_flow [];
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user