From 72bc519662a29713d494d399cad5ef4f1b65c34a Mon Sep 17 00:00:00 2001 From: Doug Kent Date: Mon, 6 Jul 2020 10:36:45 -0400 Subject: [PATCH 1/4] Merge conflict --- src/arc.ts | 15 +++++++++------ test/arc.spec.ts | 17 +++++++++++++---- test/utils.ts | 7 ++++--- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/arc.ts b/src/arc.ts index ecac0b64..901faeb5 100644 --- a/src/arc.ts +++ b/src/arc.ts @@ -77,8 +77,8 @@ export class Arc extends GraphNodeObserver { public get isInfuraProvider(): boolean { return typeof this._web3Provider === 'string' && - (this._web3Provider.includes('infura.io') || - this._web3Provider.includes('xdai')) + (this._web3Provider.includes('infura.io') || + this._web3Provider.includes('xdai')) } /** @@ -214,6 +214,7 @@ export class Arc extends GraphNodeObserver { name version address + alias } } ` @@ -391,10 +392,11 @@ export class Arc extends GraphNodeObserver { throw Error(`No contract with name ${name} and version ${version} is known`) } - public getABI(opts: { address?: Address - abiName?: string - version?: string - }): any[] { + public getABI(opts: { + address?: Address + abiName?: string + version?: string + }): any[] { if (Object.values(opts).filter((value) => value !== undefined).length === 0) { throw Error('getABI needs at least one parameter passed') } @@ -607,4 +609,5 @@ export interface IContractInfo { version: string address: Address name: string + alias: string } diff --git a/test/arc.spec.ts b/test/arc.spec.ts index 84d54f6a..203c729c 100644 --- a/test/arc.spec.ts +++ b/test/arc.spec.ts @@ -205,12 +205,12 @@ describe('Arc ', () => { it('arc.plugin() should work', async () => { const arc = await newArc() - const nonUniquePlugin = await arc.plugin({where: { name: 'GenericScheme' }}) - const uniquePlugin = await arc.plugin({where: { address: getTestScheme('GenericScheme') }}, true) + const nonUniquePlugin = await arc.plugin({ where: { name: 'GenericScheme' } }) + const uniquePlugin = await arc.plugin({ where: { address: getTestScheme('GenericScheme') } }, true) expect(nonUniquePlugin).toBeInstanceOf(Plugin) expect(uniquePlugin).toBeInstanceOf(Plugin) - await expect(arc.plugin({where: { name: 'ContributionReward' }}, true)).rejects.toThrow() + await expect(arc.plugin({ where: { name: 'ContributionReward' } }, true)).rejects.toThrow() }) it('arc.plugins() should work', async () => { @@ -229,7 +229,7 @@ describe('Arc ', () => { it('arc.getABI works', async () => { const arc = await newArc() await arc.fetchContractInfos() - const abi = arc.getABI({abiName: 'Redeemer', version: REDEEMER_CONTRACT_VERSIONS[0]}) + const abi = arc.getABI({ abiName: 'Redeemer', version: REDEEMER_CONTRACT_VERSIONS[0] }) expect(abi[0].name).toEqual('redeem') }) @@ -308,3 +308,12 @@ describe('Arc ', () => { .toEqual(await signer.getAddress()) }) }) + +it('plugin contractInfo should contain alias', async () => { + const arc = await newArc() + const pluginId = '0x405fC0EE23C7fcd0a41A864505Fe8c969ca3eF6A' + + const contractInfo = arc.getContractInfo(pluginId) + + expect(contractInfo.alias).toEqual("ContributionRewardExt") +}) diff --git a/test/utils.ts b/test/utils.ts index ac8d07d2..f16b3d80 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -75,7 +75,7 @@ export function getTestAddresses(version: string = LATEST_ARC_VERSION): ITestAdd } export function sleep(ms: number) { - return new Promise( (resolve) => setTimeout(resolve, ms) ) + return new Promise((resolve) => setTimeout(resolve, ms)) } export function getTestScheme(name: PluginName): Address { @@ -271,7 +271,7 @@ export async function firstResult(observable: Observable) { return observable.pipe(first()).toPromise() } -export function getContractAddressesFromMigration(environment: 'private'|'rinkeby'|'mainnet'): IContractInfo[] { +export function getContractAddressesFromMigration(environment: 'private' | 'rinkeby' | 'mainnet'): IContractInfo[] { const migration = require('@daostack/migration-experimental/migration.json')[environment] const contracts: IContractInfo[] = [] for (const version of Object.keys(migration.package)) { @@ -279,8 +279,9 @@ export function getContractAddressesFromMigration(environment: 'private'|'rinkeb contracts.push({ address: migration.package[version][name].toLowerCase(), id: migration.package[version][name], + alias: migration.base[version][name], // fake the data for tests name, - version + version, }) } } From 82bac6418e6101af13caace717bc0ae7dd78d024 Mon Sep 17 00:00:00 2001 From: Doug Kent Date: Mon, 6 Jul 2020 10:18:52 -0400 Subject: [PATCH 2/4] fix test --- test/arc.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/arc.spec.ts b/test/arc.spec.ts index 203c729c..f5103fed 100644 --- a/test/arc.spec.ts +++ b/test/arc.spec.ts @@ -311,7 +311,7 @@ describe('Arc ', () => { it('plugin contractInfo should contain alias', async () => { const arc = await newArc() - const pluginId = '0x405fC0EE23C7fcd0a41A864505Fe8c969ca3eF6A' + const pluginId = '0x86072cbff48da3c1f01824a6761a03f105bcc697' const contractInfo = arc.getContractInfo(pluginId) From b7febd04cfd79a5167c6265594931b01a06db918 Mon Sep 17 00:00:00 2001 From: Doug Kent Date: Mon, 6 Jul 2020 11:09:53 -0400 Subject: [PATCH 3/4] fix test --- test/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils.ts b/test/utils.ts index f16b3d80..291b99eb 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -279,7 +279,7 @@ export function getContractAddressesFromMigration(environment: 'private' | 'rink contracts.push({ address: migration.package[version][name].toLowerCase(), id: migration.package[version][name], - alias: migration.base[version][name], // fake the data for tests + alias: migration.package[version][name], // fake the data for tests name, version, }) From f836e51a0f71768134dbbe4ab08a19cb4f52a5a3 Mon Sep 17 00:00:00 2001 From: Doug Kent Date: Mon, 6 Jul 2020 11:10:28 -0400 Subject: [PATCH 4/4] remove comment --- test/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils.ts b/test/utils.ts index 291b99eb..082279b4 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -279,7 +279,7 @@ export function getContractAddressesFromMigration(environment: 'private' | 'rink contracts.push({ address: migration.package[version][name].toLowerCase(), id: migration.package[version][name], - alias: migration.package[version][name], // fake the data for tests + alias: migration.package[version][name], name, version, })