From f89b8d72ef5ff98df10c7e329c1acbac6cdfe560 Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Tue, 20 Aug 2024 16:34:55 +0100 Subject: [PATCH] changes --- packages/rpc/README.md | 3 +-- packages/rpc/src/methods/keys.test.ts | 2 +- packages/rpc/src/methods/txnstatus.ts | 2 +- packages/rpc/src/util.ts | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/rpc/README.md b/packages/rpc/README.md index 366b3c09..90f8a3e7 100644 --- a/packages/rpc/README.md +++ b/packages/rpc/README.md @@ -12,9 +12,8 @@ This module provides a wrapper around common RPC calls used to fetch on-chain da ## Available Modules & Methods We now accepts rpcUrl in each method, so you can pass your own RPC regarding one of those on the list: -`packages/rpc/src/util.ts#9` +https://docs.near.org/api/rpc/providers -If `rpcUrl` is not passed, it will fallback to the `https://rpc.mainnet.near.org`. ### `getBalance(account: string, rpcUrl?: string): BN` diff --git a/packages/rpc/src/methods/keys.test.ts b/packages/rpc/src/methods/keys.test.ts index 82752465..07299496 100644 --- a/packages/rpc/src/methods/keys.test.ts +++ b/packages/rpc/src/methods/keys.test.ts @@ -4,7 +4,7 @@ import { AccessKey, getAccessKeys } from './keys'; jest.mock('cross-fetch'); describe('keys', () => { - const getRes = async (): Promise => await getAccessKeys({'nate.near', rpcUrl: 'rpc'}); + const getRes = async (): Promise => await getAccessKeys({ accountId: 'nate.near', rpcUrl: 'rpc'}); it('should return access keys for accounts', async () => { (fetch as jest.Mock).mockResolvedValueOnce({ diff --git a/packages/rpc/src/methods/txnstatus.ts b/packages/rpc/src/methods/txnstatus.ts index feb6a52c..d4797251 100644 --- a/packages/rpc/src/methods/txnstatus.ts +++ b/packages/rpc/src/methods/txnstatus.ts @@ -1,4 +1,4 @@ -import { queryNearRpc, requestFromNearRpc } from '../util'; +import { queryNearRpc } from '../util'; export type TxnStatus = 'pending' | 'success' | 'failure'; diff --git a/packages/rpc/src/util.ts b/packages/rpc/src/util.ts index 6e14ad5b..7032f399 100644 --- a/packages/rpc/src/util.ts +++ b/packages/rpc/src/util.ts @@ -2,7 +2,7 @@ import fetch from 'cross-fetch'; -export const queryNearRpc = async ({params, method, rpcUrl}) => { +export const queryNearRpc = async ({params, method, rpcUrl}): Promise<{ result: Record, error: unknown } | undefined> => { return await requestFromNearRpc({ jsonrpc: '2.0', id: 'dontcare',