Documentation ¶
Index ¶
- Variables
- func ConvertToAsset(in []*MultiSwapAsset) ([]*pb.Asset, error)
- func IsValidAddressLen(val []byte) bool
- type Address
- func (a *Address) Bytes() []byte
- func (a *Address) ConvertToCall(_ shim.ChaincodeStubInterface, in string) (*Address, error)
- func (a *Address) Equal(b *Address) bool
- func (a *Address) IsUserIDSame(b *Address) bool
- func (a *Address) MarshalJSON() ([]byte, error)
- func (a *Address) PrepareToSave(stub shim.ChaincodeStubInterface, in string) (string, error)
- func (a *Address) String() string
- func (a *Address) UnmarshalJSON(data []byte) error
- type Hex
- type MultiSwapAsset
- type MultiSwapAssets
- type Sender
Constants ¶
This section is empty.
Variables ¶
var BaseTypes = map[string]interface{}{ "string": func(_ string, _ shim.ChaincodeStubInterface, in string) (string, error) { return in, nil }, "int": func(_ int, _ shim.ChaincodeStubInterface, in string) (int, error) { return strconv.Atoi(in) }, "bool": func(_ bool, _ shim.ChaincodeStubInterface, in string) (bool, error) { return in != "" && strings.ToLower(in) != "false", nil }, "int64": func(_ int64, _ shim.ChaincodeStubInterface, in string) (int64, error) { return strconv.ParseInt(in, 10, 64) }, "uint32": func(_ uint32, _ shim.ChaincodeStubInterface, in string) (uint32, error) { v, err := strconv.ParseUint(in, 10, 32) if err != nil { return 0, err } return uint32(v), nil }, "uint64": func(_ uint64, _ shim.ChaincodeStubInterface, in string) (uint64, error) { v, err := strconv.ParseUint(in, 10, 64) if err != nil { return 0, err } return v, nil }, "float64": func(_ float64, _ shim.ChaincodeStubInterface, in string) (float64, error) { return strconv.ParseFloat(in, 64) }, "*big.Int": func(_ *big.Int, _ shim.ChaincodeStubInterface, in string) (*big.Int, error) { value, ok := new(big.Int).SetString(in, 10) if !ok { return nil, fmt.Errorf("couldn't convert %s to bigint", in) } if value.Cmp(big.NewInt(0)) < 0 { return nil, fmt.Errorf("value %s should be positive", in) } return value, nil }, "[]uint8": func(_ []uint8, stub shim.ChaincodeStubInterface, in string) ([]uint8, error) { return base58.Decode(in), nil }, }
BaseTypes is a map of base types
Functions ¶
func ConvertToAsset ¶
func ConvertToAsset(in []*MultiSwapAsset) ([]*pb.Asset, error)
ConvertToAsset converts MultiSwapAsset to Asset
func IsValidAddressLen ¶
IsValidAddressLen checks if address length is valid
Types ¶
type Address ¶
Address is a wrapper for address
func AddrFromBase58Check ¶
AddrFromBase58Check creates address from base58 string
func AddrFromBytes ¶
AddrFromBytes creates address from bytes
func (*Address) ConvertToCall ¶
ConvertToCall converts string to address
func (*Address) IsUserIDSame ¶
IsUserIDSame checks if userIDs are the same
func (*Address) MarshalJSON ¶
MarshalJSON marshals address to json
func (*Address) PrepareToSave ¶
PrepareToSave checks if address is blacklisted
func (*Address) UnmarshalJSON ¶
UnmarshalJSON unmarshals address from json
type Hex ¶
type Hex []byte
Hex is a wrapper for []byte
func (Hex) ConvertToCall ¶
ConvertToCall converts string to hex
type MultiSwapAsset ¶
type MultiSwapAsset struct { Group string `json:"group,omitempty"` Amount string `json:"amount,omitempty"` }
MultiSwapAsset is a wrapper for asset
type MultiSwapAssets ¶
type MultiSwapAssets struct {
Assets []*MultiSwapAsset
}
MultiSwapAssets is a wrapper for asset
func (MultiSwapAssets) ConvertToCall ¶
func (n MultiSwapAssets) ConvertToCall(_ shim.ChaincodeStubInterface, in string) (MultiSwapAssets, error)
ConvertToCall converts string to MultiSwapAssets
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender is a wrapper for address
func NewSenderFromAddr ¶
NewSenderFromAddr creates sender from address