Skip to content

Commit

Permalink
Add BitcoinGold
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanlemeshev committed Aug 17, 2018
1 parent 6e17da4 commit e83e430
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {
- [x] Biocoin/BIO, `'biocoin'` or `'BIO'`
- [x] Bitcoin/BTC, `'bitcoin'` or `'BTC'`
- [x] BitcoinCash/BCH, `'bitcoincash'` or `'BCH'`
- [ ] BitcoinGold/BTG, `'bitcoingold'` or `'BTG'`
- [x] BitcoinGold/BTG, `'bitcoingold'` or `'BTG'`
- [ ] BitcoinPrivate/BTCP, `'bitcoinprivate'` or `'BTCP'`
- [ ] BitcoinZ/BTCZ, `'bitcoinz'` or `'BTCZ'`
- [x] Callisto/CLO, `'callisto'` or `'CLO'`
Expand Down
33 changes: 33 additions & 0 deletions bitcoin_gold_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package crptwav

import "testing"

func TestIsValidBitcoinGold(t *testing.T) {
tt := []struct {
currency string
address string
network string
}{
{address: "GW3JrQyHtoVfEFES3Y9JagiX3VSKQStLwj", currency: "bitcoingold", network: "prod"},
{address: "GUDWdeMyAXQbrNFFivAhkJQ1GfBCFdc7JF", currency: "bitcoingold", network: "prod"},
{address: "mvww6DEJ18dbyQUukpVQXvLgrNDJazZn1Y", currency: "bitcoingold", network: "testnet"},
{address: "mn3mdEE6cf1snxVsknNz4GRTdSrWXqYp7c", currency: "BTG", network: "testnet"},
{address: "GSNFPRsdaM3MXrU5HW1AxgFwmUQC8HXK9F", currency: "BTG", network: "prod"},
}
for _, tc := range tt {
switch tc.network {
case NetworkProd:
if !IsValidProdAddress(tc.address, tc.currency) {
t.Errorf("Address %s should be valid %s %s address", tc.address, tc.currency, tc.network)
}
case NetworkTest:
if !IsValidTestnetAddress(tc.address, tc.currency) {
t.Errorf("Address %s should be valid %s %s address", tc.address, tc.currency, tc.network)
}
default:
if !IsValidAddress(tc.address, tc.currency) {
t.Errorf("Address %s should be valid %s %s address", tc.address, tc.currency, tc.network)
}
}
}
}
11 changes: 11 additions & 0 deletions currencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ var currencies = []currency{
},
validator: isValidBitcoinAddress,
},
currency{
params: currencyParams{
name: "bitcoingold",
symbol: "btg",
addressTypes: addressTypes{
prod: []string{"26", "17"},
testnet: []string{"6f", "c4"},
},
},
validator: isValidBitcoinAddress,
},
currency{
params: currencyParams{
name: "bitcoin",
Expand Down

0 comments on commit e83e430

Please sign in to comment.