api

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: LGPL-3.0 Imports: 45 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountApi

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

NetApi offers helper utils

func NewAccountApi

func NewAccountApi(baseApi *BaseApi) *AccountApi

func (*AccountApi) Create

func (api *AccountApi) Create(passPhrase string) (common.Address, error)

func (*AccountApi) List

func (api *AccountApi) List() []common.Address

func (*AccountApi) Lock

func (api *AccountApi) Lock(addr common.Address) error

func (*AccountApi) Unlock

func (api *AccountApi) Unlock(addr common.Address, passPhrase string, timeout time.Duration) error

type ActionResult added in v1.0.0

type ActionResult struct {
	InputAction      InputAction     `json:"inputAction"`
	Success          bool            `json:"success"`
	Error            string          `json:"error"`
	GasUsed          uint64          `json:"gasUsed"`
	RemainingGas     uint64          `json:"remainingGas"`
	OutputData       hexutil.Bytes   `json:"outputData"`
	SubActionResults []*ActionResult `json:"subActionResults"`
	Contract         common.Address  `json:"contract"`
}

type ActivateInviteArgs

type ActivateInviteArgs struct {
	Key    string         `json:"key"`
	PubKey *hexutil.Bytes `json:"pubKey"`
	BaseTxArgs
}

type ActivateInviteToRandAddrArgs added in v0.21.0

type ActivateInviteToRandAddrArgs struct {
	Key string `json:"key"`
	BaseTxArgs
}

type ActivateInviteToRandAddrResponse added in v0.21.0

type ActivateInviteToRandAddrResponse struct {
	Hash    common.Hash    `json:"hash"`
	Address common.Address `json:"address"`
	Key     string         `json:"key"`
}

type Balance

type Balance struct {
	Stake            decimal.Decimal `json:"stake"`
	ReplenishedStake decimal.Decimal `json:"replenishedStake"`
	LockedStake      decimal.Decimal `json:"lockedStake"`
	Balance          decimal.Decimal `json:"balance"`
	Nonce            uint32          `json:"nonce"`
	MempoolNonce     uint32          `json:"mempoolNonce"`
}

type BaseApi

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

func NewBaseApi

func NewBaseApi(engine *consensus.Engine, txpool *mempool.TxPool, ks *keystore.KeyStore, secStore *secstore.SecStore, ipfs ipfs.Proxy) *BaseApi

type BaseTxArgs

type BaseTxArgs struct {
	Nonce uint32 `json:"nonce"`
	Epoch uint16 `json:"epoch"`
}

type Block

type Block struct {
	Coinbase     common.Address  `json:"coinbase"`
	Hash         common.Hash     `json:"hash"`
	ParentHash   common.Hash     `json:"parentHash"`
	Height       uint64          `json:"height"`
	Time         int64           `json:"timestamp"`
	Root         common.Hash     `json:"root"`         // root of state tree
	IdentityRoot common.Hash     `json:"identityRoot"` // root of approved identities tree
	IpfsHash     *string         `json:"ipfsCid"`      // ipfs hash of block body
	Transactions []common.Hash   `json:"transactions"`
	Flags        []string        `json:"flags"`
	IsEmpty      bool            `json:"isEmpty"`
	OfflineAddr  *common.Address `json:"offlineAddress"`
}

type BlockchainApi

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

func NewBlockchainApi

func NewBlockchainApi(baseApi *BaseApi, bc *blockchain.Blockchain, ipfs ipfs.Proxy, pool *mempool.TxPool, d *protocol.Downloader, pm *protocol.IdenaGossipHandler, nodeState *state.NodeState) *BlockchainApi

func (*BlockchainApi) Block

func (api *BlockchainApi) Block(hash common.Hash) *Block

func (*BlockchainApi) BlockAt

func (api *BlockchainApi) BlockAt(height uint64) *Block

func (*BlockchainApi) BurntCoins

func (api *BlockchainApi) BurntCoins() []BurntCoins

func (*BlockchainApi) EstimateRawTx added in v0.28.3

