Skip to content

Commit c73bd50

Browse files
optout21Catenocrypt
andauthored
Update to new go-slip44; Filecoin, Elrond (#23)
Co-authored-by: Catenocrypt <[email protected]>
1 parent 3045d49 commit c73bd50

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

elrond.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package coincodec
22

3+
import "github.com/wealdtech/go-slip44"
4+
35
const (
46
hrpElrond = "erd"
57
ElrondKeyhashLength = 32
68
)
79

810
func init() {
9-
// 508 slip44.ELROND
10-
toBytesMap[508] = ElrondDecodeToBytes
11-
toStringMap[508] = ElrondEncodeToString
11+
toBytesMap[slip44.ELROND] = ElrondDecodeToBytes
12+
toStringMap[slip44.ELROND] = ElrondEncodeToString
1213
}
1314

1415
// ElrondDecodeToBytes converts the input string to a byte array

elrond_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/pkg/errors"
7+
"github.com/wealdtech/go-slip44"
78
)
89

910
func TestElrondEncodeToBytes(t *testing.T) {
@@ -61,8 +62,7 @@ func TestElrondEncodeToBytes(t *testing.T) {
6162
},
6263
}
6364

64-
// 508 slip44.ELROND
65-
RunTestsEncode(t, 508, tests)
65+
RunTestsEncode(t, slip44.ELROND, tests)
6666
}
6767

6868
func TestElrondDecodeToString(t *testing.T) {
@@ -95,6 +95,5 @@ func TestElrondDecodeToString(t *testing.T) {
9595
},
9696
}
9797

98-
// 508 slip44.ELROND
99-
RunTestsDecode(t, 508, tests)
98+
RunTestsDecode(t, slip44.ELROND, tests)
10099
}

filecoin.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"strconv"
88

9+
"github.com/wealdtech/go-slip44"
910
"golang.org/x/crypto/blake2b"
1011
)
1112

@@ -30,9 +31,8 @@ const (
3031
)
3132

3233
func init() {
33-
// 461 slip44.FILECOIN
34-
toBytesMap[461] = FilecoinDecodeToBytes
35-
toStringMap[461] = FilecoinEncodeToString
34+
toBytesMap[slip44.FILECOIN] = FilecoinDecodeToBytes
35+
toStringMap[slip44.FILECOIN] = FilecoinEncodeToString
3636
}
3737

3838
// Attempts to get the type by ASCII.

filecoin_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"testing"
55

66
"github.com/pkg/errors"
7+
"github.com/wealdtech/go-slip44"
78
)
89

910
func TestFilecoinToBytes(t *testing.T) {
@@ -205,8 +206,7 @@ func TestFilecoinToBytes(t *testing.T) {
205206
},
206207
}
207208

208-
// 461 slip44.FILECOIN
209-
RunTestsEncode(t, 461, tests)
209+
RunTestsEncode(t, slip44.FILECOIN, tests)
210210
}
211211

212212
func TestFilecoinToString(t *testing.T) {
@@ -363,8 +363,7 @@ func TestFilecoinToString(t *testing.T) {
363363
},
364364
}
365365

366-
// 461 slip44.FILECOIN
367-
RunTestsDecode(t, 461, tests)
366+
RunTestsDecode(t, slip44.FILECOIN, tests)
368367
}
369368

370369
func TestFilecoinTypes(t *testing.T) {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ require (
88
github.com/cpacia/bchutil v0.0.0-20181003130114-b126f6a35b6c
99
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
1010
github.com/pkg/errors v0.8.1
11-
github.com/wealdtech/go-slip44 v1.0.0
11+
github.com/wealdtech/go-slip44 v1.1.0
1212
golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708
1313
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
2929
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
3030
github.com/wealdtech/go-slip44 v1.0.0 h1:g0Wi5EufdD/ULZ4hcZKQ3TGlA6FZhGTCkmVzYmf+7Is=
3131
github.com/wealdtech/go-slip44 v1.0.0/go.mod h1://S3V9M6iN1cCflLXMjJYciRPakCDubG9YpWVyW1AvM=
32+
github.com/wealdtech/go-slip44 v1.1.0 h1:vOA63sYUpRSFSskbpYC4/WH910bWf8xn46KAJY6XFgk=
33+
github.com/wealdtech/go-slip44 v1.1.0/go.mod h1://S3V9M6iN1cCflLXMjJYciRPakCDubG9YpWVyW1AvM=
3234
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44 h1:9lP3x0pW80sDI6t1UMSLA4to18W7R7imwAI/sWS9S8Q=
3335
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
3436
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

0 commit comments

Comments
 (0)