github.com/chain5j/chain5j-pkg@v1.0.7/types/address_test.go (about) 1 // Package types 2 // 3 // @author: xwc1125 4 package types 5 6 import ( 7 "testing" 8 ) 9 10 func TestAddress_FromStr(t *testing.T) { 11 // hexAddress := NewHexAddress() 12 // newHexAddress, err := hexAddress.FromStr("0x9254E62FBCA63769DFd4Cc8e23f630F0785610CE") 13 // fmt.Println(newHexAddress.String()) 14 // newHexAddress2, err := hexAddress.FromStr("0x9254e62FBCA63769DFd4Cc8e23f630F0785610CE") 15 // fmt.Println(newHexAddress2.String()) 16 // 17 // domainAddress, err := NewDomainAddress(&hexAddress) 18 // if err != nil { 19 // panic(err) 20 // } 21 // newDomainAddress, err := domainAddress.FromStr("0x9254E62FBCA63769DFd4Cc8e23f630F0785610CE") 22 // fmt.Println(newDomainAddress.String()) 23 // newDomainAddress2, err := domainAddress.FromStr("0x9254e62FBCA63769DFd4Cc8e23f630F0785610CE") 24 // fmt.Println(newDomainAddress2.String()) 25 // 26 // marshal, err := json.Marshal(newDomainAddress) 27 // if err != nil { 28 // panic(err) 29 // } 30 // fmt.Println("json.Marshal", string(marshal)) 31 // err = json.Unmarshal(marshal, &domainAddress) 32 // if err != nil { 33 // panic(err) 34 // } 35 // fmt.Println("domainAddress", domainAddress) 36 }