Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
test: verify scope during sign{Transaction,TypedMessage} calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ccharly committed Mar 5, 2024
1 parent f649ff8 commit fb591b0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/SnapKeyring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ describe('SnapKeyring', () => {
};
const tx = TransactionFactory.fromTxData(mockTx);
const expectedSignedTx = TransactionFactory.fromTxData(mockSignedTx);
const expectedScope = 'eip155:1';

mockSnapController.handleRequest.mockResolvedValue({
pending: false,
result: mockSignedTx,
Expand All @@ -573,7 +575,7 @@ describe('SnapKeyring', () => {
method: 'keyring_submitRequest',
params: {
id: expect.any(String),
scope: expect.any(String),
scope: expectedScope,
account: accounts[0].id,
request: {
method: 'eth_signTransaction',
Expand Down Expand Up @@ -630,6 +632,7 @@ describe('SnapKeyring', () => {
},
};

const expectedScope = 'eip155:1';
const expectedSignature =
'0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c';

Expand All @@ -653,7 +656,7 @@ describe('SnapKeyring', () => {
method: 'keyring_submitRequest',
params: {
id: expect.any(String),
scope: expect.any(String),
scope: expectedScope,
account: accounts[0].id,
request: {
method: 'eth_signTypedData_v1',
Expand Down Expand Up @@ -686,7 +689,7 @@ describe('SnapKeyring', () => {
method: 'keyring_submitRequest',
params: {
id: expect.any(String),
scope: expect.any(String),
scope: expectedScope,
account: accounts[0].id,
request: {
method: 'eth_signTypedData_v4',
Expand Down Expand Up @@ -719,7 +722,7 @@ describe('SnapKeyring', () => {
method: 'keyring_submitRequest',
params: {
id: expect.any(String),
scope: expect.any(String),
scope: expectedScope,
account: accounts[0].id,
request: {
method: 'eth_signTypedData_v1',
Expand Down

0 comments on commit fb591b0

Please sign in to comment.