Skip to content

cli: spl-token transfer --no-wait still waits for transaction to confirm #67

@joncinque

Description

@joncinque

Recreation of solana-labs/solana-program-library#7595

Problem

Running the transfer command with the --no-wait flag still waits for transaction confirmation.

Given the above description, the expected behavior is to return the transaction signature immediately after sending the transaction.

Solution

The simplest solution would be to change the client.send_and_confirm_transaction call to client.send_transaction, especially since the transactions are already being confirmed inside the finish_tx function as mentioned earlier.

However, this would affect people who use the spl-token-client and expect the methods of Token to confirm transactions. For example, it may break local testing, including the tests in this repository. Considering this, an improved version of this solution would be to convert the ProgramRpcClientSendTransaction struct to a named one and add a confirm field to decide whether to also confirm the transaction inside its SendTransactionRpc implementation.

Another solution would be to:

  • Rename ProgramRpcClientSendTransaction to ProgramRpcClientSendAndConfirmTransaction
  • Add ProgramRpcClientSendTransaction that only sends the transaction in its SendTransactionRpc::send method

as mentioned in solana-labs/solana-program-library#3139 (review), but a downside of this solution is that it requires quite a bit more changes than the previous solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions