Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broadcast_tx_async should have default wait_until value of NONE, it is currently the default (ExecutedOptimistic) #143

Closed
jaswinder6991 opened this issue Apr 22, 2024 · 0 comments · Fixed by #142

Comments

@jaswinder6991
Copy link
Contributor

jaswinder6991 commented Apr 22, 2024

According to the RPC specs published here:

Using send_tx with wait_until = NONE is equal to legacy broadcast_tx_async method.
Using send_tx with finality wait_until = EXECUTED_OPTIMISTIC is equal to legacy broadcast_tx_commit method.

In the current src/methods/broadcast_tx_async.rs the From trait isn't implemented correctly as the wait_until is set to the default transaction status = ExecutedOptimistic

impl From<RpcBroadcastTxAsyncRequest>
    for near_jsonrpc_primitives::types::transactions::RpcSendTransactionRequest
{
    fn from(this: RpcBroadcastTxAsyncRequest) -> Self {
        Self {
            signed_transaction: this.signed_transaction,
            wait_until: near_primitives::views::TxExecutionStatus::default(),
        }
    }
}

It should be implemented as

impl From<RpcBroadcastTxAsyncRequest>
    for near_jsonrpc_primitives::types::transactions::RpcSendTransactionRequest
{
    fn from(this: RpcBroadcastTxAsyncRequest) -> Self {
        Self {
            signed_transaction: this.signed_transaction,
            wait_until: near_primitives::views::TxExecutionStatus::None,
        }
    }
}

Addressed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant