Skip to content

Commit 3fd50c4

Browse files
authored
Merge pull request #17 from keepkey/device-protocol-4.0.0
Update client build with device-protocol v4.0.0
2 parents 434cdcb + 0ec7e69 commit 3fd50c4

8 files changed

Lines changed: 30 additions & 17 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build/
2+
device-protocol/
23
dist/
34
python_trezor.egg-info/
45
trezor.egg-info/

build_pb.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
#!/bin/bash
22
CURDIR=$(pwd)
3-
43
DEVICE_PROTO="device-protocol"
54

6-
if [ ! -d ../$DEVICE_PROTO ]
5+
# Create a clean directory for the protobuf files
6+
if [ -d $DEVICE_PROTO ]
77
then
8-
git clone https://github.com/keepkey/$DEVICE_PROTO.git ../$DEVICE_PROTO
9-
sed -Ee 's/^import ([^.]+_pb2)/from . import \1/' -i "" $CURDIR/keepkeylib/"$i"_pb2.py
8+
rm -rf $DEVICE_PROTO
109
fi
1110

12-
cd $CURDIR/../$DEVICE_PROTO
11+
git clone --branch v4.0.0 --depth 1 https://github.com/keepkey/$DEVICE_PROTO.git $DEVICE_PROTO
12+
cd $DEVICE_PROTO
1313

14+
echo "Building with protoc version: $(protoc --version)"
1415
for i in messages types exchange ; do
1516
protoc --python_out=$CURDIR/keepkeylib/ -I/usr/include -I. $i.proto
17+
sed -Ee 's/^import ([^.]+_pb2)/from . import \1/' -i "" $CURDIR/keepkeylib/"$i"_pb2.py
1618
done
1719

1820
cd $CURDIR/keepkeylib
19-
sed -i -- 's/5000\([2-5]\)/6000\1/g' types_pb2.py
21+
sed -i "" 's/5000\([2-5]\)/6000\1/g' types_pb2.py

docker_build_pb.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/bin/bash
22

3-
TEMPDIR="../device-protocol"
43
IMAGETAG=keepkey/firmware
54

6-
docker build -t $IMAGETAG .
7-
8-
docker run -t -v $(pwd):/root/python-keepkey -v $(pwd)/$TEMPDIR:/root/device-protocol --rm $IMAGETAG /bin/sh -c "\
9-
cd /root/python-keepkey && \
10-
./build_pb.sh"
5+
docker run -it --rm \
6+
-v $(pwd):/root/python-keepkey \
7+
-w /root/python-keepkey \
8+
$IMAGETAG \
9+
./build_pb.sh

keepkeylib/client.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,18 @@ def expand_path(n):
506506
n = n[1:]
507507

508508
# coin_name/a/b/c => 44'/SLIP44_constant'/a/b/c
509-
coins = { "Bitcoin": 0, "Testnet": 1, "Namecoin": 7, "Litecoin": 2, "Dogecoin": 3, "Dash": 5, "Zcash": 133, }
509+
# https://github.com/satoshilabs/slips/blob/master/slip-0044.md
510+
coins = {
511+
"Bitcoin": 0,
512+
"Testnet": 1,
513+
"Litecoin": 2,
514+
"Dogecoin": 3,
515+
"Dash": 5,
516+
"Namecoin": 7,
517+
"Zcash": 133,
518+
"BitcoinCash": 145,
519+
}
520+
510521
if n[0] in coins:
511522
n = ["44'", "%d'" % coins[n[0]] ] + n[1:]
512523

keepkeylib/exchange_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

keepkeylib/messages_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)