func (api *BlockchainApi) EstimateRawTx(bytesTx hexutil.Bytes, from *common.Address) (*EstimateRawTxResponse, error)

func (*BlockchainApi) EstimateTx added in v0.27.2

func (api *BlockchainApi) EstimateTx(args SendTxArgs) (*EstimateTxResponse, error)

func (*BlockchainApi) FeePerGas added in v0.22.0

func (api *BlockchainApi) FeePerGas() *big.Int

func (*BlockchainApi) GetRawTx

func (api *BlockchainApi) GetRawTx(args SendTxArgs) (hexutil.Bytes, error)

func (*BlockchainApi) KeyWord added in v0.25.3

func (api *BlockchainApi) KeyWord(index int) (keywords.Keyword, error)

func (*BlockchainApi) LastBlock

func (api *BlockchainApi) LastBlock() *Block

func (*BlockchainApi) Mempool

func (api *BlockchainApi) Mempool() []common.Hash

func (*BlockchainApi) PendingTransactions

func (api *BlockchainApi) PendingTransactions(args TransactionsArgs) Transactions

sorted by epoch \ nonce desc (the newest transactions are first)

func (*BlockchainApi) SendRawTx

func (api *BlockchainApi) SendRawTx(ctx context.Context, bytesTx hexutil.Bytes) (common.Hash, error)

func (*BlockchainApi) Syncing

func (api *BlockchainApi) Syncing() Syncing

func (*BlockchainApi) Transaction

func (api *BlockchainApi) Transaction(hash common.Hash) *Transaction

func (*BlockchainApi) Transactions

func (api *BlockchainApi) Transactions(args TransactionsArgs) Transactions

func (*BlockchainApi) TxReceipt added in v0.22.0

func (api *BlockchainApi) TxReceipt(hash common.Hash) *TxReceipt

type BlockchainInitialApi added in v0.29.2

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

func NewBlockchainInitialApi added in v0.29.2

func NewBlockchainInitialApi(nodeState *state.NodeState) *BlockchainInitialApi

func (*BlockchainInitialApi) Syncing added in v0.29.2

func (api *BlockchainInitialApi) Syncing() Syncing

type BurnArgs

type BurnArgs struct {
	From   common.Address  `json:"from"`
	Key    string          `json:"key"`
	Amount decimal.Decimal `json:"amount"`
	MaxFee decimal.Decimal `json:"maxFee"`
	BaseTxArgs
}

type BurntCoins

type BurntCoins struct {
	Address common.Address  `json:"address"`
	Amount  decimal.Decimal `json:"amount"`
	Key     string          `json:"key"`
}

type CallArgs added in v0.22.0

type CallArgs struct {
	From           common.Address  `json:"from"`
	Contract       common.Address  `json:"contract"`
	Method         string          `json:"method"`
	Amount         decimal.Decimal `json:"amount"`
	Args           DynamicArgs     `json:"args"`
	MaxFee         decimal.Decimal `json:"maxFee"`
	BroadcastBlock uint64          `json:"broadcastBlock"`
}

type CeremonyIntervals

type CeremonyIntervals struct {
	FlipLotteryDuration  float64
	ShortSessionDuration float64
	LongSessionDuration  float64
}

type ChangeProfileArgs

type ChangeProfileArgs struct {
	Info     *hexutil.Bytes  `json:"info"`
	Nickname string          `json:"nickname"`
	MaxFee   decimal.Decimal `json:"maxFee"`
}

type ChangeProfileResponse

type ChangeProfileResponse struct {
	TxHash common.Hash `json:"txHash"`
	Hash   string      `json:"hash"`
}

type ContractApi added in v0.22.0

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

func NewContractApi added in v0.22.0

func NewContractApi(baseApi *BaseApi, bc *blockchain.Blockchain, deferredTxs *deferredtx.Job, subManager *subscriptions.Manager) *ContractApi

NewContractApi creates a new NetApi instance

func (*ContractApi) BatchReadData added in v0.29.3

func (api *ContractApi) BatchReadData(contract common.Address, keys []KeyWithFormat) []ContractData

