Skip to content

Commit ef818e6

Browse files
committed
test: mini js
1 parent 2b110e0 commit ef818e6

File tree

5 files changed

+135
-76
lines changed

5 files changed

+135
-76
lines changed

app/scripts/metamask-controller.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5341,12 +5341,29 @@ export default class MetamaskController extends EventEmitter {
53415341
hdPath,
53425342
hdPathDescription,
53435343
) {
5344+
console.log(
5345+
'=====>>>>>> unlockHardwareWalletAccount begin: ',
5346+
index,
5347+
deviceName,
5348+
hdPath,
5349+
hdPathDescription,
5350+
);
5351+
53445352
const { address: unlockedAccount, label } =
53455353
await this.#withKeyringForDevice(
53465354
{ name: deviceName, hdPath },
53475355
async (keyring) => {
5356+
console.log(
5357+
'=====>>>>>> #withKeyringForDevice setAccountToUnlock: ',
5358+
index,
5359+
);
53485360
keyring.setAccountToUnlock(index);
53495361
const [address] = await keyring.addAccounts(1);
5362+
console.log(
5363+
'=====>>>>>> #withKeyringForDevice addAccounts: ',
5364+
address,
5365+
deviceName,
5366+
);
53505367
return {
53515368
address: normalize(address),
53525369
label: this.getAccountLabel(
@@ -5360,18 +5377,37 @@ export default class MetamaskController extends EventEmitter {
53605377
},
53615378
);
53625379

5380+
console.log(
5381+
'=====>>>>>> unlockHardwareWalletAccount end: ',
5382+
unlockedAccount,
5383+
label,
5384+
);
5385+
53635386
// Set the account label to Trezor 1 / Ledger 1 / QR Hardware 1, etc
5364-
this.preferencesController.setAccountLabel(unlockedAccount, label);
5387+
// this.preferencesController.setAccountLabel(unlockedAccount, label);
5388+
5389+
console.log(
5390+
'=====>>>>>> unlockHardwareWalletAccount setSelectedAddress: ',
5391+
unlockedAccount,
5392+
);
53655393
// Select the account
53665394
this.preferencesController.setSelectedAddress(unlockedAccount);
53675395

5396+
console.log(
5397+
'=====>>>>>> unlockHardwareWalletAccount getAccountByAddress: ',
5398+
unlockedAccount,
5399+
);
53685400
// It is expected that the account also exist in the accounts-controller
53695401
// in other case, an error shall be thrown
53705402
const account =
53715403
this.accountsController.getAccountByAddress(unlockedAccount);
5372-
this.accountsController.setAccountName(account.id, label);
5404+
// this.accountsController.setAccountName(account.id, label);
53735405

53745406
const accounts = this.accountsController.listAccounts();
5407+
console.log(
5408+
'=====>>>>>> unlockHardwareWalletAccount listAccounts: ',
5409+
accounts,
5410+
);
53755411

53765412
const { identities } = this.preferencesController.state;
53775413
return { unlockedAccount, identities, accounts };

offscreen/scripts/onekey.ts

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ export default function init() {
7373
const settings: Partial<ConnectSettings> = {
7474
debug: true,
7575
fetchConfig: false,
76-
connectSrc: 'https://jssdk.onekey.so/1.0.35/',
76+
// connectSrc: 'https://jssdk.onekey.so/1.0.35/',
77+
connectSrc: 'https://js-sdk-bytezhang.vercel.app/',
7778
env: msg.params.env,
7879
};
7980

@@ -153,6 +154,7 @@ export default function init() {
153154
?.evmGetPublicKey('', '', {
154155
...msg.params,
155156
showOnOneKey: false,
157+
skipPassphraseCheck: true,
156158
})
157159
.then((result) => {
158160
let response;
@@ -183,12 +185,17 @@ export default function init() {
183185
break;
184186

185187
case OneKeyAction.batchGetPublicKey:
186-
sdk?.evmGetPublicKey('', '', msg.params).then((result) => {
187-
if (!result?.success) {
188-
handleBlockErrorEvent(result);
189-
}
190-
sendResponse(result);
191-
});
188+
sdk
189+
?.evmGetPublicKey('', '', {
190+
...msg.params,
191+
skipPassphraseCheck: true,
192+
})
193+
.then((result) => {
194+
if (!result?.success) {
195+
handleBlockErrorEvent(result);
196+
}
197+
sendResponse(result);
198+
});
192199
break;
193200

194201
case OneKeyAction.getPassphraseState:
@@ -201,32 +208,47 @@ export default function init() {
201208
break;
202209

203210
case OneKeyAction.signTransaction:
204-
sdk?.evmSignTransaction('', '', msg.params).then((result) => {
205-
if (!result?.success) {
206-
handleBlockErrorEvent(result);
207-
}
208-
sendResponse(result);
209-
});
211+
sdk
212+
?.evmSignTransaction('', '', {
213+
...msg.params,
214+
skipPassphraseCheck: true,
215+
})
216+
.then((result) => {
217+
if (!result?.success) {
218+
handleBlockErrorEvent(result);
219+
}
220+
sendResponse(result);
221+
});
210222

211223
break;
212224

213225
case OneKeyAction.signMessage:
214-
sdk?.evmSignMessage('', '', msg.params).then((result) => {
215-
if (!result?.success) {
216-
handleBlockErrorEvent(result);
217-
}
218-
sendResponse(result);
219-
});
226+
sdk
227+
?.evmSignMessage('', '', {
228+
...msg.params,
229+
skipPassphraseCheck: true,
230+
})
231+
.then((result) => {
232+
if (!result?.success) {
233+
handleBlockErrorEvent(result);
234+
}
235+
sendResponse(result);
236+
});
220237

221238
break;
222239

223240
case OneKeyAction.signTypedData:
224-
sdk?.evmSignTypedData('', '', msg.params).then((result) => {
225-
if (!result?.success) {
226-
handleBlockErrorEvent(result);
227-
}
228-
sendResponse(result);
229-
});
241+
sdk
242+
?.evmSignTypedData('', '', {
243+
...msg.params,
244+
skipPassphraseCheck: true,
245+
})
246+
.then((result) => {
247+
if (!result?.success) {
248+
handleBlockErrorEvent(result);
249+
}
250+
sendResponse(result);
251+
});
230252

231253
break;
232254

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,9 @@
340340
"@metamask/utils": "^11.1.0",
341341
"@ngraveio/bc-ur": "^1.1.13",
342342
"@noble/hashes": "^1.3.3",
343-
"@onekeyfe/hd-core": "1.0.36-alpha.1",
344-
"@onekeyfe/hd-shared": "1.0.36-alpha.1",
345-
"@onekeyfe/hd-web-sdk": "1.0.36-alpha.1",
343+
"@onekeyfe/hd-core": "1.0.39-alpha.0",
344+
"@onekeyfe/hd-shared": "1.0.39-alpha.0",
345+
"@onekeyfe/hd-web-sdk": "1.0.39-alpha.0",
346346
"@popperjs/core": "^2.4.0",
347347
"@reduxjs/toolkit": "patch:@reduxjs/toolkit@npm%3A1.9.7#~/.yarn/patches/@reduxjs-toolkit-npm-1.9.7-b14925495c.patch",
348348
"@segment/loosely-validate-event": "^2.0.0",
@@ -374,7 +374,7 @@
374374
"eth-ens-namehash": "^2.0.8",
375375
"eth-lattice-keyring": "patch:eth-lattice-keyring@npm%3A0.12.4#~/.yarn/patches/eth-lattice-keyring-npm-0.12.4-c5fb3fcf54.patch",
376376
"eth-method-registry": "^4.0.0",
377-
"eth-onekey-bridge-keyring": "^0.2.4",
377+
"eth-onekey-bridge-keyring": "^0.2.5",
378378
"ethereumjs-util": "^7.0.10",
379379
"extension-port-stream": "^3.0.0",
380380
"fast-json-patch": "^3.1.1",

ui/pages/create-account/connect-hardware/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ class ConnectHardwareForm extends Component {
301301
unlockHardwareWalletAccounts,
302302
hdEntropyIndex,
303303
} = this.props;
304+
console.log('=====>>>>>> onUnlockAccounts begin: ', deviceName, path);
304305
const { selectedAccounts } = this.state;
305306

306307
if (selectedAccounts.length === 0) {

yarn.lock

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -8337,12 +8337,12 @@ __metadata:
83378337
languageName: node
83388338
linkType: hard
83398339

8340-
"@onekeyfe/hd-core@npm:1.0.36-alpha.1, @onekeyfe/hd-core@npm:^1.0.36-alpha.1":
8341-
version: 1.0.36-alpha.1
8342-
resolution: "@onekeyfe/hd-core@npm:1.0.36-alpha.1"
8340+
"@onekeyfe/hd-core@npm:1.0.39-alpha.0, @onekeyfe/hd-core@npm:^1.0.39-alpha.0":
8341+
version: 1.0.39-alpha.0
8342+
resolution: "@onekeyfe/hd-core@npm:1.0.39-alpha.0"
83438343
dependencies:
8344-
"@onekeyfe/hd-shared": "npm:^1.0.36-alpha.1"
8345-
"@onekeyfe/hd-transport": "npm:^1.0.36-alpha.1"
8344+
"@onekeyfe/hd-shared": "npm:^1.0.39-alpha.0"
8345+
"@onekeyfe/hd-transport": "npm:^1.0.39-alpha.0"
83468346
axios: "npm:^0.27.2"
83478347
bignumber.js: "npm:^9.0.2"
83488348
bytebuffer: "npm:^5.0.1"
@@ -8352,60 +8352,60 @@ __metadata:
83528352
peerDependencies:
83538353
"@noble/hashes": ^1.1.3
83548354
ripple-keypairs: ^1.1.4
8355-
checksum: 10/ed98281e46806f0bb68f633fc680d4eacb7e20588603b5abbc5dc1f796c7ba61a5da4f7716390663d35f627a9adf50d83a2d591a11fd97430cb2ed33c7468fcf
8355+
checksum: 10/319837e9a71942c487bf81877ddf3eb34346f134965346add0b7478b8fa641b3f21512629ddd4e2a9400f91319a0b9f03426d164313946fc6dbb367c2e8a7712
83568356
languageName: node
83578357
linkType: hard
83588358

8359-
"@onekeyfe/hd-shared@npm:1.0.36-alpha.1, @onekeyfe/hd-shared@npm:^1.0.36-alpha.1":
8360-
version: 1.0.36-alpha.1
8361-
resolution: "@onekeyfe/hd-shared@npm:1.0.36-alpha.1"
8362-
checksum: 10/1a18d7065b4522c120a158d733c6e72023e69c8e9e843a607d14a5faa29ec0f5397b64207d6fe74393dbe976df8679f9e57e5d07a11ecacaf0d73dc808f95df6
8359+
"@onekeyfe/hd-shared@npm:1.0.39-alpha.0, @onekeyfe/hd-shared@npm:^1.0.39-alpha.0":
8360+
version: 1.0.39-alpha.0
8361+
resolution: "@onekeyfe/hd-shared@npm:1.0.39-alpha.0"
8362+
checksum: 10/dd392a2abc505c1c4440e7da9a57c1164b95a3f9f749bfdc05c4e9be98050c38b7fa7e9a0536b4b6eb91f9b74b0693faf76444ab05f61007b93cde35fee1e359
83638363
languageName: node
83648364
linkType: hard
83658365

8366-
"@onekeyfe/hd-transport-http@npm:^1.0.36-alpha.1":
8367-
version: 1.0.36-alpha.1
8368-
resolution: "@onekeyfe/hd-transport-http@npm:1.0.36-alpha.1"
8366+
"@onekeyfe/hd-transport-http@npm:^1.0.39-alpha.0":
8367+
version: 1.0.39-alpha.0
8368+
resolution: "@onekeyfe/hd-transport-http@npm:1.0.39-alpha.0"
83698369
dependencies:
8370-
"@onekeyfe/hd-shared": "npm:^1.0.36-alpha.1"
8371-
"@onekeyfe/hd-transport": "npm:^1.0.36-alpha.1"
8370+
"@onekeyfe/hd-shared": "npm:^1.0.39-alpha.0"
8371+
"@onekeyfe/hd-transport": "npm:^1.0.39-alpha.0"
83728372
axios: "npm:^0.27.2"
83738373
secure-json-parse: "npm:^4.0.0"
8374-
checksum: 10/2a16913f0dcf7769eb9693da8e0a0968cf9b05296327e1f0c7c99acd56d450a8b2d253c630e96db34497e180c309cc12bcfb8582cd8fa55cf99dde04e24afa04
8374+
checksum: 10/0dcc3ebcb0c405a8117f3be6e075b19487cbb94e852012a078eaf22dcabd4650dacceb152717405f654dfaeade0a757c096566ec78848ba1295c92c1f3e4e633
83758375
languageName: node
83768376
linkType: hard
83778377

8378-
"@onekeyfe/hd-transport-webusb@npm:^1.0.36-alpha.1":
8379-
version: 1.0.36-alpha.1
8380-
resolution: "@onekeyfe/hd-transport-webusb@npm:1.0.36-alpha.1"
8378+
"@onekeyfe/hd-transport-webusb@npm:^1.0.39-alpha.0":
8379+
version: 1.0.39-alpha.0
8380+
resolution: "@onekeyfe/hd-transport-webusb@npm:1.0.39-alpha.0"
83818381
dependencies:
8382-
"@onekeyfe/hd-shared": "npm:^1.0.36-alpha.1"
8383-
"@onekeyfe/hd-transport": "npm:^1.0.36-alpha.1"
8384-
checksum: 10/e3ae25e040359fbc723dbfc93562f0cf8054ea64327f0174330cb1e49cb022f3b95ae6907593004b8570290c7ba47a6de3f16678b7ceae14ad4c1076e6298f3c
8382+
"@onekeyfe/hd-shared": "npm:^1.0.39-alpha.0"
8383+
"@onekeyfe/hd-transport": "npm:^1.0.39-alpha.0"
8384+
checksum: 10/f08ccc005a9990ff9ada2d7498b495fd9e938e39274f8f515e014e6b22f83f5819689ed8b4d2f0fda44215d5be3f055a2095f3885ad291a8e91469b5f60c21b3
83858385
languageName: node
83868386
linkType: hard
83878387

8388-
"@onekeyfe/hd-transport@npm:^1.0.36-alpha.1":
8389-
version: 1.0.36-alpha.1
8390-
resolution: "@onekeyfe/hd-transport@npm:1.0.36-alpha.1"
8388+
"@onekeyfe/hd-transport@npm:^1.0.39-alpha.0":
8389+
version: 1.0.39-alpha.0
8390+
resolution: "@onekeyfe/hd-transport@npm:1.0.39-alpha.0"
83918391
dependencies:
83928392
bytebuffer: "npm:^5.0.1"
83938393
long: "npm:^4.0.0"
83948394
protobufjs: "npm:^6.11.2"
8395-
checksum: 10/98f0b1e0365390b86eb58449715c38ed835dfa91aa3986d09263e9b0debf0b3d4e702f00150bb57b7a7dfd21d7cf79b88925a18f303521354ef58c9eee9c942c
8395+
checksum: 10/8edcd52e6ee38651c6641f74e98b90d6dd079742b462a0a843b9ba2ddf8a83ddb687d858a78824f412a3c9af1b10bfee5d241b4be1736d419504fa084bc1b27c
83968396
languageName: node
83978397
linkType: hard
83988398

8399-
"@onekeyfe/hd-web-sdk@npm:1.0.36-alpha.1, @onekeyfe/hd-web-sdk@npm:^1.0.36-alpha.1":
8400-
version: 1.0.36-alpha.1
8401-
resolution: "@onekeyfe/hd-web-sdk@npm:1.0.36-alpha.1"
8399+
"@onekeyfe/hd-web-sdk@npm:1.0.39-alpha.0, @onekeyfe/hd-web-sdk@npm:^1.0.39-alpha.0":
8400+
version: 1.0.39-alpha.0
8401+
resolution: "@onekeyfe/hd-web-sdk@npm:1.0.39-alpha.0"
84028402
dependencies:
84038403
"@onekeyfe/cross-inpage-provider-core": "npm:^0.0.17"
8404-
"@onekeyfe/hd-core": "npm:^1.0.36-alpha.1"
8405-
"@onekeyfe/hd-shared": "npm:^1.0.36-alpha.1"
8406-
"@onekeyfe/hd-transport-http": "npm:^1.0.36-alpha.1"
8407-
"@onekeyfe/hd-transport-webusb": "npm:^1.0.36-alpha.1"
8408-
checksum: 10/3cc905621035278ff585b172b8a1d00127330257e1ab9fc7be4edaa560724e06f7adddb8fd8cfaf0436ca56ab6d0d0072b1d86cfa9bb4c0ca98b091887a0bc8f
8404+
"@onekeyfe/hd-core": "npm:^1.0.39-alpha.0"
8405+
"@onekeyfe/hd-shared": "npm:^1.0.39-alpha.0"
8406+
"@onekeyfe/hd-transport-http": "npm:^1.0.39-alpha.0"
8407+
"@onekeyfe/hd-transport-webusb": "npm:^1.0.39-alpha.0"
8408+
checksum: 10/b794ecb744c6e132db51298e2b1b46efcbe510077f5ad39c4e0a0131178bc9aba9357a1a351b231432b5ca412a0743a1168c9c9803d2f68575d65e24b142c7c4
84098409
languageName: node
84108410
linkType: hard
84118411

@@ -23344,20 +23344,20 @@ __metadata:
2334423344
languageName: node
2334523345
linkType: hard
2334623346

23347-
"eth-onekey-bridge-keyring@npm:^0.2.4":
23348-
version: 0.2.4
23349-
resolution: "eth-onekey-bridge-keyring@npm:0.2.4"
23347+
"eth-onekey-bridge-keyring@npm:^0.2.5":
23348+
version: 0.2.5
23349+
resolution: "eth-onekey-bridge-keyring@npm:0.2.5"
2335023350
dependencies:
2335123351
"@ethereumjs/rlp": "npm:^4.0.0"
2335223352
"@ethereumjs/tx": "npm:^4.2.0"
2335323353
"@ethereumjs/util": "npm:^8.0.0"
2335423354
"@metamask/eth-sig-util": "npm:^7.0.1"
2335523355
"@noble/hashes": "npm:^1.7.0"
23356-
"@onekeyfe/hd-core": "npm:^1.0.36-alpha.1"
23357-
"@onekeyfe/hd-shared": "npm:^1.0.36-alpha.1"
23358-
"@onekeyfe/hd-web-sdk": "npm:^1.0.36-alpha.1"
23356+
"@onekeyfe/hd-core": "npm:^1.0.39-alpha.0"
23357+
"@onekeyfe/hd-shared": "npm:^1.0.39-alpha.0"
23358+
"@onekeyfe/hd-web-sdk": "npm:^1.0.39-alpha.0"
2335923359
bytebuffer: "npm:^5.0.1"
23360-
checksum: 10/c8869369be887a74440af8b09d79af3f72cd8f28ca7a9df9588e268e5dfb6fb9a87e1a2b429abe2473148e9580b7f5441a4213b6e34081c4be927f7722653222
23360+
checksum: 10/643bde9387c690b42cb634de0b53932a95736e7e7b59a0fe97722d3c80b75bd33757de2455650d0cf9346408fc0f6c57174c64c4e1ad84c2ec4a5e2a811fcfcd
2336123361
languageName: node
2336223362
linkType: hard
2336323363

@@ -31833,9 +31833,9 @@ __metadata:
3183331833
"@noble/hashes": "npm:^1.3.3"
3183431834
"@octokit/core": "npm:^3.6.0"
3183531835
"@octokit/types": "npm:^14.0.0"
31836-
"@onekeyfe/hd-core": "npm:1.0.36-alpha.1"
31837-
"@onekeyfe/hd-shared": "npm:1.0.36-alpha.1"
31838-
"@onekeyfe/hd-web-sdk": "npm:1.0.36-alpha.1"
31836+
"@onekeyfe/hd-core": "npm:1.0.39-alpha.0"
31837+
"@onekeyfe/hd-shared": "npm:1.0.39-alpha.0"
31838+
"@onekeyfe/hd-web-sdk": "npm:1.0.39-alpha.0"
3183931839
"@open-rpc/meta-schema": "npm:^1.14.6"
3184031840
"@open-rpc/mock-server": "npm:^1.7.5"
3184131841
"@open-rpc/schema-utils-js": "npm:^2.0.5"
@@ -31984,7 +31984,7 @@ __metadata:
3198431984
eth-ens-namehash: "npm:^2.0.8"
3198531985
eth-lattice-keyring: "patch:eth-lattice-keyring@npm%3A0.12.4#~/.yarn/patches/eth-lattice-keyring-npm-0.12.4-c5fb3fcf54.patch"
3198631986
eth-method-registry: "npm:^4.0.0"
31987-
eth-onekey-bridge-keyring: "npm:^0.2.4"
31987+
eth-onekey-bridge-keyring: "npm:^0.2.5"
3198831988
ethereumjs-util: "npm:^7.0.10"
3198931989
ethers: "npm:5.7.0"
3199031990
extension-port-stream: "npm:^3.0.0"

0 commit comments

Comments
 (0)