github.com/0xsequence/ethkit@v1.25.0/types.go (about) 1 package ethkit 2 3 import "github.com/0xsequence/ethkit/go-ethereum/common" 4 5 type Address = common.Address 6 7 type Hash = common.Hash 8 9 const HashLength = common.HashLength 10 11 func ToPtr[T any](v T) *T { 12 return &v 13 } 14 15 func ToSlicePtrs[T any](in []T) []*T { 16 out := make([]*T, len(in)) 17 for i := range in { 18 out[i] = &in[i] 19 } 20 return out 21 } 22 23 func ToSliceValues[T any](in []*T) []T { 24 out := make([]T, len(in)) 25 for i := range in { 26 out[i] = *in[i] 27 } 28 return out 29 }