near / near-api-js

JavaScript library to interact with NEAR Protocol via RPC API
https://near.github.io/near-api-js
MIT License
388 stars 240 forks source link

Account.sendMoney transaction execution level #1346

Closed pustovalov closed 1 month ago

pustovalov commented 1 month ago

Prerequisites

Description

Hi,

In nearcore 1.39.0, the default behavior for transaction execution level was changed to no longer waits for refund receipts

 #[default]
 ExecutedOptimistic

https://github.com/near/nearcore/pull/10948 https://docs.near.org/api/rpc/transactions#tx-status-result

However, in near-api-js, it still uses FINAL https://github.com/near/near-api-js/blob/b61b66d271146f0a1b5b88e75da06dffc354860e/packages/providers/src/json-rpc-provider.ts#L125-L127

Can this be changed to EXECUTED_OPTIMISTIC for all transactions or for Account.sendMoney?

Steps to reproduce

await senderAccount.sendMoney(receiver, amount)

Expected behavior

    async sendTransaction(signedTransaction: SignedTransaction): Promise<FinalExecutionOutcome> {
        return this.sendTransactionUntil(signedTransaction, 'EXECUTED_OPTIMISTIC');
    }

Actual behavior

    async sendTransaction(signedTransaction: SignedTransaction): Promise<FinalExecutionOutcome> {
        return this.sendTransactionUntil(signedTransaction, 'FINAL');
    }

Self-service