@onekeyfe/hd-core 1.1.25-alpha.0 → 1.1.25
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/index.d.ts +31 -2
- package/dist/index.js +297 -22
- package/dist/types/api/stellarSignTransaction.d.ts +30 -1
- package/dist/types/api/stellarSignTransaction.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 +4 -4
- 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/types/api/stellarSignTransaction.ts +36 -1
package/dist/index.js
CHANGED
|
@@ -11770,6 +11770,13 @@ var nested$1 = {
|
|
|
11770
11770
|
rule: "required",
|
|
11771
11771
|
type: "uint32",
|
|
11772
11772
|
id: 14
|
|
11773
|
+
},
|
|
11774
|
+
soroban_data_size: {
|
|
11775
|
+
type: "uint32",
|
|
11776
|
+
id: 60,
|
|
11777
|
+
options: {
|
|
11778
|
+
"default": 0
|
|
11779
|
+
}
|
|
11773
11780
|
}
|
|
11774
11781
|
},
|
|
11775
11782
|
nested: {
|
|
@@ -12163,6 +12170,76 @@ var nested$1 = {
|
|
|
12163
12170
|
}
|
|
12164
12171
|
}
|
|
12165
12172
|
},
|
|
12173
|
+
StellarInvokeHostFunctionOp: {
|
|
12174
|
+
fields: {
|
|
12175
|
+
source_account: {
|
|
12176
|
+
type: "string",
|
|
12177
|
+
id: 1
|
|
12178
|
+
},
|
|
12179
|
+
contract_address: {
|
|
12180
|
+
rule: "required",
|
|
12181
|
+
type: "string",
|
|
12182
|
+
id: 2
|
|
12183
|
+
},
|
|
12184
|
+
function_name: {
|
|
12185
|
+
rule: "required",
|
|
12186
|
+
type: "string",
|
|
12187
|
+
id: 3
|
|
12188
|
+
},
|
|
12189
|
+
call_args_xdr_size: {
|
|
12190
|
+
rule: "required",
|
|
12191
|
+
type: "uint32",
|
|
12192
|
+
id: 4
|
|
12193
|
+
},
|
|
12194
|
+
call_args_xdr_initial_chunk: {
|
|
12195
|
+
rule: "required",
|
|
12196
|
+
type: "bytes",
|
|
12197
|
+
id: 5
|
|
12198
|
+
},
|
|
12199
|
+
soroban_auth_xdr_size: {
|
|
12200
|
+
rule: "required",
|
|
12201
|
+
type: "uint32",
|
|
12202
|
+
id: 6
|
|
12203
|
+
},
|
|
12204
|
+
soroban_auth_xdr_initial_chunk: {
|
|
12205
|
+
rule: "required",
|
|
12206
|
+
type: "bytes",
|
|
12207
|
+
id: 7
|
|
12208
|
+
}
|
|
12209
|
+
}
|
|
12210
|
+
},
|
|
12211
|
+
StellarSorobanDataRequest: {
|
|
12212
|
+
fields: {
|
|
12213
|
+
type: {
|
|
12214
|
+
rule: "required",
|
|
12215
|
+
type: "StellarRequestType",
|
|
12216
|
+
id: 1
|
|
12217
|
+
},
|
|
12218
|
+
data_length: {
|
|
12219
|
+
rule: "required",
|
|
12220
|
+
type: "uint32",
|
|
12221
|
+
id: 2
|
|
12222
|
+
}
|
|
12223
|
+
},
|
|
12224
|
+
nested: {
|
|
12225
|
+
StellarRequestType: {
|
|
12226
|
+
values: {
|
|
12227
|
+
CALL: 0,
|
|
12228
|
+
AUTH: 1,
|
|
12229
|
+
EXT: 2
|
|
12230
|
+
}
|
|
12231
|
+
}
|
|
12232
|
+
}
|
|
12233
|
+
},
|
|
12234
|
+
StellarSorobanDataAck: {
|
|
12235
|
+
fields: {
|
|
12236
|
+
data_xdr: {
|
|
12237
|
+
rule: "required",
|
|
12238
|
+
type: "bytes",
|
|
12239
|
+
id: 1
|
|
12240
|
+
}
|
|
12241
|
+
}
|
|
12242
|
+
},
|
|
12166
12243
|
StellarSignedTx: {
|
|
12167
12244
|
fields: {
|
|
12168
12245
|
public_key: {
|
|
@@ -13701,6 +13778,9 @@ var nested$1 = {
|
|
|
13701
13778
|
MessageType_StellarManageBuyOfferOp: 222,
|
|
13702
13779
|
MessageType_StellarPathPaymentStrictSendOp: 223,
|
|
13703
13780
|
MessageType_StellarSignedTx: 230,
|
|
13781
|
+
MessageType_StellarInvokeHostFunctionOp: 260,
|
|
13782
|
+
MessageType_StellarSorobanDataRequest: 261,
|
|
13783
|
+
MessageType_StellarSorobanDataAck: 262,
|
|
13704
13784
|
MessageType_CardanoGetPublicKey: 305,
|
|
13705
13785
|
MessageType_CardanoPublicKey: 306,
|
|
13706
13786
|
MessageType_CardanoGetAddress: 307,
|
|
@@ -33566,6 +33646,13 @@ const getFieldType = (typeName, types) => {
|
|
|
33566
33646
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `No type definition specified: ${typeName}`);
|
|
33567
33647
|
};
|
|
33568
33648
|
|
|
33649
|
+
const MINI_MAX_STRUCT_FIELDS = 16;
|
|
33650
|
+
const MINI_MAX_ACCESS_PATH_DEPTH = 6;
|
|
33651
|
+
const MINI_MAX_CUSTOM_DEP_STRUCTS = 8;
|
|
33652
|
+
const MINI_MAX_NAME_LENGTH = 63;
|
|
33653
|
+
const MINI_MAX_DYNAMIC_VALUE_BYTES = 1536;
|
|
33654
|
+
const MINI_MAX_ARRAY_TYPE_FIELDS = 24;
|
|
33655
|
+
const MINI_MAX_ARRAY_ELEMENTS = 24;
|
|
33569
33656
|
class EVMSignTypedData extends BaseMethod {
|
|
33570
33657
|
init() {
|
|
33571
33658
|
this.checkDeviceId = true;
|
|
@@ -33813,6 +33900,101 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
33813
33900
|
}
|
|
33814
33901
|
return false;
|
|
33815
33902
|
}
|
|
33903
|
+
hasClassicFamilyTypedDataFormatViolations(item) {
|
|
33904
|
+
if (!(item === null || item === void 0 ? void 0 : item.types) || !item.primaryType)
|
|
33905
|
+
return false;
|
|
33906
|
+
const isArrayType = (typeName) => /\[[0-9]*\]$/.test(typeName);
|
|
33907
|
+
const isBytesType = (typeName) => /^bytes(\d*)$/.test(typeName);
|
|
33908
|
+
const isStructType = (typeName) => typeName in item.types;
|
|
33909
|
+
if (Object.values(item.types).some(fields => fields.length > MINI_MAX_STRUCT_FIELDS)) {
|
|
33910
|
+
return true;
|
|
33911
|
+
}
|
|
33912
|
+
if (Object.entries(item.types).some(([typeName, fields]) => typeName.length > MINI_MAX_NAME_LENGTH ||
|
|
33913
|
+
fields.some(field => field.name.length > MINI_MAX_NAME_LENGTH))) {
|
|
33914
|
+
return true;
|
|
33915
|
+
}
|
|
33916
|
+
const totalArrayTypeFields = Object.values(item.types).reduce((count, fields) => count + fields.filter(field => isArrayType(field.type)).length, 0);
|
|
33917
|
+
if (totalArrayTypeFields > MINI_MAX_ARRAY_TYPE_FIELDS) {
|
|
33918
|
+
return true;
|
|
33919
|
+
}
|
|
33920
|
+
const getDepth = (typeName, visiting) => {
|
|
33921
|
+
if (isArrayType(typeName)) {
|
|
33922
|
+
const { entryTypeName } = parseArrayType(typeName);
|
|
33923
|
+
return 1 + getDepth(entryTypeName, visiting);
|
|
33924
|
+
}
|
|
33925
|
+
if (!isStructType(typeName))
|
|
33926
|
+
return 1;
|
|
33927
|
+
if (visiting.has(typeName))
|
|
33928
|
+
return MINI_MAX_ACCESS_PATH_DEPTH + 1;
|
|
33929
|
+
visiting.add(typeName);
|
|
33930
|
+
const depth = item.types[typeName].reduce((maxDepth, { type }) => {
|
|
33931
|
+
const nextDepth = 1 + getDepth(type, visiting);
|
|
33932
|
+
return Math.max(maxDepth, nextDepth);
|
|
33933
|
+
}, 1);
|
|
33934
|
+
visiting.delete(typeName);
|
|
33935
|
+
return depth;
|
|
33936
|
+
};
|
|
33937
|
+
const maxPathDepth = 1 +
|
|
33938
|
+
Math.max(getDepth('EIP712Domain', new Set()), getDepth(item.primaryType, new Set()));
|
|
33939
|
+
if (maxPathDepth > MINI_MAX_ACCESS_PATH_DEPTH) {
|
|
33940
|
+
return true;
|
|
33941
|
+
}
|
|
33942
|
+
const depStructs = new Set();
|
|
33943
|
+
const collectDeps = (typeName, visiting) => {
|
|
33944
|
+
if (isArrayType(typeName)) {
|
|
33945
|
+
const { entryTypeName } = parseArrayType(typeName);
|
|
33946
|
+
collectDeps(entryTypeName, visiting);
|
|
33947
|
+
return;
|
|
33948
|
+
}
|
|
33949
|
+
if (!isStructType(typeName) || visiting.has(typeName))
|
|
33950
|
+
return;
|
|
33951
|
+
visiting.add(typeName);
|
|
33952
|
+
if (typeName !== 'EIP712Domain' && typeName !== item.primaryType) {
|
|
33953
|
+
depStructs.add(typeName);
|
|
33954
|
+
}
|
|
33955
|
+
item.types[typeName].forEach(({ type }) => collectDeps(type, visiting));
|
|
33956
|
+
visiting.delete(typeName);
|
|
33957
|
+
};
|
|
33958
|
+
collectDeps('EIP712Domain', new Set());
|
|
33959
|
+
collectDeps(item.primaryType, new Set());
|
|
33960
|
+
if (depStructs.size > MINI_MAX_CUSTOM_DEP_STRUCTS) {
|
|
33961
|
+
return true;
|
|
33962
|
+
}
|
|
33963
|
+
const dynamicSize = (typeName, value) => {
|
|
33964
|
+
if (typeName === 'string') {
|
|
33965
|
+
return typeof value === 'string' ? Buffer.byteLength(value, 'utf8') : 0;
|
|
33966
|
+
}
|
|
33967
|
+
if (isBytesType(typeName) && typeof value === 'string') {
|
|
33968
|
+
const startIndex = value.startsWith('0x') ? 2 : 0;
|
|
33969
|
+
return (value.length - startIndex) / 2;
|
|
33970
|
+
}
|
|
33971
|
+
return 0;
|
|
33972
|
+
};
|
|
33973
|
+
const walkValue = (typeName, value) => {
|
|
33974
|
+
if (value == null)
|
|
33975
|
+
return false;
|
|
33976
|
+
if (isArrayType(typeName)) {
|
|
33977
|
+
if (!Array.isArray(value))
|
|
33978
|
+
return false;
|
|
33979
|
+
const { entryTypeName } = parseArrayType(typeName);
|
|
33980
|
+
const entryIsStruct = isStructType(entryTypeName);
|
|
33981
|
+
const entryIsPrimitive = !entryIsStruct && !isArrayType(entryTypeName);
|
|
33982
|
+
if (value.length > MINI_MAX_ARRAY_ELEMENTS &&
|
|
33983
|
+
(entryIsPrimitive || (this.params.metamaskV4Compat && entryIsStruct))) {
|
|
33984
|
+
return true;
|
|
33985
|
+
}
|
|
33986
|
+
return value.some(entry => walkValue(entryTypeName, entry));
|
|
33987
|
+
}
|
|
33988
|
+
if (dynamicSize(typeName, value) > MINI_MAX_DYNAMIC_VALUE_BYTES) {
|
|
33989
|
+
return true;
|
|
33990
|
+
}
|
|
33991
|
+
if (typeof value === 'object' && isStructType(typeName)) {
|
|
33992
|
+
return item.types[typeName].some(({ name, type }) => walkValue(type, value[name]));
|
|
33993
|
+
}
|
|
33994
|
+
return false;
|
|
33995
|
+
};
|
|
33996
|
+
return (walkValue('EIP712Domain', item.domain) || walkValue(item.primaryType, item.message));
|
|
33997
|
+
}
|
|
33816
33998
|
supportSignTyped() {
|
|
33817
33999
|
const deviceType = getDeviceType(this.device.features);
|
|
33818
34000
|
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
@@ -33832,7 +34014,8 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
33832
34014
|
const { addressN, chainId } = this.params;
|
|
33833
34015
|
const supportEip712OnClassic = existCapability(this.device.features, hdTransport.Enum_Capability.Capability_EthereumTypedData);
|
|
33834
34016
|
const deviceType = getDeviceType(this.device.features);
|
|
33835
|
-
if (DeviceModelToTypes.model_mini.includes(deviceType) &&
|
|
34017
|
+
if (DeviceModelToTypes.model_mini.includes(deviceType) &&
|
|
34018
|
+
(!supportEip712OnClassic || this.hasClassicFamilyTypedDataFormatViolations(this.params.data))) {
|
|
33836
34019
|
validateParams(this.params, [
|
|
33837
34020
|
{ name: 'domainHash', type: 'hexString', required: true },
|
|
33838
34021
|
{ name: 'messageHash', type: 'hexString', required: true },
|
|
@@ -34598,11 +34781,14 @@ class StellarGetAddress extends BaseMethod {
|
|
|
34598
34781
|
}
|
|
34599
34782
|
}
|
|
34600
34783
|
|
|
34784
|
+
const SOROBAN_CHUNK_BYTES = 1024;
|
|
34785
|
+
const SOROBAN_CHUNK_HEX_CHARS = SOROBAN_CHUNK_BYTES * 2;
|
|
34601
34786
|
class StellarSignTransaction extends BaseMethod {
|
|
34602
34787
|
constructor() {
|
|
34603
34788
|
super(...arguments);
|
|
34604
34789
|
this.operations = [];
|
|
34605
34790
|
this.parseOperation = (op) => {
|
|
34791
|
+
var _a, _b;
|
|
34606
34792
|
switch (op.type) {
|
|
34607
34793
|
case 'createAccount':
|
|
34608
34794
|
validateParams(op, [
|
|
@@ -34709,19 +34895,101 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
34709
34895
|
source_account: op.source,
|
|
34710
34896
|
bump_to: op.bumpTo,
|
|
34711
34897
|
};
|
|
34898
|
+
case 'invokeHostFunctionOneKey': {
|
|
34899
|
+
const callArgs = (_a = op.callArgsXDRHex) !== null && _a !== void 0 ? _a : '';
|
|
34900
|
+
const auth = (_b = op.sorobanAuthXDRHex) !== null && _b !== void 0 ? _b : '';
|
|
34901
|
+
if (!this.sorobanState) {
|
|
34902
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'sorobanState not initialized');
|
|
34903
|
+
}
|
|
34904
|
+
this.sorobanState.callArgs = callArgs;
|
|
34905
|
+
this.sorobanState.callArgsSent = Math.min(callArgs.length, SOROBAN_CHUNK_HEX_CHARS);
|
|
34906
|
+
this.sorobanState.auth = auth;
|
|
34907
|
+
this.sorobanState.authSent = Math.min(auth.length, SOROBAN_CHUNK_HEX_CHARS);
|
|
34908
|
+
return {
|
|
34909
|
+
type: 'StellarInvokeHostFunctionOp',
|
|
34910
|
+
source_account: op.source,
|
|
34911
|
+
contract_address: op.contract,
|
|
34912
|
+
function_name: op.functionName,
|
|
34913
|
+
call_args_xdr_size: callArgs.length / 2,
|
|
34914
|
+
call_args_xdr_initial_chunk: callArgs.slice(0, SOROBAN_CHUNK_HEX_CHARS),
|
|
34915
|
+
soroban_auth_xdr_size: auth.length / 2,
|
|
34916
|
+
soroban_auth_xdr_initial_chunk: auth.slice(0, SOROBAN_CHUNK_HEX_CHARS),
|
|
34917
|
+
};
|
|
34918
|
+
}
|
|
34919
|
+
case 'pathPaymentStrictReceive':
|
|
34920
|
+
validateParams(op, [{ name: 'sendMax', type: 'bigNumber', required: true }]);
|
|
34921
|
+
validateParams(op, [{ name: 'destAmount', type: 'bigNumber', required: true }]);
|
|
34922
|
+
return {
|
|
34923
|
+
type: 'StellarPathPaymentStrictReceiveOp',
|
|
34924
|
+
source_account: op.source,
|
|
34925
|
+
send_asset: op.sendAsset,
|
|
34926
|
+
send_max: op.sendMax,
|
|
34927
|
+
destination_account: op.destination,
|
|
34928
|
+
destination_asset: op.destAsset,
|
|
34929
|
+
destination_amount: op.destAmount,
|
|
34930
|
+
paths: op.path,
|
|
34931
|
+
};
|
|
34932
|
+
case 'pathPaymentStrictSend':
|
|
34933
|
+
validateParams(op, [{ name: 'sendAmount', type: 'bigNumber', required: true }]);
|
|
34934
|
+
validateParams(op, [{ name: 'destMin', type: 'bigNumber', required: true }]);
|
|
34935
|
+
return {
|
|
34936
|
+
type: 'StellarPathPaymentStrictSendOp',
|
|
34937
|
+
source_account: op.source,
|
|
34938
|
+
send_asset: op.sendAsset,
|
|
34939
|
+
send_amount: op.sendAmount,
|
|
34940
|
+
destination_account: op.destination,
|
|
34941
|
+
destination_asset: op.destAsset,
|
|
34942
|
+
destination_min: op.destMin,
|
|
34943
|
+
paths: op.path,
|
|
34944
|
+
};
|
|
34712
34945
|
default:
|
|
34713
34946
|
return {};
|
|
34714
34947
|
}
|
|
34715
34948
|
};
|
|
34716
|
-
this.processTxRequest = (operations, index) => __awaiter(this, void 0, void 0, function* () {
|
|
34717
|
-
|
|
34718
|
-
|
|
34719
|
-
|
|
34720
|
-
|
|
34721
|
-
|
|
34949
|
+
this.processTxRequest = (response, operations, index) => __awaiter(this, void 0, void 0, function* () {
|
|
34950
|
+
switch (response.type) {
|
|
34951
|
+
case 'StellarSignedTx':
|
|
34952
|
+
return response.message;
|
|
34953
|
+
case 'StellarSorobanDataRequest': {
|
|
34954
|
+
if (!this.sorobanState) {
|
|
34955
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'sorobanState not initialized');
|
|
34956
|
+
}
|
|
34957
|
+
const reqType = response.message.type;
|
|
34958
|
+
const hexLen = response.message.data_length * 2;
|
|
34959
|
+
let chunk;
|
|
34960
|
+
switch (reqType) {
|
|
34961
|
+
case 'CALL': {
|
|
34962
|
+
const { callArgs, callArgsSent } = this.sorobanState;
|
|
34963
|
+
chunk = callArgs.slice(callArgsSent, callArgsSent + hexLen);
|
|
34964
|
+
this.sorobanState.callArgsSent += chunk.length;
|
|
34965
|
+
break;
|
|
34966
|
+
}
|
|
34967
|
+
case 'AUTH': {
|
|
34968
|
+
const { auth, authSent } = this.sorobanState;
|
|
34969
|
+
chunk = auth.slice(authSent, authSent + hexLen);
|
|
34970
|
+
this.sorobanState.authSent += chunk.length;
|
|
34971
|
+
break;
|
|
34972
|
+
}
|
|
34973
|
+
case 'EXT': {
|
|
34974
|
+
const { ext, extSent } = this.sorobanState;
|
|
34975
|
+
chunk = ext.slice(extSent, extSent + hexLen);
|
|
34976
|
+
this.sorobanState.extSent += chunk.length;
|
|
34977
|
+
break;
|
|
34978
|
+
}
|
|
34979
|
+
default:
|
|
34980
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `unknown soroban request type: ${reqType}`);
|
|
34981
|
+
}
|
|
34982
|
+
const sorobanRes = yield this.device.commands.typedCall('StellarSorobanDataAck', ['StellarSorobanDataRequest', 'StellarSignedTx'], { data_xdr: chunk });
|
|
34983
|
+
return this.processTxRequest(sorobanRes, operations, index);
|
|
34984
|
+
}
|
|
34985
|
+
case 'StellarTxOpRequest': {
|
|
34986
|
+
const _a = operations[index], { type } = _a, op = __rest(_a, ["type"]);
|
|
34987
|
+
const nextRes = yield this.device.commands.typedCall(type, ['StellarTxOpRequest', 'StellarSorobanDataRequest', 'StellarSignedTx'], op);
|
|
34988
|
+
return this.processTxRequest(nextRes, operations, index + 1);
|
|
34989
|
+
}
|
|
34990
|
+
default:
|
|
34991
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `unexpected response type: ${response.type}`);
|
|
34722
34992
|
}
|
|
34723
|
-
yield this.device.commands.typedCall(type, 'StellarTxOpRequest', op);
|
|
34724
|
-
return this.processTxRequest(operations, index + 1);
|
|
34725
34993
|
});
|
|
34726
34994
|
}
|
|
34727
34995
|
init() {
|
|
@@ -34737,17 +35005,24 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
34737
35005
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'timebounds is required');
|
|
34738
35006
|
}
|
|
34739
35007
|
const addressN = validatePath(this.payload.path, 3);
|
|
34740
|
-
|
|
34741
|
-
|
|
34742
|
-
|
|
34743
|
-
|
|
34744
|
-
|
|
34745
|
-
|
|
34746
|
-
|
|
34747
|
-
|
|
34748
|
-
|
|
34749
|
-
|
|
34750
|
-
|
|
35008
|
+
const isSoroban = transaction.operations.some(op => op.type === 'invokeHostFunctionOneKey');
|
|
35009
|
+
if (isSoroban) {
|
|
35010
|
+
if (transaction.operations.length !== 1) {
|
|
35011
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Soroban transactions must contain exactly one operation');
|
|
35012
|
+
}
|
|
35013
|
+
if (!transaction.sorobanDataXDR) {
|
|
35014
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'sorobanDataXDR is required for Soroban transactions');
|
|
35015
|
+
}
|
|
35016
|
+
this.sorobanState = {
|
|
35017
|
+
callArgs: '',
|
|
35018
|
+
callArgsSent: 0,
|
|
35019
|
+
auth: '',
|
|
35020
|
+
authSent: 0,
|
|
35021
|
+
ext: transaction.sorobanDataXDR,
|
|
35022
|
+
extSent: 0,
|
|
35023
|
+
};
|
|
35024
|
+
}
|
|
35025
|
+
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
35026
|
if (transaction.memo) {
|
|
34752
35027
|
this.params.memo_type = transaction.memo.type;
|
|
34753
35028
|
this.params.memo_text = transaction.memo.text;
|
|
@@ -34763,8 +35038,8 @@ class StellarSignTransaction extends BaseMethod {
|
|
|
34763
35038
|
}
|
|
34764
35039
|
run() {
|
|
34765
35040
|
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);
|
|
35041
|
+
const response = yield this.device.commands.typedCall('StellarSignTx', 'StellarTxOpRequest', Object.assign({}, this.params));
|
|
35042
|
+
return this.processTxRequest(response, this.operations, 0);
|
|
34768
35043
|
});
|
|
34769
35044
|
}
|
|
34770
35045
|
}
|
|
@@ -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,EA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AAO,GAAG,OAAO,SAAS,CAAC;CACxC,CAAC;AAEF,KAAK,4BAA4B,GAAG;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB,CAAC;AAEF,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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