Skip to content

Commit

Permalink
feat: remove get_cells_by_lock_hash RPC and RPCs under indexer module
Browse files Browse the repository at this point in the history
The following methods have been removed:
1. IndexLockHash
2. GetLockHashIndexStates
3. GetLiveCellsByLockHash
4. GetTransactionsByLockHash
5. DeindexLockHash
6. GetCellsByLockHash

BREAKING CHANGE: Remove RPCs under indexer module
  • Loading branch information
shaojunda committed Mar 10, 2021
1 parent 363af48 commit fc920d4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 158 deletions.
152 changes: 23 additions & 129 deletions mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ type Client interface {
// GetHeaderByNumber returns the information about a block header by block number.
GetHeaderByNumber(ctx context.Context, number uint64) (*types.Header, error)

// GetCellsByLockHash returns the information about cells collection by the hash of lock script.
GetCellsByLockHash(ctx context.Context, hash types.Hash, from uint64, to uint64) ([]*types.Cell, error)

// GetLiveCell returns the information about a cell by out_point if it is live.
// If second with_data argument set to true, will return cell data and data_hash if it is live.
GetLiveCell(ctx context.Context, outPoint *types.OutPoint, withData bool) (*types.CellWithStatus, error)
Expand Down Expand Up @@ -74,23 +71,6 @@ type Client interface {
// EstimateFeeRate Estimate a fee rate (capacity/KB) for a transaction that to be committed in expect blocks.
EstimateFeeRate(ctx context.Context, blocks uint64) (*types.EstimateFeeRateResult, error)

////// Indexer
// IndexLockHash create index for live cells and transactions by the hash of lock script.
IndexLockHash(ctx context.Context, lockHash types.Hash, indexFrom uint64) (*types.LockHashIndexState, error)

// GetLockHashIndexStates Get lock hash index states.
GetLockHashIndexStates(ctx context.Context) ([]*types.LockHashIndexState, error)

// GetLiveCellsByLockHash returns the live cells collection by the hash of lock script.
GetLiveCellsByLockHash(ctx context.Context, lockHash types.Hash, page uint, per uint, reverseOrder bool) ([]*types.LiveCell, error)

// GetTransactionsByLockHash returns the transactions collection by the hash of lock script.
// Returns empty array when the lock_hash has not been indexed yet.
GetTransactionsByLockHash(ctx context.Context, lockHash types.Hash, page uint, per uint, reverseOrder bool) ([]*types.CellTransaction, error)

// DeindexLockHash Remove index for live cells and transactions by the hash of lock script.
DeindexLockHash(ctx context.Context, lockHash types.Hash) error

////// Net
// LocalNodeInfo returns the local node information.
LocalNodeInfo(ctx context.Context) (*types.Node, error)
Expand Down Expand Up @@ -285,15 +265,6 @@ func (cli *client) GetHeaderByNumber(ctx context.Context, number uint64) (*types
return toHeader(result), err
}

func (cli *client) GetCellsByLockHash(ctx context.Context, hash types.Hash, from uint64, to uint64) ([]*types.Cell, error) {
var result []cell
err := cli.c.CallContext(ctx, &result, "get_cells_by_lock_hash", hash, hexutil.Uint64(from), hexutil.Uint64(to))
if err != nil {
return nil, err
}
return toCells(result), err
}

func (cli *client) GetLiveCell(ctx context.Context, point *types.OutPoint, withData bool) (*types.CellWithStatus, error) {
var result cellWithStatus
err := cli.c.CallContext(ctx, &result, "get_live_cell", outPoint{
Expand Down

0 comments on commit fc920d4

Please sign in to comment.