Skip to content

Commit

Permalink
Merge pull request #1347 from LimeChain/update-tx-execution-status-value
Browse files Browse the repository at this point in the history
Update tx execution status
  • Loading branch information
vikinatora committed May 21, 2024
2 parents b61b66d + 92a6f5b commit 80d2a10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/silver-chicken-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@near-js/providers": patch
"@near-js/types": patch
---

Update tx execution status default value.
6 changes: 3 additions & 3 deletions packages/providers/src/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class JsonRpcProvider extends Provider {
* @param signedTransaction The signed transaction being sent
*/
async sendTransaction(signedTransaction: SignedTransaction): Promise<FinalExecutionOutcome> {
return this.sendTransactionUntil(signedTransaction, 'FINAL');
return this.sendTransactionUntil(signedTransaction, 'EXECUTED_OPTIMISTIC');
}

/**
Expand All @@ -144,7 +144,7 @@ export class JsonRpcProvider extends Provider {
* @param accountId The NEAR account that signed the transaction
* @param waitUntil
*/
async txStatus(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'FINAL'): Promise<FinalExecutionOutcome> {
async txStatus(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'EXECUTED_OPTIMISTIC'): Promise<FinalExecutionOutcome> {
if (typeof txHash === 'string') {
return this.txStatusString(txHash, accountId, waitUntil);
} else {
Expand All @@ -168,7 +168,7 @@ export class JsonRpcProvider extends Provider {
* @param waitUntil
* @returns {Promise<FinalExecutionOutcome>}
*/
async txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'FINAL'): Promise<FinalExecutionOutcome> {
async txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'EXECUTED_OPTIMISTIC'): Promise<FinalExecutionOutcome> {
if (typeof txHash === 'string') {
return this.sendJsonRpc('EXPERIMENTAL_tx_status', { tx_hash: txHash, sender_account_id: accountId, wait_until: waitUntil });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/provider/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type BlockId = BlockHash | BlockHeight;

export type Finality = 'optimistic' | 'near-final' | 'final'

export type TxExecutionStatus = 'NONE' | 'INCLUDED' | 'INCLUDED_FINAL' | 'EXECUTED' | 'FINAL';
export type TxExecutionStatus = 'NONE' | 'INCLUDED' | 'INCLUDED_FINAL' | 'EXECUTED' | 'FINAL' | 'EXECUTED_OPTIMISTIC';

export type BlockReference = { blockId: BlockId } | { finality: Finality } | { sync_checkpoint: 'genesis' | 'earliest_available' }

Expand Down

0 comments on commit 80d2a10

Please sign in to comment.