func (*ContractApi) Call added in v0.22.0

func (api *ContractApi) Call(ctx context.Context, args CallArgs) (common.Hash, error)

func (*ContractApi) Deploy added in v0.22.0

func (api *ContractApi) Deploy(ctx context.Context, args DeployArgs) (common.Hash, error)

func (*ContractApi) EstimateCall added in v0.22.0

func (api *ContractApi) EstimateCall(args CallArgs) (*TxReceipt, error)

func (*ContractApi) EstimateDeploy added in v0.22.0

func (api *ContractApi) EstimateDeploy(args DeployArgs) (*TxReceipt, error)

func (*ContractApi) EstimateTerminate added in v0.22.0

func (api *ContractApi) EstimateTerminate(args TerminateArgs) (*TxReceipt, error)

func (*ContractApi) Events added in v0.22.0

func (api *ContractApi) Events(args EventsArgs) interface{}

func (*ContractApi) GetStake added in v0.22.0

func (api *ContractApi) GetStake(contract common.Address) interface{}

func (*ContractApi) IterateMap added in v0.24.3

func (api *ContractApi) IterateMap(contract common.Address, mapName string, continuationToken *hexutil.Bytes, keyFormat, valueFormat string, limit int) (*IterateMapResponse, error)

func (*ContractApi) ReadData added in v0.22.0

func (api *ContractApi) ReadData(contract common.Address, key string, format string) (interface{}, error)

func (*ContractApi) ReadMap added in v0.24.3

func (api *ContractApi) ReadMap(contract common.Address, mapName string, key hexutil.Bytes, format string) (interface{}, error)

func (*ContractApi) ReadonlyCall added in v0.22.0

func (api *ContractApi) ReadonlyCall(args ReadonlyCallArgs) (interface{}, error)

func (*ContractApi) SubscribeToEvent added in v0.22.0

func (api *ContractApi) SubscribeToEvent(contract common.Address, event string) error

func (*ContractApi) Terminate added in v0.22.0

func (api *ContractApi) Terminate(ctx context.Context, args TerminateArgs) (common.Hash, error)

func (*ContractApi) UnsubscribeFromEvent added in v0.22.0

func (api *ContractApi) UnsubscribeFromEvent(contract common.Address, event string) error

type ContractData added in v0.29.3

type ContractData struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value,omitempty"`
	Error string      `json:"error,omitempty"`
}

type DelegateTxArgs added in v0.25.0

type DelegateTxArgs struct {
	To *common.Address `json:"to"`
	BaseTxArgs
}

type DeployArgs added in v0.22.0

type DeployArgs struct {
	From     common.Address  `json:"from"`
	CodeHash hexutil.Bytes   `json:"codeHash"`
	Amount   decimal.Decimal `json:"amount"`
	Args     DynamicArgs     `json:"args"`
	Nonce    hexutil.Bytes   `json:"nonce"`
	MaxFee   decimal.Decimal `json:"maxFee"`
	Code     hexutil.Bytes   `json:"code"`
}

type DnaApi

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

func NewDnaApi

func NewDnaApi(baseApi *BaseApi, bc *blockchain.Blockchain, ceremony *ceremony.ValidationCeremony, appVersion string,
	profileManager *profile.Manager) *DnaApi

func (*DnaApi) ActivateInvite

func (api *DnaApi) ActivateInvite(ctx context.Context, args ActivateInviteArgs) (common.Hash, error)

func (*DnaApi) ActivateInviteToRandAddr added in v0.21.0

func (api *DnaApi) ActivateInviteToRandAddr(ctx context.Context, args ActivateInviteToRandAddrArgs) (ActivateInviteToRandAddrResponse, error)

func (*DnaApi) BecomeOffline

func (api *DnaApi) BecomeOffline(ctx context.Context, args BaseTxArgs) (common.Hash, error)

func (*DnaApi) BecomeOnline

func (api *DnaApi) BecomeOnline(ctx context.Context, args BaseTxArgs) (common.Hash, error)

func (*DnaApi) Burn

func (api *DnaApi) Burn(ctx context.Context, args BurnArgs) (common.Hash, error)

