Skip to content

Commit 287abfd

Browse files
committed
chore: convert to ESM
1 parent 92cec32 commit 287abfd

13 files changed

+554
-544
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"strict": false,
3+
"module": true,
24
"browser": true,
35
"node": true,
46
"esversion": 11,
@@ -16,7 +18,6 @@
1618
"plusplus": true,
1719
"undef": true,
1820
"unused": "vars",
19-
"strict": true,
2021
"maxdepth": 4,
2122
"maxstatements": 100,
2223
"maxcomplexity": 20

bin/gobject-prepare.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#!/usr/bin/env node
22
"use strict";
33

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";
711

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";
1313

14-
let Fs = require("node:fs/promises");
14+
DotEnv.config({ path: ".env" });
15+
DotEnv.config({ path: ".env.secret" });
1516

1617
async function main() {
1718
/* jshint maxcomplexity: 100 */
@@ -138,7 +139,7 @@ async function main() {
138139
}
139140

140141
/**
141-
* @param {DashGov.Estimate} estimate
142+
* @param {import('../dashgov.js').Estimate} estimate
142143
* @param {Number} i
143144
*/
144145
function show(estimate, i) {
@@ -238,7 +239,7 @@ async function main() {
238239
return;
239240
}
240241

241-
/** @type {DashGov.GObjectData} */
242+
/** @type {import('../dashgov.js').GObjectData} */
242243
let gobjData = DashGov.proposal.draftJson(selected, {
243244
name: proposalName,
244245
payment_address: paymentAddr,
@@ -401,7 +402,7 @@ async function main() {
401402
// params: ["check", gobj.dataHex],
402403
// })
403404
// .catch(
404-
// /** @param {Error} err */ function (err) {
405+
// /** @param {any} err */ function (err) {
405406
// console.error(err.message);
406407
// console.error(err.code);
407408
// console.error(err);
@@ -418,8 +419,8 @@ async function main() {
418419
method: "gobject",
419420
params: [
420421
"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",
423424
gobj.time.toString(),
424425
gobj.dataHex,
425426
txid,

0 commit comments

Comments
 (0)