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

Refactor API: ForwardingPath descriptions + App intent actions #256

Merged
merged 85 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
5c4b021
Types: Update types definition
0xGabi Aug 20, 2020
e36825a
Types: Fix imports
0xGabi Aug 20, 2020
e3fb789
Refactor: update imports and definitions for Transction entity
0xGabi Aug 20, 2020
453b4ef
Refactor: Create Transaction entity & update how handle transactions
0xGabi Aug 20, 2020
163166a
Comment logic related to forwarding path description
0xGabi Aug 20, 2020
4c0890b
Comment logic related to forwarding path description
0xGabi Aug 20, 2020
552bda1
Merge branch 'refactor-transaction' of github.com:aragon/connect into…
0xGabi Aug 20, 2020
c6f1740
Refactor: Add Intent entity + refactor calculate path logic
0xGabi Aug 20, 2020
9456cbe
Refactor: Remove TransactionIntent entity + update logic
0xGabi Aug 20, 2020
d84e4b1
Fix import
0xGabi Aug 20, 2020
097325a
Refactor: Add ForwardingPath entity + update logic to describe a Forw…
0xGabi Aug 20, 2020
0d4bd4a
Merge
0xGabi Aug 26, 2020
867d0b3
Types: update types definition
0xGabi Aug 31, 2020
9f574f9
Core: Update Organization API
0xGabi Aug 31, 2020
8b28d2d
Core: Remove Intent entity + update App API
0xGabi Aug 31, 2020
81e4b28
Core: Calculate path logic + refactor utilities
0xGabi Aug 31, 2020
144bf47
Connector: fetch Repo latestsVersion
0xGabi Aug 31, 2020
fa6150b
Core: ForwardingPath descriptor logic
0xGabi Aug 31, 2020
d4c6cbf
Merge remote-tracking branch 'origin/master' into refactor-api
0xGabi Aug 31, 2020
c1afe43
Chore: Code cleanup
0xGabi Sep 1, 2020
613c7cc
Fix build
0xGabi Sep 1, 2020
2214b0a
Fix tests
0xGabi Sep 1, 2020
111305b
Merge branch 'refactor-api' of github.com:aragon/connect into refacto…
0xGabi Sep 1, 2020
a401390
Chore: clean code
0xGabi Sep 2, 2020
06b67f8
Chore: More code cleanups
0xGabi Sep 3, 2020
55eb610
Chore: fix typos
0xGabi Sep 3, 2020
d0d75ca
Add a few tests + clean code
0xGabi Sep 3, 2020
ad86cd1
Core: Add pre-transaction logic
0xGabi Sep 3, 2020
d69546a
Core: Fix radspec postprocess + findAppMethodFromData
0xGabi Sep 3, 2020
c385c6a
Core: remove side effects from postprocess function
0xGabi Sep 3, 2020
f3f5ae2
Core: Have a path object on the ForwardingPath
0xGabi Sep 4, 2020
40e596b
Tests: Fix disputable subgraph test
0xGabi Sep 8, 2020
e49264d
v0.8.0-alpha.1
0xGabi Sep 8, 2020
e7adcbb
Merge branch 'master' of github.com:aragon/connect into refactor-api
facuspagnuolo Sep 8, 2020
3d719b0
agreement: implement sign action
facuspagnuolo Sep 4, 2020
7315e10
agreement: implement close action
facuspagnuolo Sep 6, 2020
1b70b23
agreement: implement settle action
facuspagnuolo Sep 6, 2020
2781b43
core: support resetting erc20 approvals
facuspagnuolo Sep 7, 2020
b702303
agreement: implement challenge action
facuspagnuolo Sep 7, 2020
43e1f72
agreement: implement dispute action
facuspagnuolo Sep 7, 2020
ea96663
agreement: fail on not-found actions
facuspagnuolo Sep 8, 2020
4e6447b
Merge branch 'master' of github.com:aragon/connect into refactor-api
facuspagnuolo Sep 8, 2020
dd4c389
Merge branch 'refactor-api' of github.com:aragon/connect into agreeme…
facuspagnuolo Sep 8, 2020
8a73601
Core: use artifact roles data to postprocess description
0xGabi Sep 9, 2020
dcffe03
Merge remote-tracking branch 'origin/master' into refactor-api
0xGabi Sep 9, 2020
58e4757
Merge branch 'refactor-api' of github.com:aragon/connect into refacto…
0xGabi Sep 9, 2020
a1b1442
DisputableVoting: Implement new vote action
facuspagnuolo Sep 9, 2020
c283572
DisputableVoting: Implement cast vote action
facuspagnuolo Sep 9, 2020
aa99f9a
DisputableVoting: Remove vote unused internal method
facuspagnuolo Sep 9, 2020
c45b5ad
Agreement: Implement actions (#264)
facuspagnuolo Sep 9, 2020
6f82660
Merge branch 'refactor-api' into disputable_voting/implement_actions
0xGabi Sep 9, 2020
b900bd0
Update packages/connect-disputable-voting/subgraph/package.json
0xGabi Sep 9, 2020
49eee2d
Core: fix postprocess roles parsing
0xGabi Sep 9, 2020
f881b25
Merge remote-tracking branch 'origin/disputable_voting/implement_acti…
0xGabi Sep 9, 2020
3bb5f0e
Merge remote-tracking branch 'origin/disputable_voting/implement_acti…
0xGabi Sep 9, 2020
8da25a5
v0.8.0-alpha.2
0xGabi Sep 9, 2020
177b041
DisputableVoting: Compute actual quiet ending extension (#279)
facuspagnuolo Sep 9, 2020
721454a
DisputableVoting: Handle no settlement answer (#280)
facuspagnuolo Sep 10, 2020
50065ae
DisputableVoting: Fix has ended for implicit settlements (#282)
facuspagnuolo Sep 10, 2020
1c1508e
Agreement: Handle null signers (#281)
facuspagnuolo Sep 10, 2020
74d40bf
Merge branch 'refactor-api' of github.com:aragon/connect into refacto…
0xGabi Sep 10, 2020
45909c3
DisputableVoting: Fix collateral requirement parsing (#283)
facuspagnuolo Sep 11, 2020
8d6e154
Agreement: Update staking ABI (#284)
facuspagnuolo Sep 11, 2020
39b18b8
Core: fix abi overload case
0xGabi Sep 11, 2020
859ab3b
Merge branch 'refactor-api' of github.com:aragon/connect into refacto…
0xGabi Sep 11, 2020
4298d0f
v0.8.0-alpha.3
0xGabi Sep 11, 2020
8d66307
Core: Fix pre-approvals (#285)
facuspagnuolo Sep 11, 2020
a68783e
v0.8.0-alpha.4
facuspagnuolo Sep 11, 2020
b5b35f2
Agreement: Reduce staking movements complexity (#286)
facuspagnuolo Sep 14, 2020
1340963
DisputableVoting: Implement voting checks (#287)
facuspagnuolo Sep 14, 2020
1cbc0f6
v0.8.0-alpha.5
0xGabi Sep 14, 2020
7570926
Agreement: Allow nullable staking info (#293)
facuspagnuolo Sep 17, 2020
fc9c500
DisputableVoting: Implement settlement offer (#291)
facuspagnuolo Sep 17, 2020
47045de
Cache token symbols
facuspagnuolo Sep 17, 2020
5e762f5
Update agreement and disputable voting subraphs for rinkeby-staging
facuspagnuolo Sep 17, 2020
326357b
Agreement: Fix staking movement mapping
facuspagnuolo Sep 17, 2020
8184697
DisputableVoting: Implement has voted subscription
facuspagnuolo Sep 17, 2020
7208276
Examples: add forwarding-path (#290)
bpierre Sep 25, 2020
eca5746
Core: prefer generating signature from ABI (#292)
0xGabi Sep 25, 2020
085547e
Merge remote-tracking branch 'origin/master' into refactor-api
0xGabi Sep 25, 2020
62e622f
Chore: arrange imports
0xGabi Sep 25, 2020
081751a
Chore: fix type
0xGabi Sep 25, 2020
40288dd
Core: add changes from review comments
0xGabi Sep 26, 2020
6f063bf
Merge remote-tracking branch 'origin/master' into refactor-api
0xGabi Dec 30, 2020
1731eba
Core: add missing imports + update lock
0xGabi Dec 30, 2020
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
1 change: 1 addition & 0 deletions packages/connect-core/src/connections/ConnectorJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */

import { AppFilters, Network, SubscriptionHandler } from '@aragon/connect-types'

import { ConnectionContext } from '../types'
import IOrganizationConnector from './IOrganizationConnector'
import App from '../entities/App'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AppFilters, Network, SubscriptionHandler } from '@aragon/connect-types'

import { ConnectionContext } from '../types'
import App from '../entities/App'
import Organization from '../entities/Organization'
Expand Down
1 change: 1 addition & 0 deletions packages/connect-core/src/entities/Organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
AppFiltersParam,
SubscriptionHandler,
} from '@aragon/connect-types'

import { ConnectionContext } from '../types'
import TransactionIntent from '../transactions/TransactionIntent'
import { toArrayEntry } from '../utils/misc'
Expand Down
1 change: 1 addition & 0 deletions packages/connect-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type {
Networkish,
SubscriptionHandler,
} from '@aragon/connect-types'

export { default as IOrganizationConnector } from './connections/IOrganizationConnector'
export {
default as ConnectorJson,
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-core/src/transactions/TransactionIntent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethers } from 'ethers'

import TransactionPath from './TransactionPath'
import TransactionRequest from './TransactionRequest'
import Transaction from '../entities/Transaction'
import Organization from '../entities/Organization'
import { TransactionIntentData } from '../types'
import { calculateTransactionPath } from '../utils/path/calculatePath'
Expand Down Expand Up @@ -68,7 +68,7 @@ export default class TransactionIntent {
async transactions(
account: string,
options?: { as: string; path?: string[] }
): Promise<TransactionRequest[]> {
): Promise<Transaction[]> {
return (await this.paths(account, options)).transactions
}
}
6 changes: 3 additions & 3 deletions packages/connect-core/src/transactions/TransactionPath.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import TransactionRequest from './TransactionRequest'
import App from '../entities/App'
import Transaction from '../entities/Transaction'
import { TransactionPathData } from '../types'

export default class TransactionPath {
readonly apps!: App[]
readonly destination!: App
readonly forwardingFeePretransaction?: TransactionRequest
readonly transactions!: TransactionRequest[]
readonly forwardingFeePretransaction?: Transaction
readonly transactions!: Transaction[]
0xGabi marked this conversation as resolved.
Show resolved Hide resolved

constructor(data: TransactionPathData) {
this.apps = data.apps
Expand Down
19 changes: 0 additions & 19 deletions packages/connect-core/src/transactions/TransactionRequest.ts

This file was deleted.

15 changes: 6 additions & 9 deletions packages/connect-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Address, Network } from '@aragon/connect-types'

import IOrganizationConnector from './connections/IOrganizationConnector'
import App from './entities/App'
import TransactionRequest from './transactions/TransactionRequest'
import Transaction from './entities/Transaction'

export type Abi = (ethers.utils.EventFragment | ethers.utils.FunctionFragment)[]

Expand Down Expand Up @@ -100,8 +100,8 @@ export interface RoleData {
export interface TransactionPathData {
apps: App[]
destination: App
forwardingFeePretransaction?: TransactionRequest
transactions: TransactionRequest[]
forwardingFeePretransaction?: Transaction
transactions: Transaction[]
}

export interface TransactionIntentData {
Expand All @@ -110,13 +110,10 @@ export interface TransactionIntentData {
functionArgs: any[]
}

export interface TransactionRequestData {
children?: TransactionRequest[]
description?: string
descriptionAnnotated?: Annotation[]
export interface TransactionData {
data: string
from?: string
to: string
from: Address
to: Address
}

////// METADATA //////
Expand Down
5 changes: 3 additions & 2 deletions packages/connect-core/src/utils/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ethers } from 'ethers'

import { AppIntent, TransactionRequestData } from '../types'
import { AppIntent } from '../types'
import App from '../entities/App'
import Transaction from '../entities/Transaction'

export const apmAppId = (appName: string): string =>
ethers.utils.namehash(`${appName}.aragonpm.eth`)
Expand Down Expand Up @@ -49,7 +50,7 @@ export function validateMethod(
*/
export function findAppMethodFromIntent(
app: App,
transaction: TransactionRequestData
transaction: Transaction
): AppIntent | undefined {
const methodId = transaction.data.substring(0, 10)

Expand Down
2 changes: 1 addition & 1 deletion packages/connect-core/src/utils/callScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ethers } from 'ethers'

export const CALLSCRIPT_ID = '0x00000001'

interface CallScriptAction {
export interface CallScriptAction {
to: string
data: string
}
Expand Down
10 changes: 5 additions & 5 deletions packages/connect-core/src/utils/descriptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethers } from 'ethers'

import App from '../entities/App'
import TransactionRequest from '../transactions/TransactionRequest'
import Transaction from '../entities/Transaction'
import {
decodeTransactionPath,
TransactionWithChildren,
Expand All @@ -15,7 +15,7 @@ export async function describeTransaction(
transaction: TransactionWithChildren,
apps: App[],
provider?: ethers.providers.Provider
): Promise<TransactionRequest> {
): Promise<Transaction> {
if (!transaction.to) {
throw new Error(`Could not describe transaction: missing 'to'`)
}
Expand Down Expand Up @@ -44,7 +44,7 @@ export async function describeTransaction(
throw new Error(`Could not describe transaction: ${err}`)
}

return new TransactionRequest({
return new Transaction({
...transaction,
description,
descriptionAnnotated,
Expand All @@ -59,7 +59,7 @@ export async function describeTransactionPath(
path: TransactionWithChildren[],
apps: App[],
provider?: ethers.providers.Provider
): Promise<TransactionRequest[]> {
): Promise<Transaction[]> {
return Promise.all(
path.map((step) => describeTransaction(step, apps, provider))
)
Expand All @@ -69,7 +69,7 @@ export async function describeScript(
script: string,
apps: App[],
provider?: ethers.providers.Provider
): Promise<TransactionRequest[]> {
): Promise<Transaction[]> {
const path = decodeTransactionPath(script)

return describeTransactionPath(path, apps, provider)
Expand Down
1 change: 1 addition & 0 deletions packages/connect-core/src/utils/network.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Address, Network, Networkish } from '@aragon/connect-types'

import { NETWORKS } from '../params'

export function networkFromChainId(chainId: number): Network | null {
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-core/src/utils/path/calculatePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { ethers } from 'ethers'

import { AppIntent } from '../../types'
import App from '../../entities/App'
import Transaction from '../../entities/Transaction'
import { addressesEqual, includesAddress, ANY_ENTITY } from '../address'
import { isFullMethodSignature } from '../app'
import { encodeCallScript } from '../callScript'
import { canForward } from '../forwarding'
import {
Transaction,
createDirectTransactionForApp,
createForwarderTransactionBuilder,
buildForwardingFeePretransaction,
Expand Down
7 changes: 3 additions & 4 deletions packages/connect-core/src/utils/path/decodePath.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { isCallScript, decodeCallScript } from '../callScript'
import { isCallScript, decodeCallScript, CallScriptAction } from '../callScript'
import { isValidForwardCall, parseForwardCall } from '../forwarding'
import { Transaction } from '../transactions'

export interface TransactionWithChildren extends Transaction {
export interface TransactionWithChildren extends CallScriptAction {
children?: TransactionWithChildren[]
}

Expand All @@ -25,7 +24,7 @@ export function decodeTransactionPath(
return path.reduce((decodeSegments, segment) => {
const { data } = segment

let children
let children: TransactionWithChildren[] = []
if (isValidForwardCall(data)) {
const forwardedEvmScript = parseForwardCall(data)

Expand Down
5 changes: 3 additions & 2 deletions packages/connect-core/src/utils/radspec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import * as radspec from 'radspec'
import { addressesEqual } from '../address'
import { findAppMethodFromIntent } from '../app'
import App from '../../entities/App'
import { Abi, AppIntent, TransactionRequestData } from '../../types'
import Transaction from '../../entities/Transaction'
import { Abi, AppIntent } from '../../types'

interface FoundMethod {
method?: AppIntent
Expand All @@ -15,7 +16,7 @@ interface FoundMethod {
* Attempt to describe intent via radspec.
*/
export async function tryEvaluatingRadspec(
intent: TransactionRequestData,
intent: Transaction,
apps: App[],
provider?: ethers.providers.Provider // Decorated intent with description, if one could be made
): Promise<string> {
Expand Down