func (*DnaApi) CeremonyIntervals

func (api *DnaApi) CeremonyIntervals() CeremonyIntervals

func (*DnaApi) ChangeProfile deprecated

func (api *DnaApi) ChangeProfile(ctx context.Context, args ChangeProfileArgs) (ChangeProfileResponse, error)

Deprecated: Use SendChangeProfileTx

func (*DnaApi) Delegate added in v0.25.0

func (api *DnaApi) Delegate(ctx context.Context, args DelegateTxArgs) (common.Hash, error)

func (*DnaApi) Epoch

func (api *DnaApi) Epoch() Epoch

func (*DnaApi) ExportKey

func (api *DnaApi) ExportKey(password string) (string, error)

func (*DnaApi) GetBalance

func (api *DnaApi) GetBalance(address common.Address) Balance

func (*DnaApi) GetCoinbaseAddr

func (api *DnaApi) GetCoinbaseAddr() common.Address

func (*DnaApi) GlobalState added in v0.28.6

func (api *DnaApi) GlobalState() GlobalState

func (*DnaApi) Identities

func (api *DnaApi) Identities() []Identity

func (*DnaApi) Identity

func (api *DnaApi) Identity(address *common.Address) Identity

func (*DnaApi) ImportKey

func (api *DnaApi) ImportKey(args ImportKeyArgs) error

func (*DnaApi) IsValidationReady added in v0.23.1

func (api *DnaApi) IsValidationReady() bool

func (*DnaApi) KillDelegator added in v0.25.0

func (api *DnaApi) KillDelegator(ctx context.Context, args KillDelegatorTxArgs) (common.Hash, error)

func (*DnaApi) MinimalClientVersion added in v0.27.0

func (api *DnaApi) MinimalClientVersion() string

func (*DnaApi) Profile deprecated

func (api *DnaApi) Profile(address *common.Address) (ProfileResponse, error)

Deprecated: Use Identity

func (*DnaApi) SendChangeProfileTx added in v0.28.4

func (api *DnaApi) SendChangeProfileTx(ctx context.Context, args SendChangeProfileTxArgs) (common.Hash, error)

func (*DnaApi) SendInvite

func (api *DnaApi) SendInvite(ctx context.Context, args SendInviteArgs) (Invite, error)

func (*DnaApi) SendToIpfs added in v0.28.6

func (api *DnaApi) SendToIpfs(ctx context.Context, args SendToIpfsArgs) (common.Hash, error)

func (*DnaApi) SendTransaction

func (api *DnaApi) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error)

func (*DnaApi) Sign

func (api *DnaApi) Sign(value string, format *SignedDataFormat) (hexutil.Bytes, error)

func (*DnaApi) SignatureAddress

func (api *DnaApi) SignatureAddress(args SignatureAddressArgs) (common.Address, error)

func (*DnaApi) State

func (api *DnaApi) State() State

func (*DnaApi) StoreToIpfs added in v0.25.3

func (api *DnaApi) StoreToIpfs(ctx context.Context, args StoreToIpfsTxArgs) (common.Hash, error)

func (*DnaApi) Undelegate added in v0.25.0

func (api *DnaApi) Undelegate(ctx context.Context, args BaseTxArgs) (common.Hash, error)

func (*DnaApi) Version

func (api *DnaApi) Version() string

func (*DnaApi) WordsSeed added in v0.23.1

func (api *DnaApi) WordsSeed() hexutil.Bytes

type DynamicArg added in v0.22.0

type DynamicArg struct {
	Index  int    `json:"index"`
	Format string `json:"format"`
	Value  string `json:"value"`
}

func (DynamicArg) ToBytes added in v0.22.0

func (a DynamicArg) ToBytes() ([]byte, error)

type DynamicArgs added in v0.22.0

type DynamicArgs []*DynamicArg

func (DynamicArgs) ToSlice added in v0.22.0

func (d DynamicArgs) ToSlice() ([][]byte, error)

type EncryptionKeyArgs added in v0.23.1

