Skip to content

Commit

Permalink
feat(snap): redirect to approve requests based on the account origin url
Browse files Browse the repository at this point in the history
  • Loading branch information
Pitasi committed Apr 18, 2024
1 parent 63f116d commit ce55795
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions snap/src/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ export class WardenKeyring implements Keyring {
id,
address: options?.address?.valueOf() as string,
options: options ?? {},
methods: [
'personal_sign',
'eth_signTransaction',
'eth_signTypedData_v4',
],
methods: ['personal_sign', 'eth_signTransaction', 'eth_signTypedData_v4'],
};
this.state.accounts[id] = account;
await emitSnapKeyringEvent(snap, KeyringEvent.AccountCreated, { account });
Expand Down Expand Up @@ -78,11 +74,13 @@ export class WardenKeyring implements Keyring {
this.state.pendingRequests[request.id] = request;
await this.saveState();

const url = account.options.url?.toString() ?? 'http://localhost:5173/';

return {
pending: true,
redirect: {
message: 'Proceed in SpaceWard to approve this request',
url: 'http://localhost:5173/metamask',
url,
},
};
}
Expand Down

0 comments on commit ce55795

Please sign in to comment.