-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from beethovenxfi/refactor/sor-service
Refactor/sor service
- Loading branch information
Showing
14 changed files
with
162 additions
and
332 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Resolvers } from '../../schema'; | ||
import { balancerSorService } from './sorV1Beets/balancer-sor.service'; | ||
import { tokenService } from '../token/token.service'; | ||
import { sorService } from './sor.service'; | ||
import { getTokenAmountHuman } from './utils'; | ||
import { headerChain } from '../context/header-chain'; | ||
|
||
const balancerSdkResolvers: Resolvers = { | ||
Query: { | ||
sorGetSwaps: async (parent, args, context) => { | ||
const currentChain = headerChain(); | ||
if (!args.chain && currentChain) { | ||
args.chain = currentChain; | ||
} else if (!args.chain) { | ||
throw new Error('sorGetSwaps error: Provide "chain" param'); | ||
} | ||
|
||
return sorService.getSorSwaps(args); | ||
}, | ||
sorGetBatchSwapForTokensIn: async (parent, args, context) => { | ||
const tokens = await tokenService.getTokens(); | ||
|
||
return balancerSorService.getBatchSwapForTokensIn({ ...args, tokens }); | ||
}, | ||
sorGetCowSwaps: async (parent, args, context) => { | ||
return sorService.getCowSwaps(args); | ||
}, | ||
}, | ||
}; | ||
|
||
export default balancerSdkResolvers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.