aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets/src/ts/id_management.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/testnet-faucets/src/ts/id_management.ts')
-rw-r--r--packages/testnet-faucets/src/ts/id_management.ts23
1 files changed, 23 insertions, 0 deletions
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);
+ },
+};