Skip to content

Commit

Permalink
Merge branch 'master' into aaronmgdr/about-below
Browse files Browse the repository at this point in the history
* master: (40 commits)
  Add utils as a dep (#2252)
  [Wallet] Create run_app.sh script to facilitate app development (#2186)
  [Wallet] Fix persisted data loss on iOS (#2249)
  adds Testing TSX /react on the web (#2229)
  Update running-a-validator.md (#2259)
  Add ts-ignore (#2254)
  Revert "Revert "Upgrade TS version (#2196)" (#2251)" (#2255)
  Force same bignumber version (#2256)
  Fix missing Text on website (#2237)
  Revert "Upgrade TS version (#2196)" (#2251)
  [Wallet] Refer to Celo Lite as "Data Saver" mode (#2232)
  Fix using requester instead of requestee at Outgoing notifications (#2240)
  Use correct phone placeholder depending on the country on joining Celo view (#2061)
  Update Attestation Bot Docker Image (#2231)
  Baklava phase 1.1 .env file (#2226)
  [Docs] Fix typo (#2225)
  Upgrade Dependencies and get react hooks working (#2203)
  Update attestation service docker images (#2202)
  Updates TME docker images (#2200)
  Remove walletkit from celotool transactions commands (#2206)
  ...

# Conflicts:
#	packages/web/package.json
  • Loading branch information
aaronmgdr committed Dec 16, 2019
2 parents 171d446 + 75003d0 commit 4c512fd
Show file tree
Hide file tree
Showing 238 changed files with 6,530 additions and 5,742 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth-all"
GETH_BOOTNODE_DOCKER_IMAGE_TAG="master"

CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-6d4579212a7b49fdf54e2f4661c40ae8f4fbc4c5"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-53016a800a510cddae73444377bcf366d753367a"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"
Expand All @@ -47,10 +47,10 @@ ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="default"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-d405b99872097291c8e07d2445559588547938b0"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-8e69cf86010b62e283d5f9285f181fca5483733e"

ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-5ee799c0a726a44113cc0a9b26932531019a07a4"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-8e69cf86010b62e283d5f9285f181fca5483733e"

GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter"
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261"
Expand Down
24 changes: 15 additions & 9 deletions .env.baklava
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ CLUSTER_DOMAIN_NAME="celo-testnet"
TESTNET_PROJECT_NAME="celo-testnet-production"

BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout"
BLOCKSCOUT_DOCKER_IMAGE_TAG="9ebd645aa670a5195641ca03c9f9717b5ea897cc"
BLOCKSCOUT_DOCKER_IMAGE_TAG="982ffa2a1ddba3b5ccfe0915bd902ab8671ddc99"
BLOCKSCOUT_WEB_REPLICAS=3
# Increment this value everytime you redeploy blockscout. Or else the deployment will fail due to the
# existing database.
Expand All @@ -28,15 +28,15 @@ ETHSTATS_BANNED_ADDRESSES=""
GETH_NODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth"
# When upgrading change this to latest commit hash from the master of the geth repo
# `geth $ git show | head -n 1`
GETH_NODE_DOCKER_IMAGE_TAG="6e3766093331ef1cef8428c2320c60f62390adeb"
GETH_NODE_DOCKER_IMAGE_TAG="5d4224eb0e13683107f3a8ea8d7cb668e676b4fc"

GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth-all"
# When upgrading change this to latest commit hash from the master of the geth repo
# `geth $ git show | head -n 1`
GETH_BOOTNODE_DOCKER_IMAGE_TAG="6e3766093331ef1cef8428c2320c60f62390adeb"
GETH_BOOTNODE_DOCKER_IMAGE_TAG="5d4224eb0e13683107f3a8ea8d7cb668e676b4fc"

CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-dcad01808c05f77ea71b911ba331caab0fd739d3"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-53016a800a510cddae73444377bcf366d753367a"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"
Expand All @@ -49,16 +49,16 @@ ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="baklava"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-4f63a422e0af6efca536b569f3005de209eb1cfd"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-8e69cf86010b62e283d5f9285f181fca5483733e"

ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-dcad01808c05f77ea71b911ba331caab0fd739d3"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-8e69cf86010b62e283d5f9285f181fca5483733e"

GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter"
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261"

# Genesis Vars
NETWORK_ID=76172
NETWORK_ID=121119
CONSENSUS_TYPE="istanbul"
BLOCK_TIME=5
# Minimum epoch length is 15 minutes
Expand Down Expand Up @@ -103,9 +103,15 @@ STACKDRIVER_NOTIFICATION_APPLICATIONS_PREFIX="notification-service-,blockchain-a

MOBILE_WALLET_PLAYSTORE_LINK="https://play.google.com/apps/internaltest/4700990475000634666"

# NOTIFICATION_SERVICE_FIREBASE_DB="https://console.firebase.google.com/u/0/project/celo-org-mobile/database/celo-org-mobile-int/data"

PROMTOSD_SCRAPE_INTERVAL="5m"
PROMTOSD_EXPORT_INTERVAL="5m"

SMS_RETRIEVER_HASH_CODE=l5k6LvdPDXS

LEADERBOARD_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
LEADERBOARD_DOCKER_IMAGE_TAG="leaderboard-e84c5086e94193fdef430008bd44129e4151bb6b"

# Attestation Bot variables
ATTESTATION_BOT_INITIAL_WAIT_SECONDS=600
ATTESTATION_BOT_IN_BETWEEN_WAIT_SECONDS=600
ATTESTATION_BOT_MAX_ATTESTATIONS=90
13 changes: 8 additions & 5 deletions .env.baklavastaging
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/geth-all"
GETH_BOOTNODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d"

CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-51ae8e72be34a614346950b6fbd8ba3b94223947"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-53016a800a510cddae73444377bcf366d753367a"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"
Expand All @@ -49,10 +49,10 @@ ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="baklavastaging"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-51ae8e72be34a614346950b6fbd8ba3b94223947"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-8e69cf86010b62e283d5f9285f181fca5483733e"

ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-8e69cf86010b62e283d5f9285f181fca5483733e"

GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter"
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261"
Expand Down Expand Up @@ -102,9 +102,12 @@ STACKDRIVER_NOTIFICATION_APPLICATIONS_PREFIX="notification-service-,blockchain-a

MOBILE_WALLET_PLAYSTORE_LINK="https://play.google.com/apps/internaltest/4700990475000634666"

# NOTIFICATION_SERVICE_FIREBASE_DB="https://console.firebase.google.com/u/0/project/celo-org-mobile/database/celo-org-mobile-int/data"

PROMTOSD_SCRAPE_INTERVAL="5m"
PROMTOSD_EXPORT_INTERVAL="5m"

SMS_RETRIEVER_HASH_CODE=l5k6LvdPDXS

# Attestation Bot variables
ATTESTATION_BOT_INITIAL_WAIT_SECONDS=3
ATTESTATION_BOT_IN_BETWEEN_WAIT_SECONDS=10
ATTESTATION_BOT_MAX_ATTESTATIONS=3
6 changes: 3 additions & 3 deletions .env.integration
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth-all"
GETH_BOOTNODE_DOCKER_IMAGE_TAG="803c05715bd12a3c148fa870e208cbdcebcc8cb8"

CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-5bea6d30cbe6aa4272b32a4d2cfed5567f422ea9"
CELOTOOL_DOCKER_IMAGE_TAG="celotool-53016a800a510cddae73444377bcf366d753367a"

CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone"
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2"
Expand All @@ -47,10 +47,10 @@ ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle"
ORACLE_DOCKER_IMAGE_TAG="default"

TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-d405b99872097291c8e07d2445559588547938b0"
TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-8e69cf86010b62e283d5f9285f181fca5483733e"

ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-5ee799c0a726a44113cc0a9b26932531019a07a4"
ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-8e69cf86010b62e283d5f9285f181fca5483733e"

GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter"
GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261"
Expand Down
Binary file modified .env.mnemonic.baklava.enc
Binary file not shown.
Binary file modified .env.mnemonic.baklavastaging.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages/protocol/types/
!packages/protocol/lib/**/*.ts
packages/protocol/scripts/**/*.js
packages/protocol/migrations/**/*.js
packages/protocol/tests/**/*.js
packages/protocol/test/**/*.js

packages/verification-pool-api/contracts/*.ts

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ts-node": "^8.3.0",
"tsconfig-paths": "^3.8.0",
"tslint": "^5.20.0",
"typescript": "^3.5.3",
"typescript": "^3.7.3",
"typescript-tslint-plugin": "^0.5.4"
},
"dependencies": {
Expand All @@ -76,6 +76,7 @@
"**/deep-extend": "^0.5.1",
"**/extend": "^3.0.2",
"**/cross-fetch": "^3.0.2",
"sha3": "1.2.3"
"sha3": "1.2.3",
"bignumber.js": "9.0.0"
}
}
29 changes: 25 additions & 4 deletions packages/attestation-service/src/db.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ContractKit, newKit } from '@celo/contractkit'
import { FindOptions, Sequelize } from 'sequelize'
import { Block } from 'web3/eth/types'
import { fetchEnv } from './env'
import { rootLogger } from './logger'
import Attestation, { AttestationModel, AttestationStatic } from './models/attestation'
Expand All @@ -22,11 +23,31 @@ export let kit: ContractKit
export async function initializeKit() {
if (kit === undefined) {
kit = newKit(fetchEnv('CELO_PROVIDER'))
const blockNumber = await kit.web3.eth.getBlockNumber()
if (blockNumber === 0) {
throw new Error(
'Could not fetch latest block from web3 provider ' + fetchEnv('CELO_PROVIDER')
// Copied from @celo/cli/src/utils/helpers
try {
const syncProgress = await kit.web3.eth.isSyncing()
if (typeof syncProgress === 'boolean' && !syncProgress) {
const latestBlock: Block = await kit.web3.eth.getBlock('latest')
if (latestBlock && latestBlock.number > 0) {
// To catch the case in which syncing has happened in the past,
// has stopped, and hasn't started again, check for an old timestamp
// on the latest block
const ageOfBlock = Date.now() / 1000 - latestBlock.timestamp
if (ageOfBlock > 120) {
throw new Error(
`Latest block is ${ageOfBlock} seconds old, and syncing is not currently in progress`
)
}
}
} else {
throw new Error('Node is not syncing')
}
} catch (error) {
rootLogger.error(
'Initializing Kit failed, are you running your node and specified it with the "CELO_PROVIDER" env var?. It\' currently set as ' +
fetchEnv('CELO_PROVIDER')
)
throw error
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/attestation-service/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { createStream } from 'bunyan-gke-stackdriver'
import { fetchEnvOrDefault } from './env'

const logLevel = fetchEnvOrDefault('LOG_LEVEL', 'info') as LogLevelString
const logFormat = fetchEnvOrDefault('LOG_FORMAT', 'json')
const logFormat = fetchEnvOrDefault('LOG_FORMAT', 'human')

let stream: any
switch (logFormat) {
case 'stackdriver':
stream = createStream(levelFromName[logLevel])
break
case 'human':
stream = { level: logLevel, stream: bunyanDebugStream() }
case 'json':
stream = { stream: process.stdout, level: logLevel }
break
default:
stream = { stream: process.stdout, level: logLevel }
stream = { level: logLevel, stream: bunyanDebugStream() }
break
}

Expand Down
1 change: 1 addition & 0 deletions packages/blockchain-api/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DEPLOY_ENV=local
EXCHANGE_RATES_API=https://apilayer.net/api
BLOCKSCOUT_API=https://integration-blockscout.celo-testnet.org/api
FIREBASE_DB=https://celo-org-mobile-integration.firebaseio.com
FAUCET_ADDRESS=0x47e172F6CfB6c7D01C1574fa3E2Be7CC73269D95
VERIFICATION_REWARDS_ADDRESS=0xb4fdaf5f3cd313654aa357299ada901b1d2dd3b5
WEB3_PROVIDER_URL=https://integration-forno.celo-testnet.org
3 changes: 3 additions & 0 deletions packages/blockchain-api/.gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ dist/
# Exclude dependencies
node_modules/
.env

# Exclude tests
*.test.ts
3 changes: 2 additions & 1 deletion packages/blockchain-api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ dist/
# Exclude dependencies
node_modules/

# keys
# Exclude secrets
serviceAccountKey.json
src/secrets.json
2 changes: 2 additions & 0 deletions packages/blockchain-api/__mocks__/@celo/contractkit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Empty implementation because it currently adds ~8 secs for each test
// TODO: investigate why
2 changes: 2 additions & 0 deletions packages/blockchain-api/__mocks__/firebase-admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const initializeApp = jest.fn()
export const database = jest.fn()
1 change: 1 addition & 0 deletions packages/blockchain-api/app.alfajores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env_variables:
DEPLOY_ENV: "alfajores"
EXCHANGE_RATES_API: "https://apilayer.net/api"
BLOCKSCOUT_API: "https://alfajores-blockscout.celo-testnet.org/api"
FIREBASE_DB: "https://celo-org-mobile-alfajores.firebaseio.com"
# TODO Pull addresses from the build artifacts of the network in protocol/build
FAUCET_ADDRESS: "0xCEa3eF8e187490A9d85A1849D98412E5D27D1Bb3"
VERIFICATION_REWARDS_ADDRESS: "0xb4fdaf5f3cd313654aa357299ada901b1d2dd3b5"
Expand Down
1 change: 1 addition & 0 deletions packages/blockchain-api/app.alfajoresstaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env_variables:
DEPLOY_ENV: "alfajoresstaging"
EXCHANGE_RATES_API: "https://apilayer.net/api"
BLOCKSCOUT_API: "https://alfajoresstaging-blockscout.celo-testnet.org/api"
FIREBASE_DB: "https://celo-org-mobile-alfajoresstaging.firebaseio.com"
# TODO Pull addresses from the build artifacts of the network in protocol/build
FAUCET_ADDRESS: "0xF4314cb9046bECe6AA54bb9533155434d0c76909"
VERIFICATION_REWARDS_ADDRESS: "0xb4fdaf5f3cd313654aa357299ada901b1d2dd3b5"
Expand Down
1 change: 1 addition & 0 deletions packages/blockchain-api/app.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env_variables:
DEPLOY_ENV: "integration"
EXCHANGE_RATES_API: "https://apilayer.net/api"
BLOCKSCOUT_API: "https://integration-blockscout.celo-testnet.org/api"
FIREBASE_DB: "https://celo-org-mobile-integration.firebaseio.com"
# TODO Pull addresses from the build artifacts of the network in protocol/build
FAUCET_ADDRESS: "0x47e172F6CfB6c7D01C1574fa3E2Be7CC73269D95"
VERIFICATION_REWARDS_ADDRESS: "0xb4fdaf5f3cd313654aa357299ada901b1d2dd3b5"
Expand Down
1 change: 1 addition & 0 deletions packages/blockchain-api/app.pilot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env_variables:
DEPLOY_ENV: "pilot"
EXCHANGE_RATES_API: "https://apilayer.net/api"
BLOCKSCOUT_API: "https://pilot-blockscout.celo-testnet.org/api"
FIREBASE_DB: "https://celo-org-mobile-pilot.firebaseio.com"
# TODO Pull addresses from the build artifacts of the network in protocol/build
FAUCET_ADDRESS: "0x387bCb16Bfcd37AccEcF5c9eB2938E30d3aB8BF2"
VERIFICATION_REWARDS_ADDRESS: "0xb4fdaf5f3cd313654aa357299ada901b1d2dd3b5"
Expand Down
1 change: 1 addition & 0 deletions packages/blockchain-api/app.pilotstaging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env_variables:
DEPLOY_ENV: "pilotstaging"
EXCHANGE_RATES_API: "https://apilayer.net/api"
BLOCKSCOUT_API: "https://pilotstaging-blockscout.celo-testnet.org/api"
FIREBASE_DB: "https://celo-org-mobile-pilotstaging.firebaseio.com"
# TODO Pull addresses from the build artifacts of the network in protocol/build
FAUCET_ADDRESS: "0x545DEBe3030B570731EDab192640804AC8Cf65CA"
VERIFICATION_REWARDS_ADDRESS: "0xb4fdaf5f3cd313654aa357299ada901b1d2dd3b5"
Expand Down
4 changes: 3 additions & 1 deletion packages/blockchain-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
},
"dependencies": {
"@celo/contractkit": "0.2.0",
"@celo/utils": "^0.1.0",
"apollo-datasource-rest": "^0.3.1",
"apollo-server-express": "^2.4.2",
"bignumber.js": "^7.2.0",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"firebase-admin": "^8.6.1",
"graphql": "^14.1.1",
"utf8": "^3.0.0",
"web3-eth-abi": "1.0.0-beta.37"
Expand All @@ -35,7 +37,7 @@
"@types/web3": "^1.0.18",
"jest-fetch-mock": "^2.1.2",
"tsc-watch": "^1.0.31",
"typescript": "^3.5.3"
"typescript": "^3.7.3"
},
"resolutions": {
"**/cross-fetch": "3.0.4"
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/blockchain-api/src/apolloServer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApolloServer } from 'apollo-server-express'
import { BlockscoutAPI } from './blockscout'
import { CurrencyConversionAPI } from './currencyConversion'
import CurrencyConversionAPI from './currencyConversion/CurrencyConversionAPI'
import { resolvers, typeDefs } from './schema'

export interface DataSources {
Expand Down
24 changes: 24 additions & 0 deletions packages/blockchain-api/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,34 @@ function getSecrets(deployEnv: string) {
return envSecrets
}

export function getFirebaseAdminCreds(admin: any) {
// TODO: move project to celo-org-mobile
// until then, using serviceAccountKey for all envs
// tslint:disable-next-line: no-constant-condition
if (true /* DEPLOY_ENV === 'local' */) {
try {
const serviceAccount = require('../serviceAccountKey.json')
return admin.credential.cert(serviceAccount)
} catch (error) {
console.error(
'Error: Could not initialize admin credentials. Is serviceAccountKey.json missing?',
error
)
}
} else {
try {
return admin.credential.applicationDefault()
} catch (error) {
console.error('Error: Could not retrieve default app creds', error)
}
}
}

export const DEPLOY_ENV = (process.env.DEPLOY_ENV as string).toLowerCase()
export const EXCHANGE_RATES_API = (process.env.EXCHANGE_RATES_API as string).toLowerCase()
export const { EXCHANGE_RATES_API_ACCESS_KEY } = getSecrets(DEPLOY_ENV)
export const BLOCKSCOUT_API = (process.env.BLOCKSCOUT_API as string).toLowerCase()
export const FIREBASE_DB = process.env.FIREBASE_DB
export const FAUCET_ADDRESS = (process.env.FAUCET_ADDRESS as string).toLowerCase()
export const VERIFICATION_REWARDS_ADDRESS = (process.env
.VERIFICATION_REWARDS_ADDRESS as string).toLowerCase()
Expand Down
Loading

0 comments on commit 4c512fd

Please sign in to comment.