-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.js
47 lines (45 loc) · 1.52 KB
/
delete.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if (process.argv.length < 3)
{
console.log("Usage: node accept <account family seed>")
process.exit(1);
}
const RippleAPI = require('ripple-lib').RippleAPI;
const keypairs = require('ripple-keypairs');
const fs = require('fs');
const api = new RippleAPI({server: 'ws://localhost:6005'});
const secret = process.argv[2];
const address = keypairs.deriveAddress(keypairs.deriveKeypair(secret).publicKey)
api.on('error', (errorCode, errorMessage) => {console.log(errorCode + ': ' + errorMessage);});
api.on('connected', () => {console.log('connected');});
api.on('disconnected', (code) => {console.log('disconnected, code:', code);});
api.connect().then(() => {
j = {
Account: address,
TransactionType: "SetHook",
CreateCode: '',
HookOn: '0000000000000000'
}
api.prepareTransaction(j).then( (x)=>
{
let s = api.sign(x.txJSON, secret)
console.log(s)
api.submit(s.signedTransaction).then( response => {
console.log(response.resultCode, response.resultMessage);
j = {
Account: address,
TransactionType: "SetHook",
CreateCode: '',
HookOn: '0000000000000000'
}
api.prepareTransaction(j).then( (x)=>
{
let s = api.sign(x.txJSON, secret)
console.log(s)
api.submit(s.signedTransaction).then( response => {
console.log(response.resultCode, response.resultMessage);
process.exit(0);
}).catch ( e=> { console.log(e) });
});
}).catch ( e=> { console.log(e) });
});
}).then(() => {}).catch(console.error);