From 378043d80da2dd2467feed97fbd10611fe129d6a Mon Sep 17 00:00:00 2001 From: duggavo <> Date: Mon, 29 May 2023 09:02:38 +0200 Subject: [PATCH] Add relay_tx --- rpc/wallet/jsonrpc.go | 11 +++++++++++ rpc/wallet/jsonrpc_types.go | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/rpc/wallet/jsonrpc.go b/rpc/wallet/jsonrpc.go index 8f81a9f..102e5b6 100644 --- a/rpc/wallet/jsonrpc.go +++ b/rpc/wallet/jsonrpc.go @@ -152,5 +152,16 @@ func (c *Client) SweepAll(ctx context.Context, params SweepAllParams) (*SweepAll } return resp, nil +} + +func (c *Client) RelayTx(ctx context.Context, hex string) (*RelayTxResult, error) { + resp := &RelayTxResult{} + if err := c.JSONRPC(ctx, "relay_tx", map[string]string{ + "hex": hex, + }, resp); err != nil { + return nil, fmt.Errorf("jsonrpc: %w", err) + } + + return resp, nil } diff --git a/rpc/wallet/jsonrpc_types.go b/rpc/wallet/jsonrpc_types.go index 2dcbd80..5cf8b2f 100644 --- a/rpc/wallet/jsonrpc_types.go +++ b/rpc/wallet/jsonrpc_types.go @@ -174,3 +174,7 @@ type SweepAllResult struct { WeightList []uint64 `json:"weight_list"` TxBlobList []string `json:"tx_blob_list"` } + +type RelayTxResult struct { + TxHash string `json:"tx_hash"` +}