Add config for fixie static ip proxy.

This commit is contained in:
Will O'Beirne 2019-03-19 16:24:25 -04:00
parent d4715695ad
commit f2d934a4db
No known key found for this signature in database
GPG Key ID: 44C190DB5DEAF9F6
4 changed files with 11 additions and 0 deletions

View File

@ -43,3 +43,6 @@ SENTRY_DSN=""
# Logging level
LOG_LEVEL="debug"
# Fixie proxy URL for BitGo requests (optional)
# FIXIE_URL=""

View File

@ -18,12 +18,17 @@ export async function initBitGo() {
throw new Error(`BitGo cannot be used on anything but mainnet, connected node is ${network}`);
}
const proxy = env.FIXIE_URL || undefined;
const bitgo = new BitGo({
env: 'prod', // Non-prod ZEC is not supported
accessToken: env.BITGO_ACCESS_TOKEN,
proxy,
});
bitgoWallet = await bitgo.coin('zec').wallets().get({ id: env.BITGO_WALLET_ID });
log.info(`Initialized BitGo wallet "${bitgoWallet.label()}"`);
if (proxy) {
log.info(`Proxying BitGo requests through ${proxy}`);
}
}
export async function getContributionAddress(id: number) {

View File

@ -30,12 +30,14 @@ const DEFAULTS = {
TESTNET_START_BLOCK: "390000",
SENTRY_DSN: "",
FIXIE_URL: "",
};
const OPTIONAL: { [key: string]: undefined | boolean } = {
BITGO_WALLET_ID: true,
BITGO_ACCESS_TOKEN: true,
BIP32_XPUB: true,
FIXIE_URL: true,
// NOTE: Remove these from optional when sapling is ready
SPROUT_ADDRESS: true,
SPROUT_VIEWKEY: true,

View File

@ -61,6 +61,7 @@ declare module 'bitgo' {
interface BitGoOptions {
env: 'test' | 'prod';
accessToken: string;
proxy?: string;
}
export class BitGo {