Skip to content

Commit cf34f31

Browse files
committed
rework solana relayer proto types
1 parent 70bb558 commit cf34f31

File tree

11 files changed

+520
-166
lines changed

11 files changed

+520
-166
lines changed

e2e/interchaintestv8/solana/solana.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (s *Solana) NewTransactionFromInstructions(payerPubKey solana.PublicKey, in
5555
)
5656
}
5757

58-
// SignTx signs a transaction with the provided signers, broadcasts it, and confirms it.
58+
// SignTx signs a transaction with the provided signers, broadcasts it, and confirms it is finalized.
5959
func (s *Solana) SignAndBroadcastTx(ctx context.Context, tx *solana.Transaction, signers ...*solana.Wallet) (solana.Signature, error) {
6060
_, err := s.SignTx(ctx, tx, signers...)
6161
if err != nil {
@@ -110,6 +110,7 @@ func confirmationStatusLevel(status rpc.ConfirmationStatusType) int {
110110
}
111111
}
112112

113+
// Waits for transaction reaching status
113114
func (s *Solana) WaitForTxStatus(txSig solana.Signature, status rpc.ConfirmationStatusType) error {
114115
return testutil.WaitForCondition(time.Second*30, time.Second, func() (bool, error) {
115116
out, err := s.RPCClient.GetSignatureStatuses(context.TODO(), false, txSig)
@@ -177,10 +178,12 @@ func (s *Solana) WaitForProgramAvailabilityWithTimeout(ctx context.Context, prog
177178
return false
178179
}
179180

181+
// SignTx signs a transaction with the provided signers, broadcasts it, and confirms it is finalized, retries with default timeout
180182
func (s *Solana) SignAndBroadcastTxWithRetry(ctx context.Context, tx *solana.Transaction, wallet *solana.Wallet) (solana.Signature, error) {
181183
return s.SignAndBroadcastTxWithRetryTimeout(ctx, tx, wallet, 30)
182184
}
183185

186+
// SignTx signs a transaction with the provided signers, broadcasts it, and confirms it is finalized, retries with timeout
184187
func (s *Solana) SignAndBroadcastTxWithRetryTimeout(ctx context.Context, tx *solana.Transaction, wallet *solana.Wallet, timeoutSeconds int) (solana.Signature, error) {
185188
var lastErr error
186189
for range timeoutSeconds {
@@ -194,10 +197,12 @@ func (s *Solana) SignAndBroadcastTxWithRetryTimeout(ctx context.Context, tx *sol
194197
return solana.Signature{}, fmt.Errorf("transaction broadcast timed out after %d seconds: %w", timeoutSeconds, lastErr)
195198
}
196199

200+
// SignTx signs a transaction with the provided signers, broadcasts it, and confirms it is in confirmed status
197201
func (s *Solana) SignAndBroadcastTxWithConfirmedStatus(ctx context.Context, tx *solana.Transaction, wallet *solana.Wallet) (solana.Signature, error) {
198202
return s.SignAndBroadcastTxWithOpts(ctx, tx, wallet, rpc.ConfirmationStatusConfirmed)
199203
}
200204

205+
// SignTx signs a transaction with the provided signers, broadcasts it, and confirms it is in requested status
201206
func (s *Solana) SignAndBroadcastTxWithOpts(ctx context.Context, tx *solana.Transaction, wallet *solana.Wallet, status rpc.ConfirmationStatusType) (solana.Signature, error) {
202207
_, err := s.SignTx(ctx, tx, wallet)
203208
if err != nil {

0 commit comments

Comments
 (0)