@onekeyfe/hd-core 0.2.17 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/evm/EVMGetAddress.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts +1 -0
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/EVMVerifyMessage.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -6
- package/dist/types/api/evmGetAddress.d.ts +1 -0
- package/dist/types/api/evmGetAddress.d.ts.map +1 -1
- package/dist/types/api/evmGetPublicKey.d.ts +1 -0
- package/dist/types/api/evmGetPublicKey.d.ts.map +1 -1
- package/dist/types/api/evmSignMessage.d.ts +1 -0
- package/dist/types/api/evmSignMessage.d.ts.map +1 -1
- package/dist/types/api/evmSignTypedData.d.ts +1 -0
- package/dist/types/api/evmSignTypedData.d.ts.map +1 -1
- package/dist/types/api/evmVerifyMessage.d.ts +1 -0
- package/dist/types/api/evmVerifyMessage.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/device/DeviceUploadResource.ts +6 -0
- package/src/api/evm/EVMGetAddress.ts +2 -0
- package/src/api/evm/EVMGetPublicKey.ts +2 -0
- package/src/api/evm/EVMSignMessage.ts +3 -1
- package/src/api/evm/EVMSignTypedData.ts +8 -3
- package/src/api/evm/EVMVerifyMessage.ts +2 -0
- package/src/api/helpers/stringUtils.ts +1 -1
- package/src/api/stellar/StellarSignTransaction.ts +5 -2
- package/src/api/xrp/XrpGetAddress.ts +1 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/types/api/evmGetAddress.ts +1 -0
- package/src/types/api/evmGetPublicKey.ts +1 -0
- package/src/types/api/evmSignMessage.ts +1 -0
- package/src/types/api/evmSignTypedData.ts +1 -0
- package/src/types/api/evmVerifyMessage.ts +1 -0
- package/src/types/api/nearSignTransaction.ts +1 -1
- package/src/types/api/tronGetAddress.ts +2 -2
- package/src/types/api/tronSignTransaction.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUploadResource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC1E,UAAU;;;MAGR;IAEF,eAAe;;;;;IAQf,IAAI;
|
|
1
|
+
{"version":3,"file":"DeviceUploadResource.d.ts","sourceRoot":"","sources":["../../../src/api/device/DeviceUploadResource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC1E,UAAU;;;MAGR;IAEF,eAAe;;;;;IAQf,IAAI;IAoCJ,sBAAsB,QAEhB,qBAAqB,iBAAiB,CAAC,GACvC,qBAAqB,aAAa,CAAC,GACnC,qBAAqB,SAAS,CAAC,KAClC,QAAQ,OAAO,CAAC,CAkCjB;IAEI,GAAG;CAWV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAEhF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,kBAAkB,EAAE,CAAC;IACzE,SAAS,UAAS;IAElB,IAAI;
|
|
1
|
+
{"version":3,"file":"EVMGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAEhF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CAAC,kBAAkB,EAAE,CAAC;IACzE,SAAS,UAAS;IAElB,IAAI;IA+BE,GAAG;CAoBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAyB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEtF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAC7E,SAAS,UAAS;IAElB,IAAI;
|
|
1
|
+
{"version":3,"file":"EVMGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAyB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEtF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAC7E,SAAS,UAAS;IAElB,IAAI;IA+BE,GAAG;CAsBV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IACzE,IAAI;
|
|
1
|
+
{"version":3,"file":"EVMSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IACzE,IAAI;IAuBE,GAAG;CAWV"}
|
|
@@ -6,6 +6,7 @@ export declare type EVMSignTypedDataParams = {
|
|
|
6
6
|
data: EthereumSignTypedDataMessage<EthereumSignTypedDataTypes>;
|
|
7
7
|
domainHash?: string;
|
|
8
8
|
messageHash?: string;
|
|
9
|
+
chainId?: number;
|
|
9
10
|
};
|
|
10
11
|
export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams> {
|
|
11
12
|
init(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTypedData.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,KAAK,EACV,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,kCAAkC,CAAC;AAE1C,oBAAY,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"EVMSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMSignTypedData.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,KAAK,EACV,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,kCAAkC,CAAC;AAE1C,oBAAY,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IAC9E,IAAI;IAqCE,aAAa;;;;IAmHnB,eAAe;;;;;IAQf,gBAAgB;IAcV,GAAG;CAkDV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EVMVerifyMessage.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMVerifyMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IAC3E,IAAI;
|
|
1
|
+
{"version":3,"file":"EVMVerifyMessage.d.ts","sourceRoot":"","sources":["../../../src/api/evm/EVMVerifyMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IAC3E,IAAI;IAqBE,GAAG;CAOV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StellarSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/stellar/StellarSignTransaction.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,EACf,aAAa,IAAI,qBAAqB,EACvC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"StellarSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/stellar/StellarSignTransaction.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,eAAe,EACf,aAAa,IAAI,qBAAqB,EACvC,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAgC,MAAM,aAAa,CAAC;AAE7E,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,UAAU,CAAC,qBAAqB,CAAC;IACnF,UAAU,EAAE,GAAG,EAAE,CAAM;IAEvB,cAAc,OAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAoIpC;IAEF,IAAI;IAoDJ,gBAAgB,eAAsB,GAAG,SAAS,MAAM,KAAG,QAAQ,eAAe,CAAC,CAYjF;IAEI,GAAG;CAKV"}
|
package/dist/index.d.ts
CHANGED
|
@@ -394,6 +394,7 @@ declare type EVMAddress = {
|
|
|
394
394
|
declare type EVMGetAddressParams = {
|
|
395
395
|
path: string | number[];
|
|
396
396
|
showOnOneKey?: boolean;
|
|
397
|
+
chainId?: number;
|
|
397
398
|
};
|
|
398
399
|
declare function evmGetAddress(connectId: string, deviceId: string, params: CommonParams & EVMGetAddressParams): Response<EVMAddress>;
|
|
399
400
|
declare function evmGetAddress(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -406,6 +407,7 @@ declare type EVMPublicKey = {
|
|
|
406
407
|
declare type EVMGetPublicKeyParams = {
|
|
407
408
|
path: string | number[];
|
|
408
409
|
showOnOneKey?: boolean;
|
|
410
|
+
chainId?: number;
|
|
409
411
|
};
|
|
410
412
|
declare function evmGetPublicKey(connectId: string, deviceId: string, params: CommonParams & EVMGetPublicKeyParams): Response<EVMPublicKey>;
|
|
411
413
|
declare function evmGetPublicKey(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -415,6 +417,7 @@ declare function evmGetPublicKey(connectId: string, deviceId: string, params: Co
|
|
|
415
417
|
declare type EVMSignMessageParams = {
|
|
416
418
|
path: string | number[];
|
|
417
419
|
messageHex: string;
|
|
420
|
+
chainId?: number;
|
|
418
421
|
};
|
|
419
422
|
declare function evmSignMessage(connectId: string, deviceId: string, params: CommonParams & EVMSignMessageParams): Response<EthereumMessageSignature>;
|
|
420
423
|
|
|
@@ -492,6 +495,7 @@ declare type EVMSignTypedDataParams = {
|
|
|
492
495
|
data: EthereumSignTypedDataMessage<EthereumSignTypedDataTypes>;
|
|
493
496
|
domainHash?: string;
|
|
494
497
|
messageHash?: string;
|
|
498
|
+
chainId?: number;
|
|
495
499
|
};
|
|
496
500
|
declare function evmSignTypedData(connectId: string, deviceId: string, params: CommonParams & EVMSignTypedDataParams): Response<EthereumMessageSignature>;
|
|
497
501
|
|
|
@@ -499,6 +503,7 @@ declare type EVMVerifyMessageParams = {
|
|
|
499
503
|
address: string;
|
|
500
504
|
messageHex: string;
|
|
501
505
|
signature: string;
|
|
506
|
+
chainId?: number;
|
|
502
507
|
};
|
|
503
508
|
declare function evmVerifyMessage(connectId: string, deviceId: string, params: CommonParams & EVMVerifyMessageParams): Response<Success$1>;
|
|
504
509
|
|
package/dist/index.js
CHANGED
|
@@ -13040,12 +13040,15 @@ class DeviceUploadResource extends BaseMethod {
|
|
|
13040
13040
|
data: hexToBytes(dataHex),
|
|
13041
13041
|
thumbnailData: hexToBytes(thumbnailDataHex),
|
|
13042
13042
|
};
|
|
13043
|
+
const fileHash = utils.bytesToHex(blake2s.blake2s(this.payload.dataHex)).slice(0, 8);
|
|
13044
|
+
const file_name_no_ext = `${resType === 0 ? 'wp' : 'nft'}-${fileHash}-${Math.floor(Date.now() / 1000)}`;
|
|
13043
13045
|
this.params = {
|
|
13044
13046
|
extension: suffix,
|
|
13045
13047
|
data_length: this.paramsData.data.byteLength,
|
|
13046
13048
|
zoom_data_length: this.paramsData.thumbnailData.byteLength,
|
|
13047
13049
|
res_type: resType,
|
|
13048
13050
|
nft_meta_data: nftMetaData,
|
|
13051
|
+
file_name_no_ext,
|
|
13049
13052
|
};
|
|
13050
13053
|
}
|
|
13051
13054
|
run() {
|
|
@@ -14622,11 +14625,13 @@ class EvmGetAddress extends BaseMethod {
|
|
|
14622
14625
|
validateParams(batch, [
|
|
14623
14626
|
{ name: 'path', required: true },
|
|
14624
14627
|
{ name: 'showOnOneKey', type: 'boolean' },
|
|
14628
|
+
{ name: 'chainId', type: 'number' },
|
|
14625
14629
|
]);
|
|
14626
14630
|
const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
|
|
14627
14631
|
this.params.push({
|
|
14628
14632
|
address_n: addressN,
|
|
14629
14633
|
show_display: showOnOneKey,
|
|
14634
|
+
chain_id: batch.chainId,
|
|
14630
14635
|
});
|
|
14631
14636
|
});
|
|
14632
14637
|
}
|
|
@@ -14666,11 +14671,13 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
14666
14671
|
validateParams(batch, [
|
|
14667
14672
|
{ name: 'path', required: true },
|
|
14668
14673
|
{ name: 'showOnOneKey', type: 'boolean' },
|
|
14674
|
+
{ name: 'chainId', type: 'number' },
|
|
14669
14675
|
]);
|
|
14670
14676
|
const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
|
|
14671
14677
|
this.params.push({
|
|
14672
14678
|
address_n: addressN,
|
|
14673
14679
|
show_display: showOnOneKey,
|
|
14680
|
+
chain_id: batch.chainId,
|
|
14674
14681
|
});
|
|
14675
14682
|
});
|
|
14676
14683
|
}
|
|
@@ -14694,12 +14701,14 @@ class EVMSignMessage$2 extends BaseMethod {
|
|
|
14694
14701
|
validateParams(this.payload, [
|
|
14695
14702
|
{ name: 'path', required: true },
|
|
14696
14703
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
14704
|
+
{ name: 'chainId', type: 'number' },
|
|
14697
14705
|
]);
|
|
14698
|
-
const { path, messageHex } = this.payload;
|
|
14706
|
+
const { path, messageHex, chainId } = this.payload;
|
|
14699
14707
|
const addressN = validatePath(path, 3);
|
|
14700
14708
|
this.params = {
|
|
14701
14709
|
address_n: addressN,
|
|
14702
14710
|
message: formatAnyHex(messageHex),
|
|
14711
|
+
chain_id: chainId,
|
|
14703
14712
|
};
|
|
14704
14713
|
}
|
|
14705
14714
|
run() {
|
|
@@ -14992,13 +15001,15 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
14992
15001
|
{ name: 'data', type: 'object' },
|
|
14993
15002
|
{ name: 'domainHash', type: 'hexString' },
|
|
14994
15003
|
{ name: 'messageHash', type: 'hexString' },
|
|
15004
|
+
{ name: 'chainId', type: 'number' },
|
|
14995
15005
|
]);
|
|
14996
|
-
const { path, data, metamaskV4Compat, domainHash, messageHash } = this.payload;
|
|
15006
|
+
const { path, data, metamaskV4Compat, domainHash, messageHash, chainId } = this.payload;
|
|
14997
15007
|
const addressN = validatePath(path, 3);
|
|
14998
15008
|
this.params = {
|
|
14999
15009
|
addressN,
|
|
15000
15010
|
metamaskV4Compat,
|
|
15001
15011
|
data,
|
|
15012
|
+
chainId,
|
|
15002
15013
|
};
|
|
15003
15014
|
if (domainHash) {
|
|
15004
15015
|
this.params.domainHash = formatAnyHex(domainHash);
|
|
@@ -15013,7 +15024,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15013
15024
|
signTypedData() {
|
|
15014
15025
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15015
15026
|
const { commands } = this.device;
|
|
15016
|
-
const { addressN, data, metamaskV4Compat } = this.params;
|
|
15027
|
+
const { addressN, data, metamaskV4Compat, chainId } = this.params;
|
|
15017
15028
|
const { types, primaryType, domain, message, } = data;
|
|
15018
15029
|
let response = yield commands.typedCall('EthereumSignTypedData', [
|
|
15019
15030
|
'EthereumTypedDataStructRequest',
|
|
@@ -15023,6 +15034,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15023
15034
|
address_n: addressN,
|
|
15024
15035
|
primary_type: primaryType,
|
|
15025
15036
|
metamask_v4_compat: metamaskV4Compat,
|
|
15037
|
+
chain_id: chainId,
|
|
15026
15038
|
});
|
|
15027
15039
|
while (response.type === 'EthereumTypedDataStructRequest') {
|
|
15028
15040
|
const { name: typeDefinitionName } = response.message;
|
|
@@ -15115,7 +15127,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15115
15127
|
if (!this.device.features) {
|
|
15116
15128
|
throw hdShared.ERRORS.TypedError('Device_InitializeFailed', 'Device initialization failed. Please try again.');
|
|
15117
15129
|
}
|
|
15118
|
-
const { addressN } = this.params;
|
|
15130
|
+
const { addressN, chainId } = this.params;
|
|
15119
15131
|
const deviceType = getDeviceType(this.device.features);
|
|
15120
15132
|
if (deviceType === 'classic' || deviceType === 'mini') {
|
|
15121
15133
|
validateParams(this.params, [
|
|
@@ -15129,6 +15141,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
15129
15141
|
address_n: addressN,
|
|
15130
15142
|
domain_separator_hash: domainHash !== null && domainHash !== void 0 ? domainHash : '',
|
|
15131
15143
|
message_hash: messageHash,
|
|
15144
|
+
chain_id: chainId,
|
|
15132
15145
|
});
|
|
15133
15146
|
}
|
|
15134
15147
|
else {
|
|
@@ -15153,12 +15166,14 @@ class EVMSignMessage$1 extends BaseMethod {
|
|
|
15153
15166
|
{ name: 'address', type: 'string', required: true },
|
|
15154
15167
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
15155
15168
|
{ name: 'signature', type: 'hexString', required: true },
|
|
15169
|
+
{ name: 'chainId', type: 'number' },
|
|
15156
15170
|
]);
|
|
15157
15171
|
const { address, messageHex, signature } = formatAnyHex(this.payload);
|
|
15158
15172
|
this.params = {
|
|
15159
15173
|
address,
|
|
15160
15174
|
message: messageHex,
|
|
15161
15175
|
signature,
|
|
15176
|
+
chain_id: this.payload.chainId,
|
|
15162
15177
|
};
|
|
15163
15178
|
}
|
|
15164
15179
|
run() {
|
|
@@ -16574,7 +16589,7 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
16574
16589
|
getVersionRange() {
|
|
16575
16590
|
return {
|
|
16576
16591
|
model_mini: {
|
|
16577
|
-
min: '2.
|
|
16592
|
+
min: '2.9.0',
|
|
16578
16593
|
},
|
|
16579
16594
|
};
|
|
16580
16595
|
}
|
|
@@ -16656,7 +16671,7 @@ class XrpGetAddress extends BaseMethod {
|
|
|
16656
16671
|
getVersionRange() {
|
|
16657
16672
|
return {
|
|
16658
16673
|
model_mini: {
|
|
16659
|
-
min: '2.
|
|
16674
|
+
min: '2.9.0',
|
|
16660
16675
|
},
|
|
16661
16676
|
};
|
|
16662
16677
|
}
|
|
@@ -6,6 +6,7 @@ export declare type EVMAddress = {
|
|
|
6
6
|
export declare type EVMGetAddressParams = {
|
|
7
7
|
path: string | number[];
|
|
8
8
|
showOnOneKey?: boolean;
|
|
9
|
+
chainId?: number;
|
|
9
10
|
};
|
|
10
11
|
export declare function evmGetAddress(connectId: string, deviceId: string, params: CommonParams & EVMGetAddressParams): Response<EVMAddress>;
|
|
11
12
|
export declare function evmGetAddress(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"evmGetAddress.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,mBAAmB,GACzC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAExB,MAAM,CAAC,OAAO,UAAU,aAAa,CACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAAE,GACxD,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare type EVMPublicKey = {
|
|
|
6
6
|
export declare type EVMGetPublicKeyParams = {
|
|
7
7
|
path: string | number[];
|
|
8
8
|
showOnOneKey?: boolean;
|
|
9
|
+
chainId?: number;
|
|
9
10
|
};
|
|
10
11
|
export declare function evmGetPublicKey(connectId: string, deviceId: string, params: CommonParams & EVMGetPublicKeyParams): Response<EVMPublicKey>;
|
|
11
12
|
export declare function evmGetPublicKey(connectId: string, deviceId: string, params: CommonParams & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,iBAAiB,CAAC;AAEtB,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"evmGetPublicKey.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmGetPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,iBAAiB,CAAC;AAEtB,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,qBAAqB,GAC3C,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;CAAE,GAC1D,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import type { CommonParams, Response } from '../params';
|
|
|
3
3
|
export declare type EVMSignMessageParams = {
|
|
4
4
|
path: string | number[];
|
|
5
5
|
messageHex: string;
|
|
6
|
+
chainId?: number;
|
|
6
7
|
};
|
|
7
8
|
export declare function evmSignMessage(connectId: string, deviceId: string, params: CommonParams & EVMSignMessageParams): Response<EthereumMessageSignature>;
|
|
8
9
|
//# sourceMappingURL=evmSignMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmSignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"evmSignMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmSignMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,oBAAoB,GAC1C,QAAQ,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -28,6 +28,7 @@ export declare type EVMSignTypedDataParams = {
|
|
|
28
28
|
data: EthereumSignTypedDataMessage<EthereumSignTypedDataTypes>;
|
|
29
29
|
domainHash?: string;
|
|
30
30
|
messageHash?: string;
|
|
31
|
+
chainId?: number;
|
|
31
32
|
};
|
|
32
33
|
export declare function evmSignTypedData(connectId: string, deviceId: string, params: CommonParams & EVMSignTypedDataParams): Response<EthereumMessageSignature>;
|
|
33
34
|
//# sourceMappingURL=evmSignTypedData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmSignTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,iCAAiC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,oBAAY,0BAA0B,GAAG;IACvC,YAAY,EAAE,iCAAiC,EAAE,CAAC;IAClD,CAAC,oBAAoB,EAAE,MAAM,GAAG,iCAAiC,EAAE,CAAC;CACrE,CAAC;AAGF,oBAAY,4BAA4B,CAAC,CAAC,SAAS,0BAA0B,IAAI;IAC/E,KAAK,EAAE,CAAC,CAAC;IACT,WAAW,EAAE,MAAM,CAAC,CAAC;IACrB,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,IAAI,CAAC,EAAE,WAAW,CAAC;KACpB,CAAC;IACF,OAAO,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACvC,CAAC;AAEF,oBAAY,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"evmSignTypedData.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmSignTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,iCAAiC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,oBAAY,0BAA0B,GAAG;IACvC,YAAY,EAAE,iCAAiC,EAAE,CAAC;IAClD,CAAC,oBAAoB,EAAE,MAAM,GAAG,iCAAiC,EAAE,CAAC;CACrE,CAAC;AAGF,oBAAY,4BAA4B,CAAC,CAAC,SAAS,0BAA0B,IAAI;IAC/E,KAAK,EAAE,CAAC,CAAC;IACT,WAAW,EAAE,MAAM,CAAC,CAAC;IACrB,MAAM,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,IAAI,CAAC,EAAE,WAAW,CAAC;KACpB,CAAC;IACF,OAAO,EAAE;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACvC,CAAC;AAEF,oBAAY,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,IAAI,EAAE,4BAA4B,CAAC,0BAA0B,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,sBAAsB,GAC5C,QAAQ,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@ export declare type EVMVerifyMessageParams = {
|
|
|
4
4
|
address: string;
|
|
5
5
|
messageHex: string;
|
|
6
6
|
signature: string;
|
|
7
|
+
chainId?: number;
|
|
7
8
|
};
|
|
8
9
|
export declare function evmVerifyMessage(connectId: string, deviceId: string, params: CommonParams & EVMVerifyMessageParams): Response<Success>;
|
|
9
10
|
//# sourceMappingURL=evmVerifyMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evmVerifyMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmVerifyMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"evmVerifyMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmVerifyMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,oBAAY,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,sBAAsB,GAC5C,QAAQ,CAAC,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@onekeyfe/hd-shared": "^0.2.
|
|
28
|
-
"@onekeyfe/hd-transport": "^0.2.
|
|
27
|
+
"@onekeyfe/hd-shared": "^0.2.18",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.2.18",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"bignumber.js": "^9.0.2",
|
|
31
31
|
"jszip": "^3.10.1",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@types/semver": "^7.3.9",
|
|
43
43
|
"ripple-keypairs": "^1.1.4"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "ebdbd2360edeb07fdb5f4cabe253aa7e4a82f265"
|
|
46
46
|
}
|
|
@@ -43,12 +43,18 @@ export default class DeviceUploadResource extends BaseMethod<ResourceUpload> {
|
|
|
43
43
|
thumbnailData: hexToBytes(thumbnailDataHex),
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
const fileHash = bytesToHex(blake2s(this.payload.dataHex)).slice(0, 8);
|
|
47
|
+
const file_name_no_ext = `${resType === 0 ? 'wp' : 'nft'}-${fileHash}-${Math.floor(
|
|
48
|
+
Date.now() / 1000
|
|
49
|
+
)}`;
|
|
50
|
+
|
|
46
51
|
this.params = {
|
|
47
52
|
extension: suffix,
|
|
48
53
|
data_length: this.paramsData.data.byteLength,
|
|
49
54
|
zoom_data_length: this.paramsData.thumbnailData.byteLength,
|
|
50
55
|
res_type: resType,
|
|
51
56
|
nft_meta_data: nftMetaData,
|
|
57
|
+
file_name_no_ext,
|
|
52
58
|
};
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -26,6 +26,7 @@ export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
|
|
|
26
26
|
validateParams(batch, [
|
|
27
27
|
{ name: 'path', required: true },
|
|
28
28
|
{ name: 'showOnOneKey', type: 'boolean' },
|
|
29
|
+
{ name: 'chainId', type: 'number' },
|
|
29
30
|
]);
|
|
30
31
|
|
|
31
32
|
const showOnOneKey = batch.showOnOneKey ?? true;
|
|
@@ -33,6 +34,7 @@ export default class EvmGetAddress extends BaseMethod<EthereumGetAddress[]> {
|
|
|
33
34
|
this.params.push({
|
|
34
35
|
address_n: addressN,
|
|
35
36
|
show_display: showOnOneKey,
|
|
37
|
+
chain_id: batch.chainId,
|
|
36
38
|
});
|
|
37
39
|
});
|
|
38
40
|
}
|
|
@@ -26,6 +26,7 @@ export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]>
|
|
|
26
26
|
validateParams(batch, [
|
|
27
27
|
{ name: 'path', required: true },
|
|
28
28
|
{ name: 'showOnOneKey', type: 'boolean' },
|
|
29
|
+
{ name: 'chainId', type: 'number' },
|
|
29
30
|
]);
|
|
30
31
|
|
|
31
32
|
const showOnOneKey = batch.showOnOneKey ?? true;
|
|
@@ -33,6 +34,7 @@ export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKey[]>
|
|
|
33
34
|
this.params.push({
|
|
34
35
|
address_n: addressN,
|
|
35
36
|
show_display: showOnOneKey,
|
|
37
|
+
chain_id: batch.chainId,
|
|
36
38
|
});
|
|
37
39
|
});
|
|
38
40
|
}
|
|
@@ -14,9 +14,10 @@ export default class EVMSignMessage extends BaseMethod<EthereumSignMessage> {
|
|
|
14
14
|
validateParams(this.payload, [
|
|
15
15
|
{ name: 'path', required: true },
|
|
16
16
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
17
|
+
{ name: 'chainId', type: 'number' },
|
|
17
18
|
]);
|
|
18
19
|
|
|
19
|
-
const { path, messageHex } = this.payload;
|
|
20
|
+
const { path, messageHex, chainId } = this.payload;
|
|
20
21
|
|
|
21
22
|
const addressN = validatePath(path, 3);
|
|
22
23
|
|
|
@@ -24,6 +25,7 @@ export default class EVMSignMessage extends BaseMethod<EthereumSignMessage> {
|
|
|
24
25
|
this.params = {
|
|
25
26
|
address_n: addressN,
|
|
26
27
|
message: formatAnyHex(messageHex),
|
|
28
|
+
chain_id: chainId,
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -22,6 +22,7 @@ export type EVMSignTypedDataParams = {
|
|
|
22
22
|
data: EthereumSignTypedDataMessage<EthereumSignTypedDataTypes>;
|
|
23
23
|
domainHash?: string;
|
|
24
24
|
messageHash?: string;
|
|
25
|
+
chainId?: number;
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams> {
|
|
@@ -35,9 +36,10 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
35
36
|
{ name: 'data', type: 'object' },
|
|
36
37
|
{ name: 'domainHash', type: 'hexString' },
|
|
37
38
|
{ name: 'messageHash', type: 'hexString' },
|
|
39
|
+
{ name: 'chainId', type: 'number' },
|
|
38
40
|
]);
|
|
39
41
|
|
|
40
|
-
const { path, data, metamaskV4Compat, domainHash, messageHash } = this.payload;
|
|
42
|
+
const { path, data, metamaskV4Compat, domainHash, messageHash, chainId } = this.payload;
|
|
41
43
|
|
|
42
44
|
const addressN = validatePath(path, 3);
|
|
43
45
|
|
|
@@ -45,6 +47,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
45
47
|
addressN,
|
|
46
48
|
metamaskV4Compat,
|
|
47
49
|
data,
|
|
50
|
+
chainId,
|
|
48
51
|
};
|
|
49
52
|
|
|
50
53
|
if (domainHash) {
|
|
@@ -62,7 +65,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
62
65
|
|
|
63
66
|
async signTypedData() {
|
|
64
67
|
const { commands } = this.device;
|
|
65
|
-
const { addressN, data, metamaskV4Compat } = this.params;
|
|
68
|
+
const { addressN, data, metamaskV4Compat, chainId } = this.params;
|
|
66
69
|
|
|
67
70
|
const {
|
|
68
71
|
types,
|
|
@@ -82,6 +85,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
82
85
|
address_n: addressN,
|
|
83
86
|
primary_type: primaryType as string,
|
|
84
87
|
metamask_v4_compat: metamaskV4Compat,
|
|
88
|
+
chain_id: chainId,
|
|
85
89
|
}
|
|
86
90
|
);
|
|
87
91
|
|
|
@@ -204,7 +208,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
204
208
|
);
|
|
205
209
|
}
|
|
206
210
|
|
|
207
|
-
const { addressN } = this.params;
|
|
211
|
+
const { addressN, chainId } = this.params;
|
|
208
212
|
|
|
209
213
|
// For Classic、Mini device we use EthereumSignTypedData
|
|
210
214
|
const deviceType = getDeviceType(this.device.features);
|
|
@@ -225,6 +229,7 @@ export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams>
|
|
|
225
229
|
address_n: addressN,
|
|
226
230
|
domain_separator_hash: domainHash ?? '',
|
|
227
231
|
message_hash: messageHash,
|
|
232
|
+
chain_id: chainId,
|
|
228
233
|
}
|
|
229
234
|
);
|
|
230
235
|
} else {
|
|
@@ -13,6 +13,7 @@ export default class EVMSignMessage extends BaseMethod<EthereumVerifyMessage> {
|
|
|
13
13
|
{ name: 'address', type: 'string', required: true },
|
|
14
14
|
{ name: 'messageHex', type: 'hexString', required: true },
|
|
15
15
|
{ name: 'signature', type: 'hexString', required: true },
|
|
16
|
+
{ name: 'chainId', type: 'number' },
|
|
16
17
|
]);
|
|
17
18
|
|
|
18
19
|
const { address, messageHex, signature } = formatAnyHex(this.payload);
|
|
@@ -21,6 +22,7 @@ export default class EVMSignMessage extends BaseMethod<EthereumVerifyMessage> {
|
|
|
21
22
|
address,
|
|
22
23
|
message: messageHex,
|
|
23
24
|
signature,
|
|
25
|
+
chain_id: this.payload.chainId,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
StellarSignedTx,
|
|
4
4
|
StellarSignTx as HardwareStellarSignTx,
|
|
5
5
|
} from '@onekeyfe/hd-transport';
|
|
6
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
6
7
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
7
8
|
import { validatePath } from '../helpers/pathUtils';
|
|
8
9
|
import { BaseMethod } from '../BaseMethod';
|
|
9
10
|
import { validateParams } from '../helpers/paramsValidator';
|
|
10
11
|
import { StellarOperation, StellarSignTransactionParams } from '../../types';
|
|
11
|
-
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
12
12
|
|
|
13
13
|
export default class StellarSignTransaction extends BaseMethod<HardwareStellarSignTx> {
|
|
14
14
|
operations: any[] = [];
|
|
@@ -160,7 +160,10 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
160
160
|
|
|
161
161
|
const { transaction, networkPassphrase } = this.payload as StellarSignTransactionParams;
|
|
162
162
|
if (!transaction.timebounds) {
|
|
163
|
-
throw ERRORS.TypedError(
|
|
163
|
+
throw ERRORS.TypedError(
|
|
164
|
+
HardwareErrorCode.CallMethodInvalidParameter,
|
|
165
|
+
'timebounds is required'
|
|
166
|
+
);
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
// init params
|
|
@@ -13,11 +13,11 @@ export type TronGetAddressParams = {
|
|
|
13
13
|
export declare function tronGetAddress(
|
|
14
14
|
connectId: string,
|
|
15
15
|
deviceId: string,
|
|
16
|
-
params: CommonParams & TronGetAddressParams
|
|
16
|
+
params: CommonParams & TronGetAddressParams
|
|
17
17
|
): Response<TronAddress>;
|
|
18
18
|
|
|
19
19
|
export declare function tronGetAddress(
|
|
20
20
|
connectId: string,
|
|
21
21
|
deviceId: string,
|
|
22
|
-
params: CommonParams & { bundle?: TronGetAddressParams[] }
|
|
22
|
+
params: CommonParams & { bundle?: TronGetAddressParams[] }
|
|
23
23
|
): Response<Array<TronAddress>>;
|
|
@@ -37,5 +37,5 @@ export type TronSignTransactionParams = {
|
|
|
37
37
|
export declare function tronSignTransaction(
|
|
38
38
|
connectId: string,
|
|
39
39
|
deviceId: string,
|
|
40
|
-
params: CommonParams & TronSignTransactionParams
|
|
40
|
+
params: CommonParams & TronSignTransactionParams
|
|
41
41
|
): Response<TronSignedTx>;
|