@onekeyfe/hd-core 1.2.2-alpha.10 → 1.2.2-alpha.101
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/__tests__/device-lifecycle-events.test.ts +30 -14
- package/__tests__/logBlockEvent.test.ts +45 -122
- package/__tests__/open-wallet-session.test.ts +53 -0
- package/__tests__/protocol-v2.test.ts +35 -0
- package/__tests__/sol-sign-offchain-message.test.ts +70 -0
- package/dist/api/UploadPortfolio.d.ts +1 -0
- package/dist/api/UploadPortfolio.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/uiPromiseRegistry.d.ts +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/index.d.ts +19 -12
- package/dist/index.js +87 -97
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +3 -4
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/api/solSignOffchainMessage.d.ts +2 -0
- package/dist/types/api/solSignOffchainMessage.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/UploadPortfolio.ts +5 -4
- package/src/api/solana/SolSignOffchainMessage.ts +57 -4
- package/src/core/index.ts +21 -7
- package/src/data/messages/messages-protocol-v2.json +8 -5
- package/src/data/messages/messages.json +8 -5
- package/src/events/logBlockEvent.ts +6 -75
- package/src/protocols/protocol-v2/walletSession.ts +7 -2
- package/src/types/api/protocolV2.ts +3 -4
- package/src/types/api/solSignOffchainMessage.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -13203,7 +13203,8 @@ var nested$2 = {
|
|
|
13203
13203
|
},
|
|
13204
13204
|
SolanaOffChainMessageVersion: {
|
|
13205
13205
|
values: {
|
|
13206
|
-
MESSAGE_VERSION_0: 0
|
|
13206
|
+
MESSAGE_VERSION_0: 0,
|
|
13207
|
+
MESSAGE_VERSION_1: 1
|
|
13207
13208
|
}
|
|
13208
13209
|
},
|
|
13209
13210
|
SolanaOffChainMessageFormat: {
|
|
@@ -13236,14 +13237,16 @@ var nested$2 = {
|
|
|
13236
13237
|
},
|
|
13237
13238
|
message_format: {
|
|
13238
13239
|
type: "SolanaOffChainMessageFormat",
|
|
13239
|
-
id: 4
|
|
13240
|
-
options: {
|
|
13241
|
-
"default": "V0_RESTRICTED_ASCII"
|
|
13242
|
-
}
|
|
13240
|
+
id: 4
|
|
13243
13241
|
},
|
|
13244
13242
|
application_domain: {
|
|
13245
13243
|
type: "bytes",
|
|
13246
13244
|
id: 5
|
|
13245
|
+
},
|
|
13246
|
+
required_signers: {
|
|
13247
|
+
rule: "repeated",
|
|
13248
|
+
type: "bytes",
|
|
13249
|
+
id: 7
|
|
13247
13250
|
}
|
|
13248
13251
|
}
|
|
13249
13252
|
},
|
|
@@ -36027,7 +36030,8 @@ var nested = {
|
|
|
36027
36030
|
},
|
|
36028
36031
|
SolanaOffChainMessageVersion: {
|
|
36029
36032
|
values: {
|
|
36030
|
-
MESSAGE_VERSION_0: 0
|
|
36033
|
+
MESSAGE_VERSION_0: 0,
|
|
36034
|
+
MESSAGE_VERSION_1: 1
|
|
36031
36035
|
}
|
|
36032
36036
|
},
|
|
36033
36037
|
SolanaOffChainMessageFormat: {
|
|
@@ -36115,10 +36119,7 @@ var nested = {
|
|
|
36115
36119
|
},
|
|
36116
36120
|
message_format: {
|
|
36117
36121
|
type: "SolanaOffChainMessageFormat",
|
|
36118
|
-
id: 4
|
|
36119
|
-
options: {
|
|
36120
|
-
"default": "V0_RESTRICTED_ASCII"
|
|
36121
|
-
}
|
|
36122
|
+
id: 4
|
|
36122
36123
|
},
|
|
36123
36124
|
application_domain: {
|
|
36124
36125
|
type: "bytes",
|
|
@@ -36127,6 +36128,11 @@ var nested = {
|
|
|
36127
36128
|
source_fingerprint: {
|
|
36128
36129
|
type: "uint32",
|
|
36129
36130
|
id: 6
|
|
36131
|
+
},
|
|
36132
|
+
required_signers: {
|
|
36133
|
+
rule: "repeated",
|
|
36134
|
+
type: "bytes",
|
|
36135
|
+
id: 7
|
|
36130
36136
|
}
|
|
36131
36137
|
}
|
|
36132
36138
|
},
|
|
@@ -41663,61 +41669,13 @@ const LogBlockEvent = new Set([
|
|
|
41663
41669
|
UI_RESPONSE.RECEIVE_PIN,
|
|
41664
41670
|
UI_RESPONSE.RECEIVE_PASSPHRASE,
|
|
41665
41671
|
]);
|
|
41666
|
-
const
|
|
41667
|
-
'openWalletSession',
|
|
41672
|
+
const LogPayloadBlockMethod = new Set([
|
|
41668
41673
|
'deviceUploadNft',
|
|
41669
41674
|
'deviceUploadWallpaper',
|
|
41670
41675
|
'uploadPortfolio',
|
|
41671
41676
|
'fileWrite',
|
|
41672
41677
|
'fileRead',
|
|
41673
41678
|
]);
|
|
41674
|
-
const LogPayloadBlockMethod = new Set([
|
|
41675
|
-
'deviceUploadNft',
|
|
41676
|
-
'deviceUploadWallpaper',
|
|
41677
|
-
'uploadPortfolio',
|
|
41678
|
-
]);
|
|
41679
|
-
const SensitiveLogKeys = new Set([
|
|
41680
|
-
'devicestate',
|
|
41681
|
-
'entropy',
|
|
41682
|
-
'expectedpassphrasestate',
|
|
41683
|
-
'mnemonic',
|
|
41684
|
-
'passphrase',
|
|
41685
|
-
'passphrasestate',
|
|
41686
|
-
'password',
|
|
41687
|
-
'pin',
|
|
41688
|
-
'privatekey',
|
|
41689
|
-
'seed',
|
|
41690
|
-
'session',
|
|
41691
|
-
'sessionid',
|
|
41692
|
-
'walletsessionid',
|
|
41693
|
-
'xprv',
|
|
41694
|
-
]);
|
|
41695
|
-
const normalizeLogKey = (key) => key.replace(/[_-]/g, '').toLowerCase();
|
|
41696
|
-
const isSigningMethod = (methodName) => /sign/i.test(methodName);
|
|
41697
|
-
const redactLogValue = (value, seen) => {
|
|
41698
|
-
if (ArrayBuffer.isView(value)) {
|
|
41699
|
-
return `[BINARY:${value.byteLength}]`;
|
|
41700
|
-
}
|
|
41701
|
-
if (value instanceof ArrayBuffer) {
|
|
41702
|
-
return `[BINARY:${value.byteLength}]`;
|
|
41703
|
-
}
|
|
41704
|
-
if (Array.isArray(value)) {
|
|
41705
|
-
return value.map(item => redactLogValue(item, seen));
|
|
41706
|
-
}
|
|
41707
|
-
if (!value || typeof value !== 'object')
|
|
41708
|
-
return value;
|
|
41709
|
-
if (seen.has(value))
|
|
41710
|
-
return '[CIRCULAR]';
|
|
41711
|
-
seen.add(value);
|
|
41712
|
-
const redacted = Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
41713
|
-
key,
|
|
41714
|
-
SensitiveLogKeys.has(normalizeLogKey(key)) && item !== null && item !== undefined
|
|
41715
|
-
? '[REDACTED]'
|
|
41716
|
-
: redactLogValue(item, seen),
|
|
41717
|
-
]));
|
|
41718
|
-
seen.delete(value);
|
|
41719
|
-
return redacted;
|
|
41720
|
-
};
|
|
41721
41679
|
function getLogBlockLabel(message) {
|
|
41722
41680
|
if (!message || typeof message !== 'object')
|
|
41723
41681
|
return undefined;
|
|
@@ -41726,26 +41684,16 @@ function getLogBlockLabel(message) {
|
|
|
41726
41684
|
return type;
|
|
41727
41685
|
}
|
|
41728
41686
|
const methodName = method !== null && method !== void 0 ? method : payload === null || payload === void 0 ? void 0 : payload.method;
|
|
41729
|
-
if (methodName &&
|
|
41687
|
+
if (methodName && LogPayloadBlockMethod.has(methodName)) {
|
|
41730
41688
|
return methodName;
|
|
41731
41689
|
}
|
|
41732
41690
|
return undefined;
|
|
41733
41691
|
}
|
|
41734
41692
|
function getSafeLogPayload(value, blockLabel) {
|
|
41735
|
-
if (blockLabel
|
|
41736
|
-
(LogBlockEvent.has(blockLabel) ||
|
|
41737
|
-
LogPayloadBlockMethod.has(blockLabel) ||
|
|
41738
|
-
isSigningMethod(blockLabel))) {
|
|
41693
|
+
if (blockLabel) {
|
|
41739
41694
|
return { method: blockLabel, payload: '[REDACTED]' };
|
|
41740
41695
|
}
|
|
41741
|
-
|
|
41742
|
-
if (blockLabel &&
|
|
41743
|
-
redactedValue &&
|
|
41744
|
-
typeof redactedValue === 'object' &&
|
|
41745
|
-
!Array.isArray(redactedValue)) {
|
|
41746
|
-
return Object.assign(Object.assign({}, redactedValue), { method: blockLabel });
|
|
41747
|
-
}
|
|
41748
|
-
return redactedValue;
|
|
41696
|
+
return value;
|
|
41749
41697
|
}
|
|
41750
41698
|
function formatLogMethodLabel(label, methodName) {
|
|
41751
41699
|
return methodName ? `${label} [${methodName}]` : label;
|
|
@@ -41869,7 +41817,7 @@ const selectDeviceSession = (device, expectedPassphraseState, deriveCardano, onS
|
|
|
41869
41817
|
return getDeviceSession(device, buildDeviceSessionGetRequest());
|
|
41870
41818
|
});
|
|
41871
41819
|
function getProtocolV2WalletSession(device, options) {
|
|
41872
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
41820
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
41873
41821
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41874
41822
|
const forceWalletSelection = (options === null || options === void 0 ? void 0 : options.forceWalletSelection) === true || (options === null || options === void 0 ? void 0 : options.initSession) === true;
|
|
41875
41823
|
const readCurrentAttachPinSession = (options === null || options === void 0 ? void 0 : options.readCurrentAttachPinSession) === true;
|
|
@@ -41940,7 +41888,7 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
41940
41888
|
return keepAttachPin ? Object.assign(session, { viaAttachPin: true }) : session;
|
|
41941
41889
|
});
|
|
41942
41890
|
const rejectMismatchedAttachPinWallet = () => __awaiter(this, void 0, void 0, function* () {
|
|
41943
|
-
var
|
|
41891
|
+
var _o;
|
|
41944
41892
|
const features = yield refreshProtocolV2DeviceStatus(device);
|
|
41945
41893
|
markWalletStatusRefreshed();
|
|
41946
41894
|
if (features.unlockedAttachPin !== true) {
|
|
@@ -41949,10 +41897,10 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
41949
41897
|
try {
|
|
41950
41898
|
yield device.lockDevice();
|
|
41951
41899
|
}
|
|
41952
|
-
catch (
|
|
41900
|
+
catch (_p) {
|
|
41953
41901
|
}
|
|
41954
41902
|
if (options === null || options === void 0 ? void 0 : options.rejectAttachPinForMainWallet) {
|
|
41955
|
-
(
|
|
41903
|
+
(_o = device.clearStandardInternalState) === null || _o === void 0 ? void 0 : _o.call(device);
|
|
41956
41904
|
device.clearInternalState();
|
|
41957
41905
|
}
|
|
41958
41906
|
else {
|
|
@@ -41961,11 +41909,11 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
41961
41909
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckUnlockTypeError);
|
|
41962
41910
|
});
|
|
41963
41911
|
const lockAttachPinBeforePassphraseSelection = () => __awaiter(this, void 0, void 0, function* () {
|
|
41964
|
-
var
|
|
41912
|
+
var _q;
|
|
41965
41913
|
if (readCurrentAttachPinSession || (options === null || options === void 0 ? void 0 : options.onlyMainPin)) {
|
|
41966
41914
|
return;
|
|
41967
41915
|
}
|
|
41968
|
-
if (((
|
|
41916
|
+
if (((_q = device.features) === null || _q === void 0 ? void 0 : _q.unlockedAttachPin) !== true) {
|
|
41969
41917
|
return;
|
|
41970
41918
|
}
|
|
41971
41919
|
yield rejectMismatchedAttachPinWallet();
|
|
@@ -41986,8 +41934,8 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
41986
41934
|
}
|
|
41987
41935
|
});
|
|
41988
41936
|
const selectStandardWallet = (forceMainPin = false) => __awaiter(this, void 0, void 0, function* () {
|
|
41989
|
-
var
|
|
41990
|
-
if (((
|
|
41937
|
+
var _r;
|
|
41938
|
+
if (((_r = device.features) === null || _r === void 0 ? void 0 : _r.passphraseProtection) === true) {
|
|
41991
41939
|
yield selectMainPin();
|
|
41992
41940
|
yield askDevicePassphrase(device, {
|
|
41993
41941
|
passphrase: '',
|
|
@@ -42052,6 +42000,9 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
42052
42000
|
throw error;
|
|
42053
42001
|
}
|
|
42054
42002
|
resumed = false;
|
|
42003
|
+
if (((_g = device.features) === null || _g === void 0 ? void 0 : _g.unlockedAttachPin) === true) {
|
|
42004
|
+
response = yield getDeviceSession(device, sessionGetRequest());
|
|
42005
|
+
}
|
|
42055
42006
|
}
|
|
42056
42007
|
}
|
|
42057
42008
|
else if (expectedPassphraseState) {
|
|
@@ -42080,7 +42031,7 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
42080
42031
|
}
|
|
42081
42032
|
catch (error) {
|
|
42082
42033
|
if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
|
|
42083
|
-
(
|
|
42034
|
+
(_h = device.clearStandardInternalState) === null || _h === void 0 ? void 0 : _h.call(device);
|
|
42084
42035
|
}
|
|
42085
42036
|
else {
|
|
42086
42037
|
device.clearInternalState();
|
|
@@ -42095,7 +42046,7 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
42095
42046
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WalletSessionInvalid);
|
|
42096
42047
|
}
|
|
42097
42048
|
if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
|
|
42098
|
-
(
|
|
42049
|
+
(_j = device.clearStandardInternalState) === null || _j === void 0 ? void 0 : _j.call(device);
|
|
42099
42050
|
yield selectStandardWallet(true);
|
|
42100
42051
|
response = yield getDeviceSession(device, sessionGetRequest());
|
|
42101
42052
|
}
|
|
@@ -42110,7 +42061,7 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
42110
42061
|
}
|
|
42111
42062
|
catch (error) {
|
|
42112
42063
|
if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
|
|
42113
|
-
(
|
|
42064
|
+
(_k = device.clearStandardInternalState) === null || _k === void 0 ? void 0 : _k.call(device);
|
|
42114
42065
|
}
|
|
42115
42066
|
else {
|
|
42116
42067
|
device.clearInternalState();
|
|
@@ -42133,7 +42084,7 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
42133
42084
|
if (sessionIsAttachPinWallet(response)) {
|
|
42134
42085
|
response = yield askEmptyPassphraseAndGet({ deriveCardano: true, keepAttachPin: true });
|
|
42135
42086
|
}
|
|
42136
|
-
else if (((
|
|
42087
|
+
else if (((_l = device.features) === null || _l === void 0 ? void 0 : _l.passphraseProtection) === false) {
|
|
42137
42088
|
response = yield getDeviceSession(device, buildDeviceSessionGetRequest());
|
|
42138
42089
|
}
|
|
42139
42090
|
else if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
|
|
@@ -42150,7 +42101,7 @@ function getProtocolV2WalletSession(device, options) {
|
|
|
42150
42101
|
}
|
|
42151
42102
|
catch (error) {
|
|
42152
42103
|
if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
|
|
42153
|
-
(
|
|
42104
|
+
(_m = device.clearStandardInternalState) === null || _m === void 0 ? void 0 : _m.call(device);
|
|
42154
42105
|
}
|
|
42155
42106
|
else {
|
|
42156
42107
|
device.clearInternalState();
|
|
@@ -55463,16 +55414,16 @@ const FILESYSTEM_FILE_WRITE_MESSAGE_TYPE = 60805;
|
|
|
55463
55414
|
const PORTFOLIO_UPDATE_MESSAGE_TYPE = 61400;
|
|
55464
55415
|
class UploadPortfolio extends FileWrite {
|
|
55465
55416
|
init() {
|
|
55466
|
-
const { packageBase64, timeoutMs } = this.payload;
|
|
55417
|
+
const { packageBase64, timeoutMs, uiMode = 'silent' } = this.payload;
|
|
55467
55418
|
const packageBytes = decodeCanonicalBase64({
|
|
55468
55419
|
value: packageBase64,
|
|
55469
55420
|
parameterName: 'packageBase64',
|
|
55470
55421
|
maxBytes: PORTFOLIO_PACKAGE_MAX_BYTES,
|
|
55471
55422
|
});
|
|
55472
|
-
this.payload = Object.assign(Object.assign({}, this.payload), { path: PORTFOLIO_PENDING_PATH, offset: 0, data: packageBytes, chunkSize: PORTFOLIO_CHUNK_SIZE, overwrite: true, append: false, emitProgress:
|
|
55423
|
+
this.payload = Object.assign(Object.assign({}, this.payload), { path: PORTFOLIO_PENDING_PATH, offset: 0, data: packageBytes, chunkSize: PORTFOLIO_CHUNK_SIZE, overwrite: true, append: false, emitProgress: uiMode === 'progress', timeoutMs });
|
|
55473
55424
|
super.init();
|
|
55474
55425
|
this.unlockPolicy = 'none';
|
|
55475
|
-
this.protocolV2UiMode = 'none';
|
|
55426
|
+
this.protocolV2UiMode = uiMode === 'progress' ? 'auto' : 'none';
|
|
55476
55427
|
}
|
|
55477
55428
|
run() {
|
|
55478
55429
|
const _super = Object.create(null, {
|
|
@@ -59518,6 +59469,25 @@ class SolSignTransaction extends BaseMethod {
|
|
|
59518
59469
|
}
|
|
59519
59470
|
}
|
|
59520
59471
|
|
|
59472
|
+
const SOLANA_PUBLIC_KEY_LENGTH = 32;
|
|
59473
|
+
const SOLANA_APPLICATION_DOMAIN_LENGTH = 32;
|
|
59474
|
+
const normalizeRequiredSigners = (requiredSigners) => {
|
|
59475
|
+
if (!requiredSigners)
|
|
59476
|
+
return undefined;
|
|
59477
|
+
const normalized = requiredSigners.map((signer, index) => {
|
|
59478
|
+
if (typeof signer !== 'string' ||
|
|
59479
|
+
!isHexString(addHexPrefix(signer), SOLANA_PUBLIC_KEY_LENGTH)) {
|
|
59480
|
+
throw invalidParameter(`Parameter [requiredSigners][${index}] must be a ${SOLANA_PUBLIC_KEY_LENGTH}-byte hex public key.`);
|
|
59481
|
+
}
|
|
59482
|
+
return stripHexPrefix(signer).toLowerCase();
|
|
59483
|
+
});
|
|
59484
|
+
for (let index = 1; index < normalized.length; index += 1) {
|
|
59485
|
+
if (normalized[index - 1] >= normalized[index]) {
|
|
59486
|
+
throw invalidParameter('Parameter [requiredSigners] must be strictly sorted and unique.');
|
|
59487
|
+
}
|
|
59488
|
+
}
|
|
59489
|
+
return normalized;
|
|
59490
|
+
};
|
|
59521
59491
|
class SolSignOffchainMessage extends BaseMethod {
|
|
59522
59492
|
getSupportedProtocols() {
|
|
59523
59493
|
return ['V1', 'V2'];
|
|
@@ -59532,15 +59502,29 @@ class SolSignOffchainMessage extends BaseMethod {
|
|
|
59532
59502
|
{ name: 'messageVersion', type: 'number', required: false },
|
|
59533
59503
|
{ name: 'messageFormat', type: 'number', required: false },
|
|
59534
59504
|
{ name: 'applicationDomainHex', type: 'hexString', required: false },
|
|
59505
|
+
{ name: 'sourceFingerprint', type: 'number', required: false },
|
|
59506
|
+
{ name: 'requiredSigners', type: 'array', required: false, allowEmpty: true },
|
|
59535
59507
|
]);
|
|
59536
|
-
const { path, messageHex, messageVersion, messageFormat, applicationDomainHex } = this.payload;
|
|
59508
|
+
const { path, messageHex, messageVersion, messageFormat, applicationDomainHex, sourceFingerprint, requiredSigners, } = this.payload;
|
|
59537
59509
|
const addressN = validatePath(path, 3);
|
|
59510
|
+
if (sourceFingerprint !== undefined &&
|
|
59511
|
+
(!Number.isInteger(sourceFingerprint) ||
|
|
59512
|
+
sourceFingerprint < 0 ||
|
|
59513
|
+
sourceFingerprint > 0xffffffff)) {
|
|
59514
|
+
throw invalidParameter('Parameter [sourceFingerprint] must be a uint32 number.');
|
|
59515
|
+
}
|
|
59516
|
+
if (applicationDomainHex !== undefined &&
|
|
59517
|
+
!isHexString(addHexPrefix(applicationDomainHex), SOLANA_APPLICATION_DOMAIN_LENGTH)) {
|
|
59518
|
+
throw invalidParameter('Parameter [applicationDomainHex] must be 32 bytes.');
|
|
59519
|
+
}
|
|
59538
59520
|
this.params = {
|
|
59539
59521
|
address_n: addressN,
|
|
59540
59522
|
message: stripHexPrefix(messageHex),
|
|
59541
59523
|
message_version: messageVersion !== null && messageVersion !== void 0 ? messageVersion : undefined,
|
|
59542
59524
|
message_format: messageFormat !== null && messageFormat !== void 0 ? messageFormat : undefined,
|
|
59543
|
-
application_domain: applicationDomainHex
|
|
59525
|
+
application_domain: applicationDomainHex ? stripHexPrefix(applicationDomainHex) : undefined,
|
|
59526
|
+
source_fingerprint: sourceFingerprint !== null && sourceFingerprint !== void 0 ? sourceFingerprint : undefined,
|
|
59527
|
+
required_signers: normalizeRequiredSigners(requiredSigners),
|
|
59544
59528
|
};
|
|
59545
59529
|
}
|
|
59546
59530
|
getVersionRange() {
|
|
@@ -66384,11 +66368,15 @@ function isRetryableBleProtocolV2ProbeError(method, error) {
|
|
|
66384
66368
|
message.includes('did not respond to expected protocol'));
|
|
66385
66369
|
}
|
|
66386
66370
|
function isRetryableBleConnectionError(method, error) {
|
|
66387
|
-
var _a;
|
|
66371
|
+
var _a, _b;
|
|
66388
66372
|
if ((_a = method.device) === null || _a === void 0 ? void 0 : _a.wasInterruptedByUser()) {
|
|
66389
66373
|
return false;
|
|
66390
66374
|
}
|
|
66391
66375
|
const typedError = error;
|
|
66376
|
+
if ((typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.BleTimeoutError &&
|
|
66377
|
+
((_b = typedError.params) === null || _b === void 0 ? void 0 : _b.acquireDeadlineExceeded) === true) {
|
|
66378
|
+
return false;
|
|
66379
|
+
}
|
|
66392
66380
|
return ((typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.BleTimeoutError ||
|
|
66393
66381
|
(typedError === null || typedError === void 0 ? void 0 : typedError.errorCode) === hdShared.HardwareErrorCode.BleConnectedError ||
|
|
66394
66382
|
isRetryableBleProtocolV2ProbeError(method, error) ||
|
|
@@ -66401,10 +66389,11 @@ function isMissingDetectedProtocolV2Error(method, error) {
|
|
|
66401
66389
|
typeof typedError.message === 'string' &&
|
|
66402
66390
|
typedError.message.includes('Device protocol has not been detected'));
|
|
66403
66391
|
}
|
|
66404
|
-
function
|
|
66405
|
-
return (
|
|
66406
|
-
|
|
66407
|
-
|
|
66392
|
+
function isTerminalBleStaleBondError(error) {
|
|
66393
|
+
return hdShared.isBleStaleBondHardwareError(error);
|
|
66394
|
+
}
|
|
66395
|
+
function isDeviceIdentityMismatchError(error) {
|
|
66396
|
+
return ((error === null || error === void 0 ? void 0 : error.errorCode) === hdShared.HardwareErrorCode.DeviceCheckDeviceIdError);
|
|
66408
66397
|
}
|
|
66409
66398
|
const BLE_ACQUIRE_DEADLINE_MS = 60 * 1000;
|
|
66410
66399
|
function raceBleAcquire(acquirePromise, abortSignal) {
|
|
@@ -66419,7 +66408,7 @@ function raceBleAcquire(acquirePromise, abortSignal) {
|
|
|
66419
66408
|
fn();
|
|
66420
66409
|
};
|
|
66421
66410
|
const onAbort = () => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled)));
|
|
66422
|
-
const deadline = setTimeout(() => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleTimeoutError, `BLE acquire exceeded ${BLE_ACQUIRE_DEADLINE_MS}ms deadline
|
|
66411
|
+
const deadline = setTimeout(() => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleTimeoutError, `BLE acquire exceeded ${BLE_ACQUIRE_DEADLINE_MS}ms deadline`, { acquireDeadlineExceeded: true }))), BLE_ACQUIRE_DEADLINE_MS);
|
|
66423
66412
|
acquirePromise.then(value => settle(() => resolve(value)), error => settle(() => reject(error)));
|
|
66424
66413
|
if (abortSignal) {
|
|
66425
66414
|
if (abortSignal.aborted) {
|
|
@@ -66636,7 +66625,8 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
|
|
|
66636
66625
|
hdShared.HardwareErrorCode.DeviceInterruptedFromUser,
|
|
66637
66626
|
hdShared.HardwareErrorCode.CallQueueActionCancelled,
|
|
66638
66627
|
].includes(error.errorCode) ||
|
|
66639
|
-
|
|
66628
|
+
isTerminalBleStaleBondError(error) ||
|
|
66629
|
+
isDeviceIdentityMismatchError(error)) {
|
|
66640
66630
|
reject(error);
|
|
66641
66631
|
return;
|
|
66642
66632
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletSession.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/walletSession.ts"],"names":[],"mappings":"AAOA,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4B,CAAC,EAAE,OAAO,CAAC;IACvC,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;;;;;;GAkYF;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,uBAAuB,EAAE,MAAM,EAC/B,aAAa,CAAC,EAAE,OAAO;;;;;;GAOxB"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { CommonParams, Response } from '../params';
|
|
2
2
|
import type { OnboardingStatus, Success } from '@onekeyfe/hd-transport';
|
|
3
3
|
import type { DeviceRebootParams } from '../../api/protocol-v2/helpers';
|
|
4
|
+
import type { UploadPortfolioParams } from '../../api/UploadPortfolio';
|
|
4
5
|
import type { DeviceUploadWallpaperParams, DeviceUploadWallpaperResponse } from '../../api/protocol-v2/DeviceUploadWallpaper';
|
|
5
6
|
import type { DeviceUploadNftParams, DeviceUploadNftResponse } from '../../api/protocol-v2/DeviceUploadNft';
|
|
6
7
|
export type { DeviceRebootParams, RebootTypeInput } from '../../api/protocol-v2/helpers';
|
|
8
|
+
export type { UploadPortfolioParams } from '../../api/UploadPortfolio';
|
|
7
9
|
export type { DeviceUploadWallpaperParams, DeviceUploadWallpaperResponse, } from '../../api/protocol-v2/DeviceUploadWallpaper';
|
|
8
10
|
export type { DeviceUploadNftParams, DeviceUploadNftResponse, } from '../../api/protocol-v2/DeviceUploadNft';
|
|
9
11
|
export type FileInfo = {
|
|
@@ -23,10 +25,7 @@ export declare function deviceReboot(connectId: string, params: CommonParams & D
|
|
|
23
25
|
export declare function deviceGetOnboardingStatus(connectId: string, params?: CommonParams): Response<OnboardingStatus>;
|
|
24
26
|
export declare function deviceUploadWallpaper(connectId: string, params: CommonParams & DeviceUploadWallpaperParams): Response<DeviceUploadWallpaperResponse>;
|
|
25
27
|
export declare function deviceUploadNft(connectId: string, params: CommonParams & DeviceUploadNftParams): Response<DeviceUploadNftResponse>;
|
|
26
|
-
export declare function uploadPortfolio(connectId: string, params: {
|
|
27
|
-
packageBase64: string;
|
|
28
|
-
timeoutMs?: number | string;
|
|
29
|
-
}): Response<FileInfo & {
|
|
28
|
+
export declare function uploadPortfolio(connectId: string, params: UploadPortfolioParams): Response<FileInfo & {
|
|
30
29
|
portfolioUpdated: true;
|
|
31
30
|
}>;
|
|
32
31
|
//# sourceMappingURL=protocolV2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocolV2.d.ts","sourceRoot":"","sources":["../../../src/types/api/protocolV2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAG/C,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACzF,YAAY,EACV,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,6CAA6C,CAAC;AACrD,YAAY,EACV,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAI/C,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC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,CAC3C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,2BAA2B,GACjD,QAAQ,CAAC,6BAA6B,CAAC,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,qBAAqB,GAC3C,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,qBAAqB,GAC5B,QAAQ,CAAC,QAAQ,GAAG;IAAE,gBAAgB,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -10,6 +10,8 @@ export type SolSignOffchainMessageParams = {
|
|
|
10
10
|
messageVersion?: SolanaOffChainMessageVersion;
|
|
11
11
|
messageFormat?: SolanaOffChainMessageFormat;
|
|
12
12
|
applicationDomainHex?: string;
|
|
13
|
+
sourceFingerprint?: number;
|
|
14
|
+
requiredSigners?: string[];
|
|
13
15
|
};
|
|
14
16
|
export declare function solSignOffchainMessage(connectId: string, deviceId: string, params: CommonParams & SolSignOffchainMessageParams): Response<SolSignOffchainMessageResponse>;
|
|
15
17
|
//# sourceMappingURL=solSignOffchainMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solSignOffchainMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/solSignOffchainMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,MAAM,GAAG,MAAM,EA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