Skip to content

Commit

Permalink
Merge pull request #2789 from near/master
Browse files Browse the repository at this point in the history
2022-06-28 Release
  • Loading branch information
andy-haynes authored Jun 29, 2022
2 parents 64c0870 + 8166476 commit e00db32
Show file tree
Hide file tree
Showing 42 changed files with 888 additions and 155 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jenkinsfile @morgsmccauley @andy-haynes
58 changes: 30 additions & 28 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ pipeline {
AWS_CREDENTIALS = 'aws-credentials-password'
AWS_REGION = 'us-west-2'
TESTNET_AWS_ROLE = credentials('testnet-assumed-role')
TESTNET_AWS_ROLE_ACCOUNT = credentials('testnet-assumed-role-account')
TESTNET_AWS_ACCOUNT_ID = credentials('testnet-mnw-account-id')
MAINNET_AWS_ROLE = credentials('mainnet-assumed-role')
MAINNET_AWS_ROLE_ACCOUNT = credentials('mainnet-assumed-role-account')
MAINNET_AWS_ACCOUNT_ID = credentials('mainnet-mnw-account-id')

// s3 buckets
TESTNET_PR_PREVIEW_STATIC_SITE_BUCKET = credentials('testnet-pr-previews-static-website')
Expand Down Expand Up @@ -47,6 +47,7 @@ pipeline {
steps {
dir("$WORKSPACE/packages/frontend") {
sh 'yarn install --frozen-lockfile'
sh 'yarn lint'
}
}
}
Expand All @@ -62,10 +63,13 @@ pipeline {
stage('packages:test') {
failFast true

when {
expression { env.BUILD_FRONTEND == 'true' }
}
parallel {
stage('frontend:prebuild:testnet-staging') {
when {
expression { env.BUILD_FRONTEND == 'true' }
not { branch 'stable' }
}
environment {
NEAR_WALLET_ENV = 'testnet_STAGING'
Expand All @@ -79,7 +83,7 @@ pipeline {

stage('frontend:prebuild:testnet') {
when {
expression { env.BUILD_FRONTEND == 'true' }
not { branch 'stable' }
}
environment {
NEAR_WALLET_ENV = 'testnet'
Expand All @@ -93,7 +97,7 @@ pipeline {

stage('frontend:prebuild:mainnet-staging') {
when {
expression { env.BUILD_FRONTEND == 'true' }
not { branch 'stable' }
}
environment {
NEAR_WALLET_ENV = 'mainnet_STAGING'
Expand All @@ -106,9 +110,6 @@ pipeline {
}

stage('frontend:prebuild:mainnet') {
when {
expression { env.BUILD_FRONTEND == 'true' }
}
environment {
NEAR_WALLET_ENV = 'mainnet'
}
Expand Down Expand Up @@ -137,8 +138,7 @@ pipeline {
// build end-to-end testing package
stage('e2e-tests') {
when {
expression { env.BUILD_E2E == 'true' };
anyOf { branch 'master' ; branch 'stable' }
expression { env.BUILD_E2E == 'true' }
}
stages {
stage('e2e-tests:build') {
Expand All @@ -155,7 +155,8 @@ pipeline {
// build frontend bundles
stage('frontend:bundle:testnet-staging') {
when {
expression { env.BUILD_FRONTEND == 'true' }
expression { env.BUILD_FRONTEND == 'true' };
not { branch 'stable' }
}
environment {
NEAR_WALLET_ENV = 'testnet_STAGING'
Expand All @@ -170,7 +171,8 @@ pipeline {

stage('frontend:bundle:testnet') {
when {
expression { env.BUILD_FRONTEND == 'true' }
expression { env.BUILD_FRONTEND == 'true' };
branch 'master'
}
environment {
NEAR_WALLET_ENV = 'testnet'
Expand All @@ -185,7 +187,8 @@ pipeline {

stage('frontend:bundle:mainnet-staging') {
when {
expression { env.BUILD_FRONTEND == 'true' }
expression { env.BUILD_FRONTEND == 'true' };
not { branch 'stable' }
}
environment {
NEAR_WALLET_ENV = 'mainnet_STAGING'
Expand All @@ -200,7 +203,8 @@ pipeline {

stage('frontend:bundle:mainnet') {
when {
expression { env.BUILD_FRONTEND == 'true' }
expression { env.BUILD_FRONTEND == 'true' };
branch 'stable'
}
environment {
NEAR_WALLET_ENV = 'mainnet'
Expand Down Expand Up @@ -243,13 +247,13 @@ pipeline {
region: env.AWS_REGION,
credentials: env.AWS_CREDENTIALS,
role: env.TESTNET_AWS_ROLE,
roleAccount: env.TESTNET_AWS_ROLE_ACCOUNT
roleAccount: env.TESTNET_AWS_ACCOUNT_ID
) {
s3Upload(
bucket: "$TESTNET_PR_PREVIEW_STATIC_SITE_BUCKET/$CHANGE_ID",
includePathPattern: "*",
path: '',
workingDir: env.FRONTEND_TESTNET_BUNDLE_PATH
workingDir: env.FRONTEND_TESTNET_STAGING_BUNDLE_PATH
)
}
}
Expand All @@ -265,13 +269,13 @@ pipeline {
region: env.AWS_REGION,
credentials: env.AWS_CREDENTIALS,
role: env.MAINNET_AWS_ROLE,
roleAccount: env.MAINNET_AWS_ROLE_ACCOUNT
roleAccount: env.MAINNET_AWS_ACCOUNT_ID
) {
s3Upload(
bucket: "$MAINNET_PR_PREVIEW_STATIC_SITE_BUCKET/$CHANGE_ID",
includePathPattern: "*",
path: '',
workingDir: env.FRONTEND_MAINNET_BUNDLE_PATH
workingDir: env.FRONTEND_MAINNET_STAGING_BUNDLE_PATH
)
}
}
Expand All @@ -295,7 +299,7 @@ pipeline {
region: env.AWS_REGION,
credentials: env.AWS_CREDENTIALS,
role: env.TESTNET_AWS_ROLE,
roleAccount: env.TESTNET_AWS_ROLE_ACCOUNT
roleAccount: env.TESTNET_AWS_ACCOUNT_ID
) {
s3Upload(
bucket: env.TESTNET_STAGING_STATIC_SITE_BUCKET,
Expand All @@ -313,13 +317,11 @@ pipeline {
}
steps {
milestone(403)
input(message: 'Deploy to testnet?')
milestone(404)
withAWS(
region: env.AWS_REGION,
credentials: env.AWS_CREDENTIALS,
role: env.TESTNET_AWS_ROLE,
roleAccount: env.TESTNET_AWS_ROLE_ACCOUNT
roleAccount: env.TESTNET_AWS_ACCOUNT_ID
) {
s3Upload(
bucket: env.TESTNET_STATIC_SITE_BUCKET,
Expand All @@ -333,15 +335,15 @@ pipeline {

stage('frontend:deploy:mainnet-staging') {
when {
branch 'stable'
branch 'master'
}
steps {
milestone(405)
milestone(404)
withAWS(
region: env.AWS_REGION,
credentials: env.AWS_CREDENTIALS,
role: env.MAINNET_AWS_ROLE,
roleAccount: env.MAINNET_AWS_ROLE_ACCOUNT
roleAccount: env.MAINNET_AWS_ACCOUNT_ID
) {
s3Upload(
bucket: env.MAINNET_STAGING_STATIC_SITE_BUCKET,
Expand All @@ -358,14 +360,14 @@ pipeline {
branch 'stable'
}
steps {
milestone(406)
milestone(405)
input(message: 'Deploy to mainnet?')
milestone(407)
milestone(406)
withAWS(
region: env.AWS_REGION,
credentials: env.AWS_CREDENTIALS,
role: env.MAINNET_AWS_ROLE,
roleAccount: env.MAINNET_AWS_ROLE_ACCOUNT
roleAccount: env.MAINNET_AWS_ACCOUNT_ID
) {
s3Upload(
bucket: env.MAINNET_STATIC_SITE_BUCKET,
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/ci/ParcelBundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class ParcelBundler {
this.bundler.on('bundled', (bundle) => {
fs.copyFileSync(this.buildWasmSourcePath('multisig.wasm'), this.buildOutputPath('multisig.wasm'));
fs.copyFileSync(this.buildWasmSourcePath('main.wasm'), this.buildOutputPath('main.wasm'));
fs.copyFileSync(this.buildWasmSourcePath('state_cleanup.wasm'), this.buildOutputPath('state_cleanup.wasm'));
});

return this.bundler;
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"lodash.unset": "^4.5.2",
"lodash.update": "^4.10.2",
"mixpanel-browser": "^2.41.0",
"near-api-js": "^0.43.1",
"near-api-js": "^0.45.1",
"near-ledger-js": "^0.2.1",
"near-seed-phrase": "^0.2.0",
"node-cache": "^5.1.2",
Expand Down Expand Up @@ -65,7 +65,7 @@
},
"scripts": {
"predeploy": "yarn build",
"update:static": "cp src/wasm/multisig.wasm dist/multisig.wasm && cp src/wasm/main.wasm dist/main.wasm",
"update:static": "cp src/wasm/multisig.wasm dist/multisig.wasm && cp src/wasm/main.wasm dist/main.wasm && cp src/wasm/state_cleanup.wasm dist/state_cleanup.wasm",
"start": "yarn update:static; parcel src/index.html --https --cert devServerCertificates/primary.crt --key devServerCertificates/private.pem",
"prebuild": "rm -rf dist/",
"build": "yarn run bundle && yarn run sentry",
Expand All @@ -76,8 +76,8 @@
"fix": "eslint --ext .js --ext .jsx . --fix",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"prepush": "yarn run test",
"precommit": "concurrently \"yarn run fix\" \".githooks/format-json\"",
"prepush": "concurrently \"yarn run test\" \"yarn lint\"",
"precommit": ".githooks/format-json",
"preinstall": "npx only-allow yarn"
},
"browserslist": [
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/src/components/Routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
import AccessKeysWrapper from './access-keys/v2/AccessKeysWrapper';
import { AutoImportWrapper } from './accounts/auto_import/AutoImportWrapper';
import BatchImportAccounts from './accounts/batch_import_accounts';
import BatchLedgerExport from './accounts/batch_ledger_export';
import { ExistingAccountWrapper } from './accounts/create/existing_account/ExistingAccountWrapper';
import { InitialDepositWrapper } from './accounts/create/initial_deposit/InitialDepositWrapper';
import { CreateAccountLanding } from './accounts/create/landing/CreateAccountLanding';
Expand Down Expand Up @@ -579,6 +580,11 @@ class Routing extends Component {
}, {});
return <BatchImportAccounts accountIdToKeyMap={accountIdToKeyMap} onCancel={() => this.props.history.replace('/')}/>;
})} />
<Route
exact
path="/batch-ledger-export"
component={BatchLedgerExport}
/>
<Route
exact
path="/sign-in-ledger"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const CustomContainer = styled.div`
}
`;

const BatchImportAccountsSuccessScreen = ({ accounts = [] }) => {
const BatchImportAccountsSuccessScreen = ({ accounts = [], customTitleId }) => {
const dispatch = useDispatch();
const accountUrlReferrer = useSelector(selectAccountUrlReferrer);

Expand All @@ -36,7 +36,7 @@ const BatchImportAccountsSuccessScreen = ({ accounts = [] }) => {
<AvatarSuccessIcon />
<div className='screen-descripton'>
<h3>
<Translate id="batchImportAccounts.successScreen.title" data={{ noOfAccounts: accounts.length }}/>
<Translate id={customTitleId || 'batchImportAccounts.successScreen.title'} data={{ noOfAccounts: accounts.length }}/>
{accountUrlReferrer || <Translate id="sign.unknownApp" />}
</h3>
<br />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { differenceBy } from 'lodash';
import { differenceBy, uniqWith, isEqual } from 'lodash';

import { IMPORT_STATUS } from '.';

/**
* @typedef {{
* accountId: string,
* status: "pending" | "success" | "waiting" | "error" | null ,
* key: string,
* ledgerHdPath: string
* key?: string,
* ledgerHdPath?: string,
* keyType?: string
* }} account
*
* @typedef {{accounts: account[], urlConfirmed: boolean}} state
Expand Down Expand Up @@ -46,6 +47,13 @@ const sequentialAccountImportReducer = (state = initialState, action) => {

return;
}
case ACTIONS.ADD_ACCOUNTS: {
if (state.accounts.every(({ status }) => status === null)) {
state.accounts = uniqWith(state.accounts.concat(action.accounts), isEqual);
}

return;
}
case ACTIONS.BEGIN_IMPORT: {
if (state.accounts.every(({ status }) => status === null)) {
const [firstAccount, ...remainingAccounts] = state.accounts;
Expand Down
Loading

0 comments on commit e00db32

Please sign in to comment.