diff --git a/packages/dai-plugin-governance/babel.config.js b/packages/dai-plugin-governance/babel.config.js deleted file mode 120000 index 426aaf31b..000000000 --- a/packages/dai-plugin-governance/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -../../babel.config.js \ No newline at end of file diff --git a/packages/dai-plugin-governance/babel.config.js b/packages/dai-plugin-governance/babel.config.js new file mode 100644 index 000000000..5ba3b1f06 --- /dev/null +++ b/packages/dai-plugin-governance/babel.config.js @@ -0,0 +1,23 @@ +module.exports = function(api) { + api.cache(true); + + const presets = ['@babel/preset-env']; + const plugins = [ + ['@babel/plugin-proposal-decorators', { legacy: true }], + '@babel/plugin-proposal-function-sent', + '@babel/plugin-proposal-export-namespace-from', + '@babel/plugin-proposal-numeric-separator', + '@babel/plugin-proposal-throw-expressions', + '@babel/plugin-proposal-class-properties', + '@babel/plugin-transform-runtime' + ]; + + const babelrcRoots = ['.', './lib/*']; + + return { + presets, + plugins, + babelrcRoots + }; + }; + \ No newline at end of file diff --git a/packages/dai-plugin-governance/package.json b/packages/dai-plugin-governance/package.json index cfa8eeacb..d4cc66e90 100644 --- a/packages/dai-plugin-governance/package.json +++ b/packages/dai-plugin-governance/package.json @@ -1,7 +1,7 @@ { "name": "@makerdao/dai-plugin-governance", "description": "A dai.js plugin for adding MKR governance support to dapps.", - "version": "0.14.3", + "version": "0.14.6", "license": "MIT", "repository": { "type": "git", diff --git a/packages/dai-plugin-governance/src/SpellService.js b/packages/dai-plugin-governance/src/SpellService.js index e961da45d..91dfa023c 100644 --- a/packages/dai-plugin-governance/src/SpellService.js +++ b/packages/dai-plugin-governance/src/SpellService.js @@ -16,6 +16,7 @@ export default class SpellService extends PublicService { this.executionDate = {}; this.scheduledDate = {}; this.nextCastTime = {}; + this.expiration = {}; this.executiveHash = {}; this.officeHours = {}; } @@ -50,6 +51,18 @@ export default class SpellService extends PublicService { return this.nextCastTime[spellAddress]; } + async getExpiration(spellAddress) { + if (this.expiration[spellAddress]) return this.expiration[spellAddress]; + const spell = this.get('smartContract').getContractByAddressAndAbi( + spellAddress, + DsSpellAbi + ); + const expiration = await spell.expiration(); + if (!expiration.toNumber()) return undefined; + this.expiration[spellAddress] = new Date(expiration.toNumber() * 1000); + return this.expiration[spellAddress]; + } + async getScheduledDate(spellAddress) { if (this.scheduledDate[spellAddress]) return this.scheduledDate[spellAddress]; diff --git a/packages/dai-plugin-governance/test/SpellService.test.js b/packages/dai-plugin-governance/test/SpellService.test.js index 656921a3a..dc6837ae0 100644 --- a/packages/dai-plugin-governance/test/SpellService.test.js +++ b/packages/dai-plugin-governance/test/SpellService.test.js @@ -52,6 +52,15 @@ describe('use mainnet', () => { expect(eta).toEqual(new Date('2020-01-26T11:53:19.000Z')); }); + test('get spell expiration', async () => { + const eta = await spellService.getExpiration( + '0x9400d4D59134af2a48a4bf4237E809A80f90Fe63' + ); + expect(eta).toEqual(new Date('2021-11-07T20:22:48.000Z')); + }); + + //TODO: add test for getNextCastTime(); + test('get executive hash text', async () => { const done = await spellService.getExecutiveHash( '0x9400d4D59134af2a48a4bf4237E809A80f90Fe63' diff --git a/packages/dai/package.json b/packages/dai/package.json index 580e4cb35..26a3e2c35 100644 --- a/packages/dai/package.json +++ b/packages/dai/package.json @@ -1,6 +1,6 @@ { "name": "@makerdao/dai", - "version": "0.32.15", + "version": "0.35.16", "contributors": [ "Wouter Kampmann ", "Sean Brennan ",