Skip to content

Commit

Permalink
fix: check for "REQNACK" response from indy ledger (#626)
Browse files Browse the repository at this point in the history
Signed-off-by: annelein <[email protected]>
  • Loading branch information
Annelein authored Feb 10, 2022
1 parent fb19ff5 commit ce66f07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/modules/ledger/IndyPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AriesFrameworkError, IndySdkError } from '../../error'
import { isIndyError } from '../../utils/indyError'

import { LedgerError } from './error/LedgerError'
import { isLedgerRejectResponse } from './ledgerUtil'
import { isLedgerRejectResponse, isLedgerReqnackResponse } from './ledgerUtil'

export interface IndyPoolConfig {
genesisPath?: string
Expand Down Expand Up @@ -122,7 +122,7 @@ export class IndyPool {
public async submitReadRequest(request: Indy.LedgerRequest) {
const response = await this.submitRequest(request)

if (isLedgerRejectResponse(response)) {
if (isLedgerRejectResponse(response) || isLedgerReqnackResponse(response)) {
throw new LedgerError(`Ledger '${this.id}' rejected read transaction request: ${response.reason}`)
}

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/modules/ledger/ledgerUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ import type * as Indy from 'indy-sdk'
export function isLedgerRejectResponse(response: Indy.LedgerResponse): response is Indy.LedgerRejectResponse {
return response.op === 'REJECT'
}

export function isLedgerReqnackResponse(response: Indy.LedgerResponse): response is Indy.LedgerReqnackResponse {
return response.op === 'REQNACK'
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2237,10 +2237,10 @@
dependencies:
"@types/node" "*"

"@types/indy-sdk-react-native@npm:@types/indy-sdk@^1.16.10", "@types/indy-sdk@^1.16.10":
version "1.16.10"
resolved "https://registry.yarnpkg.com/@types/indy-sdk/-/indy-sdk-1.16.10.tgz#cb13c0c639ce63758eecf534dc01111dc1c42633"
integrity sha512-zcSBMiDyareFHgDF/RpeWvboFTBTnHLi/+SK8pb7UL+o9WIHW6W8ZuLkinOiu58MvPlKceSjEx8dAl/+yoW2JA==
"@types/indy-sdk-react-native@npm:@types/indy-sdk@^1.16.12", "@types/indy-sdk@^1.16.12":
version "1.16.12"
resolved "https://registry.npmjs.org/@types/indy-sdk/-/indy-sdk-1.16.12.tgz#7b6ad4e4ebf11125bd77f0ef98cf727d0262c4b7"
integrity sha512-6uyHSSAoM+eKQD4XF+KohAjbkDN6D9DnriYWlGi/pLCWkd74kCcEMlm7/REqfMkAgxL52wh7Cyzir+cnIi342g==
dependencies:
buffer "^6.0.0"

Expand Down

0 comments on commit ce66f07

Please sign in to comment.