Documentation ¶
Index ¶
- Constants
- Variables
- func BNBDecodeToBytes(input string) ([]byte, error)
- func BNBEncodeToString(bytes []byte) (string, error)
- func Base58AddressDecodeToBytesPrefix(input string, decodedSize int, validPrefixes [][]byte) ([]byte, error)
- func Base58AddressEncodeToStringPrefix(data []byte, decodedSize int, validPrefixes [][]byte) (string, error)
- func Base58ChecksumDecode(b string, alphabet string) ([]byte, error)
- func Base58ChecksumEncode(b []byte, alphabet string) string
- func Base58Decode(b string, alphabet string) ([]byte, error)
- func Base58Encode(b []byte, alphabet string) string
- func Bech32AddressDecodeToBytes(hrp string, input string, keyhashLength int) ([]byte, error)
- func Bech32AddressEncodeToString(hrp string, bytes []byte, keyhashLength int) (string, error)
- func Bech32DecodeToBytes(input string, hrp string) ([]byte, error)
- func Bech32EncodeToString(bytes []byte, hrp string) (string, error)
- func BitcoinCashDecodeToBytes(input string) ([]byte, error)
- func BitcoinCashEncodeToString(input []byte) (string, error)
- func BitcoinDecodeToBytes(input string) ([]byte, error)
- func BitcoinEncodeToString(input []byte) (string, error)
- func CosmosDecodeToBytes(input string) ([]byte, error)
- func CosmosEncodeToString(bytes []byte) (string, error)
- func ElrondDecodeToBytes(input string) ([]byte, error)
- func ElrondEncodeToString(bytes []byte) (string, error)
- func EtherToBytes(input string) ([]byte, error)
- func EtherToString(input []byte) (string, error)
- func FilecoinDecodeToBytes(input string) ([]byte, error)
- func FilecoinEncodeToString(data []byte) (string, error)
- func IoTexDecodeToBytes(input string) ([]byte, error)
- func IoTexEncodeToString(bytes []byte) (string, error)
- func MakeBitcoinDecodeToBytes(config *CoinConfig) func(string) ([]byte, error)
- func MakeBitcoinEncodeToString(config *CoinConfig) func([]byte) (string, error)
- func NimiqDecodeToBytes(input string) ([]byte, error)
- func NimiqEncodeToString(buf []byte) (string, error)
- func OntologyDecodeToBytes(input string) ([]byte, error)
- func OntologyEncodeToString(bytes []byte) (string, error)
- func PolkadotDecodeToBytes(input string) ([]byte, error)
- func PolkadotEncodeToString(data []byte) (string, error)
- func RunTestDecode(coinType uint32, tt TestcaseDecode) error
- func RunTestEncode(coinType uint32, tt TestcaseEncode) error
- func RunTestsDecode(t *testing.T, coinType uint32, tests []TestcaseDecode)
- func RunTestsEncode(t *testing.T, coinType uint32, tests []TestcaseEncode)
- func SS58AddressDecodeToBytes(input string, network byte) ([]byte, error)
- func SS58AddressEncodeToString(data []byte, network byte) (string, error)
- func SolanaDecodeToBytes(input string) ([]byte, error)
- func SolanaEncodeToString(data []byte) (string, error)
- func StellarDecodeToBytes(input string) ([]byte, error)
- func StellarEncodeToString(bytes []byte) (string, error)
- func TezosDecodeToBytes(input string) ([]byte, error)
- func TezosEncodeToString(bytes []byte) (string, error)
- func ToBytes(input string, coinType uint32) ([]byte, error)
- func ToString(input []byte, coinType uint32) (string, error)
- func TronDecodeToBytes(input string) ([]byte, error)
- func TronEncodeToString(bytes []byte) (string, error)
- func XRPDecodeToBytes(input string) ([]byte, error)
- func XRPEncodeToString(bytes []byte) (string, error)
- func ZilliqaDecodeToBytes(input string) ([]byte, error)
- func ZilliqaEncodeToString(bytes []byte) (string, error)
- type CoinConfig
- type TestcaseDecode
- type TestcaseEncode
- type Type
Constants ¶
const ( OP_DUP = 0x76 OP_HASH160 = 0xa9 OP_EQUALVERIFY = 0x88 OP_CHECKSIG = 0xac OP_EQUAL = 0x87 )
const ( ZCashStaticPrefixByte = 0x1C // 28 ZCashPrefixByteP2pkh = 0xB8 // 184 ZCashPrefixByteP2sh = 0xBD // 189 )
const ( PREFIX byte = 'f' BASE32_ALPHABET_FILECOIN string = "abcdefghijklmnopqrstuvwxyz234567" )
const ( TypeID = iota TypeSecp256k1 TypeActor TypeBls TypeInvalid )
const ( OntologyAddressLength = 21 OntologyVersion = 0x17 )
const ( TronAddressLength = 21 TronPrefix = 0x41 )
const (
// Default alphabet, used e.g. by Bitcoin
Base58DefaultAlphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
)
const (
Bech32DefaultKeyhashLength = 20
)
const (
ElrondKeyhashLength = 32
)
const (
PolkadotNetwork = 0
)
const (
SolanaAddressLength = 32
)
const (
TezosAddressLength = 23
)
Variables ¶
var ( P2PKH_SCRIPT_PREFIX = []byte{OP_DUP, OP_HASH160, btcKeyHashLenght} P2SH_SCRIPT_PREFIX = []byte{OP_HASH160, btcKeyHashLenght} )
Functions ¶
func BNBDecodeToBytes ¶
BNBDecodeToBytes converts the input string to a byte array
func BNBEncodeToString ¶
BNBEncodeToString converts the input byte array to a string representation of the BNB address.
func Base58AddressDecodeToBytesPrefix ¶ added in v1.0.8
func Base58AddressEncodeToStringPrefix ¶ added in v1.0.8
func Base58ChecksumDecode ¶ added in v1.0.6
Base58Decode decodes a modified base58 string to a byte slice and checks checksum.
func Base58ChecksumEncode ¶ added in v1.0.6
Base58Encode encodes a byte slice to a modified base58 string.
func Base58Decode ¶
Base58Decode decodes a modified base58 string to a byte slice.
func Base58Encode ¶
Base58Encode encodes a byte slice to a modified base58 string.
func Bech32AddressDecodeToBytes ¶
Bech32AddressDecodeToBytes converts the input string to a byte array
func Bech32AddressEncodeToString ¶
Bech32AddressEncodeToString converts the input byte array to a string representation of the bech32 address.
func BitcoinCashDecodeToBytes ¶
BitcoinCashDecodeToBytes converts the input string to a byte array
func BitcoinCashEncodeToString ¶
BitcoinCashEncodeToString converts the input byte array to a string representation of the Bitcoin address.
func BitcoinDecodeToBytes ¶
BitcoinDecodeToBytes converts the input string to a byte array
func BitcoinEncodeToString ¶
BitcoinEncodeToString converts the input byte array to a string representation of the Bitcoin address.
func CosmosDecodeToBytes ¶
CosmosDecodeToBytes converts the input string to a byte array
func CosmosEncodeToString ¶
CosmosEncodeToString converts the input byte array to a string representation of the Cosmos address.
func ElrondDecodeToBytes ¶ added in v1.0.9
ElrondDecodeToBytes converts the input string to a byte array
func ElrondEncodeToString ¶ added in v1.0.9
ElrondEncodeToString converts the input byte array to a string representation of the Elrond address.
func EtherToBytes ¶
EtherToBytes converts the input string to a byte array.
func EtherToString ¶
EtherToString converts the input byte array to a string representation of the Ethereum address.
func FilecoinDecodeToBytes ¶ added in v1.0.9
FilecoinDecodeToBytes converts the input string to a byte array
func FilecoinEncodeToString ¶ added in v1.0.9
FilecoinEncodeToString converts the input byte array to a string representation of the Solana address.
func IoTexDecodeToBytes ¶
IoTexDecodeToBytes converts the input string to a byte array
func IoTexEncodeToString ¶
IoTexEncodeToString converts the input byte array to a string representation of the Cosmos address.
func MakeBitcoinDecodeToBytes ¶
func MakeBitcoinDecodeToBytes(config *CoinConfig) func(string) ([]byte, error)
MakeBitcoinDecodeToBytes takes a CoinConfig and returns a func to decode string to bytes
func MakeBitcoinEncodeToString ¶
func MakeBitcoinEncodeToString(config *CoinConfig) func([]byte) (string, error)
MakeBitcoinEncodeToString takes a CoinConfig and returns a func to encode bytes to string
func NimiqDecodeToBytes ¶ added in v1.0.6
NimiqDecodeToBytes converts the "user-friendly Nimiq address" to its raw byte representation. The input must be uppercase, spaces are ignored.
func NimiqEncodeToString ¶ added in v1.0.6
NimiqEncodeToString a raw address to its user-friendly representation. If len(buf) != 20, encoding fails.
func OntologyDecodeToBytes ¶ added in v1.0.6
OntologyDecodeToBytes converts the input string to a byte array
func OntologyEncodeToString ¶ added in v1.0.6
OntologyEncodeToString converts the input byte array to a string representation of the Ontology address.
func PolkadotDecodeToBytes ¶ added in v1.0.7
PolkadotDecodeToBytes converts the input string to a byte array
func PolkadotEncodeToString ¶ added in v1.0.7
PolkadotEncodeToString converts the input byte array to a string representation of the Polkadot address.
func RunTestDecode ¶ added in v1.0.6
func RunTestDecode(coinType uint32, tt TestcaseDecode) error
func RunTestEncode ¶ added in v1.0.6
func RunTestEncode(coinType uint32, tt TestcaseEncode) error
func RunTestsDecode ¶ added in v1.0.6
func RunTestsDecode(t *testing.T, coinType uint32, tests []TestcaseDecode)
func RunTestsEncode ¶ added in v1.0.6
func RunTestsEncode(t *testing.T, coinType uint32, tests []TestcaseEncode)
func SS58AddressDecodeToBytes ¶ added in v1.0.7
SS58AddressDecodeToBytes converts the input string to a byte array
func SS58AddressEncodeToString ¶ added in v1.0.7
SS58AddressEncodeToString converts the input byte array to a string representation of the address.
func SolanaDecodeToBytes ¶ added in v1.0.8
SolanaDecodeToBytes converts the input string to a byte array
func SolanaEncodeToString ¶ added in v1.0.8
SolanaEncodeToString converts the input byte array to a string representation of the Solana address.
func StellarDecodeToBytes ¶
StellarDecodeToBytes converts the input string to a byte array
func StellarEncodeToString ¶
StellarEncodeToString converts the input byte array to a string representation of the Cosmos address.
func TezosDecodeToBytes ¶ added in v1.0.6
TezosDecodeToBytes converts the input string to a byte array
func TezosEncodeToString ¶ added in v1.0.6
TezosEncodeToString converts the input byte array to a string representation of the Tezos address.
func ToString ¶
ToString converts the input byte array to a string representation of the given coin type.
func TronDecodeToBytes ¶ added in v1.0.6
TronDecodeToBytes converts the input string to a byte array
func TronEncodeToString ¶ added in v1.0.6
TronEncodeToString converts the input byte array to a string representation of the Tron address.
func XRPDecodeToBytes ¶
XRPDecodeToBytes converts the input string to a byte array
func XRPEncodeToString ¶
XRPEncodeToString converts the input byte array to a string representation of the XRP address.
func ZilliqaDecodeToBytes ¶
ZilliqaDecodeToBytes converts the input string to a byte array
func ZilliqaEncodeToString ¶
ZilliqaEncodeToString converts the input byte array to a string representation of the Zilliqa address.
Types ¶
type CoinConfig ¶
CoinConfig for Bitcoin and its forks
type TestcaseDecode ¶ added in v1.0.6
type TestcaseDecode struct {
// contains filtered or unexported fields
}
type TestcaseEncode ¶ added in v1.0.6
type TestcaseEncode struct {
// contains filtered or unexported fields
}
Source Files ¶
- base58.go
- base58_address.go
- base58_checksum.go
- bech32.go
- bech32_address.go
- bitcoin.go
- bitcoin_cash.go
- bitcoin_forks.go
- bnb.go
- codec.go
- cosmos.go
- elrond.go
- ethereum.go
- filecoin.go
- iotex.go
- nimiq.go
- ontology.go
- polkadot.go
- solana.go
- ss58address.go
- stellar.go
- test_runner.go
- tezos.go
- tron.go
- xrp.go
- zilliqa.go