Skip to content

Commit cfce065

Browse files
committed
Merge branch 'feat/router' of https://github.com/mento-protocol/mento-sdk into feat/router
2 parents 2df476a + 60b7d12 commit cfce065

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

scripts/cacheTradablePairs.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Mento } from '../src/mento'
99
import fs from 'fs'
1010
import path from 'path'
1111

12-
async function getTradablePairsForNetwork(chainId: number, rpcUrl: string) {
12+
async function getTradablePairsForNetwork(rpcUrl: string) {
1313
const provider = new providers.JsonRpcProvider(rpcUrl)
1414
const mento = await Mento.create(provider)
1515
return await mento.getTradablePairs(true)
@@ -22,10 +22,7 @@ async function main() {
2222
for (const [chainId, rpcUrl] of Object.entries(rpcUrls)) {
2323
console.log(`Fetching pairs for chain ${chainId}...`)
2424
try {
25-
results[Number(chainId)] = await getTradablePairsForNetwork(
26-
Number(chainId),
27-
rpcUrl
28-
)
25+
results[Number(chainId)] = await getTradablePairsForNetwork(rpcUrl)
2926
} catch (e) {
3027
console.error(`Error fetching pairs for chain ${chainId}:`, e)
3128
}

src/constants/addresses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export type Identifier = keyof ContractAddressMap[keyof ContractAddressMap]
7777

7878
export function getAddress(identifier: Identifier, chainId: number): string {
7979
const addressesForChain = addresses[chainId]
80-
if (!addresses) {
80+
if (!addressesForChain) {
8181
throw new Error(`No addresses found for chain ID ${chainId}`)
8282
}
8383

src/mento.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe('Mento', () => {
136136
return {
137137
getExchanges: () =>
138138
fakeExchangesByProviders[
139-
exchangeProvider as keyof typeof fakeExchangesByProviders
139+
exchangeProvider as keyof typeof fakeExchangesByProviders
140140
],
141141
}
142142
})
@@ -164,7 +164,7 @@ describe('Mento', () => {
164164
symbol: jest.fn(
165165
() =>
166166
fakeSymbolsByTokenAddr[
167-
contractAddr as keyof typeof fakeSymbolsByTokenAddr
167+
contractAddr as keyof typeof fakeSymbolsByTokenAddr
168168
]
169169
),
170170
populateTransaction: {
@@ -807,9 +807,6 @@ describe('Mento', () => {
807807
for (const exchange of mockedExchanges) {
808808
const tokenIn = exchange.assets[0]
809809
const tokenOut = exchange.assets[1]
810-
const symbol0 = fakeSymbolsByTokenAddr[tokenIn]
811-
const symbol1 = fakeSymbolsByTokenAddr[tokenOut]
812-
const [firstSymbol, secondSymbol] = [symbol0, symbol1].sort()
813810
const directPair: TradablePair = {
814811
id: `${fakeSymbolsByTokenAddr[tokenIn]}-${fakeSymbolsByTokenAddr[tokenOut]}`,
815812
assets: [
@@ -907,7 +904,7 @@ describe('Mento', () => {
907904
mockRouter.populateTransaction.swapTokensForExactTokens.mockReturnValueOnce(
908905
fakeTxObj
909906
)
910-
const spy = jest
907+
jest
911908
.spyOn(signer, 'populateTransaction')
912909
// @ts-ignore
913910
.mockReturnValueOnce(fakePopulatedTxObj)

0 commit comments

Comments
 (0)