type EncryptionKeyArgs struct {
	Data      hexutil.Bytes `json:"data"`
	Signature hexutil.Bytes `json:"signature"`
	Epoch     uint16        `json:"epoch"`
}

type Epoch

type Epoch struct {
	StartBlock     uint64    `json:"startBlock"`
	Epoch          uint16    `json:"epoch"`
	NextValidation time.Time `json:"nextValidation"`
	CurrentPeriod  string    `json:"currentPeriod"`
}

type EstimateRawTxResponse added in v0.28.3

type EstimateRawTxResponse struct {
	Receipt *TxReceipt      `json:"receipt"`
	TxHash  common.Hash     `json:"txHash"`
	TxFee   decimal.Decimal `json:"txFee"`
}

type EstimateTxResponse added in v0.27.2

type EstimateTxResponse struct {
	TxHash common.Hash     `json:"txHash"`
	TxFee  decimal.Decimal `json:"txFee"`
}

type Event added in v0.22.0

type Event struct {
	Contract common.Address  `json:"contract"`
	Event    string          `json:"event"`
	Args     []hexutil.Bytes `json:"args"`
}

type EventsArgs added in v0.22.0

type EventsArgs struct {
	Contract common.Address `json:"contract"`
}

type Flip added in v1.0.3

type Flip struct {
	Hash string `json:"hash"`
	Pair uint8  `json:"pair"`
}

type FlipAnswer

type FlipAnswer struct {
	// Deprecated
	WrongWords *bool        `json:"wrongWords"`
	Grade      types.Grade  `json:"grade"`
	Answer     types.Answer `json:"answer"`
	Hash       string       `json:"hash"`
}

type FlipApi

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

func NewFlipApi

func NewFlipApi(baseApi *BaseApi, fp *flip.Flipper, ipfsProxy ipfs.Proxy, ceremony *ceremony.ValidationCeremony) *FlipApi

NewFlipApi creates a new FlipApi instance

func (*FlipApi) Delete

func (api *FlipApi) Delete(ctx context.Context, hash string) (common.Hash, error)

func (*FlipApi) Get

func (api *FlipApi) Get(hash string) (FlipResponse, error)

Works only for coinbase address

func (*FlipApi) GetKeys added in v0.21.4

func (api *FlipApi) GetKeys(addr common.Address, hash string) (FlipKeysResponse, error)

func (*FlipApi) GetRaw added in v0.21.4

func (api *FlipApi) GetRaw(hash string) (FlipResponse2, error)

func (*FlipApi) LongHashes

func (api *FlipApi) LongHashes(addr *common.Address) ([]FlipHashesResponse, error)

func (*FlipApi) PrivateEncryptionKeyCandidates added in v0.23.1

func (api *FlipApi) PrivateEncryptionKeyCandidates(addr common.Address) ([]hexutil.Bytes, error)

func (*FlipApi) RawSubmit added in v0.24.0

func (api *FlipApi) RawSubmit(args RawFlipSubmitArgs) (FlipSubmitResponse, error)

func (*FlipApi) SendPrivateEncryptionKeysPackage added in v0.23.1

func (api *FlipApi) SendPrivateEncryptionKeysPackage(args EncryptionKeyArgs) error

func (*FlipApi) SendPublicEncryptionKey added in v0.23.1

func (api *FlipApi) SendPublicEncryptionKey(args EncryptionKeyArgs) error

func (*FlipApi) ShortHashes

func (api *FlipApi) ShortHashes(addr *common.Address) ([]FlipHashesResponse, error)

func (*FlipApi) Submit

func (api *FlipApi) Submit(args FlipSubmitArgs) (FlipSubmitResponse, error)

func (*FlipApi) SubmitLongAnswers

func (api *FlipApi) SubmitLongAnswers(args SubmitAnswersArgs) (SubmitAnswersResponse, error)

func (*FlipApi) SubmitShortAnswers

func (api *FlipApi) SubmitShortAnswers(args SubmitAnswersArgs) (SubmitAnswersResponse, error)

func (*FlipApi) WordPairs added in v0.24.1

