Skip to content

Commit 74c90e9

Browse files
committed
fix: make market configrators optional, default to sdk values
1 parent 568936d commit 74c90e9

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/attachSDK.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ export default async function attachSDK(): Promise<CreditAccountsService> {
7676
logger.debug({ tag: "timing" }, `new block ts: ${formatTs(block)}`);
7777
} catch {}
7878
});
79+
const mcs = new Set(
80+
sdk.marketRegister.marketConfigurators.map(mc => mc.address),
81+
);
7982
// load second time with hook
80-
await sdk.marketRegister.loadMarkets(config.marketConfigurators);
83+
await sdk.marketRegister.loadMarkets(Array.from(mcs));
8184
}
8285
const service = new CreditAccountsService(sdk, {
8386
batchSize: config.compressorBatchSize,

src/config/schema.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ export const ConfigSchema = PartialV300ConfigSchema.extend({
4848
/**
4949
* Market configurators addresses to attach SDK
5050
*/
51-
marketConfigurators: z
52-
.string()
53-
.transform(s => s.split(","))
54-
.pipe(z.array(Address)),
51+
marketConfigurators: stringArrayLike
52+
.optional()
53+
.pipe(z.array(Address))
54+
.transform(a => (a.length ? a : undefined))
55+
.optional(),
5556
/**
5657
* App name used in various messages to distinguish instances
5758
*/
@@ -79,11 +80,14 @@ export const ConfigSchema = PartialV300ConfigSchema.extend({
7980
jsonRpcProviders: stringArrayLike
8081
.optional()
8182
.pipe(z.array(z.string().url()))
83+
.transform(a => (a.length ? a : undefined))
8284
.optional(),
8385
/**
8486
* Alchemy API keys to use
8587
*/
86-
alchemyKeys: stringArrayLike.optional(),
88+
alchemyKeys: stringArrayLike
89+
.transform(a => (a.length ? a : undefined))
90+
.optional(),
8791
/**
8892
* Private key used to send liquidation transactions
8993
*/
@@ -120,10 +124,11 @@ export const ConfigSchema = PartialV300ConfigSchema.extend({
120124
* Redstone gateways override
121125
* Set local caching proxies to avoid rate limiting in test environment
122126
*/
123-
redstoneGateways: z
124-
.string()
127+
redstoneGateways: stringArrayLike
125128
.optional()
126-
.transform(s => (s ? s.split(",") : undefined)),
129+
.pipe(z.array(z.string().url()))
130+
.transform(a => (a.length ? a : undefined))
131+
.optional(),
127132
/**
128133
* The serive can deploy partial liquidator contracts.
129134
* Usage: deploy them once from local machine then pass the address to production service

0 commit comments

Comments
 (0)