|
|
@ -112,9 +112,11 @@ func (b *APIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.R |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// EventMux ...
|
|
|
|
// EventMux ...
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) EventMux() *event.TypeMux { return b.hmy.eventMux } |
|
|
|
func (b *APIBackend) EventMux() *event.TypeMux { return b.hmy.eventMux } |
|
|
|
|
|
|
|
|
|
|
|
// BloomStatus ...
|
|
|
|
// BloomStatus ...
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) BloomStatus() (uint64, uint64) { |
|
|
|
func (b *APIBackend) BloomStatus() (uint64, uint64) { |
|
|
|
sections, _, _ := b.hmy.bloomIndexer.Sections() |
|
|
|
sections, _, _ := b.hmy.bloomIndexer.Sections() |
|
|
|
return params.BloomBitsBlocks, sections |
|
|
|
return params.BloomBitsBlocks, sections |
|
|
@ -128,53 +130,63 @@ func (b *APIBackend) ProtocolVersion() int { |
|
|
|
// Filter related APIs
|
|
|
|
// Filter related APIs
|
|
|
|
|
|
|
|
|
|
|
|
// GetLogs ...
|
|
|
|
// GetLogs ...
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error) { |
|
|
|
func (b *APIBackend) GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error) { |
|
|
|
// TODO(ricl): implement
|
|
|
|
// TODO(ricl): implement
|
|
|
|
return nil, nil |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// HeaderByHash ...
|
|
|
|
// HeaderByHash ...
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) HeaderByHash(ctx context.Context, blockHash common.Hash) (*types.Header, error) { |
|
|
|
func (b *APIBackend) HeaderByHash(ctx context.Context, blockHash common.Hash) (*types.Header, error) { |
|
|
|
// TODO(ricl): implement
|
|
|
|
// TODO(ricl): implement
|
|
|
|
return nil, nil |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ServiceFilter ...
|
|
|
|
// ServiceFilter ...
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) { |
|
|
|
func (b *APIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) { |
|
|
|
// TODO(ricl): implement
|
|
|
|
// TODO(ricl): implement
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SubscribeNewTxsEvent ...
|
|
|
|
// SubscribeNewTxsEvent subcribes new tx event.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription { |
|
|
|
func (b *APIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription { |
|
|
|
return b.hmy.TxPool().SubscribeNewTxsEvent(ch) |
|
|
|
return b.hmy.TxPool().SubscribeNewTxsEvent(ch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SubscribeChainEvent ...
|
|
|
|
// SubscribeChainEvent subcribes chain event.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { |
|
|
|
func (b *APIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { |
|
|
|
return b.hmy.BlockChain().SubscribeChainEvent(ch) |
|
|
|
return b.hmy.BlockChain().SubscribeChainEvent(ch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SubscribeChainHeadEvent ...
|
|
|
|
// SubscribeChainHeadEvent subcribes chain head event.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription { |
|
|
|
func (b *APIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription { |
|
|
|
return b.hmy.BlockChain().SubscribeChainHeadEvent(ch) |
|
|
|
return b.hmy.BlockChain().SubscribeChainHeadEvent(ch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SubscribeChainSideEvent ...
|
|
|
|
// SubscribeChainSideEvent subcribes chain side event.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription { |
|
|
|
func (b *APIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription { |
|
|
|
return b.hmy.BlockChain().SubscribeChainSideEvent(ch) |
|
|
|
return b.hmy.BlockChain().SubscribeChainSideEvent(ch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SubscribeRemovedLogsEvent ...
|
|
|
|
// SubscribeRemovedLogsEvent subcribes removed logs event.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { |
|
|
|
func (b *APIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { |
|
|
|
return b.hmy.BlockChain().SubscribeRemovedLogsEvent(ch) |
|
|
|
return b.hmy.BlockChain().SubscribeRemovedLogsEvent(ch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SubscribeLogsEvent ...
|
|
|
|
// SubscribeLogsEvent subcribes log event.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { |
|
|
|
func (b *APIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { |
|
|
|
return b.hmy.BlockChain().SubscribeLogsEvent(ch) |
|
|
|
return b.hmy.BlockChain().SubscribeLogsEvent(ch) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetPoolTransactions ...
|
|
|
|
// GetPoolTransactions returns pool transactions.
|
|
|
|
|
|
|
|
// TODO: this is not implemented or verified yet for harmony.
|
|
|
|
func (b *APIBackend) GetPoolTransactions() (types.Transactions, error) { |
|
|
|
func (b *APIBackend) GetPoolTransactions() (types.Transactions, error) { |
|
|
|
pending, err := b.hmy.txPool.Pending() |
|
|
|
pending, err := b.hmy.txPool.Pending() |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -187,7 +199,7 @@ func (b *APIBackend) GetPoolTransactions() (types.Transactions, error) { |
|
|
|
return txs, nil |
|
|
|
return txs, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetBalance ...
|
|
|
|
// GetBalance returns balance of an given address.
|
|
|
|
func (b *APIBackend) GetBalance(address common.Address) (*hexutil.Big, error) { |
|
|
|
func (b *APIBackend) GetBalance(address common.Address) (*hexutil.Big, error) { |
|
|
|
balance, err := b.hmy.nodeAPI.GetBalanceOfAddress(address) |
|
|
|
balance, err := b.hmy.nodeAPI.GetBalanceOfAddress(address) |
|
|
|
return (*hexutil.Big)(balance), err |
|
|
|
return (*hexutil.Big)(balance), err |
|
|
|