-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathsend_transaction.go
31 lines (24 loc) · 1.27 KB
/
send_transaction.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package rpc
import (
"context"
)
type SendTransactionResponse JsonRpcResponse[string]
type SendTransactionConfigEncoding string
const (
SendTransactionConfigEncodingBase58 SendTransactionConfigEncoding = "base58"
SendTransactionConfigEncodingBase64 SendTransactionConfigEncoding = "base64"
)
type SendTransactionConfig struct {
SkipPreflight bool `json:"skipPreflight,omitempty"` // default: false
PreflightCommitment Commitment `json:"preflightCommitment,omitempty"` // default: finalized
Encoding SendTransactionConfigEncoding `json:"encoding,omitempty"` // default: base58
MaxRetries uint64 `json:"maxRetries,omitempty"`
}
// SendTransaction submits a signed transaction to the cluster for processing
func (c *RpcClient) SendTransaction(ctx context.Context, tx string) (JsonRpcResponse[string], error) {
return call[JsonRpcResponse[string]](c, ctx, "sendTransaction", tx)
}
// SendTransaction submits a signed transaction to the cluster for processing
func (c *RpcClient) SendTransactionWithConfig(ctx context.Context, tx string, cfg SendTransactionConfig) (JsonRpcResponse[string], error) {
return call[JsonRpcResponse[string]](c, ctx, "sendTransaction", tx, cfg)
}