Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cosanta / DASH / PirateCash #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ The application will be compiled and copied onto your device
- BIP39 mnemonic to BIP39 seed generation
- Hierarchical Deterministic (HD) wallet generation from seed
- Generation of offline `m/44'/0'/0'/0` BTC wallet
- Generation of offline `m/44'/770'/0'/0` COSA wallet
- Generation of offline `m/44'/60'/0'/0` ETH wallet (coded from the $SPORK Castle of ETHDenver 2023!)
- Generation of offline `m/44'/5'/0'/0` DASH wallet
- Generation of offline `m/44'/3'/0'/0` DOGE wallet
- Generation of offline `m/44'/770'/0'/0` PIRATE wallet
- Generation of offline `m/44'/133'/0'/0` ZEC transparent address wallet (by @wh00hw)
- Similar features to: https://iancoleman.io/bip39/
- Saving wallets to SD card
Expand Down
9 changes: 9 additions & 0 deletions flipbip.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@

#define COIN_BTC 0
#define COIN_DOGE 3
#define COIN_DASH 5
#define COIN_ETH 60
#define COIN_ZEC 133
#define COIN_PIRATE 660
#define COIN_COSA 770

#define TEXT_BUFFER_SIZE 256

Expand Down Expand Up @@ -75,8 +78,11 @@ typedef enum {

typedef enum {
FlipBipCoinBTC0,
FlipBipCoinCOSA3,
FlipBipCoinETH60,
FlipBipCoinDASH3,
FlipBipCoinDOGE3,
FlipBipCoinPIRATE3,
FlipBipCoinZEC133,
} FlipBipCoin;

Expand All @@ -96,8 +102,11 @@ typedef enum {

typedef enum {
SubmenuIndexScene1BTC = 10,
SubmenuIndexScene1COSA,
SubmenuIndexScene1ETH,
SubmenuIndexScene1DASH,
SubmenuIndexScene1DOGE,
SubmenuIndexScene1PIRATE,
SubmenuIndexScene1ZEC,
SubmenuIndexScene1New,
SubmenuIndexScene1Renew,
Expand Down
42 changes: 42 additions & 0 deletions scenes/flipbip_scene_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,36 @@ void flipbip_scene_menu_on_enter(void* context) {
SubmenuIndexScene1BTC,
flipbip_scene_menu_submenu_callback,
app);
submenu_add_item(
app->submenu,
"View COSA wallet",
SubmenuIndexScene1COSA,
flipbip_scene_menu_submenu_callback,
app);
submenu_add_item(
app->submenu,
"View ETH wallet",
SubmenuIndexScene1ETH,
flipbip_scene_menu_submenu_callback,
app);
submenu_add_item(
app->submenu,
"View DASH wallet",
SubmenuIndexScene1DASH,
flipbip_scene_menu_submenu_callback,
app);
submenu_add_item(
app->submenu,
"View DOGE wallet",
SubmenuIndexScene1DOGE,
flipbip_scene_menu_submenu_callback,
app);
submenu_add_item(
app->submenu,
"View PIRATE wallet",
SubmenuIndexScene1PIRATE,
flipbip_scene_menu_submenu_callback,
app);
submenu_add_item(
app->submenu,
"View ZEC (t-addr) wallet",
Expand Down Expand Up @@ -93,6 +111,14 @@ bool flipbip_scene_menu_on_event(void* context, SceneManagerEvent event) {
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1BTC);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
return true;
} else if(event.event == SubmenuIndexScene1COSA) {
app->overwrite_saved_seed = 0;
app->import_from_mnemonic = 0;
app->bip44_coin = FlipBipCoinCOSA3;
scene_manager_set_scene_state(
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1COSA);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
return true;
} else if(event.event == SubmenuIndexScene1ETH) {
app->overwrite_saved_seed = 0;
app->import_from_mnemonic = 0;
Expand All @@ -101,6 +127,14 @@ bool flipbip_scene_menu_on_event(void* context, SceneManagerEvent event) {
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1ETH);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
return true;
} else if(event.event == SubmenuIndexScene1DASH) {
app->overwrite_saved_seed = 0;
app->import_from_mnemonic = 0;
app->bip44_coin = FlipBipCoinDASH3;
scene_manager_set_scene_state(
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1DASH);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
return true;
} else if(event.event == SubmenuIndexScene1DOGE) {
app->overwrite_saved_seed = 0;
app->import_from_mnemonic = 0;
Expand All @@ -109,6 +143,14 @@ bool flipbip_scene_menu_on_event(void* context, SceneManagerEvent event) {
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1DOGE);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
return true;
} else if(event.event == SubmenuIndexScene1PIRATE) {
app->overwrite_saved_seed = 0;
app->import_from_mnemonic = 0;
app->bip44_coin = FlipBipCoinPIRATE3;
scene_manager_set_scene_state(
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1PIRATE);
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
return true;
} else if(event.event == SubmenuIndexScene1ZEC) {
app->overwrite_saved_seed = 0;
app->import_from_mnemonic = 0;
Expand Down
10 changes: 8 additions & 2 deletions views/flipbip_scene_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,24 @@ const char* TEXT_INFO = "-Scroll pages with up/down-"
#define TEXT_QRFILE_EXT ".qrcode" // 7 chars + 1 null

// bip44_coin, xprv_version, xpub_version, addr_version, wif_version, addr_format
const uint32_t COIN_INFO_ARRAY[4][6] = {
const uint32_t COIN_INFO_ARRAY[7][6] = {
{COIN_BTC, 0x0488ade4, 0x0488b21e, 0x00, 0x80, FlipBipCoinBTC0},
{COIN_COSA, 0x0488ade4, 0x0488b21e, 0x1c, 0xcc, FlipBipCoinBTC0},
{COIN_ETH, 0x0488ade4, 0x0488b21e, 0x00, 0x80, FlipBipCoinETH60},
{COIN_DASH, 0x0488ade4, 0x0488b21e, 0x4c, 0xcc, FlipBipCoinBTC0},
{COIN_DOGE, 0x02fac398, 0x02facafd, 0x1e, 0x9e, FlipBipCoinBTC0},
{COIN_PIRATE, 0x0488ade4, 0x0488b21e, 0x37, 0xcb, FlipBipCoinBTC0},
{COIN_ZEC, 0x0488ade4, 0x0488b21e, 0x1cb8, 0x80, FlipBipCoinZEC133},
};

// coin_name, derivation_path
const char* COIN_TEXT_ARRAY[4][3] = {
const char* COIN_TEXT_ARRAY[7][3] = {
{"BTC", "m/44'/0'/0'/0", "bitcoin:"},
{"COSA", "m/44'/770'/0'/0", "cosanta:"},
{"ETH", "m/44'/60'/0'/0", "ethereum:"},
{"DASH", "m/44'/5'/0'/0", "dash:"},
{"DOGE", "m/44'/3'/0'/0", "dogecoin:"},
{"PIRATE", "m/44'/660'/0'/0", "piratecash:"},
{"ZEC", "m/44'/133'/0'/0", "zcash:"}};

struct FlipBipScene1 {
Expand Down
Loading