Merge branch 'Thunnini/ledger-ethereum-warning'
This commit is contained in:
commit
6a49b69a02
66
.pnp.cjs
generated
66
.pnp.cjs
generated
@ -29,10 +29,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
"packageLocation": "./",\
|
"packageLocation": "./",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@amplitude/analytics-browser", "npm:1.6.6"],\
|
["@amplitude/analytics-browser", "npm:1.6.6"],\
|
||||||
["@keplr-wallet/common", "npm:0.11.23"],\
|
["@keplr-wallet/common", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/cosmos", "npm:0.11.23"],\
|
["@keplr-wallet/cosmos", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/proto-types", "npm:0.11.23"],\
|
["@keplr-wallet/proto-types", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/types", "npm:0.11.23"],\
|
["@keplr-wallet/types", "npm:0.11.25"],\
|
||||||
["@next/eslint-plugin-next", "npm:13.0.5"],\
|
["@next/eslint-plugin-next", "npm:13.0.5"],\
|
||||||
["@sentry/nextjs", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:7.27.0"],\
|
["@sentry/nextjs", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:7.27.0"],\
|
||||||
["@types/eslint", "npm:8.4.10"],\
|
["@types/eslint", "npm:8.4.10"],\
|
||||||
@ -643,11 +643,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@keplr-wallet/common", [\
|
["@keplr-wallet/common", [\
|
||||||
["npm:0.11.23", {\
|
["npm:0.11.25", {\
|
||||||
"packageLocation": "./.yarn/cache/@keplr-wallet-common-npm-0.11.23-21e0bff02f-fa756241d0.zip/node_modules/@keplr-wallet/common/",\
|
"packageLocation": "./.yarn/cache/@keplr-wallet-common-npm-0.11.25-9963e214ee-30aed28c56.zip/node_modules/@keplr-wallet/common/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@keplr-wallet/common", "npm:0.11.23"],\
|
["@keplr-wallet/common", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/crypto", "npm:0.11.23"],\
|
["@keplr-wallet/crypto", "npm:0.11.25"],\
|
||||||
["buffer", "npm:6.0.3"],\
|
["buffer", "npm:6.0.3"],\
|
||||||
["delay", "npm:4.4.1"]\
|
["delay", "npm:4.4.1"]\
|
||||||
],\
|
],\
|
||||||
@ -655,16 +655,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@keplr-wallet/cosmos", [\
|
["@keplr-wallet/cosmos", [\
|
||||||
["npm:0.11.23", {\
|
["npm:0.11.25", {\
|
||||||
"packageLocation": "./.yarn/cache/@keplr-wallet-cosmos-npm-0.11.23-e909d29c73-3777ad82ee.zip/node_modules/@keplr-wallet/cosmos/",\
|
"packageLocation": "./.yarn/cache/@keplr-wallet-cosmos-npm-0.11.25-5a72ef6016-25a540d80f.zip/node_modules/@keplr-wallet/cosmos/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@keplr-wallet/cosmos", "npm:0.11.23"],\
|
["@keplr-wallet/cosmos", "npm:0.11.25"],\
|
||||||
["@ethersproject/address", "npm:5.7.0"],\
|
["@ethersproject/address", "npm:5.7.0"],\
|
||||||
["@keplr-wallet/common", "npm:0.11.23"],\
|
["@keplr-wallet/common", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/crypto", "npm:0.11.23"],\
|
["@keplr-wallet/crypto", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/proto-types", "npm:0.11.23"],\
|
["@keplr-wallet/proto-types", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/types", "npm:0.11.23"],\
|
["@keplr-wallet/types", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/unit", "npm:0.11.23"],\
|
["@keplr-wallet/unit", "npm:0.11.25"],\
|
||||||
["axios", "npm:0.27.2"],\
|
["axios", "npm:0.27.2"],\
|
||||||
["bech32", "npm:1.1.4"],\
|
["bech32", "npm:1.1.4"],\
|
||||||
["buffer", "npm:6.0.3"],\
|
["buffer", "npm:6.0.3"],\
|
||||||
@ -675,10 +675,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@keplr-wallet/crypto", [\
|
["@keplr-wallet/crypto", [\
|
||||||
["npm:0.11.23", {\
|
["npm:0.11.25", {\
|
||||||
"packageLocation": "./.yarn/cache/@keplr-wallet-crypto-npm-0.11.23-00a1560834-660425deb6.zip/node_modules/@keplr-wallet/crypto/",\
|
"packageLocation": "./.yarn/cache/@keplr-wallet-crypto-npm-0.11.25-eb75244924-bdb5ff6c57.zip/node_modules/@keplr-wallet/crypto/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@keplr-wallet/crypto", "npm:0.11.23"],\
|
["@keplr-wallet/crypto", "npm:0.11.25"],\
|
||||||
["@ethersproject/keccak256", "npm:5.7.0"],\
|
["@ethersproject/keccak256", "npm:5.7.0"],\
|
||||||
["bip32", "npm:2.0.6"],\
|
["bip32", "npm:2.0.6"],\
|
||||||
["bip39", "npm:3.0.4"],\
|
["bip39", "npm:3.0.4"],\
|
||||||
@ -692,10 +692,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@keplr-wallet/proto-types", [\
|
["@keplr-wallet/proto-types", [\
|
||||||
["npm:0.11.23", {\
|
["npm:0.11.25", {\
|
||||||
"packageLocation": "./.yarn/cache/@keplr-wallet-proto-types-npm-0.11.23-e19f2b6321-0dfe72c3c9.zip/node_modules/@keplr-wallet/proto-types/",\
|
"packageLocation": "./.yarn/cache/@keplr-wallet-proto-types-npm-0.11.25-8f5637fdcf-07f0efcd41.zip/node_modules/@keplr-wallet/proto-types/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@keplr-wallet/proto-types", "npm:0.11.23"],\
|
["@keplr-wallet/proto-types", "npm:0.11.25"],\
|
||||||
["long", "npm:4.0.0"],\
|
["long", "npm:4.0.0"],\
|
||||||
["protobufjs", "npm:6.11.3"]\
|
["protobufjs", "npm:6.11.3"]\
|
||||||
],\
|
],\
|
||||||
@ -703,10 +703,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@keplr-wallet/types", [\
|
["@keplr-wallet/types", [\
|
||||||
["npm:0.11.23", {\
|
["npm:0.11.25", {\
|
||||||
"packageLocation": "./.yarn/cache/@keplr-wallet-types-npm-0.11.23-47d40e583e-15c60741f3.zip/node_modules/@keplr-wallet/types/",\
|
"packageLocation": "./.yarn/cache/@keplr-wallet-types-npm-0.11.25-03c9c802b5-1482307c0a.zip/node_modules/@keplr-wallet/types/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@keplr-wallet/types", "npm:0.11.23"],\
|
["@keplr-wallet/types", "npm:0.11.25"],\
|
||||||
["axios", "npm:0.27.2"],\
|
["axios", "npm:0.27.2"],\
|
||||||
["long", "npm:4.0.0"],\
|
["long", "npm:4.0.0"],\
|
||||||
["secretjs", "npm:0.17.7"]\
|
["secretjs", "npm:0.17.7"]\
|
||||||
@ -715,11 +715,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
}]\
|
}]\
|
||||||
]],\
|
]],\
|
||||||
["@keplr-wallet/unit", [\
|
["@keplr-wallet/unit", [\
|
||||||
["npm:0.11.23", {\
|
["npm:0.11.25", {\
|
||||||
"packageLocation": "./.yarn/cache/@keplr-wallet-unit-npm-0.11.23-5690bbdf49-560aec00cb.zip/node_modules/@keplr-wallet/unit/",\
|
"packageLocation": "./.yarn/cache/@keplr-wallet-unit-npm-0.11.25-e5c3f823f6-dfed155ce2.zip/node_modules/@keplr-wallet/unit/",\
|
||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["@keplr-wallet/unit", "npm:0.11.23"],\
|
["@keplr-wallet/unit", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/types", "npm:0.11.23"],\
|
["@keplr-wallet/types", "npm:0.11.25"],\
|
||||||
["big-integer", "npm:1.6.51"],\
|
["big-integer", "npm:1.6.51"],\
|
||||||
["utility-types", "npm:3.10.0"]\
|
["utility-types", "npm:3.10.0"]\
|
||||||
],\
|
],\
|
||||||
@ -4435,10 +4435,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
|||||||
"packageDependencies": [\
|
"packageDependencies": [\
|
||||||
["icns-frontend", "workspace:."],\
|
["icns-frontend", "workspace:."],\
|
||||||
["@amplitude/analytics-browser", "npm:1.6.6"],\
|
["@amplitude/analytics-browser", "npm:1.6.6"],\
|
||||||
["@keplr-wallet/common", "npm:0.11.23"],\
|
["@keplr-wallet/common", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/cosmos", "npm:0.11.23"],\
|
["@keplr-wallet/cosmos", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/proto-types", "npm:0.11.23"],\
|
["@keplr-wallet/proto-types", "npm:0.11.25"],\
|
||||||
["@keplr-wallet/types", "npm:0.11.23"],\
|
["@keplr-wallet/types", "npm:0.11.25"],\
|
||||||
["@next/eslint-plugin-next", "npm:13.0.5"],\
|
["@next/eslint-plugin-next", "npm:13.0.5"],\
|
||||||
["@sentry/nextjs", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:7.27.0"],\
|
["@sentry/nextjs", "virtual:4b77e00d446246df1ed27001550885fbf1b51be18c660c1b5c357d3d763078ecef2a676194291a120f149b87573081e5af0621dc83cf1f83383639f39ac133c7#npm:7.27.0"],\
|
||||||
["@types/eslint", "npm:8.4.10"],\
|
["@types/eslint", "npm:8.4.10"],\
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@keplr-wallet-types-npm-0.11.25-03c9c802b5-1482307c0a.zip
vendored
Normal file
BIN
.yarn/cache/@keplr-wallet-types-npm-0.11.25-03c9c802b5-1482307c0a.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
import { ChainItemType } from "../../types";
|
import { ChainItemType, DisabledChainItemType } from "../../types";
|
||||||
import { FunctionComponent, useEffect, useState } from "react";
|
import { FunctionComponent, useEffect, useState } from "react";
|
||||||
|
|
||||||
import color from "../../styles/color";
|
import color from "../../styles/color";
|
||||||
@ -8,15 +8,31 @@ import { ChainImage } from "./chain-image";
|
|||||||
import { Checkbox } from "../checkbox";
|
import { Checkbox } from "../checkbox";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
chainItem: ChainItemType;
|
chainItem: ChainItemType | DisabledChainItemType;
|
||||||
checkedItemHandler: (chainItem: ChainItemType, isChecked: boolean) => void;
|
checkedItemHandler: (chainItem: ChainItemType, isChecked: boolean) => void;
|
||||||
checkedItems: Set<unknown>;
|
checkedItems: Set<unknown>;
|
||||||
disabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ChainItem: FunctionComponent<Props> = (props) => {
|
export const ChainItem: FunctionComponent<Props> = (props) => {
|
||||||
const { chainItem, checkedItemHandler, checkedItems, disabled } = props;
|
const { chainItem, checkedItemHandler, checkedItems } = props;
|
||||||
const [checked, setChecked] = useState(!!disabled);
|
const disabled = "disabled" in chainItem && chainItem.disabled;
|
||||||
|
// XXX: Currently, this component can't handle `checked` state well,
|
||||||
|
// If chain is disabled, it should be disabled in general.
|
||||||
|
// However, if it is disabled due to the limitation of ethermint and ledger,
|
||||||
|
// it should be not checked.
|
||||||
|
// To solve this problem, for now, just use dumb way.
|
||||||
|
// If chain is disabled with explicit reason, it should be unchecked.
|
||||||
|
const [checked, setChecked] = useState(!!disabled && !chainItem.reason);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (disabled) {
|
||||||
|
if (chainItem.reason) {
|
||||||
|
setChecked(false);
|
||||||
|
} else {
|
||||||
|
setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [chainItem, disabled]);
|
||||||
|
|
||||||
const checkHandler = () => {
|
const checkHandler = () => {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
@ -46,7 +62,12 @@ export const ChainItem: FunctionComponent<Props> = (props) => {
|
|||||||
/>
|
/>
|
||||||
<ChainInfoContainer>
|
<ChainInfoContainer>
|
||||||
<ChainName>{`.${chainItem.prefix}`}</ChainName>
|
<ChainName>{`.${chainItem.prefix}`}</ChainName>
|
||||||
|
{chainItem.address ? (
|
||||||
<WalletAddress>{chainItem.address}</WalletAddress>
|
<WalletAddress>{chainItem.address}</WalletAddress>
|
||||||
|
) : null}
|
||||||
|
{disabled && chainItem.reason ? (
|
||||||
|
<DisabledReason>{chainItem.reason.message}</DisabledReason>
|
||||||
|
) : null}
|
||||||
</ChainInfoContainer>
|
</ChainInfoContainer>
|
||||||
|
|
||||||
<Flex1 />
|
<Flex1 />
|
||||||
@ -117,3 +138,10 @@ export const WalletAddress = styled.div`
|
|||||||
|
|
||||||
color: ${color.grey["400"]};
|
color: ${color.grey["400"]};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const DisabledReason = styled.div`
|
||||||
|
color: ${color.grey["200"]};
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 17px;
|
||||||
|
`;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { Dispatch, FunctionComponent, SetStateAction, useEffect } from "react";
|
import { Dispatch, FunctionComponent, SetStateAction, useEffect } from "react";
|
||||||
import { ChainItemType } from "../../types";
|
import { ChainItemType, DisabledChainItemType } from "../../types";
|
||||||
import color from "../../styles/color";
|
import color from "../../styles/color";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { ChainItem } from "./chain-item";
|
import { ChainItem } from "./chain-item";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
chainList: ChainItemType[];
|
chainList: ChainItemType[];
|
||||||
disabledChainList: ChainItemType[];
|
disabledChainList: DisabledChainItemType[];
|
||||||
checkedItems: Set<unknown>;
|
checkedItems: Set<unknown>;
|
||||||
setCheckedItems: Dispatch<SetStateAction<Set<unknown>>>;
|
setCheckedItems: Dispatch<SetStateAction<Set<unknown>>>;
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ export const ChainList: FunctionComponent<Props> = (props) => {
|
|||||||
<ChainContainer color={color.grey["900"]}>
|
<ChainContainer color={color.grey["900"]}>
|
||||||
{chainList.map((chainItem) => (
|
{chainList.map((chainItem) => (
|
||||||
<ChainItem
|
<ChainItem
|
||||||
key={chainItem.address}
|
key={chainItem.chainId}
|
||||||
chainItem={chainItem}
|
chainItem={chainItem}
|
||||||
checkedItemHandler={checkedItemHandler}
|
checkedItemHandler={checkedItemHandler}
|
||||||
checkedItems={checkedItems}
|
checkedItems={checkedItems}
|
||||||
@ -38,11 +38,10 @@ export const ChainList: FunctionComponent<Props> = (props) => {
|
|||||||
))}
|
))}
|
||||||
{disabledChainList.map((chainItem) => (
|
{disabledChainList.map((chainItem) => (
|
||||||
<ChainItem
|
<ChainItem
|
||||||
key={chainItem.address}
|
key={chainItem.chainId}
|
||||||
chainItem={chainItem}
|
chainItem={chainItem}
|
||||||
checkedItemHandler={checkedItemHandler}
|
checkedItemHandler={checkedItemHandler}
|
||||||
checkedItems={checkedItems}
|
checkedItems={checkedItems}
|
||||||
disabled={true}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</ChainContainer>
|
</ChainContainer>
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@amplitude/analytics-browser": "^1.6.6",
|
"@amplitude/analytics-browser": "^1.6.6",
|
||||||
"@keplr-wallet/common": "^0.11.23",
|
"@keplr-wallet/common": "^0.11.25",
|
||||||
"@keplr-wallet/cosmos": "^0.11.23",
|
"@keplr-wallet/cosmos": "^0.11.25",
|
||||||
"@keplr-wallet/proto-types": "^0.11.23",
|
"@keplr-wallet/proto-types": "^0.11.25",
|
||||||
"@keplr-wallet/types": "^0.11.23",
|
"@keplr-wallet/types": "^0.11.25",
|
||||||
"@sentry/nextjs": "^7.27.0",
|
"@sentry/nextjs": "^7.27.0",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
|
@ -6,6 +6,7 @@ import { useEffect, useState } from "react";
|
|||||||
// Types
|
// Types
|
||||||
import {
|
import {
|
||||||
ChainItemType,
|
ChainItemType,
|
||||||
|
DisabledChainItemType,
|
||||||
QueryError,
|
QueryError,
|
||||||
RegisteredAddresses,
|
RegisteredAddresses,
|
||||||
TwitterProfileType,
|
TwitterProfileType,
|
||||||
@ -70,12 +71,17 @@ export default function VerificationPage() {
|
|||||||
name: string;
|
name: string;
|
||||||
pubKey: Uint8Array;
|
pubKey: Uint8Array;
|
||||||
bech32Address: string;
|
bech32Address: string;
|
||||||
|
isLedgerNano?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const [chainList, setChainList] = useState<ChainItemType[]>([]);
|
const [chainList, setChainList] = useState<
|
||||||
const [disabledChainList, setDisabledChainList] = useState<ChainItemType[]>(
|
(ChainItemType & {
|
||||||
[],
|
isEthermintLike?: boolean;
|
||||||
);
|
})[]
|
||||||
|
>([]);
|
||||||
|
const [disabledChainList, setDisabledChainList] = useState<
|
||||||
|
DisabledChainItemType[]
|
||||||
|
>([]);
|
||||||
const [registeredChainList, setRegisteredChainList] = useState<
|
const [registeredChainList, setRegisteredChainList] = useState<
|
||||||
RegisteredAddresses[]
|
RegisteredAddresses[]
|
||||||
>([]);
|
>([]);
|
||||||
@ -101,7 +107,13 @@ export default function VerificationPage() {
|
|||||||
}, [wallet]);
|
}, [wallet]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const disabledChainList = chainList.filter((chain) => {
|
const disabledChainList = chainList
|
||||||
|
.filter((chain) => {
|
||||||
|
if (!chain.address) {
|
||||||
|
// Address can be "" if `getKey` failed.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
for (const registeredChain of registeredChainList) {
|
for (const registeredChain of registeredChainList) {
|
||||||
if (
|
if (
|
||||||
chain.prefix === registeredChain.bech32_prefix &&
|
chain.prefix === registeredChain.bech32_prefix &&
|
||||||
@ -112,11 +124,33 @@ export default function VerificationPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
})
|
||||||
|
.map<DisabledChainItemType>((chain) => {
|
||||||
|
if (walletKey) {
|
||||||
|
if (walletKey.isLedgerNano && chain.isEthermintLike) {
|
||||||
|
return {
|
||||||
|
...chain,
|
||||||
|
disabled: true,
|
||||||
|
reason: new Error(
|
||||||
|
"Support for Ethereum address on Ledger is coming soon.",
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...chain,
|
||||||
|
disabled: true,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredChainList = chainList.filter(
|
const filteredChainList = chainList.filter((chain) => {
|
||||||
(chain) => !disabledChainList.includes(chain),
|
return (
|
||||||
|
disabledChainList.find(
|
||||||
|
(disabled) => disabled.chainId === chain.chainId,
|
||||||
|
) == null
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
|
||||||
setChainList(filteredChainList);
|
setChainList(filteredChainList);
|
||||||
setDisabledChainList(disabledChainList);
|
setDisabledChainList(disabledChainList);
|
||||||
@ -200,7 +234,7 @@ export default function VerificationPage() {
|
|||||||
const chainIds = (await wallet.getChainInfosWithoutEndpoints()).map(
|
const chainIds = (await wallet.getChainInfosWithoutEndpoints()).map(
|
||||||
(c) => c.chainId,
|
(c) => c.chainId,
|
||||||
);
|
);
|
||||||
const chainKeys = await Promise.all(
|
const chainKeys = await Promise.allSettled(
|
||||||
chainIds.map((chainId) => wallet.getKey(chainId)),
|
chainIds.map((chainId) => wallet.getKey(chainId)),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -213,14 +247,20 @@ export default function VerificationPage() {
|
|||||||
chainImageUrl: `https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/${
|
chainImageUrl: `https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/${
|
||||||
ChainIdHelper.parse(chainInfo.chainId).identifier
|
ChainIdHelper.parse(chainInfo.chainId).identifier
|
||||||
}/chain.png`,
|
}/chain.png`,
|
||||||
|
isEthermintLike: chainInfo.isEthermintLike,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const chainArray = [];
|
const chainArray = [];
|
||||||
for (let i = 0; i < chainKeys.length; i++) {
|
for (let i = 0; i < chainKeys.length; i++) {
|
||||||
|
const chainKey = chainKeys[i];
|
||||||
|
if (chainKey.status !== "fulfilled") {
|
||||||
|
console.log("Failed to get key from wallet", chainKey);
|
||||||
|
}
|
||||||
chainArray.push({
|
chainArray.push({
|
||||||
address: chainKeys[i].bech32Address,
|
address:
|
||||||
|
chainKey.status === "fulfilled" ? chainKey.value.bech32Address : "",
|
||||||
...chainInfos[i],
|
...chainInfos[i],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,3 +5,10 @@ export interface ChainItemType {
|
|||||||
chainImageUrl: string;
|
chainImageUrl: string;
|
||||||
address: string;
|
address: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DisabledChainItemType extends ChainItemType {
|
||||||
|
disabled: true;
|
||||||
|
|
||||||
|
// Show reason why this chain is disabled to user if needed.
|
||||||
|
reason?: Error;
|
||||||
|
}
|
||||||
|
@ -45,18 +45,32 @@ export class KeplrWallet implements Wallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getChainInfosWithoutEndpoints(): Promise<
|
getChainInfosWithoutEndpoints(): Promise<
|
||||||
Omit<ChainInfo, "rest" | "rpc" | "nodeProvider">[]
|
(Pick<ChainInfo, "chainId" | "chainName" | "bech32Config"> & {
|
||||||
|
readonly isEthermintLike?: boolean;
|
||||||
|
})[]
|
||||||
> {
|
> {
|
||||||
// TODO: Update @keplr-wallet/types
|
return this.keplr.getChainInfosWithoutEndpoints().then((chainInfos) => {
|
||||||
return (this.keplr as any).getChainInfosWithoutEndpoints();
|
return chainInfos.map((chainInfo) => {
|
||||||
|
return {
|
||||||
|
...chainInfo,
|
||||||
|
isEthermintLike: chainInfo.features?.includes("eth-address-gen"),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getKey(chainId: string): Promise<{
|
getKey(chainId: string): Promise<{
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly pubKey: Uint8Array;
|
readonly pubKey: Uint8Array;
|
||||||
readonly bech32Address: string;
|
readonly bech32Address: string;
|
||||||
|
readonly isLedgerNano?: boolean;
|
||||||
}> {
|
}> {
|
||||||
return this.keplr.getKey(chainId);
|
return this.keplr.getKey(chainId).then((key) => {
|
||||||
|
return {
|
||||||
|
...key,
|
||||||
|
isLedgerNano: key.isNanoLedger,
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
init(chainIds: string[]): Promise<void> {
|
init(chainIds: string[]): Promise<void> {
|
||||||
@ -88,8 +102,7 @@ export class KeplrWallet implements Wallet {
|
|||||||
signature: Uint8Array;
|
signature: Uint8Array;
|
||||||
}[]
|
}[]
|
||||||
> {
|
> {
|
||||||
// TODO: Update @keplr-wallet/types
|
return this.keplr.signICNSAdr36(
|
||||||
return (this.keplr as any).signICNSAdr36(
|
|
||||||
chainId,
|
chainId,
|
||||||
contractAddress,
|
contractAddress,
|
||||||
owner,
|
owner,
|
||||||
|
@ -4,13 +4,16 @@ export interface Wallet {
|
|||||||
init(chainIds: string[]): Promise<void>;
|
init(chainIds: string[]): Promise<void>;
|
||||||
|
|
||||||
getChainInfosWithoutEndpoints(): Promise<
|
getChainInfosWithoutEndpoints(): Promise<
|
||||||
Omit<ChainInfo, "rest" | "rpc" | "nodeProvider">[]
|
(Pick<ChainInfo, "chainId" | "chainName" | "bech32Config"> & {
|
||||||
|
readonly isEthermintLike?: boolean;
|
||||||
|
})[]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
getKey(chainId: string): Promise<{
|
getKey(chainId: string): Promise<{
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly pubKey: Uint8Array;
|
readonly pubKey: Uint8Array;
|
||||||
readonly bech32Address: string;
|
readonly bech32Address: string;
|
||||||
|
readonly isLedgerNano?: boolean;
|
||||||
}>;
|
}>;
|
||||||
signAmino(
|
signAmino(
|
||||||
chainId: string,
|
chainId: string,
|
||||||
|
70
yarn.lock
70
yarn.lock
@ -498,39 +498,39 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@keplr-wallet/common@npm:0.11.23, @keplr-wallet/common@npm:^0.11.23":
|
"@keplr-wallet/common@npm:0.11.25, @keplr-wallet/common@npm:^0.11.25":
|
||||||
version: 0.11.23
|
version: 0.11.25
|
||||||
resolution: "@keplr-wallet/common@npm:0.11.23"
|
resolution: "@keplr-wallet/common@npm:0.11.25"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@keplr-wallet/crypto": 0.11.23
|
"@keplr-wallet/crypto": 0.11.25
|
||||||
buffer: ^6.0.3
|
buffer: ^6.0.3
|
||||||
delay: ^4.4.0
|
delay: ^4.4.0
|
||||||
checksum: fa756241d0dece173875ee851df2702adfa934d36f2b074efd3895090940db12018cb4489733225ed7660af8da3a58104da229b1a1db6971b6a678e8f4a8c9d9
|
checksum: 30aed28c568d2f0b33dc3d1d05526ba9893e4d458187109f19b20025b9ef95094aa328d4473a7bdf6c45dce251d7bfc85fd5f6adf7cd5586060fbe481dc76411
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@keplr-wallet/cosmos@npm:^0.11.23":
|
"@keplr-wallet/cosmos@npm:^0.11.25":
|
||||||
version: 0.11.23
|
version: 0.11.25
|
||||||
resolution: "@keplr-wallet/cosmos@npm:0.11.23"
|
resolution: "@keplr-wallet/cosmos@npm:0.11.25"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ethersproject/address": ^5.6.0
|
"@ethersproject/address": ^5.6.0
|
||||||
"@keplr-wallet/common": 0.11.23
|
"@keplr-wallet/common": 0.11.25
|
||||||
"@keplr-wallet/crypto": 0.11.23
|
"@keplr-wallet/crypto": 0.11.25
|
||||||
"@keplr-wallet/proto-types": 0.11.23
|
"@keplr-wallet/proto-types": 0.11.25
|
||||||
"@keplr-wallet/types": 0.11.23
|
"@keplr-wallet/types": 0.11.25
|
||||||
"@keplr-wallet/unit": 0.11.23
|
"@keplr-wallet/unit": 0.11.25
|
||||||
axios: ^0.27.2
|
axios: ^0.27.2
|
||||||
bech32: ^1.1.4
|
bech32: ^1.1.4
|
||||||
buffer: ^6.0.3
|
buffer: ^6.0.3
|
||||||
long: ^4.0.0
|
long: ^4.0.0
|
||||||
protobufjs: ^6.11.2
|
protobufjs: ^6.11.2
|
||||||
checksum: 3777ad82ee55c341db417e9a4d079f55e78ddd6b0372c3e3b7d3f1cf6598ce4bbae1b2ed3d7f72980d861c2580da1b41e9143f30c524b45e86cc0b56e016de50
|
checksum: 25a540d80fb5cd93d88f7b071b801789fb2bd7360b610f57231070411fed63d6a17ab3ad014bc54158c43cf1034799428c6e6087b7db1cbe09cd08726e95535c
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@keplr-wallet/crypto@npm:0.11.23":
|
"@keplr-wallet/crypto@npm:0.11.25":
|
||||||
version: 0.11.23
|
version: 0.11.25
|
||||||
resolution: "@keplr-wallet/crypto@npm:0.11.23"
|
resolution: "@keplr-wallet/crypto@npm:0.11.25"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ethersproject/keccak256": ^5.5.0
|
"@ethersproject/keccak256": ^5.5.0
|
||||||
bip32: ^2.0.6
|
bip32: ^2.0.6
|
||||||
@ -540,39 +540,39 @@ __metadata:
|
|||||||
crypto-js: ^4.0.0
|
crypto-js: ^4.0.0
|
||||||
elliptic: ^6.5.3
|
elliptic: ^6.5.3
|
||||||
sha.js: ^2.4.11
|
sha.js: ^2.4.11
|
||||||
checksum: 660425deb64b5aee5a2497470490ad11f97472823909dd9eb3066730cc4011656433d0349279866369d00fe166680ba21b17a990f93000a0aab712f4da5274d8
|
checksum: bdb5ff6c57fbe296e40da9e913e5cf89a29a2b5f2887d56b2d2cac801ae06cc8b9b0b16b7d8cc5275bca434a3f632bf1b1f52c3b5b3253643f0adb4a9771e85e
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@keplr-wallet/proto-types@npm:0.11.23, @keplr-wallet/proto-types@npm:^0.11.23":
|
"@keplr-wallet/proto-types@npm:0.11.25, @keplr-wallet/proto-types@npm:^0.11.25":
|
||||||
version: 0.11.23
|
version: 0.11.25
|
||||||
resolution: "@keplr-wallet/proto-types@npm:0.11.23"
|
resolution: "@keplr-wallet/proto-types@npm:0.11.25"
|
||||||
dependencies:
|
dependencies:
|
||||||
long: ^4.0.0
|
long: ^4.0.0
|
||||||
protobufjs: ^6.11.2
|
protobufjs: ^6.11.2
|
||||||
checksum: 0dfe72c3c9d12319276fc7e67ff997b4a01216299e73d331132565d8489ca729d4207713c11b91f8893774995c2d813b7faed6b83911400d13969a0d3a147189
|
checksum: 07f0efcd41ef83eb7e9441ab06cd7e607311c5db1fef09b90c0bbef8baeff2feded3ca6a958243cfdfb6dd9aa7ebd6ee51df781c2b3bfe29e2a83961ef7eb58b
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@keplr-wallet/types@npm:0.11.23, @keplr-wallet/types@npm:^0.11.23":
|
"@keplr-wallet/types@npm:0.11.25, @keplr-wallet/types@npm:^0.11.25":
|
||||||
version: 0.11.23
|
version: 0.11.25
|
||||||
resolution: "@keplr-wallet/types@npm:0.11.23"
|
resolution: "@keplr-wallet/types@npm:0.11.25"
|
||||||
dependencies:
|
dependencies:
|
||||||
axios: ^0.27.2
|
axios: ^0.27.2
|
||||||
long: ^4.0.0
|
long: ^4.0.0
|
||||||
secretjs: 0.17.7
|
secretjs: 0.17.7
|
||||||
checksum: 15c60741f3b15c3ad2542ba655224b1fdd95736c31b2885c1e37c6fb7cac14c8e6b80a2add84d5ae17e97ab016b3046f4720729580017300ba8d0873cf7a2dd3
|
checksum: 1482307c0aabd9494635fa62a99160e5f0906951de9af027a48d927c205d130f1c62c43172ef672ad24982cc9864aab91866a6568d3e2d833ecb584b22eab9a8
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@keplr-wallet/unit@npm:0.11.23":
|
"@keplr-wallet/unit@npm:0.11.25":
|
||||||
version: 0.11.23
|
version: 0.11.25
|
||||||
resolution: "@keplr-wallet/unit@npm:0.11.23"
|
resolution: "@keplr-wallet/unit@npm:0.11.25"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@keplr-wallet/types": 0.11.23
|
"@keplr-wallet/types": 0.11.25
|
||||||
big-integer: ^1.6.48
|
big-integer: ^1.6.48
|
||||||
utility-types: ^3.10.0
|
utility-types: ^3.10.0
|
||||||
checksum: 560aec00cb6b0b6b9934f70712ad43632c7420fb61b3d66fb8789b5cfdf9b8dd8e5ec5e43159e31e2f845e8ea8b1bf15ba8c97bf47fd0ea4734403c5321fd0bc
|
checksum: dfed155ce2487396a549e7fbab514adceec30938f45fd5af61d03bf51a5be558736e450acf5b1ff764e9d3d42634306f6d10c1fe6480adad00ac3d7162e27985
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -3546,10 +3546,10 @@ __metadata:
|
|||||||
resolution: "icns-frontend@workspace:."
|
resolution: "icns-frontend@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@amplitude/analytics-browser": ^1.6.6
|
"@amplitude/analytics-browser": ^1.6.6
|
||||||
"@keplr-wallet/common": ^0.11.23
|
"@keplr-wallet/common": ^0.11.25
|
||||||
"@keplr-wallet/cosmos": ^0.11.23
|
"@keplr-wallet/cosmos": ^0.11.25
|
||||||
"@keplr-wallet/proto-types": ^0.11.23
|
"@keplr-wallet/proto-types": ^0.11.25
|
||||||
"@keplr-wallet/types": ^0.11.23
|
"@keplr-wallet/types": ^0.11.25
|
||||||
"@next/eslint-plugin-next": ^13.0.5
|
"@next/eslint-plugin-next": ^13.0.5
|
||||||
"@sentry/nextjs": ^7.27.0
|
"@sentry/nextjs": ^7.27.0
|
||||||
"@types/eslint": ^8.4.10
|
"@types/eslint": ^8.4.10
|
||||||
|
Loading…
Reference in New Issue
Block a user