Skip to content

Commit eaf222d

Browse files
authored
Merge pull request #1536 from Conflux-Chain/dev
release 2.8.3
2 parents d9c5c5c + 57b149e commit eaf222d

File tree

213 files changed

+653
-1703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+653
-1703
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "helios",
33
"private": true,
4-
"version": "2.8.2",
4+
"version": "2.8.3",
55
"workspaces": [
66
"websites/*",
77
"packages/doc-ui/*",

packages/account/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fluent-wallet/account",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"type": "module",
55
"main": "index.js",
66
"dependencies": {

packages/addr-by-network/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fluent-wallet/addr-by-network",
33
"type": "module",
44
"main": "index.js",
5-
"version": "0.0.5",
5+
"version": "0.0.6",
66
"dependencies": {
77
"@fluent-wallet/account": "workspace:packages/account",
88
"@fluent-wallet/base32-address": "workspace:packages/base32-address",

packages/background/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "helios-background",
3-
"version": "0.0.36",
3+
"version": "0.0.37",
44
"type": "module",
55
"main": "src/index.js",
66
"private": true,
@@ -58,7 +58,7 @@
5858
"@fluent-wallet/cfx_sign-tx-with-ledger-nano-s": "workspace:*",
5959
"@fluent-wallet/cfx_sign-typed-data_v4": "workspace:packages/rpcs/cfx_signTypedData_v4",
6060
"@fluent-wallet/consts": "workspace:packages/consts",
61-
"@fluent-wallet/db": "1.0.79",
61+
"@fluent-wallet/db": "1.0.80",
6262
"@fluent-wallet/eth_accounts": "workspace:packages/rpcs/eth_accounts",
6363
"@fluent-wallet/eth_block-number": "workspace:packages/rpcs/eth_blockNumber",
6464
"@fluent-wallet/eth_call": "workspace:packages/rpcs/eth_call",

packages/base32-address/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fluent-wallet/base32-address",
33
"type": "module",
44
"main": "index.js",
5-
"version": "0.1.5",
5+
"version": "0.1.6",
66
"dependencies": {
77
"@fluent-wallet/account": "workspace:packages/account",
88
"@fluent-wallet/consts": "workspace:packages/consts",

packages/browser-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "browser-extension",
3-
"version": "0.0.41",
3+
"version": "0.0.42",
44
"main": "index.js",
55
"author": "yqrashawn <namy.19@gmail.com>",
66
"license": "MIT",

packages/consts/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ export const ETH_SEPOLIA_EXPLORER_URL = 'https://sepolia.etherscan.io'
113113
export const DEFAULT_CFX_HDPATH = `m/44'/503'/0'/0`
114114
export const DEFAULT_ETH_HDPATH = `m/44'/60'/0'/0`
115115

116+
// for ledger import address path
117+
export const LEDGER_LIVE_PATH = `m/44'/60'/0'/0/0`
118+
// for MEW or MyCrypto import address path
119+
export const MEW_PATH = `m/44'/60'/0'`
120+
116121
export const REGENERATE = 'REGENERATE'
117122

118123
export const CFX_LOCALNET_RPC_ENDPOINT = 'http://localhost:12537'

packages/consts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "@fluent-wallet/consts",
33
"type": "module",
44
"main": "index.js",
5-
"version": "0.0.25"
5+
"version": "0.0.26"
66
}

packages/contract-method-name/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@fluent-wallet/contract-method-name",
33
"type": "module",
4-
"version": "2.0.3",
4+
"version": "2.0.4",
55
"main": "index.js",
66
"dependencies": {
77
"@ethersproject/abi": "5.6.3",

packages/db/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fluent-wallet/db",
3-
"version": "1.0.79",
3+
"version": "1.0.80",
44
"main": "index.js",
55
"type": "module",
66
"files": [

packages/detect-address-type/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"main": "index.js",
55
"packageManager": "yarn@3.0.1",
6-
"version": "0.0.4",
6+
"version": "0.0.5",
77
"dependencies": {
88
"@fluent-wallet/base32-address": "workspace:packages/base32-address",
99
"@fluent-wallet/checks": "workspace:packages/checks"

packages/did/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fluent-wallet/did",
33
"main": "index.js",
44
"type": "module",
5-
"version": "0.0.6",
5+
"version": "0.0.7",
66
"dependencies": {
77
"@ensdomains/eth-ens-namehash": "2.0.15",
88
"@fluent-wallet/base32-address": "workspace:packages/base32-address",

packages/estimate-tx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"main": "index.js",
55
"packageManager": "yarn@3.0.1",
6-
"version": "0.2.6",
6+
"version": "0.2.7",
77
"dependencies": {
88
"@fluent-wallet/consts": "workspace:*",
99
"@fluent-wallet/detect-address-type": "workspace:packages/detect-address-type",

packages/ledger/conflux.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export default class Conflux {
147147
const addressArr = []
148148
try {
149149
for (const index of indexArray) {
150-
const hdPath = `${HDPATH.CONFLUX}${index}`
150+
const hdPath = `${HDPATH.CONFLUX}/${index}`
151151
const {address} = await this.getAddress(hdPath)
152152
const {hexAddress} = decode(address)
153153
addressArr.push({

packages/ledger/const.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ export const INS = {
3232
OPEN_APP: 0xd8,
3333
}
3434
export const HDPATH = {
35-
CONFLUX: "44'/503'/0'/0/",
36-
ETHEREUM: "44'/60'/0'/0/",
35+
CONFLUX: "44'/503'/0'/0",
36+
ETHEREUM: "44'/60'/0'/0",
37+
LEDGER_LIVE: "44'/60'/0'/0/0",
3738
}
3839

3940
export const ERROR = {

packages/ledger/ethereum.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,14 @@ export default class Ethereum {
169169
}
170170
}
171171

172-
async getAddressList(indexArray) {
172+
async getAddressList(indexArray, path = HDPATH.ETHEREUM) {
173173
if (!Array.isArray(indexArray)) return []
174-
const isNumber = indexArray.every(function (item) {
175-
return typeof item === 'number'
176-
})
174+
const isNumber = indexArray.every(item => typeof item === 'number')
177175
if (!isNumber) return []
178176
const addressArr = []
179177
try {
180178
for (const index of indexArray) {
181-
const hdPath = `${HDPATH.ETHEREUM}${index}`
179+
const hdPath = this.getAddressesPathForIndex(index, path)
182180
const {address} = await this.getAddress(hdPath)
183181
addressArr.push({
184182
address,
@@ -224,4 +222,16 @@ export default class Ethereum {
224222
}
225223
return error
226224
}
225+
getAddressesPathForIndex = (index, inputPath) => {
226+
// if the path starts with 'm/', remove it
227+
// because the ledger app doesn't need the 'm/' prefix(see: https://github.com/LedgerHQ/ledger-live/blob/develop/libs/ledger-live-common/src/families/celo/hw-app-celo.ts#L150)
228+
const path = inputPath.startsWith('m/')
229+
? inputPath.replace('m/', '')
230+
: inputPath
231+
232+
if (path === HDPATH.LEDGER_LIVE) {
233+
return `44'/60'/${index}'/0/0`
234+
}
235+
return `${path}/${index}`
236+
}
227237
}

packages/ledger/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fluent-wallet/ledger",
33
"type": "module",
44
"main": "index.js",
5-
"version": "0.1.2",
5+
"version": "0.1.3",
66
"dependencies": {
77
"@fluent-wallet/base32-address": "workspace:packages/base32-address",
88
"@fluent-wallet/hw-app-conflux": "0.1.1",

packages/popup/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"name": "helios-popup",
44
"type": "module",
5-
"version": "0.1.19",
5+
"version": "0.1.20",
66
"main": "index.js",
77
"author": "yqrashawn <namy.19@gmail.com>",
88
"license": "MIT",

packages/popup/src/pages/ImportHwAccount/index.js

+83-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import PropTypes from 'prop-types'
2-
import {useState, useEffect, useMemo} from 'react'
2+
import {useState, useEffect, useMemo, useCallback} from 'react'
33
import {useAsync} from 'react-use'
44
import {useSWRConfig} from 'swr'
55
import {isUndefined} from '@fluent-wallet/checks'
@@ -17,7 +17,12 @@ import {
1717
CheckCircleFilled,
1818
QuestionCircleOutlined,
1919
} from '@fluent-wallet/component-icons'
20-
import {DEFAULT_CFX_HDPATH, DEFAULT_ETH_HDPATH} from '@fluent-wallet/consts'
20+
import {
21+
DEFAULT_CFX_HDPATH,
22+
DEFAULT_ETH_HDPATH,
23+
LEDGER_LIVE_PATH,
24+
MEW_PATH,
25+
} from '@fluent-wallet/consts'
2126
import {encode} from '@fluent-wallet/base32-address'
2227
import {TitleNav, CompWithLabel, Avatar, DisplayBalance} from '../../components'
2328
import {
@@ -34,12 +39,35 @@ import {useLedgerBindingApi} from '../../hooks'
3439
import useLoading from '../../hooks/useLoading'
3540
import useImportHWParams from './useImportHWParams'
3641
import {request} from '../../utils'
42+
import Dropdown from '@fluent-wallet/component-dropdown'
43+
import Menu from '../../../../ui/components/Menu'
44+
import MenuItem from '../../../../ui/components/Menu/MenuItem'
3745

3846
const {
3947
WALLET_IMPORT_HARDWARE_WALLET_ACCOUNT_GROUP_OR_ACCOUNT,
4048
WALLETDB_REFETCH_BALANCE,
4149
} = RPC_METHODS
4250

51+
const confluxLedgerPath = {
52+
name: 'BIP 44 Standard',
53+
value: DEFAULT_CFX_HDPATH,
54+
}
55+
56+
const ethereumLedgerPath = [
57+
{
58+
name: 'BIP 44 Standard',
59+
value: DEFAULT_ETH_HDPATH,
60+
},
61+
{
62+
name: 'Ledger Live',
63+
value: LEDGER_LIVE_PATH,
64+
},
65+
{
66+
name: 'Legacy',
67+
value: MEW_PATH,
68+
},
69+
]
70+
4371
function ImportingResults({importStatus}) {
4472
const {t} = useTranslation()
4573
const {mutate} = useSWRConfig()
@@ -114,14 +142,18 @@ function ImportHwAccount() {
114142
const {data: importedAddressData} = useQueryImportedAddress(networkId)
115143
const ledgerBindingApi = useLedgerBindingApi()
116144

145+
const [selectedPath, setSelectedPath] = useState()
146+
117147
const {value: addressList, loading} = useAsync(async () => {
118148
let addresses = []
149+
if (selectedPath === undefined) return addresses
119150
try {
120151
if (ledgerBindingApi) {
121152
addresses = await ledgerBindingApi.getAddressList(
122153
new Array(HARDWARE_ACCOUNT_PAGE_LIMIT)
123154
.fill('')
124155
.map((_item, index) => index + offset),
156+
selectedPath?.value,
125157
)
126158
}
127159
} catch (e) {
@@ -138,7 +170,13 @@ function ImportHwAccount() {
138170
return {address: address?.toLowerCase?.(), hdPath}
139171
})
140172
: addresses
141-
}, [offset, ledgerBindingApi])
173+
}, [selectedPath, offset, ledgerBindingApi])
174+
175+
const handleSelectChange = useCallback(path => {
176+
// if user change the hd path, reset the offset
177+
setSelectedPath(path)
178+
setOffset(0)
179+
}, [])
142180

143181
const {value: deviceInfo} = useAsync(async () => {
144182
if (ledgerBindingApi) {
@@ -183,6 +221,16 @@ function ImportHwAccount() {
183221
)
184222
}, [checkboxStatusObj])
185223

224+
useEffect(() => {
225+
if (selectedPath === undefined) {
226+
if (type === NETWORK_TYPE.CFX) {
227+
setSelectedPath(confluxLedgerPath)
228+
} else if (type === NETWORK_TYPE.ETH) {
229+
setSelectedPath(ethereumLedgerPath[0])
230+
}
231+
}
232+
}, [type, selectedPath])
233+
186234
const onSelectAllAccount = () => {
187235
const ret = {}
188236
Object.keys(checkboxStatusObj).forEach(
@@ -278,17 +326,38 @@ function ImportHwAccount() {
278326
className="mt-5"
279327
label={<p className="text-sm text-gray-40">{t('hdPath')}</p>}
280328
>
281-
<Input
282-
value={`BIP 44 Standard(${
283-
type === NETWORK_TYPE.CFX
284-
? DEFAULT_CFX_HDPATH
285-
: DEFAULT_ETH_HDPATH
286-
})`}
287-
width="w-full box-border"
288-
readOnly
289-
className="pointer-events-none"
290-
id="hd-path"
291-
/>
329+
{type === NETWORK_TYPE.CFX ? (
330+
<Input
331+
value={`${confluxLedgerPath?.name}(${confluxLedgerPath?.value})`}
332+
width="w-full box-border"
333+
readOnly
334+
className="pointer-events-none"
335+
id="hd-path"
336+
/>
337+
) : (
338+
<Dropdown
339+
overlay={
340+
<Menu>
341+
{ethereumLedgerPath.map(({name, value}) => (
342+
<MenuItem
343+
onClick={() => handleSelectChange({name, value})}
344+
selected={selectedPath?.value === value}
345+
containerClassName="w-full"
346+
key={value}
347+
itemKey={value}
348+
>{`${name}(${value})`}</MenuItem>
349+
))}
350+
</Menu>
351+
}
352+
>
353+
<Input
354+
value={`${selectedPath?.name}(${selectedPath?.value})`}
355+
width="w-full box-border"
356+
readOnly
357+
id="hd-path"
358+
/>
359+
</Dropdown>
360+
)}
292361
</CompWithLabel>
293362
<CompWithLabel
294363
label={

packages/rpc-engine/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fluent-wallet/rpc-engine",
33
"type": "module",
44
"main": "index.js",
5-
"version": "2.0.12",
5+
"version": "2.0.13",
66
"dependencies": {
77
"@fluent-wallet/associative": "workspace:packages/associative",
88
"@fluent-wallet/cache-rpc": "workspace:packages/cache-rpc",
@@ -16,7 +16,7 @@
1616
"@fluent-wallet/json-rpc-error": "workspace:packages/json-rpc-error",
1717
"@fluent-wallet/random-id": "workspace:packages/random-id",
1818
"@fluent-wallet/rpc-epoch-ref": "workspace:packages/rpc-epoch-ref",
19-
"@fluent-wallet/spec": "1.0.9",
19+
"@fluent-wallet/spec": "1.0.10",
2020
"@fluent-wallet/transducers": "workspace:packages/transducers",
2121
"@thi.ng/atom": "4.1.42",
2222
"@thi.ng/rstream": "6.0.21",

packages/rpcs/cfx_accounts/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "@fluent-wallet/cfx_accounts",
33
"type": "module",
44
"main": "index.js",
5-
"version": "3.0.3",
5+
"version": "3.0.4",
66
"dependencies": {
7-
"@fluent-wallet/spec": "1.0.9"
7+
"@fluent-wallet/spec": "1.0.10"
88
}
99
}

packages/rpcs/cfx_call/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "module",
44
"main": "index.js",
55
"packageManager": "yarn@3.0.1",
6-
"version": "0.0.10",
6+
"version": "0.0.11",
77
"dependencies": {
8-
"@fluent-wallet/spec": "1.0.9"
8+
"@fluent-wallet/spec": "1.0.10"
99
}
1010
}

0 commit comments

Comments
 (0)