forked from hummingbot/gateway
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #4 from robotter-ai/feat/mango-markets-3
Feat/mango markets 3
- Loading branch information
Showing
38 changed files
with
162,677 additions
and
220 deletions.
There are no files selected for viewing
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
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,20 @@ | ||
import { HttpException } from '../../services/error-handler'; | ||
import { Solana } from './solana'; | ||
import { NextFunction, Request, Response } from 'express'; | ||
|
||
export const verifySolanaIsAvailable = async ( | ||
req: Request, | ||
_res: Response, | ||
next: NextFunction | ||
) => { | ||
if (!req || !req.body || !req.body.network) { | ||
throw new HttpException(404, 'No Solana network informed.'); | ||
} | ||
|
||
const solana = await Solana.getInstance(req.body.network); | ||
if (!solana.ready) { | ||
await solana.init(); | ||
} | ||
|
||
return next(); | ||
}; |
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,54 @@ | ||
import { TokenListType } from '../../services/base'; | ||
import { ConfigManagerV2 } from '../../services/config-manager-v2'; | ||
interface NetworkConfig { | ||
name: string; | ||
nodeURL: string; | ||
tokenListType: TokenListType; | ||
tokenListSource: string; | ||
nativeCurrencySymbol: string; | ||
maxLRUCacheInstances: number; | ||
} | ||
|
||
export interface Config { | ||
network: NetworkConfig; | ||
tokenProgram: string; | ||
transactionLamports: number; | ||
lamportsToSol: number; | ||
timeToLive: number; | ||
} | ||
|
||
export function getSolanaConfig( | ||
chainName: string, | ||
networkName: string | ||
): Config { | ||
return { | ||
network: { | ||
name: networkName, | ||
nodeURL: ConfigManagerV2.getInstance().get( | ||
chainName + '.networks.' + networkName + '.nodeURL' | ||
), | ||
tokenListType: ConfigManagerV2.getInstance().get( | ||
chainName + '.networks.' + networkName + '.tokenListType' | ||
), | ||
tokenListSource: ConfigManagerV2.getInstance().get( | ||
chainName + '.networks.' + networkName + '.tokenListSource' | ||
), | ||
nativeCurrencySymbol: ConfigManagerV2.getInstance().get( | ||
chainName + '.networks.' + networkName + '.nativeCurrencySymbol' | ||
), | ||
maxLRUCacheInstances: ConfigManagerV2.getInstance().get( | ||
chainName + '.networks.' + networkName + '.maxLRUCacheInstances' | ||
), | ||
}, | ||
tokenProgram: ConfigManagerV2.getInstance().get( | ||
chainName + '.tokenProgram' | ||
), | ||
transactionLamports: ConfigManagerV2.getInstance().get( | ||
chainName + '.transactionLamports' | ||
), | ||
lamportsToSol: ConfigManagerV2.getInstance().get( | ||
chainName + '.lamportsToSol' | ||
), | ||
timeToLive: ConfigManagerV2.getInstance().get(chainName + '.timeToLive'), | ||
}; | ||
} |
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,19 @@ | ||
export const constants = { | ||
retry: { | ||
all: { | ||
maxNumberOfRetries: 0, // 0 means no retries | ||
delayBetweenRetries: 0, // 0 means no delay (milliseconds) | ||
}, | ||
}, | ||
timeout: { | ||
all: 0, // 0 means no timeout (milliseconds) | ||
}, | ||
parallel: { | ||
all: { | ||
batchSize: 0, // 0 means no batching (group all) | ||
delayBetweenBatches: 0, // 0 means no delay (milliseconds) | ||
}, | ||
}, | ||
}; | ||
|
||
export default constants; |
Oops, something went wrong.