native

package
v0.0.0-...-7797dff Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFetcher = errors.New("sign requests fetcher cannot be nil")

ErrNoFetcher is returned when the fetcher is nil.

Functions

This section is empty.

Types

type APISignRequestFetcher

type APISignRequestFetcher struct {
	APIURL string
}

APISignRequestFetcher SignRequestFetcher implementation: fetches sign requests from an API.

func NewMockAPISignRequestFetcher

func NewMockAPISignRequestFetcher() (*APISignRequestFetcher, error)

NewMockAPISignRequestFetcher creates a new APISignRequestFetcher with a mock API URL.

func (*APISignRequestFetcher) GetBtcSignRequests

func (f *APISignRequestFetcher) GetBtcSignRequests(from, limit int) ([]SignReq, error)

GetBtcSignRequests retrieves sign requests from the API.

type Block

type Block interface {
	Transactions() []Tx
}

Block is a universal blockchain block type

type Blockchain

type Blockchain interface {
	Close(ctx context.Context) error
	ChainID() string
	ChainHeader() (chainID string, latestBlock uint64, err error)
	SubscribeNewBlock(ctx context.Context) (<-chan Block, error)
	Block(ctx context.Context, height int64) (blk Block, err error)
}

Blockchain is the expected blockchain interface the indexer needs to store data in the database.

type Indexer

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

Indexer struct responsible for calling blockchain rpc/websocket for data and storing that into the database.

func NewIndexer

func NewIndexer(ctx context.Context, b Blockchain, logger zerolog.Logger,
	startBlockHeight int, ika remote2ika.Client) (*Indexer, error)

NewIndexer returns a new indexer struct with open connections.

func (*Indexer) Close

func (i *Indexer) Close(ctx context.Context) error

Close closes all the open connections.

func (*Indexer) HandleBlock

func (i *Indexer) HandleBlock(ctx context.Context, b Block) error

HandleBlock handles the receive of a block from the chain.

func (*Indexer) HandleNewBlock

func (i *Indexer) HandleNewBlock(ctx context.Context, b Block) error

HandleNewBlock handles the receive of new block from the chain.

func (*Indexer) HandleTx

func (i *Indexer) HandleTx(ctx context.Context, blockHeight, blockTimeUnix int, tx Tx) error

HandleTx handles the receive of new Tx from the chain.

func (*Indexer) IndexBlocksFromTo

func (i *Indexer) IndexBlocksFromTo(ctx context.Context, from, to int)

IndexBlocksFromTo index blocks from specific heights.

func (*Indexer) IndexOldBlocks

func (i *Indexer) IndexOldBlocks(ctx context.Context)

IndexOldBlocks checks if it is needed to index old blocks and index them as needed.

func (*Indexer) Start

func (i *Indexer) Start(ctx context.Context) error

Start indexing

type SignReq

type SignReq struct {
	ID        uint64 // Unique sequence number for the sign request
	Payload   []byte // Bytes to be signed
	DWalletID string // ID of the  dwallet
	UserSig   string // Partial signature created with the user's share of the private key
	FinalSig  []byte // Full signature generated by the IKA network
	Timestamp int64  // Timestamp of the sign request (in Unix time)
}

SignReq represents a signature request.

func (*SignReq) DecodeMsg

func (z *SignReq) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*SignReq) EncodeMsg

func (z *SignReq) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*SignReq) MarshalMsg

func (z *SignReq) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*SignReq) Msgsize

func (z *SignReq) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignReq) UnmarshalMsg

func (z *SignReq) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type SignReqFetcher

type SignReqFetcher interface {
	GetBtcSignRequests(from int, limit int) ([]SignReq, error)
}

SignReqFetcher is an interface for getting sign requests from the Native network.

type SignReqs

type SignReqs []SignReq

SignReqs is a slice of SignReq

func (*SignReqs) DecodeMsg

func (z *SignReqs) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (SignReqs) EncodeMsg

func (z SignReqs) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (SignReqs) MarshalMsg

func (z SignReqs) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (SignReqs) Msgsize

func (z SignReqs) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignReqs) UnmarshalMsg

func (z *SignReqs) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Tx

type Tx []byte

Tx is a universal transaction type. Note: should be updated

Jump to

Keyboard shortcuts

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