Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@wharfkit/protocol-esr",
"description": "Abstract methods useful to all ESR-based wallet plugins",
"version": "1.5.0",
"version": "2.0.0",
"homepage": "https://github.com/wharfkit/protocol-esr",
"license": "BSD-3-Clause",
"main": "lib/protocol-esr.js",
Expand Down
10 changes: 5 additions & 5 deletions src/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ export async function waitForCallback(callbackArgs, buoyWs, t): Promise<Callback

if (!callbackResponse) {
// If the promise was rejected, throw an error
throw new Error(callbackResponse.rejected)
throw new Error('Empty callback response received')
}

// Process the identity request callback payload
const payload = JSON.parse(callbackResponse) as CallbackPayload

// If the promise was rejected, throw an error
if (typeof callbackResponse.rejected === 'string') {
throw new Error(callbackResponse.rejected)
}

// Process the identity request callback payload
const payload = JSON.parse(callbackResponse) as CallbackPayload

if (payload.sa === undefined || payload.sp === undefined || payload.cid === undefined) {
throw new Error(t('error.cancelled', {default: 'The request was cancelled from Anchor.'}))
throw new Error('The request was cancelled.')
}

return payload
Expand Down
Loading