Skip to content

Commit 5974d18

Browse files
committed
feat(support error message and data): support get error message and data from the SDK
1 parent 0b1bd1e commit 5974d18

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/lib/
55
/docs/tmp.md
66
/.idea
7+
/.vscode

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@idealight-labs/anyweb-js-sdk",
33
"description": "AnyWeb JavaScript Software Development Kit",
4-
"version": "1.2.1",
4+
"version": "1.2.2",
55
"license": "LGPL-3.0",
66
"author": "[email protected]",
77
"repository": {

src/interface/provider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export interface IIframeData {
9191
type: 'event' | 'callback' | 'router' | 'default'
9292
data: unknown
9393
success?: boolean
94+
message?: string
9495
}
9596

9697
export interface IIframeEventData {

src/provider.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,11 @@ export class Provider implements IProvider {
277277
},
278278
this
279279
)
280-
} catch (e) {
280+
} catch (e: any) {
281281
throw new ProviderRpcError(
282282
ProviderErrorCode.SendTransactionError,
283-
'Error to sendTransaction: ' + e
283+
'Error to sendTransaction: ' + e.message,
284+
e.data
284285
)
285286
}
286287
case 'anyweb_importAccount':
@@ -315,6 +316,8 @@ export class Provider implements IProvider {
315316
this
316317
)
317318
case 'exit_accounts':
319+
return this.rawRequest('anyweb_revoke', params)
320+
case 'anyweb_revoke':
318321
return await callIframe(
319322
'pages/dapp/auth',
320323
{

src/utils/address.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export enum AddressType {
1111
/**
1212
* Get the type of an address.
1313
* @param address
14+
* @param logger
1415
*/
1516
export const getAddressType = (
1617
address: string,

0 commit comments

Comments
 (0)