gitmark 0.0.28 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/git-mark-init +26 -4
- package/package.json +1 -1
package/bin/git-mark-init
CHANGED
|
@@ -76,7 +76,7 @@ function getNewSecret() {
|
|
|
76
76
|
|
|
77
77
|
// get secret
|
|
78
78
|
// generate secret if none
|
|
79
|
-
if (data.secret) {
|
|
79
|
+
if (!data.secret) {
|
|
80
80
|
console.log('no secret found')
|
|
81
81
|
var newsecret = getNewSecret()
|
|
82
82
|
console.log('newsecret', newsecret)
|
|
@@ -102,21 +102,43 @@ var { address } = bitcoin.payments.p2pkh({
|
|
|
102
102
|
})
|
|
103
103
|
console.log('pubkey address computed from private', address)
|
|
104
104
|
|
|
105
|
-
// todo: put all in config, if not there
|
|
105
|
+
// todo: put all in config, if not there, check
|
|
106
|
+
console.log('run')
|
|
107
|
+
console.log(`git config gitmark.secret ${data.secret}`)
|
|
108
|
+
console.log(`git config gitmark.address ${address}`)
|
|
109
|
+
console.log(`git config gitmark.sshkey ${data.sshkey}`)
|
|
110
|
+
console.log(`git config gitmark.salt pwd`)
|
|
111
|
+
console.log(`git config gitmark.faucet ${data.faucet}`)
|
|
106
112
|
|
|
107
113
|
|
|
108
114
|
// get faucet
|
|
109
115
|
console.log('faucet', data.faucet)
|
|
110
116
|
|
|
111
117
|
// add to faucet
|
|
112
|
-
console.log('type', address, 'into', data.faucet, 'and wait for tx to get in a block')
|
|
118
|
+
console.log('type', address, 'into', data.faucet, 'and wait for tx to get in a block or try')
|
|
119
|
+
console.log(`curl ${data.faucet}/?address=${address}`)
|
|
120
|
+
console.log(`curl ${data.faucet}/webcredits/webledger.json`)
|
|
113
121
|
|
|
114
122
|
// todo get tx value
|
|
123
|
+
var cmd = `sleep 0.4 ; curl ${data.faucet}/webcredits/webledger.json`
|
|
124
|
+
var ledger = JSON.parse($(cmd).toString())
|
|
125
|
+
console.log(ledger)
|
|
115
126
|
|
|
116
127
|
// todo print to screen
|
|
128
|
+
function findValueByPrefix(object, prefix) {
|
|
129
|
+
for (var property in object) {
|
|
130
|
+
if (object.hasOwnProperty(property) &&
|
|
131
|
+
property.toString().startsWith(prefix)) {
|
|
132
|
+
return property.split(':')[1];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var tx = findValueByPrefix(ledger, "txo:");
|
|
138
|
+
console.log('tx', tx)
|
|
117
139
|
|
|
118
140
|
// create gitmark.json
|
|
119
141
|
console.log('create gitmark.json and check in files')
|
|
120
142
|
|
|
121
143
|
// git mark genesis
|
|
122
|
-
console.log('
|
|
144
|
+
console.log('git mark --genesis ', tx)
|