Skip to content

Commit

Permalink
rm redundant api
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasir Shariff committed Jan 8, 2024
1 parent 3d14f00 commit d6f8a9a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 34 deletions.
2 changes: 1 addition & 1 deletion __tests__/08.fast-forward.ava.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (getNetworkFromEnv() === 'sandbox') {
const env_after = after as EnvData;
console.log(`After: timestamp = ${env_after[0]}, epoch_height = ${env_after[1]}`);

const block = await t.context.worker.provider.viewBlock();
const block = await t.context.worker.provider.block({finality: 'final'});

// Rounding off to nearest hundred, providing wiggle room incase not perfectly `forward_height`
t.true(Math.ceil(block.header.height / 100) * 100 === forward_height);
Expand Down
10 changes: 1 addition & 9 deletions packages/js/dist/jsonrpc.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/js/dist/jsonrpc.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions packages/js/dist/jsonrpc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/js/dist/jsonrpc.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions packages/js/src/jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import process from 'process';
import {NEAR} from 'near-units';
import {stringifyJsonOrBytes} from 'near-api-js/lib/transaction';
import {Records} from './record';
import {JSONRpc, ContractCodeView, AccountView, NearProtocolConfig, AccountBalance, CodeResult, ViewStateResult, BlockId, Finality, StateItem, TESTNET_RPC_ADDR, Empty, MAINNET_RPC_ADDR, PublicKey, Network, AccessKeyView, AccessKeyList, BlockHash, BlockHeight, BlockResult} from './types';
import {JSONRpc, ContractCodeView, AccountView, NearProtocolConfig, AccountBalance, CodeResult, ViewStateResult, BlockId, Finality, StateItem, TESTNET_RPC_ADDR, Empty, MAINNET_RPC_ADDR, PublicKey, Network, AccessKeyView, AccessKeyList} from './types';

const OPTIMISTIC: {finality: 'optimistic'} = {finality: 'optimistic'};
/**
Expand Down Expand Up @@ -200,17 +200,6 @@ export class JsonRpcProvider extends JSONRpc {
async fastForward(deltaHeight: number): Promise<Empty> {
return this.sendJsonRpc('sandbox_fast_forward', {delta_height: deltaHeight});
}

/**
* Get details about specific blocks or chunks.
* The `block` can be a block height or a block hash, defaulting to
* finality param to return latest block.
* @param block
* @returns Promise<BlockResult>
*/
async viewBlock(block?: BlockHash | BlockHeight): Promise<BlockResult> {
return this.sendJsonRpc('block', block ? {block_id: block} : {finality: 'final'});
}
}

export const TestnetRpc = JsonRpcProvider.from(TESTNET_RPC_ADDR);
Expand Down

0 comments on commit d6f8a9a

Please sign in to comment.