From 75fa6aff1210360971c1e2f07232a25433e67382 Mon Sep 17 00:00:00 2001 From: Danny Cho Date: Thu, 2 Mar 2023 15:51:51 +1300 Subject: [PATCH 01/23] fix: filter out corrupted accounts and continue wallet-migration --- .../wallet-migration/WalletMigration.jsx | 5 ++--- .../src/components/wallet-migration/utils.ts | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/frontend/src/components/wallet-migration/WalletMigration.jsx b/packages/frontend/src/components/wallet-migration/WalletMigration.jsx index e375e1e021..0efc5c6bc3 100644 --- a/packages/frontend/src/components/wallet-migration/WalletMigration.jsx +++ b/packages/frontend/src/components/wallet-migration/WalletMigration.jsx @@ -43,9 +43,8 @@ const WalletMigration = ({ open, onClose }) => { useEffect(() => { const importRotatableAccounts = async () => { const accounts = await wallet.keyStore.getAccounts(NETWORK_ID); - const details = await Promise.all( - accounts.map((accountId) => getAccountDetails({ accountId, wallet })) - ); + const details = await Promise.allSettled(accounts.map((accountId) => getAccountDetails({ accountId, wallet }))) + .then((results) => results.filter(({ status }) => status === 'fulfilled').map(({ value }) => value)); setAccountWithDetails(details); setLoadingMultisigAccounts(false); }; diff --git a/packages/frontend/src/components/wallet-migration/utils.ts b/packages/frontend/src/components/wallet-migration/utils.ts index 20027b67da..762a0a71e3 100644 --- a/packages/frontend/src/components/wallet-migration/utils.ts +++ b/packages/frontend/src/components/wallet-migration/utils.ts @@ -52,14 +52,19 @@ export const redirectLinkdropUser = ({ }; export async function getAccountDetails({ accountId, wallet }) { - const keyType = await wallet.getAccountKeyType(accountId); - const accountBalance = await wallet.getBalance(keyType.accountId); + try { + const keyType = await wallet.getAccountKeyType(accountId); + const accountBalance = await wallet.getBalance(keyType.accountId); - const account = await wallet.getAccount(accountId); - let isConversionRequired = false; - if (typeof account.isKeyConversionRequiredForDisable === 'function') { - isConversionRequired = await account.isKeyConversionRequiredForDisable(); - } + const account = await wallet.getAccount(accountId); + let isConversionRequired = false; + if (typeof account.isKeyConversionRequiredForDisable === 'function') { + isConversionRequired = await account.isKeyConversionRequiredForDisable(); + } - return { accountId, keyType, accountBalance, isConversionRequired }; + return { accountId, keyType, accountBalance, isConversionRequired }; + } catch (e) { + console.log(`account ${accountId} error: ${e}`); + throw e; + } } From 6b10eabfa66875b00fb9ddfc777065527073ac81 Mon Sep 17 00:00:00 2001 From: Andy Haynes Date: Mon, 6 Mar 2023 13:30:48 -0800 Subject: [PATCH 02/23] fix: use accountWithDetails --- .../src/components/wallet-migration/WalletMigration.jsx | 2 +- .../wallet-migration/modals/CleanKeysModal/CleanKeysModal.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/wallet-migration/WalletMigration.jsx b/packages/frontend/src/components/wallet-migration/WalletMigration.jsx index 0efc5c6bc3..b566cfa56c 100644 --- a/packages/frontend/src/components/wallet-migration/WalletMigration.jsx +++ b/packages/frontend/src/components/wallet-migration/WalletMigration.jsx @@ -161,7 +161,7 @@ const WalletMigration = ({ open, onClose }) => { )} {state.activeView === WALLET_MIGRATION_VIEWS.CLEAN_KEYS && ( { const importAccounts = async () => { const accountDetails = await Promise.all( - accounts.map((accountId) => getAccountDetails({ + accounts.map(({ accountId }) => getAccountDetails({ accountId, publicKeyBlacklist: rotatedPublicKeys, wallet, From 85376d192a20318e42259d47426bc7b7b032e743 Mon Sep 17 00:00:00 2001 From: Andy Haynes Date: Mon, 6 Mar 2023 13:52:39 -0800 Subject: [PATCH 03/23] fix: set NETWORK_ID to a real value --- packages/frontend/src/config/environmentDefaults/mainnet.js | 2 +- .../frontend/src/config/environmentDefaults/mainnet_STAGING.js | 2 +- packages/frontend/src/config/environmentDefaults/testnet.js | 2 +- .../frontend/src/config/environmentDefaults/testnet_STAGING.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/config/environmentDefaults/mainnet.js b/packages/frontend/src/config/environmentDefaults/mainnet.js index 9047c02b4e..afb2e589cd 100644 --- a/packages/frontend/src/config/environmentDefaults/mainnet.js +++ b/packages/frontend/src/config/environmentDefaults/mainnet.js @@ -41,7 +41,7 @@ export default { ], MULTISIG_MIN_AMOUNT: '4', MULTISIG_MIN_PROMPT_AMOUNT: '200', - NETWORK_ID: 'default', + NETWORK_ID: 'mainnet', NODE_URL: 'https://rpc.mainnet.near.org', REACT_APP_USE_TESTINGLOCKUP: false, RECAPTCHA_CHALLENGE_API_KEY: '6LeRzswaAAAAAGeS7mSasZ1wDcGnMcH3D7W1gy1b', diff --git a/packages/frontend/src/config/environmentDefaults/mainnet_STAGING.js b/packages/frontend/src/config/environmentDefaults/mainnet_STAGING.js index 65168d108d..45621c8501 100644 --- a/packages/frontend/src/config/environmentDefaults/mainnet_STAGING.js +++ b/packages/frontend/src/config/environmentDefaults/mainnet_STAGING.js @@ -41,7 +41,7 @@ export default { ], MULTISIG_MIN_AMOUNT: '4', MULTISIG_MIN_PROMPT_AMOUNT: '200', - NETWORK_ID: 'default', + NETWORK_ID: 'mainnet', NODE_URL: 'https://rpc.mainnet.near.org', REACT_APP_USE_TESTINGLOCKUP: false, RECAPTCHA_CHALLENGE_API_KEY: '6LeRzswaAAAAAGeS7mSasZ1wDcGnMcH3D7W1gy1b', diff --git a/packages/frontend/src/config/environmentDefaults/testnet.js b/packages/frontend/src/config/environmentDefaults/testnet.js index 4f768f2f1c..9f77a9ae9a 100644 --- a/packages/frontend/src/config/environmentDefaults/testnet.js +++ b/packages/frontend/src/config/environmentDefaults/testnet.js @@ -41,7 +41,7 @@ export default { ], MULTISIG_MIN_AMOUNT: '4', MULTISIG_MIN_PROMPT_AMOUNT: '200', - NETWORK_ID: 'default', + NETWORK_ID: 'testnet', NODE_URL: 'https://rpc.testnet.near.org', REACT_APP_USE_TESTINGLOCKUP: false, SENTRY_DSN: 'https://75d1dabd0ab646329fad8a3e7d6c761d@o398573.ingest.sentry.io/5254526', diff --git a/packages/frontend/src/config/environmentDefaults/testnet_STAGING.js b/packages/frontend/src/config/environmentDefaults/testnet_STAGING.js index 44b936ff29..ecbda53f7c 100644 --- a/packages/frontend/src/config/environmentDefaults/testnet_STAGING.js +++ b/packages/frontend/src/config/environmentDefaults/testnet_STAGING.js @@ -41,7 +41,7 @@ export default { ], MULTISIG_MIN_AMOUNT: '4', MULTISIG_MIN_PROMPT_AMOUNT: '200', - NETWORK_ID: 'default', + NETWORK_ID: 'testnet', NODE_URL: 'https://rpc.testnet.near.org', REACT_APP_USE_TESTINGLOCKUP: false, SENTRY_DSN: 'https://75d1dabd0ab646329fad8a3e7d6c761d@o398573.ingest.sentry.io/5254526', From a0677f3863325a50493e73381b6e49481c980ac4 Mon Sep 17 00:00:00 2001 From: Danny Cho Date: Tue, 14 Mar 2023 16:49:17 +1300 Subject: [PATCH 04/23] feat: added more partners on buy page --- .../frontend/src/components/buy/BuyNear.js | 32 ++++- .../src/components/buy/FundingType.jsx | 10 +- .../src/components/buy/assets/alchemyPay.svg | 16 +++ .../src/components/buy/assets/allBridge.svg | 14 +++ .../src/components/buy/assets/banxa.svg | 9 ++ .../src/components/buy/assets/binanceUs.svg | 15 +++ .../src/components/buy/assets/bitstamp.svg | 12 ++ .../src/components/buy/assets/coinDCX.svg | 21 ++++ .../src/components/buy/assets/coinbase.svg | 31 +++++ .../src/components/buy/assets/guardarian.svg | 35 ++++++ .../src/components/buy/assets/mercuryo.svg | 4 + .../src/components/buy/assets/multichain.svg | 9 ++ .../src/components/buy/assets/okx.svg | 18 +++ .../src/components/buy/assets/onRamper.svg | 4 + .../src/components/buy/assets/rampNetwork.svg | 10 ++ .../src/components/buy/assets/upbit.svg | 8 ++ .../src/components/buy/assets/wirex.svg | 3 + .../src/components/buy/assets/wormhole.svg | 64 ++++++++++ packages/frontend/src/config/buyNearConfig.js | 114 ++++++++++++++++++ 19 files changed, 426 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/src/components/buy/assets/alchemyPay.svg create mode 100644 packages/frontend/src/components/buy/assets/allBridge.svg create mode 100644 packages/frontend/src/components/buy/assets/banxa.svg create mode 100644 packages/frontend/src/components/buy/assets/binanceUs.svg create mode 100644 packages/frontend/src/components/buy/assets/bitstamp.svg create mode 100644 packages/frontend/src/components/buy/assets/coinDCX.svg create mode 100644 packages/frontend/src/components/buy/assets/coinbase.svg create mode 100644 packages/frontend/src/components/buy/assets/guardarian.svg create mode 100644 packages/frontend/src/components/buy/assets/mercuryo.svg create mode 100644 packages/frontend/src/components/buy/assets/multichain.svg create mode 100644 packages/frontend/src/components/buy/assets/okx.svg create mode 100644 packages/frontend/src/components/buy/assets/onRamper.svg create mode 100644 packages/frontend/src/components/buy/assets/rampNetwork.svg create mode 100644 packages/frontend/src/components/buy/assets/upbit.svg create mode 100644 packages/frontend/src/components/buy/assets/wirex.svg create mode 100644 packages/frontend/src/components/buy/assets/wormhole.svg diff --git a/packages/frontend/src/components/buy/BuyNear.js b/packages/frontend/src/components/buy/BuyNear.js index 2b80df7829..bad66618dd 100644 --- a/packages/frontend/src/components/buy/BuyNear.js +++ b/packages/frontend/src/components/buy/BuyNear.js @@ -224,8 +224,36 @@ export function BuyNear({ match, location, history }) { isWhitelabel ? PayMethods.transak : null, PayMethods.utorg, PayMethods.nearPay, + PayMethods.onRamper, + PayMethods.mercuryo, + PayMethods.guardian, + PayMethods.banxa, + PayMethods.rampNetwork, + PayMethods.alchemyPay, + PayMethods.wirex, + ].filter((v) => !!v); + const bridgeMethods = [ + PayMethods.rainbow, + PayMethods.allbridge, + PayMethods.wormhole, + PayMethods.multichain, + ]; + + const exchangeMethods = [ + PayMethods.okex, + PayMethods.binance, + PayMethods.binanceUs, + PayMethods.huobi, + PayMethods.kraken, + PayMethods.coinbase, + PayMethods.okx, + PayMethods.bitstamp, + PayMethods.upbit, + PayMethods.coinDCX, + ]; + return ( diff --git a/packages/frontend/src/components/buy/FundingType.jsx b/packages/frontend/src/components/buy/FundingType.jsx index 50dff0c1c8..87de35a8d1 100644 --- a/packages/frontend/src/components/buy/FundingType.jsx +++ b/packages/frontend/src/components/buy/FundingType.jsx @@ -47,6 +47,13 @@ const Button = styled.div` const WrapperImg = styled.div` display: flex; + min-width: 110px; +`; + +const Image = styled.img` + height: 20px; + max-width: 150px; + ${({ blackBackground }) => blackBackground && 'background: black;'} `; export const FundingType = ({ @@ -56,6 +63,7 @@ export const FundingType = ({ track, disabled, provideReferrer, + blackBackground = false, }) => { return ( - {name} + {name} {disabled ? null :