add postToWhisper

This commit is contained in:
Barry Gitarts 2018-11-23 17:38:15 -05:00
parent f06d4d62ca
commit 4daa01aaf4
1 changed files with 65 additions and 53 deletions

View File

@ -1,7 +1,6 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import translate, { translateRaw } from 'translations';
import { ISignedMessage } from 'libs/signing';
import { IFullWallet } from 'libs/wallet';
@ -31,6 +30,16 @@ const initialState: State = {
message: Principles
};
const postToWhisper = signedMessage => {
const msg = JSON.stringify(signedMessage, null, 2);
window.opener.postMessage(
{type: 'whisperMsg', msg, channel: 'mytest' },
'*'
);
}
const messagePlaceholder = translateRaw('SIGN_MSG_PLACEHOLDER');
export class SignMessage extends Component<Props, State> {
@ -100,6 +109,9 @@ export class SignMessage extends Component<Props, State> {
</CodeBlock>
</label>
</CopyToClipboard>
<button onClick={() => { postToWhisper(signedMessage) }}>
Broadcast to Status
</button>
</div>
)}
</div>