diff options
Diffstat (limited to 'packages/kovan-faucets/src/ts/id_management.ts')
-rw-r--r-- | packages/kovan-faucets/src/ts/id_management.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/kovan-faucets/src/ts/id_management.ts b/packages/kovan-faucets/src/ts/id_management.ts new file mode 100644 index 000000000..838650be0 --- /dev/null +++ b/packages/kovan-faucets/src/ts/id_management.ts @@ -0,0 +1,27 @@ +import {configs} from './configs'; +import * as EthereumTx from 'ethereumjs-tx'; + +type Callback = (err: Error, accounts: any) => void; + +export const idManagement = { + getAccounts(callback: Callback) { + /* tslint:disable */ + console.log('configs.DISPENSER_ADDRESS', configs.DISPENSER_ADDRESS); + /* tslint:enable */ + callback(null, [ + configs.DISPENSER_ADDRESS, + ]); + }, + approveTransaction(txData: object, callback: Callback) { + callback(null, true); + }, + signTransaction(txData: object, callback: Callback) { + /* tslint:disable */ + let tx = new EthereumTx(txData); + /* tslint:enable */ + const privateKeyBuffer = new Buffer(configs.DISPENSER_PRIVATE_KEY, 'hex'); + tx.sign(privateKeyBuffer); + const rawTx = `0x${tx.serialize().toString('hex')}`; + callback(null, rawTx); + }, +}; |