From d965fdb11dfba5631c1f98ad3e309876c199999a Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 23 Jan 2018 10:10:43 -0800 Subject: Rename to testnet-faucets --- packages/testnet-faucets/src/ts/id_management.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/testnet-faucets/src/ts/id_management.ts (limited to 'packages/testnet-faucets/src/ts/id_management.ts') diff --git a/packages/testnet-faucets/src/ts/id_management.ts b/packages/testnet-faucets/src/ts/id_management.ts new file mode 100644 index 000000000..930821172 --- /dev/null +++ b/packages/testnet-faucets/src/ts/id_management.ts @@ -0,0 +1,23 @@ +import EthereumTx = require('ethereumjs-tx'); + +import { configs } from './configs'; +import { utils } from './utils'; + +type Callback = (err: Error | null, accounts: any) => void; + +export const idManagement = { + getAccounts(callback: Callback) { + utils.consoleLog(`configs.DISPENSER_ADDRESS: ${configs.DISPENSER_ADDRESS}`); + callback(null, [configs.DISPENSER_ADDRESS]); + }, + approveTransaction(txData: object, callback: Callback) { + callback(null, true); + }, + signTransaction(txData: object, callback: Callback) { + const tx = new EthereumTx(txData); + const privateKeyBuffer = new Buffer(configs.DISPENSER_PRIVATE_KEY as string, 'hex'); + tx.sign(privateKeyBuffer); + const rawTx = `0x${tx.serialize().toString('hex')}`; + callback(null, rawTx); + }, +}; -- cgit v1.2.3