blob: 74865afb8c0952afe915c2d503cb2c8fe44d3c60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import EthereumTx = require('ethereumjs-tx');
import { configs } from './configs';
import { utils } from './utils';
type Callback = (err: Error, 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, 'hex');
tx.sign(privateKeyBuffer);
const rawTx = `0x${tx.serialize().toString('hex')}`;
callback(null, rawTx);
},
};
|