Skip to content

Commit

Permalink
Provide error messages as string on Provider api
Browse files Browse the repository at this point in the history
  • Loading branch information
KaffinPX committed Sep 14, 2024
1 parent 6d14406 commit 410a2eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/provider/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface AccountInfo {
networkId: string
}

export interface CustomInput {
export interface Input {
address: string
outpoint: string
index: number,
Expand All @@ -19,7 +19,7 @@ export interface CustomInput {

export interface RequestMappings {
'account': []
'transact': [[ string, string ][], string?, CustomInput[]?] // outputs, fee, inputs
'transact': [[ string, string ][], string?, Input[]?]
}

export interface Request<M extends keyof RequestMappings = keyof RequestMappings> {
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface EventMessage<M extends keyof EventMappings = keyof EventMapping
id: number
event: M
data: EventMappings[M] | false
error?: number
error?: string
}

export type Event<M extends keyof EventMappings = keyof EventMappings> = {
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/messaging/wallet/provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Provider extends EventEmitter {
id: number,
event: E,
data: EventMappings[E] | false,
error?: number
error?: string
) {
if (!this.port || !this.granted) return

Expand Down Expand Up @@ -102,7 +102,7 @@ export default class Provider extends EventEmitter {
if (transaction) {
this.submitEvent(request.id, 'transact', transaction)
} else {
this.submitEvent(request.id, 'transact', false, 0)
this.submitEvent(request.id, 'transact', false, 'User rejected the request.')
this.account.transactions.off('transaction', appendTransaction)
}
})
Expand Down

0 comments on commit 410a2eb

Please sign in to comment.