2021-02-08 17:49:49 +01:00
|
|
|
import React from 'react';
|
2021-04-28 21:53:59 +02:00
|
|
|
import testData from '../../../../.storybook/test-data';
|
2021-12-08 21:32:59 +01:00
|
|
|
import README from './README.mdx';
|
2021-02-08 17:49:49 +01:00
|
|
|
import SignatureRequest from './signature-request.component';
|
|
|
|
|
2023-04-25 12:47:12 +02:00
|
|
|
const [MOCK_PRIMARY_IDENTITY, MOCK_SECONDARY_IDENTITY] = Object.values(
|
|
|
|
testData.metamask.identities,
|
|
|
|
);
|
2021-02-08 17:49:49 +01:00
|
|
|
|
|
|
|
export default {
|
2021-12-01 20:27:57 +01:00
|
|
|
title: 'Components/App/SignatureRequest',
|
2021-12-08 21:32:59 +01:00
|
|
|
component: SignatureRequest,
|
|
|
|
parameters: {
|
|
|
|
docs: {
|
|
|
|
page: README,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
argTypes: {
|
|
|
|
txData: { control: 'object' },
|
|
|
|
fromAccount: {
|
|
|
|
table: {
|
|
|
|
address: { control: 'text' },
|
|
|
|
balance: { control: 'text' },
|
|
|
|
name: { control: 'text' },
|
|
|
|
},
|
|
|
|
},
|
2022-05-17 00:24:08 +02:00
|
|
|
hardwareWalletRequiresConnection: { control: 'boolean' },
|
2021-12-08 21:32:59 +01:00
|
|
|
isLedgerWallet: { control: 'boolean' },
|
|
|
|
clearConfirmTransaction: { action: 'Clean Confirm' },
|
|
|
|
cancel: { action: 'Cancel' },
|
|
|
|
sign: { action: 'Sign' },
|
2023-06-27 00:50:08 +02:00
|
|
|
showRejectTransactionsConfirmationModal: {
|
|
|
|
action: 'showRejectTransactionsConfirmationModal',
|
|
|
|
},
|
|
|
|
cancelAll: { action: 'cancelAll' },
|
2021-12-08 21:32:59 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DefaultStory = (args) => {
|
|
|
|
return <SignatureRequest {...args} />;
|
2021-02-08 17:49:49 +01:00
|
|
|
};
|
|
|
|
|
2021-12-08 21:32:59 +01:00
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
|
|
|
|
DefaultStory.args = {
|
|
|
|
txData: {
|
|
|
|
msgParams: {
|
|
|
|
data: JSON.stringify({
|
|
|
|
domain: {
|
|
|
|
name: 'happydapp.website',
|
|
|
|
},
|
|
|
|
message: {
|
|
|
|
string: 'haay wuurl',
|
|
|
|
number: 42,
|
|
|
|
},
|
2022-05-17 00:24:08 +02:00
|
|
|
primaryType: 'Mail',
|
|
|
|
types: {
|
|
|
|
EIP712Domain: [
|
|
|
|
{ name: 'name', type: 'string' },
|
|
|
|
{ name: 'version', type: 'string' },
|
|
|
|
{ name: 'chainId', type: 'uint256' },
|
|
|
|
{ name: 'verifyingContract', type: 'address' },
|
|
|
|
],
|
|
|
|
Group: [
|
|
|
|
{ name: 'name', type: 'string' },
|
|
|
|
{ name: 'members', type: 'Person[]' },
|
|
|
|
],
|
|
|
|
Mail: [
|
|
|
|
{ name: 'from', type: 'Person' },
|
|
|
|
{ name: 'to', type: 'Person[]' },
|
|
|
|
{ name: 'contents', type: 'string' },
|
|
|
|
],
|
|
|
|
Person: [
|
|
|
|
{ name: 'name', type: 'string' },
|
|
|
|
{ name: 'wallets', type: 'address[]' },
|
|
|
|
],
|
|
|
|
},
|
2021-12-08 21:32:59 +01:00
|
|
|
}),
|
2022-12-02 15:12:43 +01:00
|
|
|
origin: 'https://happydapp.website/',
|
2021-12-08 21:32:59 +01:00
|
|
|
},
|
|
|
|
},
|
2022-05-17 00:24:08 +02:00
|
|
|
fromAccount: MOCK_PRIMARY_IDENTITY,
|
2023-05-02 17:53:20 +02:00
|
|
|
providerConfig: { name: 'Goerli ETH' },
|
2023-04-25 12:47:12 +02:00
|
|
|
selectedAccount: MOCK_PRIMARY_IDENTITY,
|
2023-06-27 00:50:08 +02:00
|
|
|
hardwareWalletRequiresConnection: false,
|
|
|
|
currentCurrency: 'usd',
|
2023-04-25 12:47:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const AccountMismatchStory = (args) => {
|
|
|
|
return <SignatureRequest {...args} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
AccountMismatchStory.storyName = 'AccountMismatch';
|
|
|
|
|
|
|
|
AccountMismatchStory.args = {
|
|
|
|
...DefaultStory.args,
|
|
|
|
selectedAccount: MOCK_SECONDARY_IDENTITY,
|
2021-02-08 17:49:49 +01:00
|
|
|
};
|