Skip to content

Commit

Permalink
feat: example methods
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-haynes committed Jun 5, 2024
1 parent 57204f1 commit 1c296d1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Viewer } from './viewer';
import { TransactionComposer } from './transactions';
import type { CallOptions, ViewOptions } from './types';

interface ConstructorParams {
export interface ClientParams {
network: string;
}

Expand All @@ -36,7 +36,7 @@ export class NearClient {
private signMessage: (message: Uint8Array) => Promise<PublicKeySignature> = () => new Promise((_, rej) => rej('SignerNotInitialized'));
private signingAccountId: string;

constructor({ network }: ConstructorParams = { network: 'mainnet' }) {
constructor({ network }: ClientParams = { network: 'mainnet' }) {
this.network = network;
if (network === 'mainnet') {
this.withMainnetRpc();
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { NearClient } from './composer';
export { ClientParams, NearClient } from './composer';
export * from './methods';
export { TransactionComposer } from './transactions';
export { Viewer } from './viewer';
4 changes: 4 additions & 0 deletions packages/client/src/methods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { ClientParams, NearClient } from './composer';

export const getBalance = (accountId: string, clientOptions?: ClientParams) => new NearClient(clientOptions).getBalance(accountId);
export const getContractCode = (accountId: string, clientOptions?: ClientParams) => new NearClient(clientOptions).viewer.contractCode(accountId);

0 comments on commit 1c296d1

Please sign in to comment.