github.com/aeternity/aepp-sdk-go/v6@v6.0.0/cmd/validation.go (about)

     1  package cmd
     2  
     3  import "github.com/aeternity/aepp-sdk-go/v6/binary"
     4  
     5  // IsAddress does some minor checks to ensure that the string is an ak_ address
     6  func IsAddress(a string) bool {
     7  	if len(a) > 0 && a[:3] == string(binary.PrefixAccountPubkey) {
     8  		return true
     9  	}
    10  	return false
    11  }
    12  
    13  // IsBytecode does some minor checks to ensure that the string is a cb_ bytecode
    14  func IsBytecode(a string) bool {
    15  	if len(a) > 0 && a[:3] == string(binary.PrefixContractByteArray) {
    16  		return true
    17  	}
    18  	return false
    19  }
    20  
    21  // IsTransaction does some minor checks to ensure that the string is a tx_ transaction
    22  func IsTransaction(a string) bool {
    23  	if len(a) > 0 && a[:3] == string(binary.PrefixTransaction) {
    24  		return true
    25  	}
    26  	return false
    27  }