Documentation
¶
Index ¶
- Constants
- func DecodeGenericValue(o interface{}, data GenericValue) error
- type BatchGetResult
- type ContractBackend
- type GenericStorageContract
- func (g *GenericStorageContract) Address() common.Address
- func (g *GenericStorageContract) BatchGet(keys [][]byte) (*BatchGetResult, error)
- func (g *GenericStorageContract) Clear() error
- func (g *GenericStorageContract) Count() (*big.Int, error)
- func (g *GenericStorageContract) Exists(key []byte) (bool, error)
- func (g *GenericStorageContract) Get(key []byte) (*GetResult, error)
- func (g *GenericStorageContract) List(offset, limit uint64) (*ListResult, error)
- func (g *GenericStorageContract) ListKeys(offset, limit uint64) (*ListKeysResult, error)
- func (g *GenericStorageContract) Put(key []byte, value GenericValue) error
- func (g *GenericStorageContract) PutSimple(key []byte, data []byte) error
- func (g *GenericStorageContract) Remove(key []byte) (bool, error)
- type GenericValue
- type GenericValueContainer
- type GetResult
- type ListKeysResult
- type ListResult
- type NamespaceBatchGetResult
- type NamespaceGenericValue
- type NamespaceGetResult
- type NamespaceListKeysResult
- type NamespaceListNamespacesResult
- type NamespaceListResult
- type NamespaceStorageContract
- func (ns *NamespaceStorageContract) Address() common.Address
- func (ns *NamespaceStorageContract) BatchGet(namespace string, keys [][]byte) (*NamespaceBatchGetResult, error)
- func (ns *NamespaceStorageContract) BatchPut(namespace string, keys [][]byte, values []NamespaceGenericValue) error
- func (ns *NamespaceStorageContract) ClearAll() error
- func (ns *NamespaceStorageContract) ClearNamespace(namespace string) error
- func (ns *NamespaceStorageContract) CountInNamespace(namespace string) (*big.Int, error)
- func (ns *NamespaceStorageContract) Exists(namespace string, key []byte) (bool, error)
- func (ns *NamespaceStorageContract) Get(namespace string, key []byte) (*NamespaceGetResult, error)
- func (ns *NamespaceStorageContract) HasNamespace(namespace string) (bool, error)
- func (ns *NamespaceStorageContract) List(namespace string, offset, limit *big.Int) (*NamespaceListResult, error)
- func (ns *NamespaceStorageContract) ListKeys(namespace string, offset, limit *big.Int) (*NamespaceListKeysResult, error)
- func (ns *NamespaceStorageContract) ListNamespaces(offset, limit *big.Int) (*NamespaceListNamespacesResult, error)
- func (ns *NamespaceStorageContract) NamespaceCount() (*big.Int, error)
- func (ns *NamespaceStorageContract) Put(namespace string, key []byte, value NamespaceGenericValue) error
- func (ns *NamespaceStorageContract) Remove(namespace string, key []byte) (bool, error)
- func (ns *NamespaceStorageContract) TotalCount() (*big.Int, error)
- type NamespaceStorageContractWrapper
- func (ns *NamespaceStorageContractWrapper) Address() common.Address
- func (ns *NamespaceStorageContractWrapper) BatchGet(keys [][]byte) (*NamespaceBatchGetResult, error)
- func (ns *NamespaceStorageContractWrapper) BatchPut(keys [][]byte, values []NamespaceGenericValue) error
- func (ns *NamespaceStorageContractWrapper) Clear() error
- func (ns *NamespaceStorageContractWrapper) Count() (*big.Int, error)
- func (ns *NamespaceStorageContractWrapper) Exists(key []byte) (bool, error)
- func (ns *NamespaceStorageContractWrapper) Get(key []byte) (*NamespaceGetResult, error)
- func (ns *NamespaceStorageContractWrapper) List(offset, limit uint64) (*NamespaceListResult, error)
- func (ns *NamespaceStorageContractWrapper) ListKeys(offset, limit uint64) (*NamespaceListKeysResult, error)
- func (ns *NamespaceStorageContractWrapper) Put(key []byte, value NamespaceGenericValue) error
- func (ns *NamespaceStorageContractWrapper) Remove(key []byte) (bool, error)
- type StorageContract
Constants ¶
const GenericStorageABI = `` /* 9709-byte string literal not displayed */
GenericStorageABI is the ABI definition for the GenericStorage contract
const GenericStorageByteCodeStr = "" /* 22280-byte string literal not displayed */
const NamespaceStorageABI = `` /* 15150-byte string literal not displayed */
NamespaceStorageABI is the ABI definition for the NamespaceStorage contract
const NamespaceStorageContractByteCodeStr = "" /* 35728-byte string literal not displayed */
NamespaceStorageContractByteCodeStr is the bytecode for the NamespaceStorage contract
Variables ¶
This section is empty.
Functions ¶
func DecodeGenericValue ¶
func DecodeGenericValue(o interface{}, data GenericValue) error
DecodeGenericValue decodes a GenericValue into a specific object
Types ¶
type BatchGetResult ¶
type BatchGetResult struct {
Values []GenericValue `json:"values"`
ExistsFlags []bool `json:"existsFlags"`
}
BatchGetResult represents the result of a batch get operation
type ContractBackend ¶
type ContractBackend interface {
Call(callMsg *ethereum.CallMsg) ([]byte, error)
Handle(callMsg *ethereum.CallMsg) error
}
ContractBackend defines the interface for contract backend operations
type GenericStorageContract ¶
type GenericStorageContract struct {
// contains filtered or unexported fields
}
GenericStorageContract provides an interface to interact with the GenericStorage smart contract
func NewGenericStorageContract ¶
func NewGenericStorageContract(contractAddress common.Address, backend ContractBackend, owner common.Address) (*GenericStorageContract, error)
NewGenericStorageContract creates a new GenericStorage contract instance
func (*GenericStorageContract) Address ¶
func (g *GenericStorageContract) Address() common.Address
Address returns the contract address
func (*GenericStorageContract) BatchGet ¶
func (g *GenericStorageContract) BatchGet(keys [][]byte) (*BatchGetResult, error)
BatchGet retrieves multiple values by their keys
func (*GenericStorageContract) Clear ¶
func (g *GenericStorageContract) Clear() error
Clear removes all stored data (emergency function)
func (*GenericStorageContract) Count ¶
func (g *GenericStorageContract) Count() (*big.Int, error)
Count returns the total number of stored items
func (*GenericStorageContract) Exists ¶
func (g *GenericStorageContract) Exists(key []byte) (bool, error)
Exists checks if a key exists in the storage
func (*GenericStorageContract) Get ¶
func (g *GenericStorageContract) Get(key []byte) (*GetResult, error)
Get retrieves data by key
func (*GenericStorageContract) List ¶
func (g *GenericStorageContract) List(offset, limit uint64) (*ListResult, error)
List retrieves all stored data with pagination
func (*GenericStorageContract) ListKeys ¶
func (g *GenericStorageContract) ListKeys(offset, limit uint64) (*ListKeysResult, error)
ListKeys retrieves all keys with pagination (lightweight version)
func (*GenericStorageContract) Put ¶
func (g *GenericStorageContract) Put(key []byte, value GenericValue) error
Put stores data with the given key
type GenericValue ¶
type GenericValue struct {
PrimaryData []byte `json:"primaryData"`
SecondaryData []byte `json:"secondaryData"`
AuxiliaryData []byte `json:"auxiliaryData"`
}
GenericValue represents the value structure in the GenericStorage contract
type GenericValueContainer ¶
type GenericValueContainer interface {
Decode(data GenericValue) error
Encode() (GenericValue, error)
}
GenericValueContainer is an interface for objects that can be encoded/decoded to/from GenericValue
type GetResult ¶
type GetResult struct {
Value GenericValue `json:"value"`
KeyExists bool `json:"keyExists"`
}
GetResult represents the result of a get operation
type ListKeysResult ¶
ListKeysResult represents the result of a listKeys operation
type ListResult ¶
type ListResult struct {
KeyList [][]byte `json:"keyList"`
Values []GenericValue `json:"values"`
Total *big.Int `json:"total"`
}
ListResult represents the result of a list operation
type NamespaceBatchGetResult ¶
type NamespaceBatchGetResult = BatchGetResult
NamespaceBatchGetResult represents the result of a batch get operation
type NamespaceGenericValue ¶
type NamespaceGenericValue = GenericValue
NamespaceGenericValue represents the value structure in the NamespaceStorage contract This is the same as GenericValue but renamed to avoid conflicts
type NamespaceGetResult ¶
type NamespaceGetResult = GetResult
NamespaceGetResult represents the result of a get operation
type NamespaceListKeysResult ¶
type NamespaceListKeysResult = ListKeysResult
NamespaceListKeysResult represents the result of a listKeys operation
type NamespaceListNamespacesResult ¶
type NamespaceListNamespacesResult struct {
NamespaceList []string `json:"namespaceList"`
Counts []*big.Int `json:"counts"`
Total *big.Int `json:"total"`
}
NamespaceListNamespacesResult represents the result of a listNamespaces operation
type NamespaceListResult ¶
type NamespaceListResult = ListResult
NamespaceListResult represents the result of a list operation
type NamespaceStorageContract ¶
type NamespaceStorageContract struct {
// contains filtered or unexported fields
}
NamespaceStorageContract provides an interface to interact with the NamespaceStorage smart contract
func NewNamespaceStorageContract ¶
func NewNamespaceStorageContract(contractAddress common.Address, backend ContractBackend, owner common.Address) (*NamespaceStorageContract, error)
NewNamespaceStorageContract creates a new NamespaceStorage contract instance
func (*NamespaceStorageContract) Address ¶
func (ns *NamespaceStorageContract) Address() common.Address
Address returns the contract address
func (*NamespaceStorageContract) BatchGet ¶
func (ns *NamespaceStorageContract) BatchGet(namespace string, keys [][]byte) (*NamespaceBatchGetResult, error)
BatchGet retrieves multiple values by their keys within a namespace
func (*NamespaceStorageContract) BatchPut ¶
func (ns *NamespaceStorageContract) BatchPut(namespace string, keys [][]byte, values []NamespaceGenericValue) error
BatchPut stores multiple key-value pairs in the same namespace
func (*NamespaceStorageContract) ClearAll ¶
func (ns *NamespaceStorageContract) ClearAll() error
ClearAll clears all stored data across all namespaces (emergency function)
func (*NamespaceStorageContract) ClearNamespace ¶
func (ns *NamespaceStorageContract) ClearNamespace(namespace string) error
ClearNamespace clears all data in a specific namespace
func (*NamespaceStorageContract) CountInNamespace ¶
func (ns *NamespaceStorageContract) CountInNamespace(namespace string) (*big.Int, error)
CountInNamespace returns the number of items in a namespace
func (*NamespaceStorageContract) Exists ¶
func (ns *NamespaceStorageContract) Exists(namespace string, key []byte) (bool, error)
Exists checks if a key exists in a namespace
func (*NamespaceStorageContract) Get ¶
func (ns *NamespaceStorageContract) Get(namespace string, key []byte) (*NamespaceGetResult, error)
Get retrieves data by namespace and key
func (*NamespaceStorageContract) HasNamespace ¶
func (ns *NamespaceStorageContract) HasNamespace(namespace string) (bool, error)
HasNamespace checks if a namespace exists
func (*NamespaceStorageContract) List ¶
func (ns *NamespaceStorageContract) List(namespace string, offset, limit *big.Int) (*NamespaceListResult, error)
List retrieves all stored data in a namespace with pagination
func (*NamespaceStorageContract) ListKeys ¶
func (ns *NamespaceStorageContract) ListKeys(namespace string, offset, limit *big.Int) (*NamespaceListKeysResult, error)
ListKeys retrieves all keys in a namespace with pagination
func (*NamespaceStorageContract) ListNamespaces ¶
func (ns *NamespaceStorageContract) ListNamespaces(offset, limit *big.Int) (*NamespaceListNamespacesResult, error)
ListNamespaces retrieves all namespaces with pagination
func (*NamespaceStorageContract) NamespaceCount ¶
func (ns *NamespaceStorageContract) NamespaceCount() (*big.Int, error)
NamespaceCount returns the total number of namespaces
func (*NamespaceStorageContract) Put ¶
func (ns *NamespaceStorageContract) Put(namespace string, key []byte, value NamespaceGenericValue) error
Put stores data with the given namespace and key
func (*NamespaceStorageContract) Remove ¶
func (ns *NamespaceStorageContract) Remove(namespace string, key []byte) (bool, error)
Remove deletes data by namespace and key
func (*NamespaceStorageContract) TotalCount ¶
func (ns *NamespaceStorageContract) TotalCount() (*big.Int, error)
TotalCount returns the total number of items across all namespaces
type NamespaceStorageContractWrapper ¶
type NamespaceStorageContractWrapper struct {
// contains filtered or unexported fields
}
NamespaceStorageContractWrapper wraps the NamespaceStorageContract
func NewNamespaceStorageContractWrapper ¶
func NewNamespaceStorageContractWrapper(contractAddress common.Address, backend ContractBackend, owner common.Address, ns string) (*NamespaceStorageContractWrapper, error)
func (*NamespaceStorageContractWrapper) Address ¶
func (ns *NamespaceStorageContractWrapper) Address() common.Address
Address returns the contract address
func (*NamespaceStorageContractWrapper) BatchGet ¶
func (ns *NamespaceStorageContractWrapper) BatchGet(keys [][]byte) (*NamespaceBatchGetResult, error)
BatchGet retrieves multiple values by their keys within a namespace
func (*NamespaceStorageContractWrapper) BatchPut ¶
func (ns *NamespaceStorageContractWrapper) BatchPut(keys [][]byte, values []NamespaceGenericValue) error
BatchPut stores multiple key-value pairs in the same namespace
func (*NamespaceStorageContractWrapper) Clear ¶
func (ns *NamespaceStorageContractWrapper) Clear() error
Clear removes all data in the namespace
func (*NamespaceStorageContractWrapper) Count ¶
func (ns *NamespaceStorageContractWrapper) Count() (*big.Int, error)
Count returns the number of items in the namespace
func (*NamespaceStorageContractWrapper) Exists ¶
func (ns *NamespaceStorageContractWrapper) Exists(key []byte) (bool, error)
Exists checks if a key exists in a namespace
func (*NamespaceStorageContractWrapper) Get ¶
func (ns *NamespaceStorageContractWrapper) Get(key []byte) (*NamespaceGetResult, error)
Get retrieves data by namespace and key
func (*NamespaceStorageContractWrapper) List ¶
func (ns *NamespaceStorageContractWrapper) List(offset, limit uint64) (*NamespaceListResult, error)
List retrieves all stored data in a namespace with pagination
func (*NamespaceStorageContractWrapper) ListKeys ¶
func (ns *NamespaceStorageContractWrapper) ListKeys(offset, limit uint64) (*NamespaceListKeysResult, error)
ListKeys retrieves all keys in a namespace with pagination
func (*NamespaceStorageContractWrapper) Put ¶
func (ns *NamespaceStorageContractWrapper) Put(key []byte, value NamespaceGenericValue) error
Put stores data with the given namespace and key
type StorageContract ¶
type StorageContract interface {
Address() common.Address
Put(key []byte, value GenericValue) error
Get(key []byte) (*GetResult, error)
Remove(key []byte) (bool, error)
Exists(key []byte) (bool, error)
List(uint64, uint64) (*ListResult, error)
ListKeys(uint64, uint64) (*ListKeysResult, error)
BatchGet(keys [][]byte) (*BatchGetResult, error)
Count() (*big.Int, error)
}
StorageContract provides an interface to interact with the storage smart contract