Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy committed Jul 31, 2019
2 parents 4634733 + 74a6423 commit a17a99c
Show file tree
Hide file tree
Showing 32 changed files with 221 additions and 98 deletions.
73 changes: 73 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ jobs:
- attach_workspace:
at: ~/app

- run:
name: Ensure translations are not missing
command: |
set -euo pipefail
diff <(cat packages/mobile/locales/en-US/*.json | jq keys | sort) <(cat packages/mobile/locales/es-AR/*.json | jq keys | sort)
- run:
name: jest tests
command: |
Expand Down Expand Up @@ -218,6 +224,27 @@ jobs:
# Flaky tests - run them twice
command: yarn --cwd packages/protocol test || yarn --cwd packages/protocol test

contractkit-test:
<<: *defaults
steps:
- attach_workspace:
at: ~/app
- run:
name: test alphanet
command: |
# Test alphanet
set -euo pipefail
yarn --cwd=packages/contractkit build alfajores
yarn --cwd=packages/contractkit test
- run:
name: test alphanet staging
command: |
# Test alphanet
set -euo pipefail
yarn --cwd=packages/contractkit build alfajoresstaging
yarn --cwd=packages/contractkit test
cli-test:
<<: *defaults
steps:
Expand Down Expand Up @@ -318,6 +345,35 @@ jobs:
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
./ci_test_sync.sh checkout master
end-to-end-geth-integration-sync-test:
<<: *defaults
steps:
- attach_workspace:
at: ~/app
- run:
name: Check if the test should run
command: |
DIRS_TO_CHECK="${PWD}/packages/celotool,${PWD}/packages/protocol"
./scripts/ci_check_if_test_should_run_v2.sh ${DIRS_TO_CHECK}
- run:
name: Setup Go language
command: |
set -e
set -v
wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz
tar xf go1.11.5.linux-amd64.tar.gz -C /tmp
ls /tmp/go/bin/go
/tmp/go/bin/go version
- run:
name: Run test
command: |
set -e
export PATH=${PATH}:/tmp/go/bin
go version
cd packages/celotool
mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
./ci_test_integration_sync.sh checkout master
web:
working_directory: ~/app
docker:
Expand All @@ -340,10 +396,19 @@ workflows:
- build-all-packages:
requires:
- install_dependencies
- lint-checks
- general-test:
requires:
- install_dependencies
- lint-checks
- contractkit-test:
requires:
- install_dependencies
- lint-checks
- cli-test:
requires:
- install_dependencies
- lint-checks
- mobile-test:
requires:
- install_dependencies
Expand All @@ -359,12 +424,20 @@ workflows:
- protocol-test:
requires:
- install_dependencies
- lint-checks
- end-to-end-geth-transfer-test:
requires:
- install_dependencies
- lint-checks
- end-to-end-geth-governance-test:
requires:
- install_dependencies
- lint-checks
- end-to-end-geth-sync-test:
requires:
- install_dependencies
- lint-checks
- end-to-end-geth-integration-sync-test:
requires:
- install_dependencies
- lint-checks
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"node": ">=8.0.0"
},
"scripts": {
"setup:environment": "./import_contract_types_from_sdk.sh",
"setup:environment": "yarn --cwd=packages/contractkit build-sdk",
"build": "rm -rf lib && yarn run prepack",
"lint": "tslint -c tslint.json --project tsconfig.json",
"lint-checks": "yarn run lint",
Expand All @@ -32,6 +32,7 @@
"version": "oclif-dev readme && git add README.md"
},
"dependencies": {
"@celo/contractkit": "^0.0.1",
"@oclif/command": "^1",
"@oclif/config": "^1",
"@oclif/plugin-help": "^2",
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/src/adapters/bonded-deposit.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import Web3 from 'web3'
import { BondedDeposits } from '../generated/contracts'
import { Address, zip } from '../utils/helpers'

import BN from 'bn.js'
import Web3 from 'web3'
import { TransactionObject } from 'web3/eth/types'

import { BondedDeposits } from '@celo/contractkit'

import { Address, zip } from '../utils/helpers'

export interface VotingDetails {
accountAddress: Address
voterAddress: Address
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/adapters/validators.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Web3 from 'web3'
import { TransactionObject } from 'web3/eth/types'
import { Validators } from '../generated/contracts'

import { Validators } from '@celo/contractkit'

import { Address, compareBN, eqAddress, NULL_ADDRESS, zip } from '../utils/helpers'
import { BondedDepositAdapter } from './bonded-deposit'

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/account/balance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StableToken } from '@celo/contractkit'

import { BaseCommand } from '../../base'
import { StableToken } from '../../generated/contracts'
import { printValueMap } from '../../utils/cli'
import { Args } from '../../utils/command'

Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/account/transferdollar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { flags } from '@oclif/command'
import Web3 from 'web3'

import { StableToken } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { StableToken } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/account/transfergold.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { flags } from '@oclif/command'
import Web3 from 'web3'

import { GoldToken } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { GoldToken } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/bonds/deposit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { flags } from '@oclif/command'
import Web3 from 'web3'

import { BondedDeposits } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { BondedDeposits } from '../../generated/contracts'
import { BondArgs } from '../../utils/bonds'
import { displaySendTx, failWith } from '../../utils/cli'
import { Flags } from '../../utils/command'
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/bonds/notify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BondedDeposits } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { BondedDeposits } from '../../generated/contracts'
import { BondArgs } from '../../utils/bonds'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/bonds/register.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BondedDeposits } from '@celo/contractkit'

import { BaseCommand } from '../../base'
import { BondedDeposits } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/bonds/withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BondedDeposits } from '@celo/contractkit'

import { BaseCommand } from '../../base'
import { BondedDeposits } from '../../generated/contracts'
import { BondArgs } from '../../utils/bonds'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/commands/exchange/list.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { flags } from '@oclif/command'
import { cli } from 'cli-ux'

import { Exchange } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { Exchange } from '../../generated/contracts'

export default class List extends BaseCommand {
static description = 'List information about tokens on the exchange (all amounts in wei)'
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/exchange/selldollar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { StableToken } from '@celo/contractkit'

import { BaseCommand } from '../../base'
import { StableToken } from '../../generated/contracts'
import { doSwap, swapArguments } from '../../utils/exchange'

export default class SellDollar extends BaseCommand {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/exchange/sellgold.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GoldToken } from '@celo/contractkit'

import { BaseCommand } from '../../base'
import { GoldToken } from '../../generated/contracts'
import { doSwap, swapArguments } from '../../utils/exchange'

export default class SellGold extends BaseCommand {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/validator/affiliation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Validators } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { Validators } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/validator/register.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Validators } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { Validators } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/validatorgroup/member.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Validators } from '@celo/contractkit'
import { flags } from '@oclif/command'
import { IArg } from '@oclif/parser/lib/args'

import { BaseCommand } from '../../base'
import { Validators } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Args, Flags } from '../../utils/command'

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/commands/validatorgroup/register.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Validators } from '@celo/contractkit'
import { flags } from '@oclif/command'

import { BaseCommand } from '../../base'
import { Validators } from '../../generated/contracts'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'

Expand Down
7 changes: 4 additions & 3 deletions packages/cli/src/utils/exchange.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Web3 from 'web3'
import { Exchange } from '../generated/contracts'
import { IERC20Token } from '../generated/types/IERC20Token'

import { CeloTokenType, Exchange } from '@celo/contractkit'

import { displaySendTx } from './cli'

export const swapArguments = [
Expand Down Expand Up @@ -30,7 +31,7 @@ interface SwapArgs {
export const doSwap = async (
web3: Web3,
args: SwapArgs,
sellToken: IERC20Token,
sellToken: CeloTokenType,
sellGold: boolean
) => {
const exchange = await Exchange(web3, args.from)
Expand Down
26 changes: 11 additions & 15 deletions packages/contractkit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import GenesisBlockUtils from './src/genesis-block-utils'
import GoogleStorageUtils from './src/google-storage-utils'
import { Logger, LogLevel } from './src/logger'
import StaticNodeUtils from './src/static-node-utils'
import { Web3Utils } from './src/web3-utils'

export {
Attestations,
Expand All @@ -23,17 +24,17 @@ export {
export {
CeloFunctionCall,
CeloLog,
FunctionABICache,
constructFunctionABICache,
FunctionABICache,
getFunctionSignatureFromInput,
parseFunctionCall,
parseLog,
} from './src/abi'
export { unlockAccount } from './src/account-utils'
export {
ActionableAttestation,
AttestationState,
attestationMessageToSign,
AttestationState,
decodeAttestationCode,
extractAttestationCodeFromMessage,
findMatchingIssuer,
Expand All @@ -54,19 +55,19 @@ export {
validateAttestationCode,
} from './src/attestations'
export {
awaitConfirmation,
CeloContract,
Contracts,
SendTransaction,
SendTransactionLogEvent,
SendTransactionLogEventType,
TxLogger,
TxPromises,
awaitConfirmation,
emptyTxLogger,
getContracts,
selectContractByAddress,
SendTransaction,
sendTransaction,
sendTransactionAsync,
SendTransactionLogEvent,
SendTransactionLogEventType,
TxLogger,
TxPromises,
} from './src/contract-utils'
export {
getABEContract,
Expand All @@ -78,10 +79,10 @@ export {
getStableTokenContract,
} from './src/contracts'
export {
CeloTokenType,
allowance,
approveToken,
balanceOf,
CeloTokenType,
convertToContractDecimals,
getErc20Balance,
getGoldTokenAddress,
Expand All @@ -95,9 +96,4 @@ export { GenesisBlockUtils }
export { GoogleStorageUtils }
export { Logger as ContractKitLogger, LogLevel as ContractKitLogLevel }
export { StaticNodeUtils }

// Note: If we export Web3Utils here than the mobile app fails with the following error: https://pastebin.com/raw/1QzcaFsW
// Therefore, I am disabling that for now
// TODO(ashishb): Renable this
// import { Web3Utils } from './src/web3-utils'
// export { Web3Utils }
export { Web3Utils }
Loading

0 comments on commit a17a99c

Please sign in to comment.