1
1
#!/usr/bin/env node
2
2
"use strict" ;
3
3
4
- let DotEnv = require ( "dotenv" ) ;
5
- DotEnv . config ( { path : ".env" } ) ;
6
- DotEnv . config ( { path : ".env.secret" } ) ;
4
+ import DotEnv from "dotenv" ;
5
+
6
+ import DashGov from "dashgov" ;
7
+ import DashRpc from "dashrpc" ;
8
+ import DashKeys from "dashkeys" ;
9
+ import DashTx from "dashtx" ;
10
+ import Secp256k1 from "@dashincubator/secp256k1" ;
7
11
8
- let DashGov = require ( "../" ) ;
9
- let DashRpc = require ( "dashrpc" ) ;
10
- let DashKeys = require ( "dashkeys" ) ;
11
- let DashTx = require ( "dashtx" ) ;
12
- let Secp256k1 = require ( "@dashincubator/secp256k1" ) ;
12
+ import Fs from "node:fs/promises" ;
13
13
14
- let Fs = require ( "node:fs/promises" ) ;
14
+ DotEnv . config ( { path : ".env" } ) ;
15
+ DotEnv . config ( { path : ".env.secret" } ) ;
15
16
16
17
async function main ( ) {
17
18
/* jshint maxcomplexity: 100 */
@@ -138,7 +139,7 @@ async function main() {
138
139
}
139
140
140
141
/**
141
- * @param {DashGov .Estimate } estimate
142
+ * @param {import('../dashgov.js') .Estimate } estimate
142
143
* @param {Number } i
143
144
*/
144
145
function show ( estimate , i ) {
@@ -238,7 +239,7 @@ async function main() {
238
239
return ;
239
240
}
240
241
241
- /** @type {DashGov .GObjectData } */
242
+ /** @type {import('../dashgov.js') .GObjectData } */
242
243
let gobjData = DashGov . proposal . draftJson ( selected , {
243
244
name : proposalName ,
244
245
payment_address : paymentAddr ,
@@ -401,7 +402,7 @@ async function main() {
401
402
// params: ["check", gobj.dataHex],
402
403
// })
403
404
// .catch(
404
- // /** @param {Error } err */ function (err) {
405
+ // /** @param {any } err */ function (err) {
405
406
// console.error(err.message);
406
407
// console.error(err.code);
407
408
// console.error(err);
@@ -418,8 +419,8 @@ async function main() {
418
419
method : "gobject" ,
419
420
params : [
420
421
"submit" ,
421
- gobj . hashParent . toString ( ) , // '0' must be a string for some reason
422
- gobj . revision . toString ( ) ,
422
+ gobj . hashParent ? .toString ( ) || "0" , // '0' must be a string for some reason
423
+ gobj . revision ? .toString ( ) || "1" ,
423
424
gobj . time . toString ( ) ,
424
425
gobj . dataHex ,
425
426
txid ,
0 commit comments