func (api *FlipApi) WordPairs(addr common.Address, vrfHash hexutil.Bytes) []FlipWords

func (*FlipApi) Words

func (api *FlipApi) Words(hash string) (FlipWordsResponse, error)

type FlipHashesResponse

type FlipHashesResponse struct {
	Hash      string `json:"hash"`
	Ready     bool   `json:"ready"`
	Extra     bool   `json:"extra"`
	Available bool   `json:"available"`
}

type FlipKeysResponse added in v0.21.4

type FlipKeysResponse struct {
	PublicKey  hexutil.Bytes `json:"publicKey"`
	PrivateKey hexutil.Bytes `json:"privateKey"`
}

type FlipResponse

type FlipResponse struct {
	Hex        hexutil.Bytes `json:"hex"`
	PrivateHex hexutil.Bytes `json:"privateHex"`
}

type FlipResponse2 added in v0.21.4

type FlipResponse2 struct {
	PublicHex  hexutil.Bytes `json:"publicHex"`
	PrivateHex hexutil.Bytes `json:"privateHex"`
}

type FlipSubmitArgs

type FlipSubmitArgs struct {
	Hex        *hexutil.Bytes `json:"hex"`
	PublicHex  *hexutil.Bytes `json:"publicHex"`
	PrivateHex *hexutil.Bytes `json:"privateHex"`
	PairId     uint8          `json:"pairId"`
}

type FlipSubmitResponse

type FlipSubmitResponse struct {
	TxHash common.Hash `json:"txHash"`
	Hash   string      `json:"hash"`
}

type FlipWords

type FlipWords struct {
	Words [2]uint32 `json:"words"`
	Used  bool      `json:"used"`
	Id    int       `json:"id"`
}

type FlipWordsResponse

type FlipWordsResponse struct {
	Words [2]int `json:"words"`
}

type GlobalState added in v0.28.6

type GlobalState struct {
	NetworkSize                  int             `json:"networkSize"`
	DiscriminationStakeThreshold decimal.Decimal `json:"discriminationStakeThreshold"`
}

type Identity

type Identity struct {
	Address             common.Address  `json:"address"`
	ProfileHash         string          `json:"profileHash"`
	Stake               decimal.Decimal `json:"stake"`
	ReplenishedStake    decimal.Decimal `json:"replenishedStake"`
	LockedStake         decimal.Decimal `json:"lockedStake"`
	Invites             uint8           `json:"invites"`
	Age                 uint16          `json:"age"`
	State               string          `json:"state"`
	PubKey              string          `json:"pubkey"`
	RequiredFlips       uint8           `json:"requiredFlips"`
	AvailableFlips      uint8           `json:"availableFlips"`
	FlipKeyWordPairs    []FlipWords     `json:"flipKeyWordPairs"`
	MadeFlips           uint8           `json:"madeFlips"`
	QualifiedFlips      uint32          `json:"totalQualifiedFlips"`
	ShortFlipPoints     float32         `json:"totalShortFlipPoints"`
	Flips               []string        `json:"flips"`
	FlipsWithPair       []Flip          `json:"flipsWithPair"`
	Online              bool            `json:"online"`
	Generation          uint32          `json:"generation"`
	Code                hexutil.Bytes   `json:"code"`
	Invitees            []state.TxAddr  `json:"invitees"`
	Penalty             decimal.Decimal `json:"penalty"`
	LastValidationFlags []string        `json:"lastValidationFlags"`
	Delegatee           *common.Address `json:"delegatee"`
	DelegationEpoch     uint16          `json:"delegationEpoch"`
	DelegationNonce     uint32          `json:"delegationNonce"`
	UndelegationEpoch   uint16          `json:"undelegationEpoch"`
	PendingUndelegation *common.Address `json:"pendingUndelegation"`
	IsPool              bool            `json:"isPool"`
	Inviter             *Inviter        `json:"inviter"`
	ShardId             uint32          `json:"shardId"`
	PenaltySeconds      uint16          `json:"penaltySeconds"`
	DiscriminationFlags []string        `json:"discriminationFlags"`
}

