@@ -39,6 +39,7 @@ export default class BaseApp {
39
39
readonly P1_VALUES : P1_VALUESGeneric
40
40
readonly REQUIRED_PATH_LENGTHS ?: number [ ]
41
41
readonly CHUNK_SIZE : number
42
+ readonly CUSTOM_APP_ERROR_DESCRIPTION ?: Readonly < Record < LedgerError , string > >
42
43
43
44
/**
44
45
* Constructs a new BaseApp instance.
@@ -56,6 +57,7 @@ export default class BaseApp {
56
57
this . P1_VALUES = params . p1Values
57
58
this . CHUNK_SIZE = params . chunkSize
58
59
this . REQUIRED_PATH_LENGTHS = params . acceptedPathLengths
60
+ this . CUSTOM_APP_ERROR_DESCRIPTION = params . customAppErrorDescription
59
61
}
60
62
61
63
/**
@@ -125,7 +127,7 @@ export default class BaseApp {
125
127
const statusList = [ LedgerError . NoErrors , LedgerError . DataIsInvalid , LedgerError . BadKeyHandle ]
126
128
127
129
const responseBuffer = await this . transport . send ( this . CLA , ins , payloadType , p2 , chunk , statusList )
128
- const response = processResponse ( responseBuffer )
130
+ const response = processResponse ( responseBuffer , this . CUSTOM_APP_ERROR_DESCRIPTION )
129
131
130
132
return response
131
133
}
@@ -154,7 +156,7 @@ export default class BaseApp {
154
156
async getVersion ( ) : Promise < ResponseVersion > {
155
157
try {
156
158
const responseBuffer = await this . transport . send ( this . CLA , this . INS . GET_VERSION , 0 , 0 )
157
- const response = processResponse ( responseBuffer )
159
+ const response = processResponse ( responseBuffer , this . CUSTOM_APP_ERROR_DESCRIPTION )
158
160
159
161
// valid options are
160
162
// test mode: 1 byte
@@ -224,7 +226,7 @@ export default class BaseApp {
224
226
async appInfo ( ) : Promise < ResponseAppInfo > {
225
227
try {
226
228
const responseBuffer = await this . transport . send ( LEDGER_DASHBOARD_CLA , 0x01 , 0 , 0 )
227
- const response = processResponse ( responseBuffer )
229
+ const response = processResponse ( responseBuffer , this . CUSTOM_APP_ERROR_DESCRIPTION )
228
230
229
231
const formatId = response . readBytes ( 1 ) . readUInt8 ( )
230
232
@@ -264,7 +266,7 @@ export default class BaseApp {
264
266
async deviceInfo ( ) : Promise < ResponseDeviceInfo > {
265
267
try {
266
268
const responseBuffer = await this . transport . send ( 0xe0 , 0x01 , 0 , 0 , Buffer . from ( [ ] ) , [ LedgerError . NoErrors , 0x6e00 ] )
267
- const response = processResponse ( responseBuffer )
269
+ const response = processResponse ( responseBuffer , this . CUSTOM_APP_ERROR_DESCRIPTION )
268
270
269
271
const targetId = response . readBytes ( 4 ) . toString ( 'hex' )
270
272
0 commit comments