Skip to content

Commit 86064fb

Browse files
committed
fix websocket logic and add encoded transaction to errors
1 parent 7c0cf26 commit 86064fb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

api/spl/transaction_sender.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type InstructionError struct {
5050
}
5151

5252
func (e *InstructionError) Error() string {
53-
return fmt.Sprintf("instruction error. index: %d, type: %s, code: %d", e.Index, e.Type, e.Code)
53+
return fmt.Sprintf("instruction error. index: %d, type: %s, code: %d, transaction: %s", e.Index, e.Type, e.Code, e.EncodedTransaction)
5454
}
5555

5656
type AddComputeBudgetLimitParams struct {
@@ -91,12 +91,12 @@ func (ts *TransactionSender) AddComputeBudgetLimit(ctx context.Context, tx *sola
9191
if err != nil {
9292
return fmt.Errorf("failed to set compute budget limit. simulation failed: %s", simResult.Value.Err)
9393
}
94-
instErr := InstructionError{}
94+
instErr := InstructionError{EncodedTransaction: builtTx.MustToBase64()}
9595
err = json.Unmarshal(str, &instErr)
9696
if err != nil {
9797
return fmt.Errorf("failed to set compute budget limit. simulation failed: %s", str)
9898
}
99-
return fmt.Errorf("failed to set compute budget limit. simulation failed: %w", &instErr)
99+
return fmt.Errorf("failed to set compute budget limit. simulation failed: %w, logs: %s", &instErr, simResult.Value.Logs)
100100
}
101101

102102
if simResult.Value.UnitsConsumed == nil || *simResult.Value.UnitsConsumed == uint64(0) {
@@ -344,7 +344,7 @@ func makeWebsocketUrl(endpoint string) (string, error) {
344344

345345
websocketPort := ""
346346
if startPort > 0 {
347-
websocketPort = strconv.FormatInt(int64(startPort+1), 10)
347+
websocketPort = ":" + strconv.FormatInt(int64(startPort+1), 10)
348348
}
349349
return fmt.Sprintf("%s//%s%s%s", protocol, hostish, websocketPort, rest), nil
350350
}

0 commit comments

Comments
 (0)