Skip to content

Commit 0ddbeec

Browse files
committed
feat: default to production env
1 parent 7cf6075 commit 0ddbeec

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

packages/client/src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ export class AaveClient {
6060
* @param options - The options to configure the client.
6161
* @returns The new instance of the client.
6262
*/
63-
static create(options: ClientConfig): AaveClient {
64-
return new AaveClient(configureContext(options));
63+
static create(options?: ClientConfig): AaveClient {
64+
return new AaveClient(configureContext(options ?? {}));
6565
}
6666

6767
/**

packages/client/src/config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import type { TypedDocumentNode } from '@urql/core';
66
*/
77
export type ClientConfig = {
88
/**
9-
* The environment configuration to use (e.g. `mainnet`, `testnet`).
9+
* @internal
10+
* @defaultValue `production`
1011
*/
11-
environment: EnvironmentConfig;
12+
environment?: EnvironmentConfig;
1213
/**
1314
* Whether to enable caching.
1415
*
@@ -23,6 +24,8 @@ export type ClientConfig = {
2324
debug?: boolean;
2425
/**
2526
* The custom fragments to use.
27+
*
28+
* @experimental This is an experimental API and may be subject to breaking changes.
2629
*/
2730
fragments?: TypedDocumentNode[];
2831
};

packages/client/src/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { EnvironmentConfig } from '@aave/env';
1+
import { type EnvironmentConfig, production } from '@aave/env';
22

33
import type { ClientConfig } from './config';
44
import { FragmentResolver } from './fragments';
@@ -18,7 +18,7 @@ export type Context = {
1818
*/
1919
export function configureContext(from: ClientConfig): Context {
2020
return {
21-
environment: from.environment,
21+
environment: from.environment ?? production,
2222
cache: from.cache ?? false,
2323
debug: from.debug ?? false,
2424
fragments: FragmentResolver.from(from.fragments ?? []),

0 commit comments

Comments
 (0)