state

package
v0.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2022 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const StateABIJSON = "" /* 3702-byte string literal not displayed */

StateABIJSON is JSON ABI of state contract

Variables

View Source
var StateABI abi.ABI

StateABI is an ABI of State contarct

Functions

This section is empty.

Types

type BlockchainCaller

type BlockchainCaller interface {
	// CallContract  cals smart contract. For read operation with single bigInt param
	CallContract(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error)
}

BlockchainCaller is an interface for smart contract call

type ETHResolver

type ETHResolver struct {
	RPCUrl   string
	Contract string
}

ETHResolver resolver for eth blockchains

func (ETHResolver) Resolve

func (r ETHResolver) Resolve(ctx context.Context, id, state *big.Int) (*ResolvedState, error)

Resolve returns Resolved state from blockchain

type ExtendedVerificationsOptions

type ExtendedVerificationsOptions struct {
	VerificationOptions
	OnlyLatestStates             bool
	AcceptedStateTransitionDelay time.Duration
}

ExtendedVerificationsOptions allows to set additional options

type ResolvedState

type ResolvedState struct {
	State               string `json:"state"`
	Latest              bool   `json:"latest"`
	TransitionTimestamp int64  `json:"transition_timestamp"`
}

ResolvedState can be the state verification result

func Resolve

func Resolve(ctx context.Context, c BlockchainCaller, contractAddress string, id, state *big.Int) (*ResolvedState, error)

Resolve is used to resolve identity state rpcURL - url to connect to the blockchain contractAddress is an address of state contract id is base58 identifier e.g. id:11A2HgCZ1pUcY8HoNDMjNWEBQXZdUnL3YVnVCUvR5s state is bigint string representation of identity state

type State

type State struct {
	*big.Int
}

State is structure to represent state from contract

func (*State) Unmarshal

func (s *State) Unmarshal(data []interface{}) error

Unmarshal returns getState contract result as State structure

type TransitionInfo

type TransitionInfo struct {
	ReplacedAtTimestamp *big.Int
	CreatedAtTimestamp  *big.Int
	ReplacedAtBlock     uint64
	CreatedAtBlock      uint64
	ID                  *big.Int
	ReplacedBy          *big.Int
}

TransitionInfo is information about state transition

func (*TransitionInfo) Unmarshal

func (ti *TransitionInfo) Unmarshal(data []interface{}) error

Unmarshal returns contract call result as TransitionInfo structure

type Unmarshaler

type Unmarshaler interface {
	Unmarshal([]interface{}) error
}

Unmarshaler is used for contract call result parser

type VerificationOptions

type VerificationOptions struct {
	Contract string
	RPCUrl   string
}

VerificationOptions is options for state verification

Directories

Path Synopsis
Package mock_verification is a generated GoMock package.
Package mock_verification is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL