• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Mintbase / mintbase-js / 6533192869

16 Oct 2023 11:55AM UTC coverage: 84.135%. First build
6533192869

Pull #408

github

tifrel
🤖 npm prerelease beta
Pull Request #408: Query account by public key

628 of 852 branches covered (0.0%)

Branch coverage included in aggregate %.

22 of 22 new or added lines in 4 files covered. (100.0%)

947 of 1020 relevant lines covered (92.84%)

4.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.26
/packages/rpc/src/methods/keys.ts
1
import { requestFromNearRpc } from '../util';
1✔
2

3
export type AccessKey = {
4
  public_key: string;
5
  permission: AccessKeyPermissions;
6
};
7

8
export type AccessKeyPermissions = 'FullAccess' | {
9
  'FunctionCall': {
10
    allowance: string;
11
    receiver_id: string;
12
    method_names: string[];
13
  };
14
}
15

16
export const getAccessKeys = async (accountId: string): Promise<AccessKey[]> => {
3✔
17
  const res = await requestFromNearRpc({
3✔
18
    jsonrpc: '2.0',
19
    id: 'dontcare',
20
    method: 'query',
21
    params: {
22
      request_type: 'view_access_key_list',
23
      finality: 'final',
24
      account_id: accountId,
25
    },
26
  });
27

28
  const accessKeys = res?.result?.keys;
3!
29
  if (res?.error) {
3!
30
    throw res.error;
×
31
  }
32
  if (!accessKeys) {
3✔
33
    throw new Error(`Malformed response: ${JSON.stringify(res)}`);
2✔
34
  }
35
  return accessKeys;
1✔
36
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc