@marcohefti/request-network-api-client 0.5.0 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -49
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.mts +51 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -6
package/dist/esm/index.d.mts
CHANGED
|
@@ -3627,10 +3627,61 @@ interface RequestClient {
|
|
|
3627
3627
|
/** Legacy pay endpoints */
|
|
3628
3628
|
pay: PayApi;
|
|
3629
3629
|
}
|
|
3630
|
+
/**
|
|
3631
|
+
* Creates a Request Network API client with typed domain facades.
|
|
3632
|
+
*
|
|
3633
|
+
* @param options - Client configuration options
|
|
3634
|
+
* @param options.baseUrl - API base URL (defaults to production if not provided)
|
|
3635
|
+
* @param options.apiKey - API key for server-side authentication
|
|
3636
|
+
* @param options.clientId - Client ID for browser/frontend authentication
|
|
3637
|
+
* @param options.runtimeValidation - Enable/disable runtime validation (default: true)
|
|
3638
|
+
* @param options.logLevel - Logging level: 'silent' | 'error' | 'info' | 'debug' (default: 'error')
|
|
3639
|
+
* @param options.logger - Custom logger function
|
|
3640
|
+
* @param options.userAgent - Custom user agent string
|
|
3641
|
+
* @param options.retry - Retry configuration
|
|
3642
|
+
*
|
|
3643
|
+
* @returns RequestClient instance with domain APIs
|
|
3644
|
+
*
|
|
3645
|
+
* @example
|
|
3646
|
+
* ```ts
|
|
3647
|
+
* import { createRequestClient, RequestEnvironment } from '@marcohefti/request-network-api-client';
|
|
3648
|
+
*
|
|
3649
|
+
* const client = createRequestClient({
|
|
3650
|
+
* baseUrl: RequestEnvironment.production,
|
|
3651
|
+
* apiKey: process.env.REQUEST_API_KEY,
|
|
3652
|
+
* logLevel: 'info',
|
|
3653
|
+
* });
|
|
3654
|
+
*
|
|
3655
|
+
* const tokens = await client.currencies.list({ network: 'sepolia' });
|
|
3656
|
+
* ```
|
|
3657
|
+
*/
|
|
3630
3658
|
declare function createRequestClient(options?: CreateClientOptions): RequestClient;
|
|
3631
3659
|
interface EnvOptions {
|
|
3632
3660
|
env?: NodeJS.ProcessEnv;
|
|
3633
3661
|
}
|
|
3662
|
+
/**
|
|
3663
|
+
* Creates a Request Network API client from environment variables.
|
|
3664
|
+
*
|
|
3665
|
+
* Reads configuration from the following environment variables (in order of preference):
|
|
3666
|
+
* - `REQUEST_API_URL` (or legacy `REQUEST_SDK_BASE_URL`)
|
|
3667
|
+
* - `REQUEST_API_KEY` (or legacy `REQUEST_SDK_API_KEY`)
|
|
3668
|
+
* - `REQUEST_CLIENT_ID` (or legacy `REQUEST_SDK_CLIENT_ID`)
|
|
3669
|
+
*
|
|
3670
|
+
* @param options - Optional environment override
|
|
3671
|
+
* @param options.env - Custom environment object (defaults to process.env)
|
|
3672
|
+
*
|
|
3673
|
+
* @returns RequestClient instance configured from environment
|
|
3674
|
+
*
|
|
3675
|
+
* @example
|
|
3676
|
+
* ```ts
|
|
3677
|
+
* import { createRequestClientFromEnv } from '@marcohefti/request-network-api-client';
|
|
3678
|
+
*
|
|
3679
|
+
* const client = createRequestClientFromEnv();
|
|
3680
|
+
* // Reads REQUEST_API_KEY, REQUEST_CLIENT_ID, REQUEST_API_URL from process.env
|
|
3681
|
+
*
|
|
3682
|
+
* const tokens = await client.currencies.list({ network: 'sepolia' });
|
|
3683
|
+
* ```
|
|
3684
|
+
*/
|
|
3634
3685
|
declare function createRequestClientFromEnv(options?: EnvOptions): RequestClient;
|
|
3635
3686
|
|
|
3636
3687
|
declare const RequestEnvironment: {
|
package/dist/esm/index.js
CHANGED
|
@@ -3383,8 +3383,8 @@ function isAgreementRejected(payload) {
|
|
|
3383
3383
|
}
|
|
3384
3384
|
function complianceStatusSummary(payload) {
|
|
3385
3385
|
const parts = [];
|
|
3386
|
-
const kyc = payload.kycStatus ?
|
|
3387
|
-
const agreement = payload.agreementStatus ?
|
|
3386
|
+
const kyc = payload.kycStatus ? payload.kycStatus.replace(/_/g, " ") : "unknown";
|
|
3387
|
+
const agreement = payload.agreementStatus ? payload.agreementStatus.replace(/_/g, " ") : "unknown";
|
|
3388
3388
|
parts.push(`KYC: ${kyc}`);
|
|
3389
3389
|
parts.push(`Agreement: ${agreement}`);
|
|
3390
3390
|
if (payload.clientUserId) {
|