Skip to content

Commit

Permalink
mexsettings refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cfaur09 committed Feb 6, 2025
1 parent ec8f3e5 commit 4171374
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/endpoints/mex/entities/mex.settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class MexSettings {
...response.proxy.map((x: any) => x.address),
];
settings.pairContracts = [
...response.pairs.filter((x: any) => x.state === 'Active').map((x: any) => x.address),
...response.pairs.map((x: any) => x.address),
...response.proxy.map((x: any) => x.address),
];
settings.wrapContracts = response.wrappingInfo.map((x: any) => x.address);
Expand All @@ -39,11 +39,11 @@ export class MexSettings {
settings.lockedAssetIdentifier = lockedAssetIdentifiers.find((identifier: string) => identifier.startsWith('LKMEX'));
settings.lockedAssetIdentifierV2 = lockedAssetIdentifiers.find((identifier: string) => identifier.startsWith('XMEX'));

const mexEgldPairs = response.pairs.filter((x: any) => x.firstToken.name === 'WrappedEGLD' && x.secondToken.name === 'MEX');
if (mexEgldPairs.length > 0) {
settings.wegldId = mexEgldPairs[0].firstToken.identifier;
settings.mexId = mexEgldPairs[0].secondToken.identifier;
}
const wrappedToken = response.wrappingInfo[0].wrappedToken.identifier;
const mexToken = response.simpleLockEnergy.baseAssetToken.identifier;

settings.wegldId = wrappedToken;
settings.mexId = mexToken;

return settings;
}
Expand Down
25 changes: 11 additions & 14 deletions src/endpoints/mex/mex.settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,12 @@ export class MexSettingsService {
limit: 500,
};



const query = gql`
query ($offset: Int, $limit: Int) {
pairs(offset: $offset, limit: $limit) {
state
pairs(offset: $offset, limit: $limit, state: "Active") {
address
firstToken {
name
identifier
decimals
__typename
}
secondToken {
name
identifier
decimals
__typename
}
}
proxy {
address
Expand All @@ -134,6 +123,9 @@ export class MexSettingsService {
wrappingInfo {
address
shard
wrappedToken {
identifier
}
}
distribution {
address
Expand All @@ -151,6 +143,11 @@ export class MexSettingsService {
factory {
address
}
simpleLockEnergy {
baseAssetToken {
identifier
}
}
}
`;

Expand Down

0 comments on commit 4171374

Please sign in to comment.