mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
64bfe6f307
* Fix EIP-712 rendering logic * Fix tests * Fix tests and story * Fix lint * Fix import * Fix stories
75 lines
1.7 KiB
JavaScript
75 lines
1.7 KiB
JavaScript
import React from 'react';
|
|
import { sanitizeMessage } from '../../../../helpers/utils/util';
|
|
import SignatureRequestData from './signature-request-data';
|
|
|
|
export default {
|
|
title: 'Components/App/SignatureRequest/SignatureRequestData',
|
|
|
|
component: SignatureRequestData,
|
|
argTypes: {
|
|
data: { control: 'object' },
|
|
},
|
|
};
|
|
|
|
export const DefaultStory = (args) => {
|
|
return <SignatureRequestData {...args} />;
|
|
};
|
|
|
|
DefaultStory.storyName = 'Default';
|
|
|
|
const rawMessage = {
|
|
domain: {
|
|
chainId: 97,
|
|
name: 'Ether Mail',
|
|
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
version: '1',
|
|
},
|
|
message: {
|
|
contents: 'Hello, Bob!',
|
|
from: {
|
|
name: 'Cow',
|
|
wallets: [
|
|
'0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
|
'0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF',
|
|
'0x06195827297c7A80a443b6894d3BDB8824b43896',
|
|
],
|
|
},
|
|
to: [
|
|
{
|
|
name: 'Bob',
|
|
wallets: [
|
|
'0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
|
'0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57',
|
|
'0xB0B0b0b0b0b0B000000000000000000000000000',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
primaryType: 'Mail',
|
|
types: {
|
|
EIP712Domain: [
|
|
{ name: 'name', type: 'string' },
|
|
{ name: 'version', type: 'string' },
|
|
{ name: 'chainId', type: 'uint256' },
|
|
{ name: 'verifyingContract', type: 'address' },
|
|
],
|
|
Mail: [
|
|
{ name: 'from', type: 'Person' },
|
|
{ name: 'to', type: 'Person[]' },
|
|
{ name: 'contents', type: 'string' },
|
|
],
|
|
Person: [
|
|
{ name: 'name', type: 'string' },
|
|
{ name: 'wallets', type: 'address[]' },
|
|
],
|
|
},
|
|
};
|
|
|
|
DefaultStory.args = {
|
|
data: sanitizeMessage(
|
|
rawMessage.message,
|
|
rawMessage.primaryType,
|
|
rawMessage.types,
|
|
).value,
|
|
};
|