local

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IdIdenStateData

type IdIdenStateData struct {
	Id            *core.ID
	IdenStateData *proof.IdenStateData
}

type IdenPubOnChain

type IdenPubOnChain struct {
	// contains filtered or unexported fields
}

IdenPubOnChain is an implementation of the IdenPubOnnChainer that instead of interacting with the blockchain has a local copy of the identities states. All writes (Init and Set) are set to a pending queue, and written into the internal state once the Sync function is called.

func New

func New(timeNow func() time.Time, blockNow func() uint64, verifyingKey *zktypes.Vk) *IdenPubOnChain

New creates a new IdenPubOnChain

func (*IdenPubOnChain) GetState

func (ip *IdenPubOnChain) GetState(id *core.ID) (*proof.IdenStateData, error)

GetState returns the Identity State Data of the given ID from the IdenStates Smart Contract.

func (*IdenPubOnChain) GetStateByBlock

func (ip *IdenPubOnChain) GetStateByBlock(id *core.ID, queryBlockN uint64) (*proof.IdenStateData, error)

GetStateByBlock returns the Identity State Data of the given ID published at queryBlockN from the IdenStates Smart Contract.

func (*IdenPubOnChain) GetStateByTime

func (ip *IdenPubOnChain) GetStateByTime(id *core.ID, queryBlockTs int64) (*proof.IdenStateData, error)

GetStateByTime returns the Identity State Data of the given ID published at queryBlockTs from the IdenStates Smart Contract.

func (*IdenPubOnChain) InitState

func (ip *IdenPubOnChain) InitState(id *core.ID, genesisState,
	newState *merkletree.Hash, zkProof *zktypes.Proof) (*types.Transaction, error)

InitState initializes the first Identity State of the given ID in the IdenStates Smart Contract.

func (*IdenPubOnChain) SetState

func (ip *IdenPubOnChain) SetState(id *core.ID, newState *merkletree.Hash,
	zkProof *zktypes.Proof) (*types.Transaction, error)

SetState updates the Identity State of the given ID in the IdenStates Smart Contract.

func (*IdenPubOnChain) Sync

func (ip *IdenPubOnChain) Sync()

Sync all the pending writes to the local state.

func (*IdenPubOnChain) TxConfirmBlocks added in v0.0.8

func (ip *IdenPubOnChain) TxConfirmBlocks(tx *types.Transaction) (*big.Int, error)

TxConfirmBlocks returns the number of confirmed blocks of transaction tx.

type IdenStateHistory

type IdenStateHistory struct {
	IdenStates []*proof.IdenStateData
	ByTime     map[int64]*proof.IdenStateData
	ByBlock    map[uint64]*proof.IdenStateData
}

func NewIdenStateHistory

func NewIdenStateHistory() *IdenStateHistory

func (*IdenStateHistory) Add

func (h *IdenStateHistory) Add(idenStateData *proof.IdenStateData)

Jump to

Keyboard shortcuts

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