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

Wrapper: add AppProxy's events abi to running apps #375

Merged
merged 1 commit into from Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/aragon-wrapper/src/index.js
Expand Up @@ -47,7 +47,7 @@ import {
includesAddress,
makeAddressMapProxy,
makeProxy,
makeProxyFromABI,
makeProxyFromAppABI,
AsyncRequestCache,
ANY_ENTITY
} from './utils'
Expand Down Expand Up @@ -1070,7 +1070,7 @@ export default class Aragon {
const app = apps.find((app) => addressesEqual(app.proxyAddress, proxyAddress))

// TODO: handle undefined (no proxy found), otherwise when calling app.proxyAddress next, it will throw
const appProxy = makeProxyFromABI(app.proxyAddress, app.abi, this.web3)
const appProxy = makeProxyFromAppABI(app.proxyAddress, app.abi, this.web3)

await appProxy.updateInitializationBlock()

Expand Down
6 changes: 3 additions & 3 deletions packages/aragon-wrapper/src/index.test.js
Expand Up @@ -1224,7 +1224,7 @@ test('should run the app and reply to a request', async (t) => {
proxyAddress: '0x789'
}
])
utilsStub.makeProxyFromABI = (proxyAddress) => ({
utilsStub.makeProxyFromAppABI = (proxyAddress) => ({
address: proxyAddress,
updateInitializationBlock: () => {}
})
Expand Down Expand Up @@ -1269,7 +1269,7 @@ test('should run the app and be able to shutdown', async (t) => {
proxyAddress: '0x789'
}
])
utilsStub.makeProxyFromABI = (proxyAddress) => ({
utilsStub.makeProxyFromAppABI = (proxyAddress) => ({
address: proxyAddress,
updateInitializationBlock: () => {}
})
Expand Down Expand Up @@ -1326,7 +1326,7 @@ test('should run the app and be able to shutdown and clear cache', async (t) =>
}
])

utilsStub.makeProxyFromABI = (proxyAddress) => ({
utilsStub.makeProxyFromAppABI = (proxyAddress) => ({
address: proxyAddress,
updateInitializationBlock: () => {}
})
Expand Down
6 changes: 6 additions & 0 deletions packages/aragon-wrapper/src/utils/index.js
Expand Up @@ -60,6 +60,12 @@ export function makeProxy (address, interfaceName, web3, options) {
return makeProxyFromABI(address, abi, web3, options)
}

const appProxyEventsAbi = getAbi('aragon/AppProxy').filter(({ type }) => type === 'event')
export function makeProxyFromAppABI (address, appAbi, web3, options) {
const appAbiWithProxyEvents = [].concat(appAbi, appProxyEventsAbi)
return makeProxyFromABI(address, appAbiWithProxyEvents, web3, options)
}

export function makeProxyFromABI (address, abi, web3, options) {
return new ContractProxy(address, abi, web3, options)
}
Expand Down