@onekeyfe/hd-web-sdk 0.2.6 → 0.2.8
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/build/data/messages/messages.json +110 -1
- package/build/iframe.html +1 -1
- package/build/js/iframe.5cdf9f2b252ee72155b1.js +3 -0
- package/build/js/{iframe.e162166654afe2b43e26.js.LICENSE.txt → iframe.5cdf9f2b252ee72155b1.js.LICENSE.txt} +0 -0
- package/build/js/iframe.5cdf9f2b252ee72155b1.js.map +1 -0
- package/build/onekey-js-sdk.js +334 -4
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +6 -6
- package/build/js/iframe.e162166654afe2b43e26.js +0 -3
- package/build/js/iframe.e162166654afe2b43e26.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -7452,6 +7452,21 @@ const inject = ({
|
|
|
7452
7452
|
connectId,
|
|
7453
7453
|
deviceId,
|
|
7454
7454
|
method: 'xrpSignTransaction'
|
|
7455
|
+
})),
|
|
7456
|
+
suiGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
|
|
7457
|
+
connectId,
|
|
7458
|
+
deviceId,
|
|
7459
|
+
method: 'suiGetAddress'
|
|
7460
|
+
})),
|
|
7461
|
+
suiGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
|
|
7462
|
+
connectId,
|
|
7463
|
+
deviceId,
|
|
7464
|
+
method: 'suiGetPublicKey'
|
|
7465
|
+
})),
|
|
7466
|
+
suiSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), {
|
|
7467
|
+
connectId,
|
|
7468
|
+
deviceId,
|
|
7469
|
+
method: 'suiSignTransaction'
|
|
7455
7470
|
}))
|
|
7456
7471
|
};
|
|
7457
7472
|
return api;
|
|
@@ -13885,6 +13900,52 @@ var nested = {
|
|
|
13885
13900
|
RebootToBootloader: {
|
|
13886
13901
|
fields: {}
|
|
13887
13902
|
},
|
|
13903
|
+
RebootToBoardloader: {
|
|
13904
|
+
fields: {}
|
|
13905
|
+
},
|
|
13906
|
+
ListResDir: {
|
|
13907
|
+
fields: {
|
|
13908
|
+
path: {
|
|
13909
|
+
rule: "required",
|
|
13910
|
+
type: "string",
|
|
13911
|
+
id: 1
|
|
13912
|
+
}
|
|
13913
|
+
}
|
|
13914
|
+
},
|
|
13915
|
+
FileInfoList: {
|
|
13916
|
+
fields: {
|
|
13917
|
+
files: {
|
|
13918
|
+
rule: "repeated",
|
|
13919
|
+
type: "FileInfo",
|
|
13920
|
+
id: 1
|
|
13921
|
+
}
|
|
13922
|
+
},
|
|
13923
|
+
nested: {
|
|
13924
|
+
FileInfo: {
|
|
13925
|
+
fields: {
|
|
13926
|
+
name: {
|
|
13927
|
+
rule: "required",
|
|
13928
|
+
type: "string",
|
|
13929
|
+
id: 1
|
|
13930
|
+
},
|
|
13931
|
+
size: {
|
|
13932
|
+
rule: "required",
|
|
13933
|
+
type: "uint64",
|
|
13934
|
+
id: 2
|
|
13935
|
+
}
|
|
13936
|
+
}
|
|
13937
|
+
}
|
|
13938
|
+
}
|
|
13939
|
+
},
|
|
13940
|
+
DeviceEraseSector: {
|
|
13941
|
+
fields: {
|
|
13942
|
+
sector: {
|
|
13943
|
+
rule: "required",
|
|
13944
|
+
type: "uint32",
|
|
13945
|
+
id: 1
|
|
13946
|
+
}
|
|
13947
|
+
}
|
|
13948
|
+
},
|
|
13888
13949
|
MoneroTransactionSourceEntry: {
|
|
13889
13950
|
fields: {
|
|
13890
13951
|
outputs: {
|
|
@@ -16018,6 +16079,61 @@ var nested = {
|
|
|
16018
16079
|
}
|
|
16019
16080
|
}
|
|
16020
16081
|
},
|
|
16082
|
+
SuiGetAddress: {
|
|
16083
|
+
fields: {
|
|
16084
|
+
address_n: {
|
|
16085
|
+
rule: "repeated",
|
|
16086
|
+
type: "uint32",
|
|
16087
|
+
id: 1,
|
|
16088
|
+
options: {
|
|
16089
|
+
packed: false
|
|
16090
|
+
}
|
|
16091
|
+
},
|
|
16092
|
+
show_display: {
|
|
16093
|
+
type: "bool",
|
|
16094
|
+
id: 2
|
|
16095
|
+
}
|
|
16096
|
+
}
|
|
16097
|
+
},
|
|
16098
|
+
SuiAddress: {
|
|
16099
|
+
fields: {
|
|
16100
|
+
address: {
|
|
16101
|
+
type: "string",
|
|
16102
|
+
id: 1
|
|
16103
|
+
}
|
|
16104
|
+
}
|
|
16105
|
+
},
|
|
16106
|
+
SuiSignTx: {
|
|
16107
|
+
fields: {
|
|
16108
|
+
address_n: {
|
|
16109
|
+
rule: "repeated",
|
|
16110
|
+
type: "uint32",
|
|
16111
|
+
id: 1,
|
|
16112
|
+
options: {
|
|
16113
|
+
packed: false
|
|
16114
|
+
}
|
|
16115
|
+
},
|
|
16116
|
+
raw_tx: {
|
|
16117
|
+
rule: "required",
|
|
16118
|
+
type: "bytes",
|
|
16119
|
+
id: 2
|
|
16120
|
+
}
|
|
16121
|
+
}
|
|
16122
|
+
},
|
|
16123
|
+
SuiSignedTx: {
|
|
16124
|
+
fields: {
|
|
16125
|
+
public_key: {
|
|
16126
|
+
rule: "required",
|
|
16127
|
+
type: "bytes",
|
|
16128
|
+
id: 1
|
|
16129
|
+
},
|
|
16130
|
+
signature: {
|
|
16131
|
+
rule: "required",
|
|
16132
|
+
type: "bytes",
|
|
16133
|
+
id: 2
|
|
16134
|
+
}
|
|
16135
|
+
}
|
|
16136
|
+
},
|
|
16021
16137
|
TezosGetAddress: {
|
|
16022
16138
|
fields: {
|
|
16023
16139
|
address_n: {
|
|
@@ -17015,6 +17131,10 @@ var nested = {
|
|
|
17015
17131
|
MessageType_AlgorandAddress: 10901,
|
|
17016
17132
|
MessageType_AlgorandSignTx: 10902,
|
|
17017
17133
|
MessageType_AlgorandSignedTx: 10903,
|
|
17134
|
+
MessageType_SuiGetAddress: 11100,
|
|
17135
|
+
MessageType_SuiAddress: 11101,
|
|
17136
|
+
MessageType_SuiSignTx: 11102,
|
|
17137
|
+
MessageType_SuiSignedTx: 11103,
|
|
17018
17138
|
MessageType_DeviceBackToBoot: 903,
|
|
17019
17139
|
MessageType_DeviceInfoSettings: 10001,
|
|
17020
17140
|
MessageType_GetDeviceInfo: 10002,
|
|
@@ -17035,7 +17155,11 @@ var nested = {
|
|
|
17035
17155
|
MessageType_ZoomRequest: 10019,
|
|
17036
17156
|
MessageType_ResourceRequest: 10020,
|
|
17037
17157
|
MessageType_ResourceAck: 10021,
|
|
17038
|
-
MessageType_ResourceUpdate: 10022
|
|
17158
|
+
MessageType_ResourceUpdate: 10022,
|
|
17159
|
+
MessageType_ListResDir: 10023,
|
|
17160
|
+
MessageType_FileInfoList: 10024,
|
|
17161
|
+
MessageType_RebootToBoardloader: 10025,
|
|
17162
|
+
MessageType_DeviceEraseSector: 10026
|
|
17039
17163
|
}
|
|
17040
17164
|
},
|
|
17041
17165
|
google: {
|
|
@@ -25403,6 +25527,209 @@ class XrpGetAddress extends BaseMethod {
|
|
|
25403
25527
|
|
|
25404
25528
|
}
|
|
25405
25529
|
|
|
25530
|
+
class SuiGetAddress extends BaseMethod {
|
|
25531
|
+
constructor() {
|
|
25532
|
+
super(...arguments);
|
|
25533
|
+
this.hasBundle = false;
|
|
25534
|
+
}
|
|
25535
|
+
|
|
25536
|
+
init() {
|
|
25537
|
+
var _a;
|
|
25538
|
+
|
|
25539
|
+
this.checkDeviceId = true;
|
|
25540
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
25541
|
+
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
25542
|
+
const payload = this.hasBundle ? this.payload : {
|
|
25543
|
+
bundle: [this.payload]
|
|
25544
|
+
};
|
|
25545
|
+
validateParams(payload, [{
|
|
25546
|
+
name: 'bundle',
|
|
25547
|
+
type: 'array'
|
|
25548
|
+
}]);
|
|
25549
|
+
this.params = [];
|
|
25550
|
+
payload.bundle.forEach(batch => {
|
|
25551
|
+
var _a;
|
|
25552
|
+
|
|
25553
|
+
const addressN = validatePath(batch.path, 3);
|
|
25554
|
+
validateParams(batch, [{
|
|
25555
|
+
name: 'path',
|
|
25556
|
+
required: true
|
|
25557
|
+
}, {
|
|
25558
|
+
name: 'showOnOneKey',
|
|
25559
|
+
type: 'boolean'
|
|
25560
|
+
}]);
|
|
25561
|
+
const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
|
|
25562
|
+
this.params.push({
|
|
25563
|
+
address_n: addressN,
|
|
25564
|
+
show_display: showOnOneKey
|
|
25565
|
+
});
|
|
25566
|
+
});
|
|
25567
|
+
}
|
|
25568
|
+
|
|
25569
|
+
publicKeyToAddress(publicKey) {
|
|
25570
|
+
const hash = sha3.sha3_256.create();
|
|
25571
|
+
hash.update('\x00');
|
|
25572
|
+
hash.update(hexToBytes(publicKey));
|
|
25573
|
+
return `0x${utils.bytesToHex(hash.digest().slice(0, 20))}`;
|
|
25574
|
+
}
|
|
25575
|
+
|
|
25576
|
+
getVersionRange() {
|
|
25577
|
+
return {
|
|
25578
|
+
model_mini: {
|
|
25579
|
+
min: '2.9.0'
|
|
25580
|
+
},
|
|
25581
|
+
model_touch: {
|
|
25582
|
+
min: '3.5.0'
|
|
25583
|
+
}
|
|
25584
|
+
};
|
|
25585
|
+
}
|
|
25586
|
+
|
|
25587
|
+
run() {
|
|
25588
|
+
var _a;
|
|
25589
|
+
|
|
25590
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25591
|
+
if (this.hasBundle && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features)) {
|
|
25592
|
+
const res = yield this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
|
|
25593
|
+
paths: this.params,
|
|
25594
|
+
ecdsa_curve_name: 'ed25519'
|
|
25595
|
+
});
|
|
25596
|
+
const result = res.message.public_keys.map((publicKey, index) => ({
|
|
25597
|
+
path: serializedPath(this.params[index].address_n),
|
|
25598
|
+
publicKey,
|
|
25599
|
+
address: this.publicKeyToAddress(publicKey)
|
|
25600
|
+
}));
|
|
25601
|
+
return Promise.resolve(result);
|
|
25602
|
+
}
|
|
25603
|
+
|
|
25604
|
+
const responses = [];
|
|
25605
|
+
|
|
25606
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
25607
|
+
const param = this.params[i];
|
|
25608
|
+
const res = yield this.device.commands.typedCall('SuiGetAddress', 'SuiAddress', Object.assign({}, param));
|
|
25609
|
+
const {
|
|
25610
|
+
address
|
|
25611
|
+
} = res.message;
|
|
25612
|
+
responses.push({
|
|
25613
|
+
path: serializedPath(param.address_n),
|
|
25614
|
+
address: address === null || address === void 0 ? void 0 : address.toLowerCase()
|
|
25615
|
+
});
|
|
25616
|
+
}
|
|
25617
|
+
|
|
25618
|
+
return Promise.resolve(this.hasBundle ? responses : responses[0]);
|
|
25619
|
+
});
|
|
25620
|
+
}
|
|
25621
|
+
|
|
25622
|
+
}
|
|
25623
|
+
|
|
25624
|
+
class SuiGetPublicKey extends BaseMethod {
|
|
25625
|
+
constructor() {
|
|
25626
|
+
super(...arguments);
|
|
25627
|
+
this.hasBundle = false;
|
|
25628
|
+
}
|
|
25629
|
+
|
|
25630
|
+
init() {
|
|
25631
|
+
var _a;
|
|
25632
|
+
|
|
25633
|
+
this.checkDeviceId = true;
|
|
25634
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
25635
|
+
this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
|
|
25636
|
+
const payload = this.hasBundle ? this.payload : {
|
|
25637
|
+
bundle: [this.payload]
|
|
25638
|
+
};
|
|
25639
|
+
validateParams(payload, [{
|
|
25640
|
+
name: 'bundle',
|
|
25641
|
+
type: 'array'
|
|
25642
|
+
}]);
|
|
25643
|
+
this.params = [];
|
|
25644
|
+
payload.bundle.forEach(batch => {
|
|
25645
|
+
var _a;
|
|
25646
|
+
|
|
25647
|
+
const addressN = validatePath(batch.path, 3);
|
|
25648
|
+
validateParams(batch, [{
|
|
25649
|
+
name: 'path',
|
|
25650
|
+
required: true
|
|
25651
|
+
}, {
|
|
25652
|
+
name: 'showOnOneKey',
|
|
25653
|
+
type: 'boolean'
|
|
25654
|
+
}]);
|
|
25655
|
+
const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
|
|
25656
|
+
this.params.push({
|
|
25657
|
+
address_n: addressN,
|
|
25658
|
+
show_display: showOnOneKey
|
|
25659
|
+
});
|
|
25660
|
+
});
|
|
25661
|
+
}
|
|
25662
|
+
|
|
25663
|
+
getVersionRange() {
|
|
25664
|
+
return {
|
|
25665
|
+
model_mini: {
|
|
25666
|
+
min: '2.9.0'
|
|
25667
|
+
},
|
|
25668
|
+
model_touch: {
|
|
25669
|
+
min: '3.5.0'
|
|
25670
|
+
}
|
|
25671
|
+
};
|
|
25672
|
+
}
|
|
25673
|
+
|
|
25674
|
+
run() {
|
|
25675
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25676
|
+
const res = yield this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
|
|
25677
|
+
paths: this.params,
|
|
25678
|
+
ecdsa_curve_name: 'ed25519'
|
|
25679
|
+
});
|
|
25680
|
+
const responses = res.message.public_keys.map((publicKey, index) => ({
|
|
25681
|
+
path: serializedPath(this.params[index].address_n),
|
|
25682
|
+
publicKey
|
|
25683
|
+
}));
|
|
25684
|
+
return Promise.resolve(this.hasBundle ? responses : responses[0]);
|
|
25685
|
+
});
|
|
25686
|
+
}
|
|
25687
|
+
|
|
25688
|
+
}
|
|
25689
|
+
|
|
25690
|
+
class SuiSignTransaction extends BaseMethod {
|
|
25691
|
+
init() {
|
|
25692
|
+
this.checkDeviceId = true;
|
|
25693
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.INITIALIZE];
|
|
25694
|
+
validateParams(this.payload, [{
|
|
25695
|
+
name: 'path',
|
|
25696
|
+
required: true
|
|
25697
|
+
}, {
|
|
25698
|
+
name: 'rawTx',
|
|
25699
|
+
type: 'hexString',
|
|
25700
|
+
required: true
|
|
25701
|
+
}]);
|
|
25702
|
+
const {
|
|
25703
|
+
path,
|
|
25704
|
+
rawTx
|
|
25705
|
+
} = this.payload;
|
|
25706
|
+
const addressN = validatePath(path, 3);
|
|
25707
|
+
this.params = {
|
|
25708
|
+
address_n: addressN,
|
|
25709
|
+
raw_tx: formatAnyHex(rawTx)
|
|
25710
|
+
};
|
|
25711
|
+
}
|
|
25712
|
+
|
|
25713
|
+
getVersionRange() {
|
|
25714
|
+
return {
|
|
25715
|
+
model_mini: {
|
|
25716
|
+
min: '2.9.0'
|
|
25717
|
+
},
|
|
25718
|
+
model_touch: {
|
|
25719
|
+
min: '3.5.0'
|
|
25720
|
+
}
|
|
25721
|
+
};
|
|
25722
|
+
}
|
|
25723
|
+
|
|
25724
|
+
run() {
|
|
25725
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25726
|
+
const res = yield this.device.commands.typedCall('SuiSignTx', 'SuiSignedTx', Object.assign({}, this.params));
|
|
25727
|
+
return Promise.resolve(res.message);
|
|
25728
|
+
});
|
|
25729
|
+
}
|
|
25730
|
+
|
|
25731
|
+
}
|
|
25732
|
+
|
|
25406
25733
|
var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
25407
25734
|
__proto__: null,
|
|
25408
25735
|
searchDevices: SearchDevices,
|
|
@@ -25472,7 +25799,10 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
25472
25799
|
cosmosGetPublicKey: CosmosGetPublicKey,
|
|
25473
25800
|
cosmosSignTransaction: CosmosSignTransaction,
|
|
25474
25801
|
xrpGetAddress: XrpGetAddress$1,
|
|
25475
|
-
xrpSignTransaction: XrpGetAddress
|
|
25802
|
+
xrpSignTransaction: XrpGetAddress,
|
|
25803
|
+
suiGetAddress: SuiGetAddress,
|
|
25804
|
+
suiGetPublicKey: SuiGetPublicKey,
|
|
25805
|
+
suiSignTransaction: SuiSignTransaction
|
|
25476
25806
|
});
|
|
25477
25807
|
|
|
25478
25808
|
function findMethod(message) {
|
|
@@ -71843,7 +72173,7 @@ module.exports = {"i8":"6.5.4"};
|
|
|
71843
72173
|
/***/ ((module) => {
|
|
71844
72174
|
|
|
71845
72175
|
"use strict";
|
|
71846
|
-
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.
|
|
72176
|
+
module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.8","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.8","@onekeyfe/hd-transport":"^0.2.8","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3","ripple-keypairs":"^1.1.4"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9","ripple-keypairs":"^1.1.4"}}');
|
|
71847
72177
|
|
|
71848
72178
|
/***/ })
|
|
71849
72179
|
|
|
@@ -74382,7 +74712,7 @@ const src_init = async settings => {
|
|
|
74382
74712
|
|
|
74383
74713
|
try {
|
|
74384
74714
|
await init({ ..._settings,
|
|
74385
|
-
version: "0.2.
|
|
74715
|
+
version: "0.2.8"
|
|
74386
74716
|
});
|
|
74387
74717
|
return true;
|
|
74388
74718
|
} catch (e) {
|