From affefdd2ef8ee281a8f2e8c36b7dfc4fc90fd578 Mon Sep 17 00:00:00 2001 From: Pierre Bertet Date: Wed, 12 Aug 2020 20:21:44 +0100 Subject: [PATCH] Add a global .prettierrc Also runs prettier on the entire codebase, except connect-voting-disputable to not break a PR being currently opened for this directory. --- .prettierrc | 4 + examples/connect-react-intro/.prettierrc | 4 - examples/connect-react-intro/src/index.tsx | 2 +- examples/list-balances-cli/src/index.ts | 2 +- examples/nodejs/src/create-karma-template.ts | 2 +- examples/nodejs/src/create-org.ts | 2 +- examples/nodejs/src/describe-script.ts | 4 +- examples/nodejs/src/helpers.ts | 2 +- examples/nodejs/src/organization.ts | 2 +- .../nodejs/src/subscriptions-low-level.ts | 14 ++- examples/nodejs/src/subscriptions-org.ts | 2 +- examples/nodejs/src/subscriptions-tokens.ts | 2 +- examples/nodejs/src/subscriptions-voting.ts | 21 ++-- examples/nodejs/src/tokens.ts | 2 +- examples/nodejs/src/transaction-path.ts | 3 +- examples/nodejs/src/voting-low-level.ts | 7 +- examples/nodejs/src/voting.ts | 7 +- examples/org-viewer-react/src/OrgInput.tsx | 2 +- examples/org-viewer-react/src/TextButton.tsx | 2 +- .../org-viewer-react/src/generic-hooks.ts | 2 +- examples/org-viewer-web/src/App.tsx | 2 +- examples/org-viewer-web/src/TextButton.tsx | 2 +- examples/org-viewer-web/src/generic-hooks.ts | 2 +- .../src/__test__/connector/agreement.test.ts | 11 +- .../src/__test__/connector/signers.test.ts | 21 +++- .../src/__test__/connector/versions.test.ts | 40 +++++-- .../src/__test__/entities/agreement.test.ts | 55 +++++++--- packages/connect-agreement/src/connect.ts | 12 ++- .../connect-agreement/src/models/Agreement.ts | 5 +- .../connect-agreement/src/models/Signer.ts | 9 +- .../src/thegraph/connector.ts | 35 +++++- .../src/thegraph/parsers/agreement.ts | 2 +- .../src/thegraph/parsers/signers.ts | 33 +++--- .../src/thegraph/parsers/versions.ts | 5 +- packages/connect-agreement/src/types.ts | 20 +++- .../src/connections/ConnectorJson.ts | 10 +- .../connect-core/src/entities/Permission.ts | 2 +- packages/connect-core/src/entities/Role.ts | 4 +- .../src/transactions/TransactionIntent.ts | 8 +- packages/connect-core/src/utils/app.ts | 6 +- .../connect-core/src/utils/descriptions.ts | 2 +- packages/connect-core/src/utils/misc.ts | 12 +-- .../src/utils/overrides/abi/ACL.json | 2 +- .../src/utils/overrides/abi/APMRegistry.json | 2 +- .../overrides/abi/ENSSubdomainRegistrar.json | 2 +- .../overrides/abi/EVMScriptRegistry.json | 2 +- .../src/utils/overrides/abi/Kernel.json | 2 +- .../src/utils/overrides/abi/Repo.json | 2 +- .../overrides/artifacts/apm/APMRegistry.json | 54 +++++----- .../artifacts/apm/ENSSubdomainRegistrar.json | 102 ++++++++---------- .../utils/overrides/artifacts/apm/Repo.json | 42 ++++---- .../utils/overrides/artifacts/aragon/ACL.json | 80 ++++++-------- .../artifacts/aragon/EVMScriptRegistry.json | 42 +++----- .../overrides/artifacts/aragon/Kernel.json | 66 +++++------- .../src/utils/path/calculatePath.ts | 20 ++-- .../connect-core/src/utils/radspec/index.ts | 2 +- .../src/utils/radspec/postprocess.ts | 6 +- .../connect-core/src/utils/transactions.ts | 2 +- packages/connect-ethereum/src/index.ts | 12 +-- packages/connect-thegraph/src/connector.ts | 18 ++-- .../connect-tokens/src/thegraph/connector.ts | 6 +- .../src/thegraph/parsers/index.ts | 2 +- .../connect-voting/src/__test__/votes.test.ts | 17 ++- .../src/thegraph/parsers/index.ts | 2 +- 64 files changed, 472 insertions(+), 399 deletions(-) create mode 100644 .prettierrc delete mode 100644 examples/connect-react-intro/.prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..b2095be8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "semi": false, + "singleQuote": true +} diff --git a/examples/connect-react-intro/.prettierrc b/examples/connect-react-intro/.prettierrc deleted file mode 100644 index a20502b7..00000000 --- a/examples/connect-react-intro/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "all" -} diff --git a/examples/connect-react-intro/src/index.tsx b/examples/connect-react-intro/src/index.tsx index 9b1dcbd9..13e69ea1 100644 --- a/examples/connect-react-intro/src/index.tsx +++ b/examples/connect-react-intro/src/index.tsx @@ -6,7 +6,7 @@ ReactDOM.render( , - document.getElementById('root'), + document.getElementById('root') ) // Hot Module Replacement (HMR) - Remove this snippet to remove HMR. diff --git a/examples/list-balances-cli/src/index.ts b/examples/list-balances-cli/src/index.ts index c8206b82..66e28909 100644 --- a/examples/list-balances-cli/src/index.ts +++ b/examples/list-balances-cli/src/index.ts @@ -49,7 +49,7 @@ function printBalances(holders: any, tokenSymbol: string): void { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.error('') console.error(err) console.log( diff --git a/examples/nodejs/src/create-karma-template.ts b/examples/nodejs/src/create-karma-template.ts index 02625d0c..cca8f1ae 100644 --- a/examples/nodejs/src/create-karma-template.ts +++ b/examples/nodejs/src/create-karma-template.ts @@ -124,7 +124,7 @@ export async function getOrgAddress( main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' diff --git a/examples/nodejs/src/create-org.ts b/examples/nodejs/src/create-org.ts index 35136a8c..00181138 100644 --- a/examples/nodejs/src/create-org.ts +++ b/examples/nodejs/src/create-org.ts @@ -39,7 +39,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' diff --git a/examples/nodejs/src/describe-script.ts b/examples/nodejs/src/describe-script.ts index 99a33b01..94c13f9e 100644 --- a/examples/nodejs/src/describe-script.ts +++ b/examples/nodejs/src/describe-script.ts @@ -20,7 +20,7 @@ async function main() { const votes = await voting.votes() - const { script } = votes.find(vote => voteId(vote) === '#54')! + const { script } = votes.find((vote) => voteId(vote) === '#54')! const description = await describeScript(script, apps) @@ -30,7 +30,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.error('') console.error(err) console.log( diff --git a/examples/nodejs/src/helpers.ts b/examples/nodejs/src/helpers.ts index 8baffae2..fea7c078 100644 --- a/examples/nodejs/src/helpers.ts +++ b/examples/nodejs/src/helpers.ts @@ -3,7 +3,7 @@ import { ethers } from 'ethers' import { GraphQLWrapper } from '@aragon/connect-thegraph' export async function keepRunning() { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve() }, 1000000000) diff --git a/examples/nodejs/src/organization.ts b/examples/nodejs/src/organization.ts index c6e86767..172b08ec 100644 --- a/examples/nodejs/src/organization.ts +++ b/examples/nodejs/src/organization.ts @@ -40,7 +40,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' diff --git a/examples/nodejs/src/subscriptions-low-level.ts b/examples/nodejs/src/subscriptions-low-level.ts index d9038409..642fef54 100644 --- a/examples/nodejs/src/subscriptions-low-level.ts +++ b/examples/nodejs/src/subscriptions-low-level.ts @@ -4,12 +4,13 @@ import { keepRunning } from './helpers' const DAO_ADDRESS = '0x059bcfbc477c46ab39d76c05b7b40f3a42e7de3b' const VOTING_APP_ADDRESS = '0xc73e86aab9d232495399d62fc80a36ae52952b81' -const ALL_VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby' +const ALL_VOTING_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby' async function main() { console.log('\nLow-level inspection of a voting app using subscriptions:') const wrapper = new GraphQLWrapper(ALL_VOTING_SUBGRAPH_URL) - + const subscription = wrapper.subscribeToQuery( gql` subscription { @@ -25,7 +26,9 @@ async function main() { {}, (results: any) => { console.log(JSON.stringify(results.data, null, 2)) - console.log(`\nTry creating a new vote at https://rinkeby.aragon.org/#/${DAO_ADDRESS}/${VOTING_APP_ADDRESS}/`) + console.log( + `\nTry creating a new vote at https://rinkeby.aragon.org/#/${DAO_ADDRESS}/${VOTING_APP_ADDRESS}/` + ) } ) @@ -36,11 +39,12 @@ async function main() { subscription.unsubscribe() } - main() .then(() => process.exit(0)) .catch((err) => { console.log(`Error: `, err) - console.log('\nPlease report any problem to https://github.com/aragon/connect/issues') + console.log( + '\nPlease report any problem to https://github.com/aragon/connect/issues' + ) process.exit(1) }) diff --git a/examples/nodejs/src/subscriptions-org.ts b/examples/nodejs/src/subscriptions-org.ts index 45b124c4..bc1b6c3b 100644 --- a/examples/nodejs/src/subscriptions-org.ts +++ b/examples/nodejs/src/subscriptions-org.ts @@ -23,7 +23,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' diff --git a/examples/nodejs/src/subscriptions-tokens.ts b/examples/nodejs/src/subscriptions-tokens.ts index 4d5a0b36..e58d3df3 100644 --- a/examples/nodejs/src/subscriptions-tokens.ts +++ b/examples/nodejs/src/subscriptions-tokens.ts @@ -27,7 +27,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' diff --git a/examples/nodejs/src/subscriptions-voting.ts b/examples/nodejs/src/subscriptions-voting.ts index 6a039b93..65cf1530 100644 --- a/examples/nodejs/src/subscriptions-voting.ts +++ b/examples/nodejs/src/subscriptions-voting.ts @@ -3,18 +3,18 @@ import { keepRunning } from './helpers' const ORG_ADDRESS = '0x7cee20f778a53403d4fc8596e88deb694bc91c98' const VOTING_APP_ADDRESS = '0xf7f9a33ed13b01324884bd87137609251b5f7c88' -const ALL_VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby' +const ALL_VOTING_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby' async function main() { - const voting = new Voting( - VOTING_APP_ADDRESS, - ALL_VOTING_SUBGRAPH_URL - ) + const voting = new Voting(VOTING_APP_ADDRESS, ALL_VOTING_SUBGRAPH_URL) const votesSubscription = voting.onVotes((votes: Vote[]) => { console.log('\nVotes: ') votes.map(console.log) - console.log(`\nTry creating a new vote at https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/\n`) + console.log( + `\nTry creating a new vote at https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/\n` + ) }) const votes = await voting.votes() @@ -24,7 +24,9 @@ async function main() { const castsSubscription = vote1.onCasts((casts: Cast[]) => { console.log(`\nCasts:`) casts.map(console.log) - console.log(`\nTry casting a vote on https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/vote/1 (You must first mint yourself a token in the Token Manager)\n`) + console.log( + `\nTry casting a vote on https://rinkeby.aragon.org/#/${ORG_ADDRESS}/${VOTING_APP_ADDRESS}/vote/1 (You must first mint yourself a token in the Token Manager)\n` + ) }) await keepRunning() @@ -34,11 +36,12 @@ async function main() { castsSubscription.unsubscribe() } - main() .then(() => process.exit(0)) .catch((err) => { console.log(`Error: `, err) - console.log('\nPlease report any problem to https://github.com/aragon/connect/issues') + console.log( + '\nPlease report any problem to https://github.com/aragon/connect/issues' + ) process.exit(1) }) diff --git a/examples/nodejs/src/tokens.ts b/examples/nodejs/src/tokens.ts index fb0faadc..f3799060 100644 --- a/examples/nodejs/src/tokens.ts +++ b/examples/nodejs/src/tokens.ts @@ -23,7 +23,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' diff --git a/examples/nodejs/src/transaction-path.ts b/examples/nodejs/src/transaction-path.ts index 83d1bae5..47e96bb6 100644 --- a/examples/nodejs/src/transaction-path.ts +++ b/examples/nodejs/src/transaction-path.ts @@ -25,11 +25,10 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.log(`Error: `, err) console.log( '\nPlease report any problem to https://github.com/aragon/connect/issues' ) process.exit(1) }) - diff --git a/examples/nodejs/src/voting-low-level.ts b/examples/nodejs/src/voting-low-level.ts index e977838e..bd0a7d39 100644 --- a/examples/nodejs/src/voting-low-level.ts +++ b/examples/nodejs/src/voting-low-level.ts @@ -2,7 +2,8 @@ import gql from 'graphql-tag' import { GraphQLWrapper } from '@aragon/connect-thegraph' const VOTING_APP_ADDRESS = '0xc73e86aab9d232495399d62fc80a36ae52952b81' -const ALL_VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby' +const ALL_VOTING_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby' const QUERY = ` query { @@ -28,6 +29,8 @@ main() .then(() => process.exit(0)) .catch((err) => { console.log(`Error: `, err) - console.log('\nPlease report any problem to https://github.com/aragon/connect/issues') + console.log( + '\nPlease report any problem to https://github.com/aragon/connect/issues' + ) process.exit(1) }) diff --git a/examples/nodejs/src/voting.ts b/examples/nodejs/src/voting.ts index 9461ab69..871fe31a 100644 --- a/examples/nodejs/src/voting.ts +++ b/examples/nodejs/src/voting.ts @@ -43,7 +43,7 @@ function voteId(vote: Vote) { async function main() { const org = await connect(env.org, 'thegraph', { chainId: env.chainId }) const apps = await org.apps() - const votingApp = apps.find(app => app.appName === 'voting.aragonpm.eth') + const votingApp = apps.find((app) => app.appName === 'voting.aragonpm.eth') console.log('\nOrganization:', org.location, `(${org.address})`) @@ -60,7 +60,8 @@ async function main() { const votes = await voting.votes() console.log( - votes.map(vote => `\n * ${voteId(vote)} ${voteTitle(vote)}`).join('') + '\n' + votes.map((vote) => `\n * ${voteId(vote)} ${voteTitle(vote)}`).join('') + + '\n' ) if (votes.length === 0) { @@ -85,7 +86,7 @@ async function main() { main() .then(() => process.exit(0)) - .catch(err => { + .catch((err) => { console.error('') console.error(err) console.log( diff --git a/examples/org-viewer-react/src/OrgInput.tsx b/examples/org-viewer-react/src/OrgInput.tsx index 74bc8115..68fd2dba 100644 --- a/examples/org-viewer-react/src/OrgInput.tsx +++ b/examples/org-viewer-react/src/OrgInput.tsx @@ -10,7 +10,7 @@ type OrgInputProps = { } export default function OrgInput({ orgName, onChange }: OrgInputProps) { - const onInputChange = useCallback(event => { + const onInputChange = useCallback((event) => { onChange(event.target.value) }, []) diff --git a/examples/org-viewer-react/src/TextButton.tsx b/examples/org-viewer-react/src/TextButton.tsx index c2697fc3..fa9dc950 100644 --- a/examples/org-viewer-react/src/TextButton.tsx +++ b/examples/org-viewer-react/src/TextButton.tsx @@ -9,7 +9,7 @@ export default function TextButton({ ...props }) { border: 0; background: none; padding: 0; - color: #DF33A4; + color: #df33a4; cursor: pointer; &:active { transform: translateY(0.5px); diff --git a/examples/org-viewer-react/src/generic-hooks.ts b/examples/org-viewer-react/src/generic-hooks.ts index 00037a9d..63bb5008 100644 --- a/examples/org-viewer-react/src/generic-hooks.ts +++ b/examples/org-viewer-react/src/generic-hooks.ts @@ -20,7 +20,7 @@ export function useCancellableAsync( setLoading(true) asyncCall(stop) - .then(result => { + .then((result) => { if (!cancelled) { setResult(result) setLoading(false) diff --git a/examples/org-viewer-web/src/App.tsx b/examples/org-viewer-web/src/App.tsx index 33c9285f..0430bec4 100644 --- a/examples/org-viewer-web/src/App.tsx +++ b/examples/org-viewer-web/src/App.tsx @@ -88,7 +88,7 @@ export default function App() { Enter an org location: openOrg(event.target.value)} + onChange={(event) => openOrg(event.target.value)} placeholder="e.g. xyz.aragonid.eth" type="text" value={orgName} diff --git a/examples/org-viewer-web/src/TextButton.tsx b/examples/org-viewer-web/src/TextButton.tsx index c2697fc3..fa9dc950 100644 --- a/examples/org-viewer-web/src/TextButton.tsx +++ b/examples/org-viewer-web/src/TextButton.tsx @@ -9,7 +9,7 @@ export default function TextButton({ ...props }) { border: 0; background: none; padding: 0; - color: #DF33A4; + color: #df33a4; cursor: pointer; &:active { transform: translateY(0.5px); diff --git a/examples/org-viewer-web/src/generic-hooks.ts b/examples/org-viewer-web/src/generic-hooks.ts index 00037a9d..63bb5008 100644 --- a/examples/org-viewer-web/src/generic-hooks.ts +++ b/examples/org-viewer-web/src/generic-hooks.ts @@ -20,7 +20,7 @@ export function useCancellableAsync( setLoading(true) asyncCall(stop) - .then(result => { + .then((result) => { if (!cancelled) { setResult(result) setLoading(false) diff --git a/packages/connect-agreement/src/__test__/connector/agreement.test.ts b/packages/connect-agreement/src/__test__/connector/agreement.test.ts index 3f348e6f..ba260526 100644 --- a/packages/connect-agreement/src/__test__/connector/agreement.test.ts +++ b/packages/connect-agreement/src/__test__/connector/agreement.test.ts @@ -1,7 +1,8 @@ import { AgreementData } from '../../types' import { AgreementConnectorTheGraph } from '../../../src' -const AGREEMENT_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' +const AGREEMENT_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' const AGREEMENT_APP_ADDRESS = '0x40bb5003d24a0f58da03b19287e20ce2a3db9b54' describe('Agreement', () => { @@ -25,8 +26,12 @@ describe('Agreement', () => { test('returns the agreement data', () => { expect(agreement.id).toBe(AGREEMENT_APP_ADDRESS) expect(agreement.dao).toBe('0xa6e4b08981ae324f16d6be39362f6de2da22882a') - expect(agreement.stakingFactory).toBe('0x07429001eea415e967c57b8d43484233d57f8b0b') - expect(agreement.currentVersionId).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`) + expect(agreement.stakingFactory).toBe( + '0x07429001eea415e967c57b8d43484233d57f8b0b' + ) + expect(agreement.currentVersionId).toBe( + `${AGREEMENT_APP_ADDRESS}-version-3` + ) }) }) }) diff --git a/packages/connect-agreement/src/__test__/connector/signers.test.ts b/packages/connect-agreement/src/__test__/connector/signers.test.ts index 66d17719..8bdc894f 100644 --- a/packages/connect-agreement/src/__test__/connector/signers.test.ts +++ b/packages/connect-agreement/src/__test__/connector/signers.test.ts @@ -1,6 +1,7 @@ import { AgreementConnectorTheGraph, Signer, Signature } from '../../../src' -const AGREEMENT_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' +const AGREEMENT_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' const AGREEMENT_APP_ADDRESS = '0x40bb5003d24a0f58da03b19287e20ce2a3db9b54' const SIGNER_ADDRESS = '0x0090aed150056316e37fe6dfa10dc63e79d173b6' @@ -19,11 +20,15 @@ describe('Agreement signers', () => { let signer: Signer beforeAll(async () => { - signer = await connector.signer(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`) + signer = await connector.signer( + `${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}` + ) }) test('allows fetching signer information', async () => { - expect(signer.id).toBe(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`) + expect(signer.id).toBe( + `${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}` + ) expect(signer.address).toBe(SIGNER_ADDRESS) expect(signer.agreementId).toBe(AGREEMENT_APP_ADDRESS) }) @@ -33,14 +38,20 @@ describe('Agreement signers', () => { let signatures: Signature[] beforeAll(async () => { - signatures = await connector.signatures(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`, 1000, 0) + signatures = await connector.signatures( + `${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`, + 1000, + 0 + ) }) test('allows fetching signer information', async () => { expect(signatures.length).toBeGreaterThan(1) const lastSignature = signatures[signatures.length - 1] - expect(lastSignature.signerId).toBe(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`) + expect(lastSignature.signerId).toBe( + `${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}` + ) expect(lastSignature.versionId).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`) expect(lastSignature.createdAt).toBe('1596201298') }) diff --git a/packages/connect-agreement/src/__test__/connector/versions.test.ts b/packages/connect-agreement/src/__test__/connector/versions.test.ts index 4aebaaf1..66287ec8 100644 --- a/packages/connect-agreement/src/__test__/connector/versions.test.ts +++ b/packages/connect-agreement/src/__test__/connector/versions.test.ts @@ -1,6 +1,7 @@ import { AgreementConnectorTheGraph, Version } from '../../../src' -const AGREEMENT_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' +const AGREEMENT_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' const AGREEMENT_APP_ADDRESS = '0x40bb5003d24a0f58da03b19287e20ce2a3db9b54' describe('Agreement versions', () => { @@ -25,9 +26,15 @@ describe('Agreement versions', () => { expect(version.id).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`) expect(version.versionId).toBe('3') expect(version.title).toBe('Agreement Test v3') - expect(version.content).toEqual('0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a') - expect(version.arbitrator).toBe('0x52180af656a1923024d1accf1d827ab85ce48878') - expect(version.appFeesCashier).toBe('0x0000000000000000000000000000000000000000') + expect(version.content).toEqual( + '0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a' + ) + expect(version.arbitrator).toBe( + '0x52180af656a1923024d1accf1d827ab85ce48878' + ) + expect(version.appFeesCashier).toBe( + '0x0000000000000000000000000000000000000000' + ) expect(version.effectiveFrom).toBe('1596201178') }) }) @@ -43,9 +50,15 @@ describe('Agreement versions', () => { expect(version.id).toBe(`${AGREEMENT_APP_ADDRESS}-version-2`) expect(version.versionId).toBe('2') expect(version.title).toBe('Agreement Test') - expect(version.content).toEqual('0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a') - expect(version.arbitrator).toBe('0x52180af656a1923024d1accf1d827ab85ce48878') - expect(version.appFeesCashier).toBe('0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4') + expect(version.content).toEqual( + '0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a' + ) + expect(version.arbitrator).toBe( + '0x52180af656a1923024d1accf1d827ab85ce48878' + ) + expect(version.appFeesCashier).toBe( + '0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4' + ) expect(version.effectiveFrom).toBe('1596198238') }) }) @@ -65,11 +78,16 @@ describe('Agreement versions', () => { const version = versions[0] expect(version.title).toBe('Agreement Test') - expect(version.content).toEqual('0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a') - expect(version.arbitrator).toBe('0x28d0807903c5591c570173502d8507a65be64edb') - expect(version.appFeesCashier).toBe('0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4') + expect(version.content).toEqual( + '0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a' + ) + expect(version.arbitrator).toBe( + '0x28d0807903c5591c570173502d8507a65be64edb' + ) + expect(version.appFeesCashier).toBe( + '0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4' + ) expect(version.effectiveFrom).toBe('1596140953') }) }) }) - diff --git a/packages/connect-agreement/src/__test__/entities/agreement.test.ts b/packages/connect-agreement/src/__test__/entities/agreement.test.ts index 46f9bcfd..eb2c814d 100644 --- a/packages/connect-agreement/src/__test__/entities/agreement.test.ts +++ b/packages/connect-agreement/src/__test__/entities/agreement.test.ts @@ -1,6 +1,7 @@ import { Agreement, Signer, AgreementConnectorTheGraph } from '../../../src' -const AGREEMENT_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' +const AGREEMENT_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/facuspagnuolo/aragon-agreement-rinkeby-staging' const AGREEMENT_APP_ADDRESS = '0x40bb5003d24a0f58da03b19287e20ce2a3db9b54' describe('Agreement', () => { @@ -21,11 +22,15 @@ describe('Agreement', () => { }) test('has a staking factory', async () => { - expect(await agreement.stakingFactory()).toBe('0x07429001eea415e967c57b8d43484233d57f8b0b') + expect(await agreement.stakingFactory()).toBe( + '0x07429001eea415e967c57b8d43484233d57f8b0b' + ) }) test('belongs to a DAO', async () => { - expect(await agreement.dao()).toBe('0xa6e4b08981ae324f16d6be39362f6de2da22882a') + expect(await agreement.dao()).toBe( + '0xa6e4b08981ae324f16d6be39362f6de2da22882a' + ) }) }) @@ -36,9 +41,15 @@ describe('Agreement', () => { expect(version.id).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`) expect(version.versionId).toBe('3') expect(version.title).toBe('Agreement Test v3') - expect(version.content).toEqual('0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a') - expect(version.arbitrator).toBe('0x52180af656a1923024d1accf1d827ab85ce48878') - expect(version.appFeesCashier).toBe('0x0000000000000000000000000000000000000000') + expect(version.content).toEqual( + '0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a' + ) + expect(version.arbitrator).toBe( + '0x52180af656a1923024d1accf1d827ab85ce48878' + ) + expect(version.appFeesCashier).toBe( + '0x0000000000000000000000000000000000000000' + ) expect(version.effectiveFrom).toBe('1596201178') }) @@ -48,9 +59,15 @@ describe('Agreement', () => { expect(version.id).toBe(`${AGREEMENT_APP_ADDRESS}-version-2`) expect(version.versionId).toBe('2') expect(version.title).toBe('Agreement Test') - expect(version.content).toEqual('0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a') - expect(version.arbitrator).toBe('0x52180af656a1923024d1accf1d827ab85ce48878') - expect(version.appFeesCashier).toBe('0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4') + expect(version.content).toEqual( + '0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a' + ) + expect(version.arbitrator).toBe( + '0x52180af656a1923024d1accf1d827ab85ce48878' + ) + expect(version.appFeesCashier).toBe( + '0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4' + ) expect(version.effectiveFrom).toBe('1596198238') }) @@ -60,9 +77,15 @@ describe('Agreement', () => { const version = versions[0] expect(version.title).toBe('Agreement Test') - expect(version.content).toEqual('0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a') - expect(version.arbitrator).toBe('0x28d0807903c5591c570173502d8507a65be64edb') - expect(version.appFeesCashier).toBe('0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4') + expect(version.content).toEqual( + '0x697066733a516d644c7533585854397555597871444b5858735459473737714e594e5062687a4c32375a5954396b457271635a' + ) + expect(version.arbitrator).toBe( + '0x28d0807903c5591c570173502d8507a65be64edb' + ) + expect(version.appFeesCashier).toBe( + '0xa52fd5bf794c1e8b44ee7db7f277ad31c1c8afb4' + ) expect(version.effectiveFrom).toBe('1596140953') }) }) @@ -76,7 +99,9 @@ describe('Agreement', () => { }) test('allows querying a particular signer', async () => { - expect(signer.id).toBe(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`) + expect(signer.id).toBe( + `${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}` + ) expect(signer.address).toBe(SIGNER_ADDRESS) expect(signer.agreementId).toBe(AGREEMENT_APP_ADDRESS) }) @@ -91,7 +116,9 @@ describe('Agreement', () => { expect(signatures.length).toBeGreaterThan(1) const lastSignature = signatures[signatures.length - 1] - expect(lastSignature.signerId).toBe(`${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}`) + expect(lastSignature.signerId).toBe( + `${AGREEMENT_APP_ADDRESS}-signer-${SIGNER_ADDRESS}` + ) expect(lastSignature.versionId).toBe(`${AGREEMENT_APP_ADDRESS}-version-3`) expect(lastSignature.createdAt).toBe('1596201298') }) diff --git a/packages/connect-agreement/src/connect.ts b/packages/connect-agreement/src/connect.ts index 0dc2386d..2438d8e7 100644 --- a/packages/connect-agreement/src/connect.ts +++ b/packages/connect-agreement/src/connect.ts @@ -1,7 +1,9 @@ import { createAppConnector } from '@aragon/connect-core' import Agreement from './models/Agreement' -import AgreementConnectorTheGraph, { subgraphUrlFromChainId } from './thegraph/connector' +import AgreementConnectorTheGraph, { + subgraphUrlFromChainId, +} from './thegraph/connector' type Config = { subgraphUrl: string @@ -15,8 +17,12 @@ export default createAppConnector( ) } - const subgraphUrl = config.subgraphUrl ?? subgraphUrlFromChainId(network.chainId) - const agreementConnector = new AgreementConnectorTheGraph(subgraphUrl, verbose) + const subgraphUrl = + config.subgraphUrl ?? subgraphUrlFromChainId(network.chainId) + const agreementConnector = new AgreementConnectorTheGraph( + subgraphUrl, + verbose + ) return new Agreement(agreementConnector, app.address) } ) diff --git a/packages/connect-agreement/src/models/Agreement.ts b/packages/connect-agreement/src/models/Agreement.ts index 8f8b88f2..29f0b228 100644 --- a/packages/connect-agreement/src/models/Agreement.ts +++ b/packages/connect-agreement/src/models/Agreement.ts @@ -56,7 +56,10 @@ export default class Agreement { return this.#connector.versions(this.#address, first, skip) } - onVersions({ first = 1000, skip = 0 } = {}, callback: Function): SubscriptionHandler { + onVersions( + { first = 1000, skip = 0 } = {}, + callback: Function + ): SubscriptionHandler { return this.#connector.onVersions(this.#address, first, skip, callback) } diff --git a/packages/connect-agreement/src/models/Signer.ts b/packages/connect-agreement/src/models/Signer.ts index c2bb3e7f..a975117c 100644 --- a/packages/connect-agreement/src/models/Signer.ts +++ b/packages/connect-agreement/src/models/Signer.ts @@ -25,14 +25,19 @@ export default class Signer { async hasSigned(versionNumber: string): Promise { const versionId = `${this.agreementId}-version-${versionNumber}` const signatures = await this.signatures() - return signatures.some((signature: Signature) => signature.versionId === versionId) + return signatures.some( + (signature: Signature) => signature.versionId === versionId + ) } async signatures({ first = 1000, skip = 0 } = {}): Promise { return this.#connector.signatures(this.id, first, skip) } - onSignatures({ first = 1000, skip = 0 } = {}, callback: Function): SubscriptionHandler { + onSignatures( + { first = 1000, skip = 0 } = {}, + callback: Function + ): SubscriptionHandler { return this.#connector.onSignatures(this.id, first, skip, callback) } } diff --git a/packages/connect-agreement/src/thegraph/connector.ts b/packages/connect-agreement/src/thegraph/connector.ts index ddeab540..a34f681b 100644 --- a/packages/connect-agreement/src/thegraph/connector.ts +++ b/packages/connect-agreement/src/thegraph/connector.ts @@ -6,7 +6,14 @@ import Signer from '../models/Signer' import Signature from '../models/Signature' import Version from '../models/Version' import { AgreementData, IAgreementConnector } from '../types' -import { parseAgreement, parseSigner, parseSignatures, parseCurrentVersion, parseVersions, parseVersion } from './parsers' +import { + parseAgreement, + parseSigner, + parseSignatures, + parseCurrentVersion, + parseVersions, + parseVersion, +} from './parsers' export function subgraphUrlFromChainId(chainId: number) { if (chainId === 1) { @@ -88,7 +95,11 @@ export default class AgreementConnectorTheGraph implements IAgreementConnector { ) } - async versions(agreement: string, first: number, skip: number): Promise { + async versions( + agreement: string, + first: number, + skip: number + ): Promise { return this.#gql.performQueryWithParser( queries.ALL_VERSIONS('query'), { agreement, first, skip }, @@ -96,7 +107,12 @@ export default class AgreementConnectorTheGraph implements IAgreementConnector { ) } - onVersions(agreement: string, first: number, skip: number, callback: Function): SubscriptionHandler { + onVersions( + agreement: string, + first: number, + skip: number, + callback: Function + ): SubscriptionHandler { return this.#gql.subscribeToQueryWithParser( queries.ALL_VERSIONS('subscription'), { agreement, first, skip }, @@ -122,7 +138,11 @@ export default class AgreementConnectorTheGraph implements IAgreementConnector { ) } - async signatures(signerId: string, first: number, skip: number): Promise { + async signatures( + signerId: string, + first: number, + skip: number + ): Promise { return this.#gql.performQueryWithParser( queries.GET_SIGNATURES('query'), { signerId, first, skip }, @@ -130,7 +150,12 @@ export default class AgreementConnectorTheGraph implements IAgreementConnector { ) } - onSignatures(signerId: string, first: number, skip: number, callback: Function): SubscriptionHandler { + onSignatures( + signerId: string, + first: number, + skip: number, + callback: Function + ): SubscriptionHandler { return this.#gql.subscribeToQueryWithParser( queries.GET_SIGNATURES('query'), { signerId, first, skip }, diff --git a/packages/connect-agreement/src/thegraph/parsers/agreement.ts b/packages/connect-agreement/src/thegraph/parsers/agreement.ts index 60bd3ced..41166a62 100644 --- a/packages/connect-agreement/src/thegraph/parsers/agreement.ts +++ b/packages/connect-agreement/src/thegraph/parsers/agreement.ts @@ -13,6 +13,6 @@ export function parseAgreement(result: QueryResult): AgreementData { id: agreement.id, dao: agreement.dao, stakingFactory: agreement.stakingFactory, - currentVersionId: agreement.currentVersion.id + currentVersionId: agreement.currentVersion.id, } } diff --git a/packages/connect-agreement/src/thegraph/parsers/signers.ts b/packages/connect-agreement/src/thegraph/parsers/signers.ts index 371b0263..2294b924 100644 --- a/packages/connect-agreement/src/thegraph/parsers/signers.ts +++ b/packages/connect-agreement/src/thegraph/parsers/signers.ts @@ -10,14 +10,20 @@ export function parseSigner(result: QueryResult, connector: any): Signer { throw new Error('Unable to parse signer.') } - return new Signer({ - id: signer.id, - address: signer.address, - agreementId: signer.agreement.id - }, connector) + return new Signer( + { + id: signer.id, + address: signer.address, + agreementId: signer.agreement.id, + }, + connector + ) } -export function parseSignatures(result: QueryResult, connector: any): Signature[] { +export function parseSignatures( + result: QueryResult, + connector: any +): Signature[] { const signatures = result.data.signatures if (!signatures) { @@ -25,11 +31,14 @@ export function parseSignatures(result: QueryResult, connector: any): Signature[ } return signatures.map((data: any) => { - return new Signature({ - id: data.id, - signerId: data.signer.id, - versionId: data.version.id, - createdAt: data.createdAt - }, connector) + return new Signature( + { + id: data.id, + signerId: data.signer.id, + versionId: data.version.id, + createdAt: data.createdAt, + }, + connector + ) }) } diff --git a/packages/connect-agreement/src/thegraph/parsers/versions.ts b/packages/connect-agreement/src/thegraph/parsers/versions.ts index 272d36ec..ab2f5a7b 100644 --- a/packages/connect-agreement/src/thegraph/parsers/versions.ts +++ b/packages/connect-agreement/src/thegraph/parsers/versions.ts @@ -3,7 +3,10 @@ import { QueryResult } from '@aragon/connect-thegraph' import { VersionData } from '../../types' import Version from '../../models/Version' -export function parseCurrentVersion(result: QueryResult, connector: any): Version { +export function parseCurrentVersion( + result: QueryResult, + connector: any +): Version { const agreement = result.data.agreement if (!agreement || !agreement.currentVersion) { diff --git a/packages/connect-agreement/src/types.ts b/packages/connect-agreement/src/types.ts index 7ac510c6..5961604a 100644 --- a/packages/connect-agreement/src/types.ts +++ b/packages/connect-agreement/src/types.ts @@ -43,9 +43,23 @@ export interface IAgreementConnector { version(versionId: string): Promise onVersion(versionId: string, callback: Function): SubscriptionHandler versions(agreement: string, first: number, skip: number): Promise - onVersions(agreement: string, first: number, skip: number, callback: Function): SubscriptionHandler + onVersions( + agreement: string, + first: number, + skip: number, + callback: Function + ): SubscriptionHandler signer(signerId: string): Promise onSigner(signerId: string, callback: Function): SubscriptionHandler - signatures(signerId: string, first: number, skip: number): Promise - onSignatures(signerId: string, first: number, skip: number, callback: Function): SubscriptionHandler + signatures( + signerId: string, + first: number, + skip: number + ): Promise + onSignatures( + signerId: string, + first: number, + skip: number, + callback: Function + ): SubscriptionHandler } diff --git a/packages/connect-core/src/connections/ConnectorJson.ts b/packages/connect-core/src/connections/ConnectorJson.ts index a838a2cd..95ff5a04 100644 --- a/packages/connect-core/src/connections/ConnectorJson.ts +++ b/packages/connect-core/src/connections/ConnectorJson.ts @@ -58,13 +58,13 @@ class ConnectorJson implements IOrganizationConnector { } appForOrg(organization: Organization): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve() }) } appsForOrg(organization: Organization): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve([]) }) } @@ -90,13 +90,13 @@ class ConnectorJson implements IOrganizationConnector { } repoForApp(organization: Organization, appAddress: string): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve() }) } appByAddress(organization: Organization, appAddress: string): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve() }) } @@ -105,7 +105,7 @@ class ConnectorJson implements IOrganizationConnector { organization: Organization, appAddress: string ): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve([]) }) } diff --git a/packages/connect-core/src/entities/Permission.ts b/packages/connect-core/src/entities/Permission.ts index 1742848e..7e6a73e7 100644 --- a/packages/connect-core/src/entities/Permission.ts +++ b/packages/connect-core/src/entities/Permission.ts @@ -48,6 +48,6 @@ export default class Permission implements PermissionData { this.#organization, this.appAddress ) - return roles.find(role => role.hash === this.roleHash) + return roles.find((role) => role.hash === this.roleHash) } } diff --git a/packages/connect-core/src/entities/Role.ts b/packages/connect-core/src/entities/Role.ts index 592eb5b6..21737b62 100644 --- a/packages/connect-core/src/entities/Role.ts +++ b/packages/connect-core/src/entities/Role.ts @@ -25,7 +25,7 @@ export default class Role { constructor(data: RoleData, metadata: Metadata, organization: Organization) { const { roles } = metadata[0] as AragonArtifact - const role = roles?.find(role => role.bytes === data.hash) + const role = roles?.find((role) => role.bytes === data.hash) this.appAddress = data.appAddress this.description = role?.name @@ -34,7 +34,7 @@ export default class Role { this.name = role?.id this.params = role?.params this.permissions = data.grantees?.map( - grantee => new Permission(grantee, organization) + (grantee) => new Permission(grantee, organization) ) } diff --git a/packages/connect-core/src/transactions/TransactionIntent.ts b/packages/connect-core/src/transactions/TransactionIntent.ts index b3660bef..42365989 100644 --- a/packages/connect-core/src/transactions/TransactionIntent.ts +++ b/packages/connect-core/src/transactions/TransactionIntent.ts @@ -59,12 +59,12 @@ export default class TransactionIntent { ) return new TransactionPath({ - apps: apps.filter(app => + apps: apps.filter((app) => path - .map(transaction => transaction.to) - .some(address => address === app.address) + .map((transaction) => transaction.to) + .some((address) => address === app.address) ), - destination: apps.find(app => app.address == this.contractAddress)!, + destination: apps.find((app) => app.address == this.contractAddress)!, forwardingFeePretransaction, transactions: describedPath, }) diff --git a/packages/connect-core/src/utils/app.ts b/packages/connect-core/src/utils/app.ts index 46cad4e1..efc2bf61 100644 --- a/packages/connect-core/src/utils/app.ts +++ b/packages/connect-core/src/utils/app.ts @@ -27,7 +27,7 @@ export function validateMethod( } // Find the relevant method information - const method = methods.find(method => + const method = methods.find((method) => isFullMethodSignature(methodSignature) ? method.sig === methodSignature : // If the full signature isn't given, just select the first overload declared @@ -65,7 +65,7 @@ export function findAppMethodFromIntent( let method // First try to find the method in the current functions if (Array.isArray(intents)) { - method = intents.find(method => checkMethodSignature(method.sig)) + method = intents.find((method) => checkMethodSignature(method.sig)) } if (!method) { @@ -78,7 +78,7 @@ export function findAppMethodFromIntent( const allDeprecatedFunctions = ([] as AppIntent[]).concat( ...deprecatedFunctionsFromVersions ) - method = allDeprecatedFunctions.find(method => + method = allDeprecatedFunctions.find((method) => checkMethodSignature(method.sig) ) } diff --git a/packages/connect-core/src/utils/descriptions.ts b/packages/connect-core/src/utils/descriptions.ts index cf3c747e..0a88c23e 100644 --- a/packages/connect-core/src/utils/descriptions.ts +++ b/packages/connect-core/src/utils/descriptions.ts @@ -61,7 +61,7 @@ export async function describeTransactionPath( provider?: ethers.providers.Provider ): Promise { return Promise.all( - path.map(step => describeTransaction(step, apps, provider)) + path.map((step) => describeTransaction(step, apps, provider)) ) } diff --git a/packages/connect-core/src/utils/misc.ts b/packages/connect-core/src/utils/misc.ts index 597f5519..91a9eaf0 100644 --- a/packages/connect-core/src/utils/misc.ts +++ b/packages/connect-core/src/utils/misc.ts @@ -6,16 +6,16 @@ export function toArrayEntry(value: T | T[]): T[] { } export function networkFromChainId(chainId: number): Network | null { - return NETWORKS.find(network => network.chainId === chainId) || null + return NETWORKS.find((network) => network.chainId === chainId) || null } export function networkFromName(name: string): Network | null { - return NETWORKS.find(network => network.name === name) || null + return NETWORKS.find((network) => network.name === name) || null } export function ensAddressFromChainId(chainId: number): Address | null { return ( - NETWORKS.find(network => network.chainId === chainId)?.ensAddress || null + NETWORKS.find((network) => network.chainId === chainId)?.ensAddress || null ) } @@ -28,7 +28,7 @@ export function toNetwork(value: Networkish): Network { throw new Error( `Network: invalid chainId provided: ${value}. ` + `Please use one of the following: ${NETWORKS.map( - network => network.name + (network) => network.name ).join(', ')}.` ) } @@ -41,7 +41,7 @@ export function toNetwork(value: Networkish): Network { throw new Error( `Network: invalid name provided: ${value}. ` + `Please use one of the following: ${NETWORKS.map( - network => network.chainId + (network) => network.chainId ).join(', ')}.` ) } @@ -66,7 +66,7 @@ export function toNetwork(value: Networkish): Network { throw new Error( `Network: no ensAddress provided. ` + `Please set one, or use one of the following chainId: ${NETWORKS.map( - network => network.name + (network) => network.name ).join(', ')}.` ) } diff --git a/packages/connect-core/src/utils/overrides/abi/ACL.json b/packages/connect-core/src/utils/overrides/abi/ACL.json index 5fb44047..774e25be 100644 --- a/packages/connect-core/src/utils/overrides/abi/ACL.json +++ b/packages/connect-core/src/utils/overrides/abi/ACL.json @@ -772,4 +772,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/packages/connect-core/src/utils/overrides/abi/APMRegistry.json b/packages/connect-core/src/utils/overrides/abi/APMRegistry.json index d4fe142d..74651a9b 100644 --- a/packages/connect-core/src/utils/overrides/abi/APMRegistry.json +++ b/packages/connect-core/src/utils/overrides/abi/APMRegistry.json @@ -485,4 +485,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/packages/connect-core/src/utils/overrides/abi/ENSSubdomainRegistrar.json b/packages/connect-core/src/utils/overrides/abi/ENSSubdomainRegistrar.json index 9e53bb33..6047ecc9 100644 --- a/packages/connect-core/src/utils/overrides/abi/ENSSubdomainRegistrar.json +++ b/packages/connect-core/src/utils/overrides/abi/ENSSubdomainRegistrar.json @@ -423,4 +423,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/packages/connect-core/src/utils/overrides/abi/EVMScriptRegistry.json b/packages/connect-core/src/utils/overrides/abi/EVMScriptRegistry.json index ca6467a6..3c17914a 100644 --- a/packages/connect-core/src/utils/overrides/abi/EVMScriptRegistry.json +++ b/packages/connect-core/src/utils/overrides/abi/EVMScriptRegistry.json @@ -387,4 +387,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/packages/connect-core/src/utils/overrides/abi/Kernel.json b/packages/connect-core/src/utils/overrides/abi/Kernel.json index b0dd9baa..4c9ffdee 100644 --- a/packages/connect-core/src/utils/overrides/abi/Kernel.json +++ b/packages/connect-core/src/utils/overrides/abi/Kernel.json @@ -618,4 +618,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/packages/connect-core/src/utils/overrides/abi/Repo.json b/packages/connect-core/src/utils/overrides/abi/Repo.json index 14a7c59a..d0cb920a 100644 --- a/packages/connect-core/src/utils/overrides/abi/Repo.json +++ b/packages/connect-core/src/utils/overrides/abi/Repo.json @@ -429,4 +429,4 @@ "type": "function" } ] -} \ No newline at end of file +} diff --git a/packages/connect-core/src/utils/overrides/artifacts/apm/APMRegistry.json b/packages/connect-core/src/utils/overrides/artifacts/apm/APMRegistry.json index c780bf6f..c06e2cdf 100644 --- a/packages/connect-core/src/utils/overrides/artifacts/apm/APMRegistry.json +++ b/packages/connect-core/src/utils/overrides/artifacts/apm/APMRegistry.json @@ -1,32 +1,28 @@ { "appName": "apm-registry.aragonpm.eth", - "roles": [ - { - "id": "CREATE_REPO_ROLE", - "bytes": "0x2a9494d64846c9fdbf0158785aa330d8bc9caf45af27fa0e8898eb4d55adcea6", - "name": "Create repos", - "params": [] - } - ], - "functions": [ - { - "sig": "initialize(address)", - "roles": [], - "notice": "Initialize this APMRegistry instance and set `_registrar` as the ENS subdomain registrar" - }, - { - "sig": "newRepo(string,address)", - "roles": [ - "CREATE_REPO_ROLE" - ], - "notice": "Create new repo in registry with `_name`" - }, - { - "sig": "newRepoWithVersion(string,address,uint16[3],address,bytes)", - "roles": [ - "CREATE_REPO_ROLE" - ], - "notice": "Create new repo in registry with `_name` and publish a first version with contract `_contractAddress` and content `@fromHex(_contentURI)`" - } - ] + "roles": [ + { + "id": "CREATE_REPO_ROLE", + "bytes": "0x2a9494d64846c9fdbf0158785aa330d8bc9caf45af27fa0e8898eb4d55adcea6", + "name": "Create repos", + "params": [] + } + ], + "functions": [ + { + "sig": "initialize(address)", + "roles": [], + "notice": "Initialize this APMRegistry instance and set `_registrar` as the ENS subdomain registrar" + }, + { + "sig": "newRepo(string,address)", + "roles": ["CREATE_REPO_ROLE"], + "notice": "Create new repo in registry with `_name`" + }, + { + "sig": "newRepoWithVersion(string,address,uint16[3],address,bytes)", + "roles": ["CREATE_REPO_ROLE"], + "notice": "Create new repo in registry with `_name` and publish a first version with contract `_contractAddress` and content `@fromHex(_contentURI)`" + } + ] } diff --git a/packages/connect-core/src/utils/overrides/artifacts/apm/ENSSubdomainRegistrar.json b/packages/connect-core/src/utils/overrides/artifacts/apm/ENSSubdomainRegistrar.json index 1a4bb0da..6088ee4b 100644 --- a/packages/connect-core/src/utils/overrides/artifacts/apm/ENSSubdomainRegistrar.json +++ b/packages/connect-core/src/utils/overrides/artifacts/apm/ENSSubdomainRegistrar.json @@ -1,58 +1,50 @@ { "appName": "apm-enssub.aragonpm.eth", - "roles": [ - { - "id": "CREATE_NAME_ROLE", - "bytes": "0xf86bc2abe0919ab91ef714b2bec7c148d94f61fdb069b91a6cfe9ecdee1799ba", - "name": "Create subdomains", - "params": [] - }, - { - "id": "DELETE_NAME_ROLE", - "bytes": "0x03d74c8724218ad4a99859bcb2d846d39999449fd18013dd8d69096627e68622", - "name": "Remove subdomains", - "params": [] - }, - { - "id": "POINT_ROOTNODE_ROLE", - "bytes": "0x9ecd0e7bddb2e241c41b595a436c4ea4fd33c9fa0caa8056acf084fc3aa3bfbe", - "name": "Point root domain", - "params": [] - } - ], - "functions": [ - { - "sig": "initialize(address,bytes32)", - "roles": [], - "notice": "Initialize this ENSSubdomainRegistrar instance with `_ens` as the root ENS registry and `_rootNode` as the node to allocate subdomains under" - }, - { - "sig": "createName(bytes32,address)", - "roles": [ - "CREATE_NAME_ROLE" - ], - "notice": "Create a new ENS subdomain record for `_label` and assign ownership to `_owner`" - }, - { - "sig": "createNameAndPoint(bytes32,address)", - "roles": [ - "CREATE_NAME_ROLE" - ], - "notice": "Create a new ENS subdomain record for `_label` that resolves to `_target` and is owned by this ENSSubdomainRegistrar" - }, - { - "sig": "deleteName(bytes32)", - "roles": [ - "DELETE_NAME_ROLE" - ], - "notice": "Deregister ENS subdomain record for `_label`" - }, - { - "sig": "pointRootNode(address)", - "roles": [ - "POINT_ROOTNODE_ROLE" - ], - "notice": "Resolve this ENSSubdomainRegistrar's root node to `_target`" - } - ] + "roles": [ + { + "id": "CREATE_NAME_ROLE", + "bytes": "0xf86bc2abe0919ab91ef714b2bec7c148d94f61fdb069b91a6cfe9ecdee1799ba", + "name": "Create subdomains", + "params": [] + }, + { + "id": "DELETE_NAME_ROLE", + "bytes": "0x03d74c8724218ad4a99859bcb2d846d39999449fd18013dd8d69096627e68622", + "name": "Remove subdomains", + "params": [] + }, + { + "id": "POINT_ROOTNODE_ROLE", + "bytes": "0x9ecd0e7bddb2e241c41b595a436c4ea4fd33c9fa0caa8056acf084fc3aa3bfbe", + "name": "Point root domain", + "params": [] + } + ], + "functions": [ + { + "sig": "initialize(address,bytes32)", + "roles": [], + "notice": "Initialize this ENSSubdomainRegistrar instance with `_ens` as the root ENS registry and `_rootNode` as the node to allocate subdomains under" + }, + { + "sig": "createName(bytes32,address)", + "roles": ["CREATE_NAME_ROLE"], + "notice": "Create a new ENS subdomain record for `_label` and assign ownership to `_owner`" + }, + { + "sig": "createNameAndPoint(bytes32,address)", + "roles": ["CREATE_NAME_ROLE"], + "notice": "Create a new ENS subdomain record for `_label` that resolves to `_target` and is owned by this ENSSubdomainRegistrar" + }, + { + "sig": "deleteName(bytes32)", + "roles": ["DELETE_NAME_ROLE"], + "notice": "Deregister ENS subdomain record for `_label`" + }, + { + "sig": "pointRootNode(address)", + "roles": ["POINT_ROOTNODE_ROLE"], + "notice": "Resolve this ENSSubdomainRegistrar's root node to `_target`" + } + ] } diff --git a/packages/connect-core/src/utils/overrides/artifacts/apm/Repo.json b/packages/connect-core/src/utils/overrides/artifacts/apm/Repo.json index b3eda31e..98a89f3d 100644 --- a/packages/connect-core/src/utils/overrides/artifacts/apm/Repo.json +++ b/packages/connect-core/src/utils/overrides/artifacts/apm/Repo.json @@ -1,25 +1,23 @@ { "appName": "apm-repo.aragonpm.eth", - "roles": [ - { - "id": "CREATE_VERSION_ROLE", - "bytes": "0x1f56cfecd3595a2e6cc1a7e6cb0b20df84cdbd92eff2fee554e70e4e45a9a7d8", - "name": "Publish versions", - "params": [] - } - ], - "functions": [ - { - "sig": "initialize()", - "roles": [], - "notice": "Initialize this Repo" - }, - { - "sig": "newVersion(uint16[3],address,bytes)", - "roles": [ - "CREATE_VERSION_ROLE" - ], - "notice": "Create new version with contract `_contractAddress` and content `@fromHex(_contentURI)`" - } - ] + "roles": [ + { + "id": "CREATE_VERSION_ROLE", + "bytes": "0x1f56cfecd3595a2e6cc1a7e6cb0b20df84cdbd92eff2fee554e70e4e45a9a7d8", + "name": "Publish versions", + "params": [] + } + ], + "functions": [ + { + "sig": "initialize()", + "roles": [], + "notice": "Initialize this Repo" + }, + { + "sig": "newVersion(uint16[3],address,bytes)", + "roles": ["CREATE_VERSION_ROLE"], + "notice": "Create new version with contract `_contractAddress` and content `@fromHex(_contentURI)`" + } + ] } diff --git a/packages/connect-core/src/utils/overrides/artifacts/aragon/ACL.json b/packages/connect-core/src/utils/overrides/artifacts/aragon/ACL.json index 16610da4..c09fc44f 100644 --- a/packages/connect-core/src/utils/overrides/artifacts/aragon/ACL.json +++ b/packages/connect-core/src/utils/overrides/artifacts/aragon/ACL.json @@ -9,74 +9,54 @@ ], "functions": [ { - "sig":"initialize(address)", - "roles":[ - - ], - "notice":"Initializes an ACL instance and sets `_permissionsCreator` as the entity that can create other permissions" + "sig": "initialize(address)", + "roles": [], + "notice": "Initializes an ACL instance and sets `_permissionsCreator` as the entity that can create other permissions" }, { - "sig":"createPermission(address,address,bytes32,address)", - "roles":[ - "CREATE_PERMISSIONS_ROLE" - ], - "notice":"Create a new permission granting `_entity` the ability to perform actions of role `_role` on `_app` (setting `_manager` as the permission manager)" + "sig": "createPermission(address,address,bytes32,address)", + "roles": ["CREATE_PERMISSIONS_ROLE"], + "notice": "Create a new permission granting `_entity` the ability to perform actions of role `_role` on `_app` (setting `_manager` as the permission manager)" }, { - "sig":"grantPermission(address,address,bytes32)", - "roles":[ - - ], - "notice":"Grants `_entity` the ability to perform actions of role `_role` on `_app`" + "sig": "grantPermission(address,address,bytes32)", + "roles": [], + "notice": "Grants `_entity` the ability to perform actions of role `_role` on `_app`" }, { - "sig":"grantPermissionP(address,address,bytes32,uint256[])", - "roles":[ - - ], - "notice":"Grants `_entity` the ability to perform actions of role `_role` on `_app`" + "sig": "grantPermissionP(address,address,bytes32,uint256[])", + "roles": [], + "notice": "Grants `_entity` the ability to perform actions of role `_role` on `_app`" }, { - "sig":"revokePermission(address,address,bytes32)", - "roles":[ - - ], - "notice":"Revokes `_entity` the ability to perform actions of role `_role` on `_app`" + "sig": "revokePermission(address,address,bytes32)", + "roles": [], + "notice": "Revokes `_entity` the ability to perform actions of role `_role` on `_app`" }, { - "sig":"setPermissionManager(address,address,bytes32)", - "roles":[ - - ], - "notice":"Sets `_newManager` as the manager of the permission `_role` in `_app`" + "sig": "setPermissionManager(address,address,bytes32)", + "roles": [], + "notice": "Sets `_newManager` as the manager of the permission `_role` in `_app`" }, { - "sig":"removePermissionManager(address,bytes32)", - "roles":[ - - ], - "notice":"Removes the manager of the permission `_role` in `_app`" + "sig": "removePermissionManager(address,bytes32)", + "roles": [], + "notice": "Removes the manager of the permission `_role` in `_app`" }, { - "sig":"getPermissionParam(address,address,address)", - "roles":[ - - ], - "notice":"Get parameter for permission" + "sig": "getPermissionParam(address,address,address)", + "roles": [], + "notice": "Get parameter for permission" }, { - "sig":"_evalLogic(address,bytes32,address,address,bytes32,uint256[])", - "roles":[ - - ], - "notice":null + "sig": "_evalLogic(address,bytes32,address,address,bytes32,uint256[])", + "roles": [], + "notice": null }, { - "sig":"transferToVault(address)", - "roles":[ - - ], - "notice":"Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them." + "sig": "transferToVault(address)", + "roles": [], + "notice": "Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them." } ] } diff --git a/packages/connect-core/src/utils/overrides/artifacts/aragon/EVMScriptRegistry.json b/packages/connect-core/src/utils/overrides/artifacts/aragon/EVMScriptRegistry.json index 109510bc..f1528258 100644 --- a/packages/connect-core/src/utils/overrides/artifacts/aragon/EVMScriptRegistry.json +++ b/packages/connect-core/src/utils/overrides/artifacts/aragon/EVMScriptRegistry.json @@ -14,39 +14,29 @@ ], "functions": [ { - "sig":"initialize()", - "roles":[ - - ], - "notice":"Initialize the registry" + "sig": "initialize()", + "roles": [], + "notice": "Initialize the registry" }, { - "sig":"addScriptExecutor(address)", - "roles":[ - "REGISTRY_ADD_EXECUTOR_ROLE" - ], - "notice":"Add a new script executor with address `_executor` to the registry" + "sig": "addScriptExecutor(address)", + "roles": ["REGISTRY_ADD_EXECUTOR_ROLE"], + "notice": "Add a new script executor with address `_executor` to the registry" }, { - "sig":"disableScriptExecutor(uint256)", - "roles":[ - "REGISTRY_MANAGER_ROLE" - ], - "notice":"Disable script executor with ID `_executorId`" + "sig": "disableScriptExecutor(uint256)", + "roles": ["REGISTRY_MANAGER_ROLE"], + "notice": "Disable script executor with ID `_executorId`" }, { - "sig":"enableScriptExecutor(uint256)", - "roles":[ - "REGISTRY_MANAGER_ROLE" - ], - "notice":"Enable script executor with ID `_executorId`" + "sig": "enableScriptExecutor(uint256)", + "roles": ["REGISTRY_MANAGER_ROLE"], + "notice": "Enable script executor with ID `_executorId`" }, { - "sig":"transferToVault(address)", - "roles":[ - - ], - "notice":"Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them." - } + "sig": "transferToVault(address)", + "roles": [], + "notice": "Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them." + } ] } diff --git a/packages/connect-core/src/utils/overrides/artifacts/aragon/Kernel.json b/packages/connect-core/src/utils/overrides/artifacts/aragon/Kernel.json index 979187b2..f8a3d4f6 100644 --- a/packages/connect-core/src/utils/overrides/artifacts/aragon/Kernel.json +++ b/packages/connect-core/src/utils/overrides/artifacts/aragon/Kernel.json @@ -14,60 +14,44 @@ ], "functions": [ { - "sig":"initialize(address,address)", - "roles":[ - - ], - "notice":"Initializes a kernel instance along with its ACL and sets `_permissionsCreator` as the entity that can create other permissions" + "sig": "initialize(address,address)", + "roles": [], + "notice": "Initializes a kernel instance along with its ACL and sets `_permissionsCreator` as the entity that can create other permissions" }, { - "sig":"newAppInstance(bytes32,address)", - "roles":[ - "APP_MANAGER_ROLE" - ], - "notice":"Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`" + "sig": "newAppInstance(bytes32,address)", + "roles": ["APP_MANAGER_ROLE"], + "notice": "Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`" }, { - "sig":"newAppInstance(bytes32,address,bytes,bool)", - "roles":[ - "APP_MANAGER_ROLE" - ], - "notice":"Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`" + "sig": "newAppInstance(bytes32,address,bytes,bool)", + "roles": ["APP_MANAGER_ROLE"], + "notice": "Create a new upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`" }, { - "sig":"newPinnedAppInstance(bytes32,address)", - "roles":[ - "APP_MANAGER_ROLE" - ], - "notice":"Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`." + "sig": "newPinnedAppInstance(bytes32,address)", + "roles": ["APP_MANAGER_ROLE"], + "notice": "Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`." }, { - "sig":"newPinnedAppInstance(bytes32,address,bytes,bool)", - "roles":[ - "APP_MANAGER_ROLE" - ], - "notice":"Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`" + "sig": "newPinnedAppInstance(bytes32,address,bytes,bool)", + "roles": ["APP_MANAGER_ROLE"], + "notice": "Create a new non-upgradeable instance of `_appId` app linked to the Kernel, setting its code to `_appBase`. `_setDefault ? 'Also sets it as the default app instance.':''`" }, { - "sig":"setApp(bytes32,bytes32,address)", - "roles":[ - "APP_MANAGER_ROLE" - ], - "notice":"Set the resolving address of `_appId` in namespace `_namespace` to `_app`" + "sig": "setApp(bytes32,bytes32,address)", + "roles": ["APP_MANAGER_ROLE"], + "notice": "Set the resolving address of `_appId` in namespace `_namespace` to `_app`" }, { - "sig":"setRecoveryVaultAppId(bytes32)", - "roles":[ - "APP_MANAGER_ROLE" - ], - "notice":null + "sig": "setRecoveryVaultAppId(bytes32)", + "roles": ["APP_MANAGER_ROLE"], + "notice": null }, { - "sig":"transferToVault(address)", - "roles":[ - - ], - "notice":"Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them." - } + "sig": "transferToVault(address)", + "roles": [], + "notice": "Send funds to recovery Vault. This contract should never receive funds, but in case it does, this function allows one to recover them." + } ] } diff --git a/packages/connect-core/src/utils/path/calculatePath.ts b/packages/connect-core/src/utils/path/calculatePath.ts index f1aa8348..d5ad871e 100644 --- a/packages/connect-core/src/utils/path/calculatePath.ts +++ b/packages/connect-core/src/utils/path/calculatePath.ts @@ -29,7 +29,7 @@ function validateMethod( } // Find the relevant method information - const method = methods.find(method => + const method = methods.find((method) => isFullMethodSignature(methodSignature) ? method.sig === methodSignature : // If the full signature isn't given, just select the first overload declared @@ -89,7 +89,7 @@ async function calculateForwardingPath( // Get a list of all forwarders (excluding the forwarders with direct permission) const filterForwarders = forwarders.filter( - forwarder => !includesAddress(forwardersWithPermission, forwarder) + (forwarder) => !includesAddress(forwardersWithPermission, forwarder) ) // Set up the path finding queue @@ -97,7 +97,7 @@ async function calculateForwardingPath( // In other words: it is an array of tuples, where the first index of the tuple // is the current path and the second index of the tuple is the // queue (a list of unexplored forwarder addresses) for that path - const queue: any = forwardersWithPermission.map(forwarderWithPermission => { + const queue: any = forwardersWithPermission.map((forwarderWithPermission) => { // TODO: Fix types (type queue = [DirectTransaction[], string[]][]) return [ [ @@ -161,7 +161,7 @@ async function calculateForwardingPath( // Avoid including the current forwarder as a candidate for the next step // in the path. Note that this is naive and may result in repeating cycles, // but the maximum path length would prevent against infinite loops - forwarders.filter(nextForwarder => nextForwarder !== forwarder), + forwarders.filter((nextForwarder) => nextForwarder !== forwarder), ]) } } @@ -189,7 +189,7 @@ export async function calculateTransactionPath( finalForwarder?: string //Address of the final forwarder that can perfom the action. Needed for actions that aren't in the ACL but whose execution depends on other factors ): Promise { // Get the destination app - const destinationApp = apps.find(app => app.address == destination) + const destinationApp = apps.find((app) => app.address == destination) if (!destinationApp) { throw new Error( `Transaction path destination (${destination}) is not an installed app` @@ -227,8 +227,8 @@ export async function calculateTransactionPath( // Failing this, attempt transaction pathing algorithm with forwarders const forwarders = apps - .filter(app => app.isForwarder === true) - .map(app => app.address) + .filter((app) => app.isForwarder === true) + .map((app) => app.address) let forwardersWithPermission: string[] = [] if (finalForwarderProvided) { @@ -246,10 +246,10 @@ export async function calculateTransactionPath( } else { // Find entities with the required permissions const role = (await destinationApp.roles()).find( - role => role.name === method.roles[0] + (role) => role.name === method.roles[0] ) const allowedEntities = - role?.permissions?.map(permission => permission.granteeAddress) || [] + role?.permissions?.map((permission) => permission.granteeAddress) || [] // No one has access, so of course we don't as well if (allowedEntities.length === 0) { @@ -271,7 +271,7 @@ export async function calculateTransactionPath( } // Find forwarders with permission to perform the action - forwardersWithPermission = forwarders.filter(forwarder => + forwardersWithPermission = forwarders.filter((forwarder) => includesAddress(allowedEntities, forwarder) ) } diff --git a/packages/connect-core/src/utils/radspec/index.ts b/packages/connect-core/src/utils/radspec/index.ts index 7b1ab9f8..ca2c1cff 100644 --- a/packages/connect-core/src/utils/radspec/index.ts +++ b/packages/connect-core/src/utils/radspec/index.ts @@ -20,7 +20,7 @@ export async function tryEvaluatingRadspec( apps: App[], provider?: ethers.providers.Provider // Decorated intent with description, if one could be made ): Promise { - const app = apps.find(app => addressesEqual(app.address, intent.to)) + const app = apps.find((app) => addressesEqual(app.address, intent.to)) // If the intent matches an installed app, use only that app to search for a // method match, otherwise fallback to searching all installed apps diff --git a/packages/connect-core/src/utils/radspec/postprocess.ts b/packages/connect-core/src/utils/radspec/postprocess.ts index bf1025f7..df376585 100644 --- a/packages/connect-core/src/utils/radspec/postprocess.ts +++ b/packages/connect-core/src/utils/radspec/postprocess.ts @@ -36,8 +36,8 @@ export async function postprocessRadspecDescription( const tokens = description .split(combinedRegex) - .map(token => token.trim()) - .filter(token => token) + .map((token) => token.trim()) + .filter((token) => token) if (tokens.length < 1) { return { description } @@ -97,7 +97,7 @@ export async function postprocessRadspecDescription( return [input, input, { type: 'text', value: input }] } - const annotatedTokens = tokens.map(token => { + const annotatedTokens = tokens.map((token) => { if (addressRegex.test(token)) { return annotateAddress(token) } diff --git a/packages/connect-core/src/utils/transactions.ts b/packages/connect-core/src/utils/transactions.ts index d5b22e92..017743cf 100644 --- a/packages/connect-core/src/utils/transactions.ts +++ b/packages/connect-core/src/utils/transactions.ts @@ -66,7 +66,7 @@ export async function createDirectTransactionForApp( throw new Error(`No ABI specified in artifact for ${destination}`) } - const methodAbiFragment = app.abi.find(method => { + const methodAbiFragment = app.abi.find((method) => { // If the full signature isn't given, just find the first overload declared if (!isFullMethodSignature(methodSignature)) { return method.name === methodSignature diff --git a/packages/connect-ethereum/src/index.ts b/packages/connect-ethereum/src/index.ts index a382dc2b..0e8e0457 100644 --- a/packages/connect-ethereum/src/index.ts +++ b/packages/connect-ethereum/src/index.ts @@ -36,7 +36,7 @@ class ConnectorEthereum implements IOrganizationConnector { } async permissionsForOrg(): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve([]) }) } @@ -51,13 +51,13 @@ class ConnectorEthereum implements IOrganizationConnector { } appForOrg(organization: Organization, filters: AppFilters): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve() }) } appsForOrg(organization: Organization, filters: AppFilters): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve([]) }) } @@ -83,13 +83,13 @@ class ConnectorEthereum implements IOrganizationConnector { } repoForApp(organization: Organization, appAddress: string): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve() }) } appByAddress(organization: Organization, appAddress: string): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve() }) } @@ -98,7 +98,7 @@ class ConnectorEthereum implements IOrganizationConnector { organization: Organization, appAddress: string ): Promise { - return new Promise(resolve => { + return new Promise((resolve) => { resolve([]) }) } diff --git a/packages/connect-thegraph/src/connector.ts b/packages/connect-thegraph/src/connector.ts index 38c6ea41..9f8e38cc 100644 --- a/packages/connect-thegraph/src/connector.ts +++ b/packages/connect-thegraph/src/connector.ts @@ -97,7 +97,7 @@ class ConnectorTheGraph implements IOrganizationConnector { return this.#gql.performQueryWithParser( queries.ROLE_BY_APP_ADDRESS('query'), { appAddress: appAddress.toLowerCase() }, - result => parseRoles(result, organization) + (result) => parseRoles(result, organization) ) } @@ -105,7 +105,7 @@ class ConnectorTheGraph implements IOrganizationConnector { return this.#gql.performQueryWithParser( queries.ORGANIZATION_PERMISSIONS('query'), { orgAddress: organization.address.toLowerCase() }, - result => parsePermissions(result, organization) + (result) => parsePermissions(result, organization) ) } @@ -117,7 +117,7 @@ class ConnectorTheGraph implements IOrganizationConnector { queries.ORGANIZATION_PERMISSIONS('subscription'), { orgAddress: organization.address.toLowerCase() }, callback, - result => parsePermissions(result, organization) + (result) => parsePermissions(result, organization) ) } @@ -128,7 +128,7 @@ class ConnectorTheGraph implements IOrganizationConnector { return this.#gql.performQueryWithParser( queries.APP_BY_ADDRESS('query'), { appAddress: appAddress.toLowerCase() }, - result => parseApp(result, organization) + (result) => parseApp(result, organization) ) } @@ -143,7 +143,7 @@ class ConnectorTheGraph implements IOrganizationConnector { first: 1, orgAddress: organization.address.toLowerCase(), }, - result => parseApps(result, organization) + (result) => parseApps(result, organization) ) return apps[0] } @@ -158,7 +158,7 @@ class ConnectorTheGraph implements IOrganizationConnector { appFilter: appFiltersToQueryFilter(filters), orgAddress: organization.address.toLowerCase(), }, - result => parseApps(result, organization) + (result) => parseApps(result, organization) ) } @@ -175,7 +175,7 @@ class ConnectorTheGraph implements IOrganizationConnector { orgAddress: organization.address.toLowerCase(), }, (apps: App[]) => callback(apps[0]), - result => parseApps(result, organization) + (result) => parseApps(result, organization) ) } @@ -191,7 +191,7 @@ class ConnectorTheGraph implements IOrganizationConnector { orgAddress: organization.address.toLowerCase(), }, callback, - result => parseApps(result, organization) + (result) => parseApps(result, organization) ) } @@ -202,7 +202,7 @@ class ConnectorTheGraph implements IOrganizationConnector { return this.#gql.performQueryWithParser( queries.REPO_BY_APP_ADDRESS('query'), { appAddress: appAddress.toLowerCase() }, - result => parseRepo(result, organization) + (result) => parseRepo(result, organization) ) } } diff --git a/packages/connect-tokens/src/thegraph/connector.ts b/packages/connect-tokens/src/thegraph/connector.ts index 8c39ad0a..a5cabeb3 100644 --- a/packages/connect-tokens/src/thegraph/connector.ts +++ b/packages/connect-tokens/src/thegraph/connector.ts @@ -44,7 +44,7 @@ export default class TokensConnectorTheGraph implements ITokensConnector { const token = await gql.performQueryWithParser( queries.TOKEN('query'), { tokenManagerAddress: appAddress }, - result => parseToken(result) + (result) => parseToken(result) ) return new TokensConnectorTheGraph(gql, token) @@ -66,7 +66,7 @@ export default class TokensConnectorTheGraph implements ITokensConnector { return this.#gql.performQueryWithParser( queries.TOKEN_HOLDERS('query'), { tokenAddress, first, skip }, - result => parseTokenHolders(result) + (result) => parseTokenHolders(result) ) } @@ -78,7 +78,7 @@ export default class TokensConnectorTheGraph implements ITokensConnector { queries.TOKEN_HOLDERS('subscription'), { tokenAddress, first: 1000, skip: 0 }, callback, - result => parseTokenHolders(result) + (result) => parseTokenHolders(result) ) } } diff --git a/packages/connect-tokens/src/thegraph/parsers/index.ts b/packages/connect-tokens/src/thegraph/parsers/index.ts index d3ebe30d..aefd6eb9 100644 --- a/packages/connect-tokens/src/thegraph/parsers/index.ts +++ b/packages/connect-tokens/src/thegraph/parsers/index.ts @@ -1,2 +1,2 @@ export { parseToken } from './tokens' -export { parseTokenHolders } from './tokenHolders' \ No newline at end of file +export { parseTokenHolders } from './tokenHolders' diff --git a/packages/connect-voting/src/__test__/votes.test.ts b/packages/connect-voting/src/__test__/votes.test.ts index 8f55ea97..6cf98d72 100644 --- a/packages/connect-voting/src/__test__/votes.test.ts +++ b/packages/connect-voting/src/__test__/votes.test.ts @@ -1,15 +1,14 @@ import { VotingConnectorTheGraph, Vote, Cast } from '../../src' -const VOTING_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-mainnet' +const VOTING_SUBGRAPH_URL = + 'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-mainnet' const VOTING_APP_ADDRESS = '0x277bfcf7c2e162cb1ac3e9ae228a3132a75f83d4' describe('when connecting to a voting app', () => { let connector: VotingConnectorTheGraph beforeAll(() => { - connector = new VotingConnectorTheGraph( - VOTING_SUBGRAPH_URL - ) + connector = new VotingConnectorTheGraph(VOTING_SUBGRAPH_URL) }) afterAll(async () => { @@ -20,10 +19,7 @@ describe('when connecting to a voting app', () => { let votes: Vote[] beforeAll(async () => { - votes = await connector.votesForApp( - VOTING_APP_ADDRESS, - 1000, 0 - ) + votes = await connector.votesForApp(VOTING_APP_ADDRESS, 1000, 0) }) test('returns a list of votes', () => { @@ -54,7 +50,9 @@ describe('when connecting to a voting app', () => { }) test('should have a valid creator', () => { - expect(vote.creator).toEqual('0xcafe1a77e84698c83ca8931f54a755176ef75f2c') + expect(vote.creator).toEqual( + '0xcafe1a77e84698c83ca8931f54a755176ef75f2c' + ) }) test('should have valid metadata', () => { @@ -97,4 +95,3 @@ Link: https://github.com/aragon/AGPs/blob/master/AGPs/AGP-5.md`) }) }) }) - diff --git a/packages/connect-voting/src/thegraph/parsers/index.ts b/packages/connect-voting/src/thegraph/parsers/index.ts index 2d4e43f8..905c5968 100644 --- a/packages/connect-voting/src/thegraph/parsers/index.ts +++ b/packages/connect-voting/src/thegraph/parsers/index.ts @@ -1,2 +1,2 @@ export { parseVotes } from './votes' -export { parseCasts } from './casts' \ No newline at end of file +export { parseCasts } from './casts'