Skip to content

Commit

Permalink
fix: fix wait_until and signed_tx_base64 parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
vikinatora committed Mar 14, 2024
1 parent d9b0657 commit bff2ba2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/providers/src/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class JsonRpcProvider extends Provider {
*/
async sendTransactionUntil(signedTransaction: SignedTransaction, waitUntil: TxExecutionStatus): Promise<TxOutcome> {
const bytes = encodeTransaction(signedTransaction);
return this.sendJsonRpc('send_tx', { signed_transaction: Buffer.from(bytes).toString('base64'), wait_until: waitUntil });
return this.sendJsonRpc('send_tx', { signed_tx_base64: Buffer.from(bytes).toString('base64'), wait_until: waitUntil });
}

/**
Expand All @@ -99,7 +99,7 @@ export class JsonRpcProvider extends Provider {
* @param signedTransaction The signed transaction being sent
*/
async sendTransaction(signedTransaction: SignedTransaction): Promise<TxOutcome> {
return this.sendTransactionUntil(signedTransaction, 'Final');
return this.sendTransactionUntil(signedTransaction, 'FINAL');
}

/**
Expand All @@ -109,7 +109,7 @@ export class JsonRpcProvider extends Provider {
* @returns {Promise<TxOutcome>}
*/
async sendTransactionAsync(signedTransaction: SignedTransaction): Promise<TxOutcome> {
return this.sendTransactionUntil(signedTransaction, 'None');
return this.sendTransactionUntil(signedTransaction, 'NONE');
}

/**
Expand All @@ -120,7 +120,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<TxOutcome> {
async txStatus(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'FINAL'): Promise<TxOutcome> {
if (typeof txHash === 'string') {
return this.txStatusString(txHash, accountId, waitUntil);
} else {
Expand All @@ -144,7 +144,7 @@ export class JsonRpcProvider extends Provider {
* @param waitUntil
* @returns {Promise<TxOutcome>}
*/
async txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'Final'): Promise<TxOutcome> {
async txStatusReceipts(txHash: Uint8Array | string, accountId: string, waitUntil: TxExecutionStatus = 'FINAL'): Promise<TxOutcome> {
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 @@ -32,7 +32,7 @@ export type BlockId = BlockHash | BlockHeight;

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

export type TxExecutionStatus = 'None' | 'Included' | 'IncludedFinal' | 'Executed' | 'Final';
export type TxExecutionStatus = 'NONE' | 'INCLUDED' | 'INCLUDED_FINAL' | 'EXECUTED' | 'FINAL';

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

Expand Down

0 comments on commit bff2ba2

Please sign in to comment.