@optimex-xyz/market-maker-sdk 0.2.0 → 0.4.1

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 CHANGED
@@ -12,6 +12,7 @@ A comprehensive toolkit for implementing Private Market Makers (PMMs) in the cro
12
12
  - [2. Quick Start](#2-quick-start)
13
13
  - [2.1. Installation](#21-installation)
14
14
  - [2.2. Environment Setup](#22-environment-setup)
15
+ - [2.3. Available Environments](#23-available-environments)
15
16
  - [3. PMM Backend APIs](#3-pmm-backend-apis)
16
17
  - [3.1. Endpoint: `/indicative-quote`](#31-endpoint-indicative-quote)
17
18
  - [Description](#description)
@@ -110,9 +111,26 @@ yarn add @optimex-xyz/market-maker-sdk
110
111
 
111
112
  ### 2.2. Environment Setup
112
113
 
113
- | Variable | Development | Production |
114
- | -------- | ----------- | ---------- |
115
- | SDK_ENV | dev | production |
114
+ you can directly specify the environment
115
+
116
+ ```typescript
117
+ import { sdk, Environment } from '@optimex-xyz/market-maker-sdk'
118
+
119
+ // Change to development environment
120
+ sdk.setEnvironment('dev' as Environment)
121
+
122
+ // Change to production environment
123
+ sdk.setEnvironment('production' as Environment)
124
+ ```
125
+
126
+ ### 2.3. Available Environments
127
+
128
+ | Environment | Description |
129
+ | ------------ | -------------------------------------------------------------------- |
130
+ | `dev` | Development environment with test networks and staging services |
131
+ | `production` | Production environment with mainnet networks and production services |
132
+
133
+ Each environment includes specific configuration for backend URLs, RPC endpoints, router addresses, and payment addresses.
116
134
 
117
135
  ## 3. PMM Backend APIs
118
136
 
package/dist/index.d.mts CHANGED
@@ -12,9 +12,15 @@ interface AppConfig extends EnvironmentConfig {
12
12
  env: Environment;
13
13
  }
14
14
  declare class Config {
15
- private readonly env;
16
- private readonly config;
17
- constructor();
15
+ private env;
16
+ private config;
17
+ constructor(env?: Environment);
18
+ /**
19
+ * Set the environment for the SDK
20
+ * @param env The environment to use ('dev' or 'production')
21
+ */
22
+ setEnvironment(env: Environment): void;
23
+ private validateAndGetConfig;
18
24
  get(): AppConfig;
19
25
  getBackendUrl(): string;
20
26
  getRpcUrl(): string;
@@ -23,6 +29,15 @@ declare class Config {
23
29
  }
24
30
  declare const config: Config;
25
31
 
32
+ declare class SDK {
33
+ /**
34
+ * Change the environment after initialization
35
+ * @param env The environment to use ('dev' or 'production')
36
+ */
37
+ setEnvironment(env: Environment): void;
38
+ }
39
+ declare const sdk: SDK;
40
+
26
41
  interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {
27
42
  }
28
43
  interface TypedContractEvent<InputTuple extends Array<any> = any, OutputTuple extends Array<any> = any, OutputObject = any> {
@@ -4783,4 +4798,4 @@ declare function camelToSnakeCase(str: string): string;
4783
4798
  declare const ensureHexPrefix: (value: string) => string;
4784
4799
  declare const removeHexPrefix: (value: string) => string;
4785
4800
 
4786
- export { type AppConfig, type ERC20, ERC20__factory, type Environment, type EnvironmentConfig, ITypes, type Payment, Payment__factory, type Router, RouterService, Router__factory, SignatureType, type Signer, SignerService, Signer__factory, SolverService, type Token, TokenSchema, TokenService, camelToSnakeCase, config, confirmDepositType, confirmPaymentType, confirmSettlementType, convertToCamelCase, convertToSnakeCase, ensureHexPrefix, index as factories, getCommitInfoHash, getMakePaymentHash, getSignature, getSigner, getTradeIdsHash, makePaymentType, presignType, removeHexPrefix, rfqAuthenticationTypes, routerService, selectionType, signerService, snakeToCamelCase, solverService, tokenService };
4801
+ export { type AppConfig, type ERC20, ERC20__factory, type Environment, type EnvironmentConfig, ITypes, type Payment, Payment__factory, type Router, RouterService, Router__factory, SDK, SignatureType, type Signer, SignerService, Signer__factory, SolverService, type Token, TokenSchema, TokenService, camelToSnakeCase, config, confirmDepositType, confirmPaymentType, confirmSettlementType, convertToCamelCase, convertToSnakeCase, ensureHexPrefix, index as factories, getCommitInfoHash, getMakePaymentHash, getSignature, getSigner, getTradeIdsHash, makePaymentType, presignType, removeHexPrefix, rfqAuthenticationTypes, routerService, sdk, selectionType, signerService, snakeToCamelCase, solverService, tokenService };
package/dist/index.d.ts CHANGED
@@ -12,9 +12,15 @@ interface AppConfig extends EnvironmentConfig {
12
12
  env: Environment;
13
13
  }
14
14
  declare class Config {
15
- private readonly env;
16
- private readonly config;
17
- constructor();
15
+ private env;
16
+ private config;
17
+ constructor(env?: Environment);
18
+ /**
19
+ * Set the environment for the SDK
20
+ * @param env The environment to use ('dev' or 'production')
21
+ */
22
+ setEnvironment(env: Environment): void;
23
+ private validateAndGetConfig;
18
24
  get(): AppConfig;
19
25
  getBackendUrl(): string;
20
26
  getRpcUrl(): string;
@@ -23,6 +29,15 @@ declare class Config {
23
29
  }
24
30
  declare const config: Config;
25
31
 
32
+ declare class SDK {
33
+ /**
34
+ * Change the environment after initialization
35
+ * @param env The environment to use ('dev' or 'production')
36
+ */
37
+ setEnvironment(env: Environment): void;
38
+ }
39
+ declare const sdk: SDK;
40
+
26
41
  interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> extends DeferredTopicFilter {
27
42
  }
28
43
  interface TypedContractEvent<InputTuple extends Array<any> = any, OutputTuple extends Array<any> = any, OutputObject = any> {
@@ -4783,4 +4798,4 @@ declare function camelToSnakeCase(str: string): string;
4783
4798
  declare const ensureHexPrefix: (value: string) => string;
4784
4799
  declare const removeHexPrefix: (value: string) => string;
4785
4800
 
4786
- export { type AppConfig, type ERC20, ERC20__factory, type Environment, type EnvironmentConfig, ITypes, type Payment, Payment__factory, type Router, RouterService, Router__factory, SignatureType, type Signer, SignerService, Signer__factory, SolverService, type Token, TokenSchema, TokenService, camelToSnakeCase, config, confirmDepositType, confirmPaymentType, confirmSettlementType, convertToCamelCase, convertToSnakeCase, ensureHexPrefix, index as factories, getCommitInfoHash, getMakePaymentHash, getSignature, getSigner, getTradeIdsHash, makePaymentType, presignType, removeHexPrefix, rfqAuthenticationTypes, routerService, selectionType, signerService, snakeToCamelCase, solverService, tokenService };
4801
+ export { type AppConfig, type ERC20, ERC20__factory, type Environment, type EnvironmentConfig, ITypes, type Payment, Payment__factory, type Router, RouterService, Router__factory, SDK, SignatureType, type Signer, SignerService, Signer__factory, SolverService, type Token, TokenSchema, TokenService, camelToSnakeCase, config, confirmDepositType, confirmPaymentType, confirmSettlementType, convertToCamelCase, convertToSnakeCase, ensureHexPrefix, index as factories, getCommitInfoHash, getMakePaymentHash, getSignature, getSigner, getTradeIdsHash, makePaymentType, presignType, removeHexPrefix, rfqAuthenticationTypes, routerService, sdk, selectionType, signerService, snakeToCamelCase, solverService, tokenService };
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  Payment__factory: () => Payment__factory,
35
35
  RouterService: () => RouterService,
36
36
  Router__factory: () => Router__factory,
37
+ SDK: () => SDK,
37
38
  SignatureType: () => SignatureType,
38
39
  SignerService: () => SignerService,
39
40
  Signer__factory: () => Signer__factory,
@@ -59,6 +60,7 @@ __export(index_exports, {
59
60
  removeHexPrefix: () => removeHexPrefix,
60
61
  rfqAuthenticationTypes: () => rfqAuthenticationTypes,
61
62
  routerService: () => routerService,
63
+ sdk: () => sdk,
62
64
  selectionType: () => selectionType,
63
65
  signerService: () => signerService,
64
66
  snakeToCamelCase: () => snakeToCamelCase,
@@ -87,12 +89,26 @@ var environments = {
87
89
  }
88
90
  };
89
91
  var Config = class {
90
- constructor() {
91
- this.env = process.env.SDK_ENV || "production";
92
- if (!environments[this.env]) {
93
- throw new Error(`Unsupported environment: ${this.env}`);
92
+ constructor(env = "production") {
93
+ this.env = env;
94
+ this.config = this.validateAndGetConfig(this.env);
95
+ }
96
+ /**
97
+ * Set the environment for the SDK
98
+ * @param env The environment to use ('dev' or 'production')
99
+ */
100
+ setEnvironment(env) {
101
+ if (!environments[env]) {
102
+ throw new Error(`Unsupported environment: ${env}`);
103
+ }
104
+ this.env = env;
105
+ this.config = environments[env];
106
+ }
107
+ validateAndGetConfig(env) {
108
+ if (!environments[env]) {
109
+ throw new Error(`Unsupported environment: ${env}`);
94
110
  }
95
- this.config = environments[this.env];
111
+ return environments[env];
96
112
  }
97
113
  get() {
98
114
  return {
@@ -115,6 +131,18 @@ var Config = class {
115
131
  };
116
132
  var config = new Config();
117
133
 
134
+ // src/config/sdk.ts
135
+ var SDK = class {
136
+ /**
137
+ * Change the environment after initialization
138
+ * @param env The environment to use ('dev' or 'production')
139
+ */
140
+ setEnvironment(env) {
141
+ config.setEnvironment(env);
142
+ }
143
+ };
144
+ var sdk = new SDK();
145
+
118
146
  // src/contracts/contract/factories/index.ts
119
147
  var factories_exports = {};
120
148
  __export(factories_exports, {
@@ -3867,6 +3895,7 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
3867
3895
  Payment__factory,
3868
3896
  RouterService,
3869
3897
  Router__factory,
3898
+ SDK,
3870
3899
  SignatureType,
3871
3900
  SignerService,
3872
3901
  Signer__factory,
@@ -3892,6 +3921,7 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
3892
3921
  removeHexPrefix,
3893
3922
  rfqAuthenticationTypes,
3894
3923
  routerService,
3924
+ sdk,
3895
3925
  selectionType,
3896
3926
  signerService,
3897
3927
  snakeToCamelCase,
package/dist/index.mjs CHANGED
@@ -24,12 +24,26 @@ var environments = {
24
24
  }
25
25
  };
26
26
  var Config = class {
27
- constructor() {
28
- this.env = process.env.SDK_ENV || "production";
29
- if (!environments[this.env]) {
30
- throw new Error(`Unsupported environment: ${this.env}`);
27
+ constructor(env = "production") {
28
+ this.env = env;
29
+ this.config = this.validateAndGetConfig(this.env);
30
+ }
31
+ /**
32
+ * Set the environment for the SDK
33
+ * @param env The environment to use ('dev' or 'production')
34
+ */
35
+ setEnvironment(env) {
36
+ if (!environments[env]) {
37
+ throw new Error(`Unsupported environment: ${env}`);
38
+ }
39
+ this.env = env;
40
+ this.config = environments[env];
41
+ }
42
+ validateAndGetConfig(env) {
43
+ if (!environments[env]) {
44
+ throw new Error(`Unsupported environment: ${env}`);
31
45
  }
32
- this.config = environments[this.env];
46
+ return environments[env];
33
47
  }
34
48
  get() {
35
49
  return {
@@ -52,6 +66,18 @@ var Config = class {
52
66
  };
53
67
  var config = new Config();
54
68
 
69
+ // src/config/sdk.ts
70
+ var SDK = class {
71
+ /**
72
+ * Change the environment after initialization
73
+ * @param env The environment to use ('dev' or 'production')
74
+ */
75
+ setEnvironment(env) {
76
+ config.setEnvironment(env);
77
+ }
78
+ };
79
+ var sdk = new SDK();
80
+
55
81
  // src/contracts/contract/factories/index.ts
56
82
  var factories_exports = {};
57
83
  __export(factories_exports, {
@@ -3803,6 +3829,7 @@ export {
3803
3829
  Payment__factory,
3804
3830
  RouterService,
3805
3831
  Router__factory,
3832
+ SDK,
3806
3833
  SignatureType,
3807
3834
  SignerService,
3808
3835
  Signer__factory,
@@ -3828,6 +3855,7 @@ export {
3828
3855
  removeHexPrefix,
3829
3856
  rfqAuthenticationTypes,
3830
3857
  routerService,
3858
+ sdk,
3831
3859
  selectionType,
3832
3860
  signerService,
3833
3861
  snakeToCamelCase,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimex-xyz/market-maker-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"