From c84a8b8cbe3b24aaa8a51c3a3502f5779c69b47d Mon Sep 17 00:00:00 2001 From: Eval EXEC Date: Sun, 27 Oct 2024 15:28:36 +0800 Subject: [PATCH] Add support to v0.119.0 --- rpc/client.go | 14 ++++++++++++++ types/chain.go | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/rpc/client.go b/rpc/client.go index be721eb5..776dfc40 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -152,6 +152,9 @@ type Client interface { // SendTransaction send new transaction into transaction pool. SendTransaction(ctx context.Context, tx *types.Transaction) (*types.Hash, error) + // SendTestTransaction send new transaction into transaction pool. + SendTestTransaction(ctx context.Context, tx *types.Transaction) (*types.Hash, error) + /// Test if a transaction can be accepted by the transaction pool without inserting it into the pool or rebroadcasting it to peers. /// The parameters and errors of this method are the same as `send_transaction`. TestTxPoolAccept(ctx context.Context, tx *types.Transaction) (*types.EntryCompleted, error) @@ -685,6 +688,17 @@ func (cli *client) SendTransaction(ctx context.Context, tx *types.Transaction) ( return &result, err } +func (cli *client) SendTestTransaction(ctx context.Context, tx *types.Transaction) (*types.Hash, error) { + var result types.Hash + + err := cli.c.CallContext(ctx, &result, "send_test_transaction", *tx, "passthrough") + if err != nil { + return nil, err + } + + return &result, err +} + // TestTxPoolAccept(ctx context.Context, tx *types.Transaction) (*types.EntryCompleted, error) func (cli *client) TestTxPoolAccept(ctx context.Context, tx *types.Transaction) (*types.EntryCompleted, error) { var result types.EntryCompleted diff --git a/types/chain.go b/types/chain.go index bc5b6967..c5e0612e 100644 --- a/types/chain.go +++ b/types/chain.go @@ -231,9 +231,11 @@ type CellWithStatus struct { } type TxStatus struct { - Status TransactionStatus `json:"status"` - BlockHash *Hash `json:"block_hash"` - Reason *string `json:"reason"` + Status TransactionStatus `json:"status"` + BlockHash *Hash `json:"block_hash"` + BlockNumber *uint64 `json:"block_number"` + TxIndex *uint `json:"tx_index"` + Reason *string `json:"reason"` } type TransactionWithStatus struct {