Skip to content

Commit f974fd3

Browse files
committed
f: feat: add script to create input and internals of gobject prepare
1 parent c4c79dc commit f974fd3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

scripts/gobject-pre-prepare.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ async function main() {
5353
let gobjCollateralBytes = DashGov.serializeForCollateralTx(gobj);
5454
let gobjCollateralHex = DashGov.utils.bytesToHex(gobjCollateralBytes);
5555

56-
let crypto = globalThis.crypto;
57-
let hash1 = await crypto.subtle.digest("SHA-256", gobjCollateralBytes);
58-
let gobjCollateralHashBuf = await crypto.subtle.digest("SHA-256", hash1);
59-
let gobjCollateralHashBytes = new Uint8Array(gobjCollateralHashBuf);
60-
let gobjCollateralHashHex = DashGov.utils.bytesToHex(gobjCollateralHashBytes);
56+
let gobjHashBytes = await DashGov.proposal.doubleSha256(gobjCollateralBytes);
57+
let gobjId = DashGov.utils.bytesToHex(gobjHashBytes);
6158

6259
console.log(
6360
"gobject prepare",
@@ -70,7 +67,7 @@ async function main() {
7067
console.log(`# ${gobjCollateralHex}`);
7168
console.log();
7269
console.log(`# GObject Hash ID (will be found in collateral tx memo)`);
73-
console.log(`# ${gobjCollateralHashHex}`);
70+
console.log(`# ${gobjId}`);
7471
}
7572

7673
main()

0 commit comments

Comments
 (0)