@optimex-xyz/market-maker-sdk 0.4.1 → 0.5.0-dev-4237adc
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/dist/index.d.mts +25 -3
- package/dist/index.d.ts +25 -3
- package/dist/index.js +30 -0
- package/dist/index.mjs +30 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,10 +11,22 @@ interface EnvironmentConfig {
|
|
|
11
11
|
interface AppConfig extends EnvironmentConfig {
|
|
12
12
|
env: Environment;
|
|
13
13
|
}
|
|
14
|
+
interface ConfigObserver {
|
|
15
|
+
onConfigUpdate(newConfig: AppConfig): void;
|
|
16
|
+
}
|
|
14
17
|
declare class Config {
|
|
15
18
|
private env;
|
|
16
19
|
private config;
|
|
20
|
+
private observers;
|
|
17
21
|
constructor(env?: Environment);
|
|
22
|
+
/**
|
|
23
|
+
* Register a service as an observer to be notified of config changes
|
|
24
|
+
*/
|
|
25
|
+
registerObserver(observer: ConfigObserver): void;
|
|
26
|
+
/**
|
|
27
|
+
* Remove a service from observers
|
|
28
|
+
*/
|
|
29
|
+
unregisterObserver(observer: ConfigObserver): void;
|
|
18
30
|
/**
|
|
19
31
|
* Set the environment for the SDK
|
|
20
32
|
* @param env The environment to use ('dev' or 'production')
|
|
@@ -35,6 +47,11 @@ declare class SDK {
|
|
|
35
47
|
* @param env The environment to use ('dev' or 'production')
|
|
36
48
|
*/
|
|
37
49
|
setEnvironment(env: Environment): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get the current environment configuration
|
|
52
|
+
* @returns The current environment configuration
|
|
53
|
+
*/
|
|
54
|
+
getConfig(): AppConfig;
|
|
38
55
|
}
|
|
39
56
|
declare const sdk: SDK;
|
|
40
57
|
|
|
@@ -4699,9 +4716,14 @@ declare const TokenSchema: z.ZodObject<{
|
|
|
4699
4716
|
}>;
|
|
4700
4717
|
type Token = z.infer<typeof TokenSchema>;
|
|
4701
4718
|
|
|
4702
|
-
declare class TokenService {
|
|
4703
|
-
private
|
|
4719
|
+
declare class TokenService implements ConfigObserver {
|
|
4720
|
+
private baseURL;
|
|
4704
4721
|
constructor();
|
|
4722
|
+
/**
|
|
4723
|
+
* Implementation of ConfigObserver interface
|
|
4724
|
+
* Updates service when config changes
|
|
4725
|
+
*/
|
|
4726
|
+
onConfigUpdate(newConfig: AppConfig): void;
|
|
4705
4727
|
/**
|
|
4706
4728
|
* Fetches all available tokens from the API
|
|
4707
4729
|
* @returns Promise<Token[]> Array of tokens
|
|
@@ -4798,4 +4820,4 @@ declare function camelToSnakeCase(str: string): string;
|
|
|
4798
4820
|
declare const ensureHexPrefix: (value: string) => string;
|
|
4799
4821
|
declare const removeHexPrefix: (value: string) => string;
|
|
4800
4822
|
|
|
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 };
|
|
4823
|
+
export { type AppConfig, type ConfigObserver, 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
|
@@ -11,10 +11,22 @@ interface EnvironmentConfig {
|
|
|
11
11
|
interface AppConfig extends EnvironmentConfig {
|
|
12
12
|
env: Environment;
|
|
13
13
|
}
|
|
14
|
+
interface ConfigObserver {
|
|
15
|
+
onConfigUpdate(newConfig: AppConfig): void;
|
|
16
|
+
}
|
|
14
17
|
declare class Config {
|
|
15
18
|
private env;
|
|
16
19
|
private config;
|
|
20
|
+
private observers;
|
|
17
21
|
constructor(env?: Environment);
|
|
22
|
+
/**
|
|
23
|
+
* Register a service as an observer to be notified of config changes
|
|
24
|
+
*/
|
|
25
|
+
registerObserver(observer: ConfigObserver): void;
|
|
26
|
+
/**
|
|
27
|
+
* Remove a service from observers
|
|
28
|
+
*/
|
|
29
|
+
unregisterObserver(observer: ConfigObserver): void;
|
|
18
30
|
/**
|
|
19
31
|
* Set the environment for the SDK
|
|
20
32
|
* @param env The environment to use ('dev' or 'production')
|
|
@@ -35,6 +47,11 @@ declare class SDK {
|
|
|
35
47
|
* @param env The environment to use ('dev' or 'production')
|
|
36
48
|
*/
|
|
37
49
|
setEnvironment(env: Environment): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get the current environment configuration
|
|
52
|
+
* @returns The current environment configuration
|
|
53
|
+
*/
|
|
54
|
+
getConfig(): AppConfig;
|
|
38
55
|
}
|
|
39
56
|
declare const sdk: SDK;
|
|
40
57
|
|
|
@@ -4699,9 +4716,14 @@ declare const TokenSchema: z.ZodObject<{
|
|
|
4699
4716
|
}>;
|
|
4700
4717
|
type Token = z.infer<typeof TokenSchema>;
|
|
4701
4718
|
|
|
4702
|
-
declare class TokenService {
|
|
4703
|
-
private
|
|
4719
|
+
declare class TokenService implements ConfigObserver {
|
|
4720
|
+
private baseURL;
|
|
4704
4721
|
constructor();
|
|
4722
|
+
/**
|
|
4723
|
+
* Implementation of ConfigObserver interface
|
|
4724
|
+
* Updates service when config changes
|
|
4725
|
+
*/
|
|
4726
|
+
onConfigUpdate(newConfig: AppConfig): void;
|
|
4705
4727
|
/**
|
|
4706
4728
|
* Fetches all available tokens from the API
|
|
4707
4729
|
* @returns Promise<Token[]> Array of tokens
|
|
@@ -4798,4 +4820,4 @@ declare function camelToSnakeCase(str: string): string;
|
|
|
4798
4820
|
declare const ensureHexPrefix: (value: string) => string;
|
|
4799
4821
|
declare const removeHexPrefix: (value: string) => string;
|
|
4800
4822
|
|
|
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 };
|
|
4823
|
+
export { type AppConfig, type ConfigObserver, 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
|
@@ -90,9 +90,22 @@ var environments = {
|
|
|
90
90
|
};
|
|
91
91
|
var Config = class {
|
|
92
92
|
constructor(env = "production") {
|
|
93
|
+
this.observers = [];
|
|
93
94
|
this.env = env;
|
|
94
95
|
this.config = this.validateAndGetConfig(this.env);
|
|
95
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Register a service as an observer to be notified of config changes
|
|
99
|
+
*/
|
|
100
|
+
registerObserver(observer) {
|
|
101
|
+
this.observers.push(observer);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Remove a service from observers
|
|
105
|
+
*/
|
|
106
|
+
unregisterObserver(observer) {
|
|
107
|
+
this.observers = this.observers.filter((obs) => obs !== observer);
|
|
108
|
+
}
|
|
96
109
|
/**
|
|
97
110
|
* Set the environment for the SDK
|
|
98
111
|
* @param env The environment to use ('dev' or 'production')
|
|
@@ -103,6 +116,8 @@ var Config = class {
|
|
|
103
116
|
}
|
|
104
117
|
this.env = env;
|
|
105
118
|
this.config = environments[env];
|
|
119
|
+
const newConfig = this.get();
|
|
120
|
+
this.observers.forEach((observer) => observer.onConfigUpdate(newConfig));
|
|
106
121
|
}
|
|
107
122
|
validateAndGetConfig(env) {
|
|
108
123
|
if (!environments[env]) {
|
|
@@ -140,6 +155,13 @@ var SDK = class {
|
|
|
140
155
|
setEnvironment(env) {
|
|
141
156
|
config.setEnvironment(env);
|
|
142
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Get the current environment configuration
|
|
160
|
+
* @returns The current environment configuration
|
|
161
|
+
*/
|
|
162
|
+
getConfig() {
|
|
163
|
+
return config.get();
|
|
164
|
+
}
|
|
143
165
|
};
|
|
144
166
|
var sdk = new SDK();
|
|
145
167
|
|
|
@@ -3702,6 +3724,14 @@ var TokenResponseSchema = import_zod3.z.object({
|
|
|
3702
3724
|
var TokenService = class {
|
|
3703
3725
|
constructor() {
|
|
3704
3726
|
this.baseURL = config.getBackendUrl();
|
|
3727
|
+
config.registerObserver(this);
|
|
3728
|
+
}
|
|
3729
|
+
/**
|
|
3730
|
+
* Implementation of ConfigObserver interface
|
|
3731
|
+
* Updates service when config changes
|
|
3732
|
+
*/
|
|
3733
|
+
onConfigUpdate(newConfig) {
|
|
3734
|
+
this.baseURL = newConfig.backendUrl;
|
|
3705
3735
|
}
|
|
3706
3736
|
/**
|
|
3707
3737
|
* Fetches all available tokens from the API
|
package/dist/index.mjs
CHANGED
|
@@ -25,9 +25,22 @@ var environments = {
|
|
|
25
25
|
};
|
|
26
26
|
var Config = class {
|
|
27
27
|
constructor(env = "production") {
|
|
28
|
+
this.observers = [];
|
|
28
29
|
this.env = env;
|
|
29
30
|
this.config = this.validateAndGetConfig(this.env);
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Register a service as an observer to be notified of config changes
|
|
34
|
+
*/
|
|
35
|
+
registerObserver(observer) {
|
|
36
|
+
this.observers.push(observer);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Remove a service from observers
|
|
40
|
+
*/
|
|
41
|
+
unregisterObserver(observer) {
|
|
42
|
+
this.observers = this.observers.filter((obs) => obs !== observer);
|
|
43
|
+
}
|
|
31
44
|
/**
|
|
32
45
|
* Set the environment for the SDK
|
|
33
46
|
* @param env The environment to use ('dev' or 'production')
|
|
@@ -38,6 +51,8 @@ var Config = class {
|
|
|
38
51
|
}
|
|
39
52
|
this.env = env;
|
|
40
53
|
this.config = environments[env];
|
|
54
|
+
const newConfig = this.get();
|
|
55
|
+
this.observers.forEach((observer) => observer.onConfigUpdate(newConfig));
|
|
41
56
|
}
|
|
42
57
|
validateAndGetConfig(env) {
|
|
43
58
|
if (!environments[env]) {
|
|
@@ -75,6 +90,13 @@ var SDK = class {
|
|
|
75
90
|
setEnvironment(env) {
|
|
76
91
|
config.setEnvironment(env);
|
|
77
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Get the current environment configuration
|
|
95
|
+
* @returns The current environment configuration
|
|
96
|
+
*/
|
|
97
|
+
getConfig() {
|
|
98
|
+
return config.get();
|
|
99
|
+
}
|
|
78
100
|
};
|
|
79
101
|
var sdk = new SDK();
|
|
80
102
|
|
|
@@ -3637,6 +3659,14 @@ var TokenResponseSchema = z3.object({
|
|
|
3637
3659
|
var TokenService = class {
|
|
3638
3660
|
constructor() {
|
|
3639
3661
|
this.baseURL = config.getBackendUrl();
|
|
3662
|
+
config.registerObserver(this);
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Implementation of ConfigObserver interface
|
|
3666
|
+
* Updates service when config changes
|
|
3667
|
+
*/
|
|
3668
|
+
onConfigUpdate(newConfig) {
|
|
3669
|
+
this.baseURL = newConfig.backendUrl;
|
|
3640
3670
|
}
|
|
3641
3671
|
/**
|
|
3642
3672
|
* Fetches all available tokens from the API
|