diff --git a/packages/client/src/composer.ts b/packages/client/src/composer.ts index 9f3a5fb856..b085bb425a 100644 --- a/packages/client/src/composer.ts +++ b/packages/client/src/composer.ts @@ -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; } @@ -36,7 +36,7 @@ export class NearClient { private signMessage: (message: Uint8Array) => Promise = () => 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(); diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 2ea0ab2e93..8f4f7dbbb4 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -1,3 +1,4 @@ -export { NearClient } from './composer'; +export { ClientParams, NearClient } from './composer'; +export * from './methods'; export { TransactionComposer } from './transactions'; export { Viewer } from './viewer'; diff --git a/packages/client/src/methods.ts b/packages/client/src/methods.ts new file mode 100644 index 0000000000..8ecae675f5 --- /dev/null +++ b/packages/client/src/methods.ts @@ -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);