diff --git a/.changeset/silver-chicken-kiss.md b/.changeset/silver-chicken-kiss.md new file mode 100644 index 000000000..55754ef8b --- /dev/null +++ b/.changeset/silver-chicken-kiss.md @@ -0,0 +1,6 @@ +--- +"@near-js/providers": patch +"@near-js/types": patch +--- + +Update tx execution status default value. diff --git a/packages/providers/src/json-rpc-provider.ts b/packages/providers/src/json-rpc-provider.ts index 1d3c299c8..6710868af 100644 --- a/packages/providers/src/json-rpc-provider.ts +++ b/packages/providers/src/json-rpc-provider.ts @@ -123,7 +123,7 @@ export class JsonRpcProvider extends Provider { * @param signedTransaction The signed transaction being sent */ async sendTransaction(signedTransaction: SignedTransaction): Promise { - return this.sendTransactionUntil(signedTransaction, 'FINAL'); + return this.sendTransactionUntil(signedTransaction, 'EXECUTED_OPTIMISTIC'); } /** @@ -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 { + async txStatus(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'EXECUTED_OPTIMISTIC'): Promise { if (typeof txHash === 'string') { return this.txStatusString(txHash, accountId, waitUntil); } else { @@ -168,7 +168,7 @@ export class JsonRpcProvider extends Provider { * @param waitUntil * @returns {Promise} */ - async txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'FINAL'): Promise { + async txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'EXECUTED_OPTIMISTIC'): Promise { if (typeof txHash === 'string') { return this.sendJsonRpc('EXPERIMENTAL_tx_status', { tx_hash: txHash, sender_account_id: accountId, wait_until: waitUntil }); } diff --git a/packages/types/src/provider/protocol.ts b/packages/types/src/provider/protocol.ts index c003a9590..4a000df47 100644 --- a/packages/types/src/provider/protocol.ts +++ b/packages/types/src/provider/protocol.ts @@ -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' }