Make sure correct purpose and cointype are used (#60)

* Fix .gitignore

Signed-off-by: Julian Strobl <jmastr@mailbox.org>

* [test] Make sure correct Purpose and CoinType are used

Signed-off-by: Julian Strobl <jmastr@mailbox.org>

---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2023-08-03 10:03:13 +02:00 committed by GitHub
parent 1a5d673a86
commit 459c0ae931
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

2
.gitignore vendored
View File

@ -6,4 +6,4 @@ release/
.DS_Store
vendor/
tags
planetmint-god
/planetmint-god

View File

@ -6,7 +6,7 @@ import (
"planetmint-go/app"
)
func initSDKConfig() {
func initSDKConfig() *sdk.Config {
// Set prefixes
accountPubKeyPrefix := app.AccountAddressPrefix + "pub"
validatorAddressPrefix := app.AccountAddressPrefix + "valoper"
@ -22,4 +22,5 @@ func initSDKConfig() {
// Set to PLMNT coin type as defined in SLIP44 (https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
config.SetCoinType(8680)
config.Seal()
return config
}

View File

@ -0,0 +1,18 @@
package cmd
import (
"testing"
"github.com/stretchr/testify/assert"
)
// TestDerivationPath makes sure that purpose and cointype are set to PLMNT (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
func TestDerivationPath(t *testing.T) {
sdkConfig := initSDKConfig()
purpose := uint32(44)
assert.Equal(t, purpose, sdkConfig.GetPurpose())
coinType := uint32(8680)
assert.Equal(t, coinType, sdkConfig.GetCoinType())
}