type ImportKeyArgs

type ImportKeyArgs struct {
	Key      string `json:"key"`
	Password string `json:"password"`
}

type InputAction added in v1.0.0

type InputAction struct {
	ActionType uint32        `json:"actionType"`
	Amount     hexutil.Bytes `json:"amount"`
	Method     string        `json:"method"`
	Args       hexutil.Bytes `json:"args"`
	GasLimit   uint64        `json:"gasLimit"`
}

type Invite

type Invite struct {
	Hash     common.Hash    `json:"hash"`
	Receiver common.Address `json:"receiver"`
	Key      string         `json:"key"`
}

type Inviter added in v0.26.4

type Inviter struct {
	TxHash      common.Hash    `json:"txHash"`
	Address     common.Address `json:"address"`
	EpochHeight uint32         `json:"epochHeight"`
}

type IpfsApi added in v0.22.0

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

func NewIpfsApi added in v0.22.0

func NewIpfsApi(ipfsProxy ipfs.Proxy) *IpfsApi

NewNetApi creates a new NetApi instance

func (*IpfsApi) Add added in v0.22.0

func (api *IpfsApi) Add(data hexutil.Bytes, pin bool) (string, error)

func (*IpfsApi) Cid added in v0.22.0

func (api *IpfsApi) Cid(data hexutil.Bytes) (string, error)

func (*IpfsApi) Get added in v0.22.0

func (api *IpfsApi) Get(cid string) (hexutil.Bytes, error)

type IterateMapResponse added in v0.24.3

type IterateMapResponse struct {
	Items             []*MapItem     `json:"items"`
	ContinuationToken *hexutil.Bytes `json:"continuationToken"`
}

type KeyWithFormat added in v0.29.3

type KeyWithFormat struct {
	Key    string `json:"key"`
	Format string `json:"format"`
}

type KillDelegatorTxArgs added in v0.25.0

type KillDelegatorTxArgs struct {
	To *common.Address `json:"to"`
	BaseTxArgs
}

type MapItem added in v0.24.3

type MapItem struct {
	Key   interface{} `json:"key"`
	Value interface{} `json:"value"`
}

type NetApi

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

NetApi offers helper utils

func NewNetApi

func NewNetApi(pm *protocol.IdenaGossipHandler, ipfsProxy ipfs.Proxy) *NetApi

NewNetApi creates a new NetApi instance

func (*NetApi) AddPeer

func (api *NetApi) AddPeer(url string) error

func (*NetApi) IpfsAddress

func (api *NetApi) IpfsAddress() string

func (*NetApi) Peers

func (api *NetApi) Peers() []Peer

func (*NetApi) PeersCount

func (api *NetApi) PeersCount() int

type Peer

type Peer struct {
	ID         string `json:"id"`
	RemoteAddr string `json:"addr"`
}

type ProfileResponse

type ProfileResponse struct {
	Info     *hexutil.Bytes `json:"info"`
	Nickname string         `json:"nickname"`
}

type RawFlipSubmitArgs added in v0.24.0

type RawFlipSubmitArgs struct {
	Tx                  *hexutil.Bytes `json:"tx"`
	EncryptedPublicHex  *hexutil.Bytes `json:"encryptedPublicHex"`
	EncryptedPrivateHex *hexutil.Bytes `json:"encryptedPrivateHex"`
}

type ReadonlyCallArgs added in v0.22.0

type ReadonlyCallArgs struct {
	Contract common.Address `json:"contract"`
	Method   string         `json:"method"`
	Format   string         `json:"format"`
	Args     DynamicArgs    `json:"args"`
}

type SendChangeProfileTxArgs added in v0.28.4

type SendChangeProfileTxArgs struct {
	Sender *common.Address `json:"sender"`
	Cid    string          `json:"cid"`
	MaxFee decimal.Decimal `json:"maxFee"`
}

type SendInviteArgs

type SendInviteArgs struct {
	To     common.Address  `json:"to"`
	Amount decimal.Decimal `json:"amount"`
	BaseTxArgs
}

SendInviteArgs represents the arguments to send invite

