forked from TrueCloudLab/frostfs-api-go
1958ff8c37
With neo-go v0.90.0 there are new event subscription component and new verification script routines based on NEO3. These features allow to avoid using low-level neo-vm code in NeoFS and corresponding projects. This commit removes unused function: - FetchPublicKeys (used in neofs indexer), - VerificationScript (used in KeysToAddress), - Address (used in KeysToAddress), - ReversedScriptHashToAddress (used in neofs indexer), - IsAddress (used in neofs indexer), - ReverseBytes (used in neofs indexer), - DecodeScriptHash (used in neofs indexer). KeysToAddress changed into KeyToAddress because NeoFS won't work with multisignature owners for now and it is not supported in neo-go library.
30 lines
563 B
Go
30 lines
563 B
Go
package chain
|
|
|
|
import (
|
|
"crypto/ecdsa"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
)
|
|
|
|
// WalletAddress implements NEO address.
|
|
type WalletAddress [AddressLength]byte
|
|
|
|
const (
|
|
// AddressLength contains size of address,
|
|
// 1 byte of address version + 20 bytes of ScriptHash + 4 bytes of checksum.
|
|
AddressLength = 25
|
|
)
|
|
|
|
// KeyToAddress returns NEO address composed from public key.
|
|
func KeyToAddress(key *ecdsa.PublicKey) string {
|
|
if key == nil {
|
|
return ""
|
|
}
|
|
|
|
neoPublicKey := keys.PublicKey{
|
|
X: key.X,
|
|
Y: key.Y,
|
|
}
|
|
|
|
return neoPublicKey.Address()
|
|
}
|