github.com/aeternity/aepp-sdk-go/v4@v4.0.1/cmd/validation.go (about)

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