Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/external txs #850

Merged
merged 13 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@aragon/templates-tokens": "^1.2.1",
"@aragon/ui": "^0.40.1",
"@aragon/wrapper": "^5.0.0-rc.14",
"@aragon/wrapper": "^5.0.0-rc.15",
"@babel/polyfill": "^7.0.0",
"@sentry/browser": "^5.5.0",
"@ungap/event-target": "^0.1.0",
Expand Down
13 changes: 13 additions & 0 deletions src/components/SignerPanel/ActionPathsContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const RADIO_ITEM_TITLE_LENGTH = 30
class ActionPathsContent extends React.Component {
static propTypes = {
direct: PropTypes.bool.isRequired,
installed: PropTypes.bool.isRequired,
external: PropTypes.bool.isRequired,
intent: PropTypes.object.isRequired,
dao: PropTypes.string.isRequired,
onSign: PropTypes.func.isRequired,
Expand Down Expand Up @@ -173,8 +175,10 @@ class ActionPathsContent extends React.Component {
}
render() {
const {
installed,
intent,
direct,
external,
paths,
pretransaction,
signingEnabled,
Expand Down Expand Up @@ -239,6 +243,15 @@ class ActionPathsContent extends React.Component {
</Info.Action>
</div>
)}
{external && (
<div css="margin-top: 20px">
<Info.Alert title="Warning">
{installed
? `Be aware that this is an attempt to execute a transaction on another app that is installed in this organization. You may want to double check that app's functionality before proceeding.`
: `Be aware that this is an attempt to execute a transaction on an *external contract* that has not been reviewed or audited. This means that it might behave unexpectedly. Please *be sure your trust this contract* before proceeding.`}
Copy link
Contributor

@sohkai sohkai Aug 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we can't use markdown in react; let's use <strong>s here :).

</Info.Alert>
Schwartz10 marked this conversation as resolved.
Show resolved Hide resolved
</div>
)}
<SignerButton onClick={this.handleSign} disabled={!signingEnabled}>
Create transaction
</SignerButton>
Expand Down
8 changes: 7 additions & 1 deletion src/components/SignerPanel/ConfirmTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import ImpossibleContent from './ImpossibleContent'
const ConfirmTransaction = ({
direct,
intent,
installed,
external,
dao,
onClose,
onSign,
Expand All @@ -20,9 +22,11 @@ const ConfirmTransaction = ({

return possible ? (
<ActionPathsContent
intent={intent}
direct={direct}
dao={dao}
external={external}
installed={installed}
intent={intent}
onSign={onSign}
paths={paths}
pretransaction={pretransaction}
Expand All @@ -36,7 +40,9 @@ const ConfirmTransaction = ({

ConfirmTransaction.propTypes = {
direct: PropTypes.bool.isRequired,
installed: PropTypes.bool.isRequired,
intent: PropTypes.object.isRequired,
external: PropTypes.bool.isRequired,
dao: PropTypes.string,
onClose: PropTypes.func.isRequired,
onSign: PropTypes.func.isRequired,
Expand Down
10 changes: 9 additions & 1 deletion src/components/SignerPanel/SignerPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,18 @@ class SignerPanel extends React.PureComponent {
// This is a temporary method to reshape the transaction bag
// to the future format we expect from Aragon.js
stateFromTransactionBag(bag) {
const { path, transaction } = bag
const { external, path, transaction } = bag
const decoratedPaths = path.map(path => ({
...path,
name: getAppName(this.props.apps, path.to),
}))

return {
intent: (transaction && this.transactionIntent(bag)) || {},
external: !!external,
installed: this.props.apps.some(
({ proxyAddress }) => proxyAddress === transaction.to
),
directPath: decoratedPaths.length === 1,
actionPaths: decoratedPaths.length ? [decoratedPaths] : [],
pretransaction: (transaction && transaction.pretransaction) || null,
Expand Down Expand Up @@ -297,6 +301,8 @@ class SignerPanel extends React.PureComponent {
actionPaths,
pretransaction,
status,
external,
installed,
} = this.state

const isTransaction = isTxSignerStatus(status)
Expand Down Expand Up @@ -344,6 +350,8 @@ class SignerPanel extends React.PureComponent {
<ConfirmTransaction
dao={dao}
direct={directPath}
external={external}
installed={installed}
intent={intent}
onClose={this.handleSignerClose}
onSign={this.handleSign}
Expand Down