type SendToIpfsArgs added in v0.28.6

type SendToIpfsArgs struct {
	Tx   *hexutil.Bytes `json:"tx"`
	Data *hexutil.Bytes `json:"data"`
}

type SendTxArgs

type SendTxArgs struct {
	Type     types.TxType    `json:"type"`
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Amount   decimal.Decimal `json:"amount"`
	MaxFee   decimal.Decimal `json:"maxFee"`
	Payload  *hexutil.Bytes  `json:"payload"`
	Tips     decimal.Decimal `json:"tips"`
	UseProto bool            `json:"useProto"`
	BaseTxArgs
}

SendTxArgs represents the arguments to submit a new transaction into the transaction pool.

type SignatureAddressArgs

type SignatureAddressArgs struct {
	Value     string
	Signature hexutil.Bytes
	Format    *SignedDataFormat
}

type SignedDataFormat added in v1.1.0

type SignedDataFormat = string
const (
	DoubleHash SignedDataFormat = "doubleHash"
	Prefix     SignedDataFormat = "prefix"
)

type State

type State struct {
	Name string `json:"name"`
}

type StoreToIpfsTxArgs added in v0.25.3

type StoreToIpfsTxArgs struct {
	Cid string `json:"cid"`
	BaseTxArgs
}

type SubmitAnswersArgs

type SubmitAnswersArgs struct {
	Answers []FlipAnswer `json:"answers"`
}

type SubmitAnswersResponse

type SubmitAnswersResponse struct {
	TxHash common.Hash `json:"txHash"`
}

type Syncing

type Syncing struct {
	Syncing      bool   `json:"syncing"`
	CurrentBlock uint64 `json:"currentBlock"`
	HighestBlock uint64 `json:"highestBlock"`
	WrongTime    bool   `json:"wrongTime"`
	GenesisBlock uint64 `json:"genesisBlock"`
	Message      string `json:"message"`
}

type TerminateArgs added in v0.22.0

type TerminateArgs struct {
	From     common.Address  `json:"from"`
	Contract common.Address  `json:"contract"`
	Args     DynamicArgs     `json:"args"`
	MaxFee   decimal.Decimal `json:"maxFee"`
}

type Transaction

type Transaction struct {
	Hash      common.Hash     `json:"hash"`
	Type      string          `json:"type"`
	From      common.Address  `json:"from"`
	To        *common.Address `json:"to"`
	Amount    decimal.Decimal `json:"amount"`
	Tips      decimal.Decimal `json:"tips"`
	MaxFee    decimal.Decimal `json:"maxFee"`
	Nonce     uint32          `json:"nonce"`
	Epoch     uint16          `json:"epoch"`
	Payload   hexutil.Bytes   `json:"payload"`
	BlockHash common.Hash     `json:"blockHash"`
	UsedFee   decimal.Decimal `json:"usedFee"`
	Timestamp int64           `json:"timestamp"`
}

type Transactions

type Transactions struct {
	Transactions []*Transaction `json:"transactions"`
	Token        *hexutil.Bytes `json:"token"`
}

type TransactionsArgs

type TransactionsArgs struct {
	Address common.Address `json:"address"`
	Count   int            `json:"count"`
	Token   hexutil.Bytes  `json:"token"`
}

type TxReceipt added in v0.22.0

type TxReceipt struct {
	Contract        common.Address   `json:"contract"`
	Method          string           `json:"method"`
	Success         bool             `json:"success"`
	GasUsed         uint64           `json:"gasUsed"`
	TxHash          *common.Hash     `json:"txHash"`
	Error           string           `json:"error"`
	GasCost         decimal.Decimal  `json:"gasCost"`
	TxFee           decimal.Decimal  `json:"txFee"`
	ActionResult    *ActionResult    `json:"actionResult"`
	Events          []Event          `json:"events"`
	MinGasLimit     *uint64          `json:"minGasLimit,omitempty"`
	MinGasLimitCost *decimal.Decimal `json:"minGasLimitCost,omitempty"`
}

Jump to

Keyboard shortcuts

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