@onekeyfe/hd-core 1.1.25-alpha.1 → 1.1.26-alpha.0
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__/evmSignTypedData.test.ts +499 -0
- package/dist/api/evm/EVMSignTypedData.d.ts +1 -0
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +169 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/index.d.ts +33 -3
- package/dist/index.js +304 -23
- package/dist/types/api/stellarSignTransaction.d.ts +30 -1
- package/dist/types/api/stellarSignTransaction.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/api/evm/EVMSignTypedData.ts +151 -2
- package/src/api/stellar/StellarSignTransaction.ts +165 -11
- package/src/data/messages/messages.json +80 -0
- package/src/data-manager/TransportManager.ts +5 -1
- package/src/device/Device.ts +1 -0
- package/src/types/api/stellarSignTransaction.ts +36 -1
- package/src/types/settings.ts +2 -1
- package/src/utils/logger.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -908,6 +908,7 @@ exports.LoggerNames = void 0;
|
|
|
908
908
|
LoggerNames["HdBleTransport"] = "@onekey/hd-ble-transport";
|
|
909
909
|
LoggerNames["HdWebBleTransport"] = "@onekey/hd-web-ble-transport";
|
|
910
910
|
LoggerNames["HdTransportWebUsb"] = "@onekey/hd-transport-webusb";
|
|
911
|
+
LoggerNames["HdTransportNodeUsb"] = "@onekey/hd-transport-node-usb";
|
|
911
912
|
LoggerNames["Connect"] = "@onekey/connect";
|
|
912
913
|
LoggerNames["Iframe"] = "IFrame";
|
|
913
914
|
LoggerNames["SendMessage"] = "[SendMessage]";
|
|
@@ -927,6 +928,7 @@ const LoggerMap = {
|
|
|
927
928
|
[exports.LoggerNames.HdWebBleTransport]: initLog(exports.LoggerNames.HdWebBleTransport),
|
|
928
929
|
[exports.LoggerNames.HdTransportLowLevel]: initLog(exports.LoggerNames.HdTransportLowLevel),
|
|
929
930
|
[exports.LoggerNames.HdTransportWebUsb]: initLog(exports.LoggerNames.HdTransportWebUsb),
|
|
931
|
+
[exports.LoggerNames.HdTransportNodeUsb]: initLog(exports.LoggerNames.HdTransportNodeUsb),
|
|
930
932
|
[exports.LoggerNames.Connect]: initLog(exports.LoggerNames.Connect),
|
|
931
933
|
[exports.LoggerNames.Iframe]: initLog(exports.LoggerNames.Iframe),
|
|
932
934
|
[exports.LoggerNames.SendMessage]: initLog(exports.LoggerNames.SendMessage),
|
|
@@ -11770,6 +11772,13 @@ var nested$1 = {
|
|
|
11770
11772
|
rule: "required",
|
|
11771
11773
|
type: "uint32",
|
|
11772
11774
|
id: 14
|
|
11775
|
+
},
|
|
11776
|
+
soroban_data_size: {
|
|
11777
|
+
type: "uint32",
|
|
11778
|
+
id: 60,
|
|
11779
|
+
options: {
|
|
11780
|
+
"default": 0
|
|
11781
|
+
}
|
|
11773
11782
|
}
|
|
11774
11783
|
},
|
|
11775
11784
|
nested: {
|
|
@@ -12163,6 +12172,76 @@ var nested$1 = {
|
|
|
12163
12172
|
}
|
|
12164
12173
|
}
|
|
12165
12174
|
},
|
|
12175
|
+
StellarInvokeHostFunctionOp: {
|
|
12176
|
+
fields: {
|
|
12177
|
+
source_account: {
|
|
12178
|
+
type: "string",
|
|
12179
|
+
id: 1
|
|
12180
|
+
},
|
|
12181
|
+
contract_address: {
|
|
12182
|
+
rule: "required",
|
|
12183
|
+
type: "string",
|
|
12184
|
+
id: 2
|
|
12185
|
+
},
|
|
12186
|
+
function_name: {
|
|
12187
|
+
rule: "required",
|
|
12188
|
+
type: "string",
|
|
12189
|
+
id: 3
|
|
12190
|
+
},
|
|
12191
|
+
call_args_xdr_size: {
|
|
12192
|
+
rule: "required",
|
|
12193
|
+
type: "uint32",
|
|
12194
|
+
id: 4
|
|
12195
|
+
},
|
|
12196
|
+
call_args_xdr_initial_chunk: {
|
|
12197
|
+
rule: "required",
|
|
12198
|
+
type: "bytes",
|
|
12199
|
+
id: 5
|
|
12200
|
+
},
|
|
12201
|
+
soroban_auth_xdr_size: {
|
|
12202
|
+
rule: "required",
|
|
12203
|
+
type: "uint32",
|
|
12204
|
+
id: 6
|
|
12205
|
+
},
|
|
12206
|
+
soroban_auth_xdr_initial_chunk: {
|
|
12207
|
+
rule: "required",
|
|
12208
|
+
type: "bytes",
|
|
12209
|
+
id: 7
|
|
12210
|
+
}
|
|
12211
|
+
}
|
|
12212
|
+
},
|
|
12213
|
+
StellarSorobanDataRequest: {
|
|
12214
|
+
fields: {
|
|
12215
|
+
type: {
|
|
12216
|
+
rule: "required",
|
|
12217
|
+
type: "StellarRequestType",
|
|
12218
|
+
id: 1
|
|
12219
|
+
},
|
|
12220
|
+
data_length: {
|
|
12221
|
+
rule: "required",
|
|
12222
|
+
type: "uint32",
|
|
12223
|
+
id: 2
|
|
12224
|
+
}
|
|
12225
|
+
},
|
|
12226
|
+
nested: {
|
|
12227
|
+
StellarRequestType: {
|
|
12228
|
+
values: {
|
|
12229
|
+
CALL: 0,
|
|
12230
|
+
AUTH: 1,
|
|
12231
|
+
EXT: 2
|
|
12232
|
+
}
|
|
12233
|
+
}
|
|
12234
|
+
}
|
|
12235
|
+
},
|
|
12236
|
+
StellarSorobanDataAck: {
|
|
12237
|
+
fields: {
|
|
12238
|
+
data_xdr: {
|
|
12239
|
+
rule: "required",
|
|
12240
|
+
type: "bytes",
|
|
12241
|
+
id: 1
|
|
12242
|
+
}
|
|
12243
|
+
}
|
|
12244
|
+
},
|
|
12166
12245
|
StellarSignedTx: {
|
|
12167
12246
|
fields: {
|
|
12168
12247
|
public_key: {
|
|
@@ -13701,6 +13780,9 @@ var nested$1 = {
|
|
|
13701
13780
|
MessageType_StellarManageBuyOfferOp: 222,
|
|
13702
13781
|
MessageType_StellarPathPaymentStrictSendOp: 223,
|
|
13703
13782
|
MessageType_StellarSignedTx: 230,
|
|
13783
|
+
MessageType_StellarInvokeHostFunctionOp: 260,
|
|
13784
|
+
MessageType_StellarSorobanDataRequest: 261,
|
|
13785
|
+
MessageType_StellarSorobanDataAck: 262,
|
|
13704
13786
|
MessageType_CardanoGetPublicKey: 305,
|
|
13705
13787
|
MessageType_CardanoPublicKey: 306,
|
|
13706
13788
|
MessageType_CardanoGetAddress: 307,
|
|
@@ -26712,6 +26794,7 @@ const Log$c = getLogger(exports.LoggerNames.Transport);
|
|
|
26712
26794
|
const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
|
|
26713
26795
|
const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
|
|
26714
26796
|
const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
|
|
26797
|
+
const NodeUsbLogger = getLogger(exports.LoggerNames.HdTransportNodeUsb);
|
|
26715
26798
|
const WebBleLogger = getLogger(exports.LoggerNames.HdWebBleTransport);
|
|
26716
26799
|
const WebUsbLogger = getLogger(exports.LoggerNames.HdTransportWebUsb);
|
|
26717
26800
|
class TransportManager {
|
|
@@ -26735,9 +26818,12 @@ class TransportManager {
|
|
|
26735
26818
|
Log$c.debug('React Native Do Not Initializing transports');
|
|
26736
26819
|
}
|
|
26737
26820
|
}
|
|
26821
|
+
else if (env === 'node-usb') {
|
|
26822
|
+
yield this.transport.init(NodeUsbLogger, DevicePool.emitter);
|
|
26823
|
+
}
|
|
26738
26824
|
else if (env === 'lowlevel') {
|
|
26739
26825
|
if (!this.plugin) {
|
|
26740
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured, 'Lowlevel transport
|
|
26826
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured, 'Lowlevel transport must have plugin');
|
|
26741
26827
|
}
|
|
26742
26828
|
yield this.transport.init(LowLevelLogger, DevicePool.emitter, this.plugin);
|
|
26743
26829
|
}
|
|
@@ -33566,6 +33652,13 @@ const getFieldType = (typeName, types) => {
|
|
|
33566
33652
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `No type definition specified: ${typeName}`);
|
|
33567
33653
|
};
|
|
33568
33654
|
|
|
33655
|
+
const MINI_MAX_STRUCT_FIELDS = 16;
|
|
33656
|
+
const MINI_MAX_ACCESS_PATH_DEPTH = 6;
|
|
33657
|
+
const MINI_MAX_CUSTOM_DEP_STRUCTS = 8;
|
|
33658
|
+
const MINI_MAX_NAME_LENGTH = 63;
|
|
33659
|
+
const MINI_MAX_DYNAMIC_VALUE_BYTES = 1536;
|
|
33660
|
+
const MINI_MAX_ARRAY_TYPE_FIELDS = 24;
|
|
33661
|
+
const MINI_MAX_ARRAY_ELEMENTS = 24;
|
|
33569
33662
|
class EVMSignTypedData extends BaseMethod {
|
|
33570
33663
|
init() {
|
|
33571
33664
|
this.checkDeviceId = true;
|
|
@@ -33813,6 +33906,101 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
33813
33906
|
}
|
|
33814
33907
|
return false;
|
|
33815
33908
|
}
|
|
33909
|
+
hasClassicFamilyTypedDataFormatViolations(item) {
|
|
33910
|
+
if (!(item === null || item === void 0 ? void 0 : item.types) || !item.primaryType)
|
|
33911
|
+
return false;
|
|
33912
|
+
const isArrayType = (typeName) => /\[[0-9]*\]$/.test(typeName);
|
|
33913
|
+
const isBytesType = (typeName) => /^bytes(\d*)$/.test(typeName);
|
|
33914
|
+
const isStructType = (typeName) => typeName in item.types;
|
|
33915
|
+
if (Object.values(item.types).some(fields => fields.length > MINI_MAX_STRUCT_FIELDS)) {
|
|
33916
|
+
return true;
|
|
33917
|
+
}
|
|
33918
|
+
if (Object.entries(item.types).some(([typeName, fields]) => typeName.length > MINI_MAX_NAME_LENGTH ||
|
|
33919
|
+
fields.some(field => field.name.length > MINI_MAX_NAME_LENGTH))) {
|
|
33920
|
+
return true;
|
|
33921
|
+
}
|
|
33922
|
+
const totalArrayTypeFields = Object.values(item.types).reduce((count, fields) => count + fields.filter(field => isArrayType(field.type)).length, 0);
|
|
33923
|
+
if (totalArrayTypeFields > MINI_MAX_ARRAY_TYPE_FIELDS) {
|
|
33924
|
+
return true;
|
|
33925
|
+
}
|
|
33926
|
+
const getDepth = (typeName, visiting) => {
|
|
33927
|
+
if (isArrayType(typeName)) {
|
|
33928
|
+
const { entryTypeName } = parseArrayType(typeName);
|
|
33929
|
+
return 1 + getDepth(entryTypeName, visiting);
|
|
33930
|
+
}
|
|
33931
|
+
if (!isStructType(typeName))
|
|
33932
|
+
return 1;
|
|
33933
|
+
if (visiting.has(typeName))
|
|
33934
|
+
return MINI_MAX_ACCESS_PATH_DEPTH + 1;
|
|
33935
|
+
visiting.add(typeName);
|
|
33936
|
+
const depth = item.types[typeName].reduce((maxDepth, { type }) => {
|
|
33937
|
+
const nextDepth = 1 + getDepth(type, visiting);
|
|
33938
|
+
return Math.max(maxDepth, nextDepth);
|
|
33939
|
+
}, 1);
|
|
33940
|
+
visiting.delete(typeName);
|
|
33941
|
+
return depth;
|
|
33942
|
+
};
|
|
33943
|
+
const maxPathDepth = 1 +
|
|
33944
|
+
Math.max(getDepth('EIP712Domain', new Set()), getDepth(item.primaryType, new Set()));
|
|
33945
|
+
if (maxPathDepth > MINI_MAX_ACCESS_PATH_DEPTH) {
|
|
33946
|
+
return true;
|
|
33947
|
+
}
|
|
33948
|
+
const depStructs = new Set();
|
|
33949
|
+
const collectDeps = (typeName, visiting) => {
|
|
33950
|
+
if (isArrayType(typeName)) {
|
|
33951
|
+
const { entryTypeName } = parseArrayType(typeName);
|
|
33952
|
+
collectDeps(entryTypeName, visiting);
|
|
33953
|
+
return;
|
|
33954
|
+
}
|
|
33955
|
+
if (!isStructType(typeName) || visiting.has(typeName))
|
|
33956
|
+
return;
|
|
33957
|
+
visiting.add(typeName);
|
|
33958
|
+
if (typeName !== 'EIP712Domain' && typeName !== item.primaryType) {
|
|
33959
|
+
depStructs.add(typeName);
|
|
33960
|
+
}
|
|
33961
|
+
item.types[typeName].forEach(({ type }) => collectDeps(type, visiting));
|
|
33962
|
+
visiting.delete(typeName);
|
|
33963
|
+
};
|
|
33964
|
+
collectDeps('EIP712Domain', new Set());
|
|
33965
|
+
collectDeps(item.primaryType, new Set());
|
|
33966
|
+
if (depStructs.size > MINI_MAX_CUSTOM_DEP_STRUCTS) {
|
|
33967
|
+
return true;
|
|
33968
|
+
}
|
|
33969
|
+
const dynamicSize = (typeName, value) => {
|
|
33970
|
+
if (typeName === 'string') {
|
|
33971
|
+
return typeof value === 'string' ? Buffer.byteLength(value, 'utf8') : 0;
|
|
33972
|
+
}
|
|
33973
|
+
if (isBytesType(typeName) && typeof value === 'string') {
|
|
33974
|
+
const startIndex = value.startsWith('0x') ? 2 : 0;
|
|
33975
|
+
return (value.length - startIndex) / 2;
|
|
33976
|
+
}
|
|
33977
|
+
return 0;
|
|
33978
|
+
};
|
|
33979
|
+
const walkValue = (typeName, value) => {
|
|
33980
|
+
if (value == null)
|
|
33981
|
+
return false;
|
|
33982
|
+
if (isArrayType(typeName)) {
|
|
33983
|
+
if (!Array.isArray(value))
|
|
33984
|
+
return false;
|
|
33985
|
+
const { entryTypeName } = parseArrayType(typeName);
|
|
33986
|
+
const entryIsStruct = isStructType(entryTypeName);
|
|
33987
|
+
const entryIsPrimitive = !entryIsStruct && !isArrayType(entryTypeName);
|
|
33988
|
+
if (value.length > MINI_MAX_ARRAY_ELEMENTS &&
|
|
33989
|
+
(entryIsPrimitive || (this.params.metamaskV4Compat && entryIsStruct))) {
|
|
33990
|
+
return true;
|
|
33991
|
+
}
|
|
33992
|
+
return value.some(entry => walkValue(entryTypeName, entry));
|
|
33993
|
+
}
|
|
33994
|
+
if (dynamicSize(typeName, value) > MINI_MAX_DYNAMIC_VALUE_BYTES) {
|
|
33995
|
+
return true;
|
|
33996
|
+
}
|
|
33997
|
+
if (typeof value === 'object' && isStructType(typeName)) {
|
|
33998
|
+
return item.types[typeName].some(({ name, type }) => walkValue(type, value[name]));
|
|
33999
|
+
}
|
|
34000
|
+
return false;
|
|
34001
|
+
};
|
|
34002
|
+
return (walkValue('EIP712Domain', item.domain) || walkValue(item.primaryType, item.message));
|
|
34003
|
+
}
|
|
33816
34004
|
supportSignTyped() {
|
|
33817
34005
|
const deviceType = getDeviceType(this.device.features);
|
|
33818
34006
|
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
@@ -33832,7 +34020,8 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
33832
34020
|
const { addressN, chainId } = this.params;
|
|
33833
34021
|
const supportEip712OnClassic = existCapability(this.device.features, hdTransport.Enum_Capability.Capability_EthereumTypedData);
|
|
33834
34022
|
const deviceType = getDeviceType(this.device.features);
|
|
33835
|
-
if (DeviceModelToTypes.model_mini.includes(deviceType) &&
|
|
34023
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType) &&
|
|
34024
|
+
(!supportEip712OnClassic || this.hasClassicFamilyTypedDataFormatViolations(this.params.data))) {
|
|
33836
34025
|
validateParams(this.params, [
|
|
33837
34026
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
33838
34027
|
{ name: 'messageHash', type: 'hexString', required: true },
|
|
@@ -34598,11 +34787,14 @@ class StellarGetAddress extends BaseMethod {
|
|
|
34598
34787
|
}
|
|
34599
34788
|
}
|
|
34600
34789
|
|
|
34790
|
+
const SOROBAN_CHUNK_BYTES = 1024;
|
|
34791
|
+
const SOROBAN_CHUNK_HEX_CHARS = SOROBAN_CHUNK_BYTES * 2;
|
|
34601
34792
|
class StellarSignTransaction extends BaseMethod {
|
|
34602
34793
|
constructor() {
|
|
34603
34794
|
super(...arguments);
|
|
34604
34795
|
this.operations = [];
|
|
34605
34796
|
this.parseOperation = (op) => {
|
|
34797
|
+
var _a, _b;
|
|
34606
34798
|
switch (op.type) {
|
|
34607
34799
|
case 'createAccount':
|
|
34608
34800
|
validateParams(op, [
|
|
@@ -34709,19 +34901,101 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
34709
34901
|
source_account: op.source,
|
|
34710
34902
|
bump_to: op.bumpTo,
|
|
34711
34903
|
};
|
|
34904
|
+
case 'invokeHostFunctionOneKey': {
|
|
34905
|
+
const callArgs = (_a = op.callArgsXDRHex) !== null && _a !== void 0 ? _a : '';
|
|
34906
|
+
const auth = (_b = op.sorobanAuthXDRHex) !== null && _b !== void 0 ? _b : '';
|
|
34907
|
+
if (!this.sorobanState) {
|
|
34908
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'sorobanState not initialized');
|
|
34909
|
+
}
|
|
34910
|
+
this.sorobanState.callArgs = callArgs;
|
|
34911
|
+
this.sorobanState.callArgsSent = Math.min(callArgs.length, SOROBAN_CHUNK_HEX_CHARS);
|
|
34912
|
+
this.sorobanState.auth = auth;
|
|
34913
|
+
this.sorobanState.authSent = Math.min(auth.length, SOROBAN_CHUNK_HEX_CHARS);
|
|
34914
|
+
return {
|
|
34915
|
+
type: 'StellarInvokeHostFunctionOp',
|
|
34916
|
+
source_account: op.source,
|
|
34917
|
+
contract_address: op.contract,
|
|
34918
|
+
function_name: op.functionName,
|
|
34919
|
+
call_args_xdr_size: callArgs.length / 2,
|
|
34920
|
+
call_args_xdr_initial_chunk: callArgs.slice(0, SOROBAN_CHUNK_HEX_CHARS),
|
|
34921
|
+
soroban_auth_xdr_size: auth.length / 2,
|
|
34922
|
+
soroban_auth_xdr_initial_chunk: auth.slice(0, SOROBAN_CHUNK_HEX_CHARS),
|
|
34923
|
+
};
|
|
34924
|
+
}
|
|
34925
|
+
case 'pathPaymentStrictReceive':
|
|
34926
|
+
validateParams(op, [{ name: 'sendMax', type: 'bigNumber', required: true }]);
|
|
34927
|
+
validateParams(op, [{ name: 'destAmount', type: 'bigNumber', required: true }]);
|
|
34928
|
+
return {
|
|
34929
|
+
type: 'StellarPathPaymentStrictReceiveOp',
|
|
34930
|
+
source_account: op.source,
|
|
34931
|
+
send_asset: op.sendAsset,
|
|
34932
|
+
send_max: op.sendMax,
|
|
34933
|
+
destination_account: op.destination,
|
|
34934
|
+
destination_asset: op.destAsset,
|
|
34935
|
+
destination_amount: op.destAmount,
|
|
34936
|
+
paths: op.path,
|
|
34937
|
+
};
|
|
34938
|
+
case 'pathPaymentStrictSend':
|
|
34939
|
+
validateParams(op, [{ name: 'sendAmount', type: 'bigNumber', required: true }]);
|
|
34940
|
+
validateParams(op, [{ name: 'destMin', type: 'bigNumber', required: true }]);
|
|
34941
|
+
return {
|
|
34942
|
+
type: 'StellarPathPaymentStrictSendOp',
|
|
34943
|
+
source_account: op.source,
|
|
34944
|
+
send_asset: op.sendAsset,
|
|
34945
|
+
send_amount: op.sendAmount,
|
|
34946
|
+
destination_account: op.destination,
|
|
34947
|
+
destination_asset: op.destAsset,
|
|
34948
|
+
destination_min: op.destMin,
|
|
34949
|
+
paths: op.path,
|
|
34950
|
+
};
|
|
34712
34951
|
default:
|
|
34713
34952
|
return {};
|
|
34714
34953
|
}
|
|
34715
34954
|
};
|
|
34716
|
-
this.processTxRequest = (operations, index) => __awaiter(this, void 0, void 0, function* () {
|
|
34717
|
-
|
|
34718
|
-
|
|
34719
|
-
|
|
34720
|
-
|
|
34721
|
-
|
|
34955
|
+
this.processTxRequest = (response, operations, index) => __awaiter(this, void 0, void 0, function* () {
|
|
34956
|
+
switch (response.type) {
|
|
34957
|
+
case 'StellarSignedTx':
|
|
34958
|
+
return response.message;
|
|
34959
|
+
case 'StellarSorobanDataRequest': {
|
|
34960
|
+
if (!this.sorobanState) {
|
|
34961
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'sorobanState not initialized');
|
|
34962
|
+
}
|
|
34963
|
+
const reqType = response.message.type;
|
|
34964
|
+
const hexLen = response.message.data_length * 2;
|
|
34965
|
+
let chunk;
|
|
34966
|
+
switch (reqType) {
|
|
34967
|
+
case 'CALL': {
|
|
34968
|
+
const { callArgs, callArgsSent } = this.sorobanState;
|
|
34969
|
+
chunk = callArgs.slice(callArgsSent, callArgsSent + hexLen);
|
|
34970
|
+
this.sorobanState.callArgsSent += chunk.length;
|
|
34971
|
+
break;
|
|
34972
|
+
}
|
|
34973
|
+
case 'AUTH': {
|
|
34974
|
+
const { auth, authSent } = this.sorobanState;
|
|
34975
|
+
chunk = auth.slice(authSent, authSent + hexLen);
|
|
34976
|
+
this.sorobanState.authSent += chunk.length;
|
|
34977
|
+
break;
|
|
34978
|
+
}
|
|
34979
|
+
case 'EXT': {
|
|
34980
|
+
const { ext, extSent } = this.sorobanState;
|
|
34981
|
+
chunk = ext.slice(extSent, extSent + hexLen);
|
|
34982
|
+
this.sorobanState.extSent += chunk.length;
|
|
34983
|
+
break;
|
|
34984
|
+
}
|
|
34985
|
+
default:
|
|
34986
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `unknown soroban request type: ${reqType}`);
|
|
34987
|
+
}
|
|
34988
|
+
const sorobanRes = yield this.device.commands.typedCall('StellarSorobanDataAck', ['StellarSorobanDataRequest', 'StellarSignedTx'], { data_xdr: chunk });
|
|
34989
|
+
return this.processTxRequest(sorobanRes, operations, index);
|
|
34990
|
+
}
|
|
34991
|
+
case 'StellarTxOpRequest': {
|
|
34992
|
+
const _a = operations[index], { type } = _a, op = __rest(_a, ["type"]);
|
|
34993
|
+
const nextRes = yield this.device.commands.typedCall(type, ['StellarTxOpRequest', 'StellarSorobanDataRequest', 'StellarSignedTx'], op);
|
|
34994
|
+
return this.processTxRequest(nextRes, operations, index + 1);
|
|
34995
|
+
}
|
|
34996
|
+
default:
|
|
34997
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `unexpected response type: ${response.type}`);
|
|
34722
34998
|
}
|
|
34723
|
-
yield this.device.commands.typedCall(type, 'StellarTxOpRequest', op);
|
|
34724
|
-
return this.processTxRequest(operations, index + 1);
|
|
34725
34999
|
});
|
|
34726
35000
|
}
|
|
34727
35001
|
init() {
|
|
@@ -34737,17 +35011,24 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
34737
35011
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'timebounds is required');
|
|
34738
35012
|
}
|
|
34739
35013
|
const addressN = validatePath(this.payload.path, 3);
|
|
34740
|
-
|
|
34741
|
-
|
|
34742
|
-
|
|
34743
|
-
|
|
34744
|
-
|
|
34745
|
-
|
|
34746
|
-
|
|
34747
|
-
|
|
34748
|
-
|
|
34749
|
-
|
|
34750
|
-
|
|
35014
|
+
const isSoroban = transaction.operations.some(op => op.type === 'invokeHostFunctionOneKey');
|
|
35015
|
+
if (isSoroban) {
|
|
35016
|
+
if (transaction.operations.length !== 1) {
|
|
35017
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Soroban transactions must contain exactly one operation');
|
|
35018
|
+
}
|
|
35019
|
+
if (!transaction.sorobanDataXDR) {
|
|
35020
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'sorobanDataXDR is required for Soroban transactions');
|
|
35021
|
+
}
|
|
35022
|
+
this.sorobanState = {
|
|
35023
|
+
callArgs: '',
|
|
35024
|
+
callArgsSent: 0,
|
|
35025
|
+
auth: '',
|
|
35026
|
+
authSent: 0,
|
|
35027
|
+
ext: transaction.sorobanDataXDR,
|
|
35028
|
+
extSent: 0,
|
|
35029
|
+
};
|
|
35030
|
+
}
|
|
35031
|
+
this.params = Object.assign({ address_n: addressN, network_passphrase: networkPassphrase, source_account: transaction.source, fee: transaction.fee, sequence_number: transaction.sequence, num_operations: transaction.operations.length, memo_type: hdTransport.StellarMemoType.NONE, timebounds_start: transaction.timebounds.minTime, timebounds_end: transaction.timebounds.maxTime }, (this.sorobanState ? { soroban_data_size: this.sorobanState.ext.length / 2 } : {}));
|
|
34751
35032
|
if (transaction.memo) {
|
|
34752
35033
|
this.params.memo_type = transaction.memo.type;
|
|
34753
35034
|
this.params.memo_text = transaction.memo.text;
|
|
@@ -34763,8 +35044,8 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
34763
35044
|
}
|
|
34764
35045
|
run() {
|
|
34765
35046
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34766
|
-
yield this.device.commands.typedCall('StellarSignTx', 'StellarTxOpRequest', Object.assign({}, this.params));
|
|
34767
|
-
return this.processTxRequest(this.operations, 0);
|
|
35047
|
+
const response = yield this.device.commands.typedCall('StellarSignTx', 'StellarTxOpRequest', Object.assign({}, this.params));
|
|
35048
|
+
return this.processTxRequest(response, this.operations, 0);
|
|
34768
35049
|
});
|
|
34769
35050
|
}
|
|
34770
35051
|
}
|
|
@@ -103,7 +103,35 @@ type StellarInflationOperation = {
|
|
|
103
103
|
type: 'inflation';
|
|
104
104
|
source?: string;
|
|
105
105
|
};
|
|
106
|
-
export type
|
|
106
|
+
export type StellarPathPaymentStrictReceiveOperation = {
|
|
107
|
+
type: 'pathPaymentStrictReceive';
|
|
108
|
+
source?: string;
|
|
109
|
+
sendAsset: StellarAsset;
|
|
110
|
+
sendMax: string;
|
|
111
|
+
destination: string;
|
|
112
|
+
destAsset: StellarAsset;
|
|
113
|
+
destAmount: string;
|
|
114
|
+
path?: StellarAsset[];
|
|
115
|
+
};
|
|
116
|
+
export type StellarPathPaymentStrictSendOperation = {
|
|
117
|
+
type: 'pathPaymentStrictSend';
|
|
118
|
+
source?: string;
|
|
119
|
+
sendAsset: StellarAsset;
|
|
120
|
+
sendAmount: string;
|
|
121
|
+
destination: string;
|
|
122
|
+
destAsset: StellarAsset;
|
|
123
|
+
destMin: string;
|
|
124
|
+
path?: StellarAsset[];
|
|
125
|
+
};
|
|
126
|
+
export type StellarInvokeHostFunctionOperation = {
|
|
127
|
+
type: 'invokeHostFunctionOneKey';
|
|
128
|
+
source?: string;
|
|
129
|
+
contract: string;
|
|
130
|
+
functionName: string;
|
|
131
|
+
callArgsXDRHex: string;
|
|
132
|
+
sorobanAuthXDRHex: string;
|
|
133
|
+
};
|
|
134
|
+
export type StellarOperation = StellarCreateAccountOperation | StellarPaymentOperation | StellarPathPaymentOperation | StellarPassiveOfferOperation | StellarManageOfferOperation | StellarSetOptionsOperation | StellarChangeTrustOperation | StellarAllowTrustOperation | StellarAccountMergeOperation | StellarInflationOperation | StellarManageDataOperation | StellarBumpSequenceOperation | StellarPathPaymentStrictReceiveOperation | StellarPathPaymentStrictSendOperation | StellarInvokeHostFunctionOperation;
|
|
107
135
|
export type StellarTransaction = {
|
|
108
136
|
source: string;
|
|
109
137
|
fee: number;
|
|
@@ -119,6 +147,7 @@ export type StellarTransaction = {
|
|
|
119
147
|
hash?: string | Buffer;
|
|
120
148
|
};
|
|
121
149
|
operations: StellarOperation[];
|
|
150
|
+
sorobanDataXDR?: string;
|
|
122
151
|
};
|
|
123
152
|
export type StellarSignTransactionParams = {
|
|
124
153
|
path: string | number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stellarSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/stellarSignTransaction.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,uBA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KAAK,4BAA4B,GAAG;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,6BAA6B,GAC7B,uBAAuB,GACvB,2BAA2B,GAC3B,4BAA4B,GAC5B,2BAA2B,GAC3B,0BAA0B,GAC1B,2BAA2B,GAC3B,0BAA0B,GAC1B,4BAA4B,GAC5B,yBAAyB,GACzB,0BAA0B,GAC1B,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"stellarSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/stellarSignTransaction.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACnC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,GAAG,OAAO,SAAS,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAA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,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;IACF,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,4BAA4B,GAClD,QAAQ,CAAC,eAAe,CAAC,CAAC"}
|
package/dist/types/settings.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
2
2
|
import type { IDeviceType } from './device';
|
|
3
|
-
export type transportEnv = 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'desktop-webusb' | 'desktop-web-ble' | 'emulator' | 'lowlevel';
|
|
3
|
+
export type transportEnv = 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'desktop-webusb' | 'desktop-web-ble' | 'emulator' | 'lowlevel' | 'node-usb';
|
|
4
4
|
export type ConnectSettings = {
|
|
5
5
|
connectSrc?: string;
|
|
6
6
|
debug?: boolean;
|
|
@@ -1 +1 @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AE,MAAM,CAAC;IAEZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,EAAE;SACR,CAAC,IAAI,OAAO,GAAG,MAAM;KACvB,CAAC;CACH,CAAC;AAEF,KAAK,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAuBpD,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,YAAY,GAAG;QAEnB,QAAQ,EAAE,oBAAoB,EAAE,CAAC;QAEjC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAEvC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAEvC,iBAAiB,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAK3C,GAAG,EAAE,uBAAuB,EAAE,CAAC;KAChC;CACF,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE;QACN,OAAO,EAAE,aAAa,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE;aACR,CAAC,IAAI,OAAO,GAAG,MAAM;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare enum LoggerNames {
|
|
|
36
36
|
HdBleTransport = "@onekey/hd-ble-transport",
|
|
37
37
|
HdWebBleTransport = "@onekey/hd-web-ble-transport",
|
|
38
38
|
HdTransportWebUsb = "@onekey/hd-transport-webusb",
|
|
39
|
+
HdTransportNodeUsb = "@onekey/hd-transport-node-usb",
|
|
39
40
|
Connect = "@onekey/connect",
|
|
40
41
|
Iframe = "IFrame",
|
|
41
42
|
SendMessage = "[SendMessage]",
|
|
@@ -55,6 +56,7 @@ export declare const LoggerMap: {
|
|
|
55
56
|
"@onekey/hd-web-ble-transport": Log;
|
|
56
57
|
"@onekey/hd-transport-lowlevel": Log;
|
|
57
58
|
"@onekey/hd-transport-webusb": Log;
|
|
59
|
+
"@onekey/hd-transport-node-usb": Log;
|
|
58
60
|
"@onekey/connect": Log;
|
|
59
61
|
IFrame: Log;
|
|
60
62
|
"[SendMessage]": Log;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAMF,cAAM,GAAG;IACP,MAAM,EAAE,MAAM,CAAC;IAEf,OAAO,EAAE,OAAO,CAAC;IAEjB,QAAQ,EAAE,UAAU,EAAE,CAAC;gBAEX,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAM5C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAYxD,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IASlB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IASpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;IASnB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAQrB;AAID,eAAO,MAAM,O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