Skip to content

Commit 4b494f7

Browse files
committed
Fix some rpc response type should be hexstring
Signed-off-by: Eval EXEC <execvy@gmail.com>
1 parent 1107c77 commit 4b494f7

File tree

4 files changed

+483
-14
lines changed

4 files changed

+483
-14
lines changed

indexer/types.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ const (
1818
)
1919

2020
type SearchKey struct {
21-
Script *types.Script `json:"script"`
22-
ScriptType types.ScriptType `json:"script_type"`
23-
ScriptSearchMode types.ScriptSearchMode `json:"script_search_mode,omitempty"`
24-
Filter *Filter `json:"filter,omitempty"`
25-
WithData bool `json:"with_data"`
21+
Script *types.Script `json:"script"`
22+
ScriptType types.ScriptType `json:"script_type"`
23+
ScriptSearchMode types.ScriptSearchMode `json:"script_search_mode,omitempty"`
24+
Filter *Filter `json:"filter,omitempty"`
25+
WithData bool `json:"with_data"`
26+
GroupByTransaction *bool `json:"group_by_transaction,omitempty"`
2627
}
2728

2829
type Filter struct {

rpc/client.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,16 @@ type Client interface {
172172

173173
RemoveTransaction(ctx context.Context, tx_hash types.Hash) (bool, error)
174174

175-
SendAlert(ctx context.Context, alert types.AlertMessage) error
175+
SendAlert(ctx context.Context, alert types.Alert) error
176176

177177
GetBlockTemplate(ctx context.Context) (types.BlockTemplate, error)
178178

179179
TxPoolReady(ctx context.Context) (bool, error)
180180

181181
// GetRawTxPool Returns all transaction ids in tx pool as a json array of string transaction ids.
182-
GetRawTxPool(ctx context.Context, verbose *bool) (*types.RawTxPool, error)
182+
GetRawTxPool(ctx context.Context) (*types.RawTxPool, error)
183+
// GetRawTxPool Returns all transaction ids in tx pool as a json array of string transaction ids.
184+
GetRawTxPoolVerbose(ctx context.Context) (*types.RawTxPoolVerbose, error)
183185

184186
// ClearTxPool Removes all transactions from the transaction pool.
185187
ClearTxPool(ctx context.Context) error
@@ -774,14 +776,21 @@ func (cli *client) TxPoolInfo(ctx context.Context) (*types.TxPoolInfo, error) {
774776
return &result, nil
775777
}
776778

777-
func (cli *client) GetRawTxPool(ctx context.Context, verbose *bool) (*types.RawTxPool, error) {
779+
func (cli *client) GetRawTxPool(ctx context.Context) (*types.RawTxPool, error) {
778780
var txPool types.RawTxPool
779781

780-
if verbose == nil {
781-
defaultVerbose := false
782-
verbose = &defaultVerbose
782+
err := cli.c.CallContext(ctx, &txPool, "get_raw_tx_pool")
783+
if err != nil {
784+
return nil, err
783785
}
784-
err := cli.c.CallContext(ctx, &txPool, "get_raw_tx_pool", verbose)
786+
787+
return &txPool, err
788+
}
789+
790+
func (cli *client) GetRawTxPoolVerbose(ctx context.Context) (*types.RawTxPoolVerbose, error) {
791+
var txPool types.RawTxPool
792+
793+
err := cli.c.CallContext(ctx, &txPool, "get_raw_tx_pool", true)
785794
if err != nil {
786795
return nil, err
787796
}
@@ -996,7 +1005,7 @@ func (cli *client) RemoveTransaction(ctx context.Context, tx_hash types.Hash) (b
9961005
return result, nil
9971006
}
9981007

999-
func (cli *client) SendAlert(ctx context.Context, alert types.AlertMessage) error {
1008+
func (cli *client) SendAlert(ctx context.Context, alert types.Alert) error {
10001009
return cli.c.CallContext(ctx, nil, "send_alert", alert)
10011010
}
10021011

0 commit comments

Comments
 (0)