psffpp 1.1.4 → 1.1.6

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.
Files changed (2) hide show
  1. package/index.js +9 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -124,6 +124,8 @@ class PSFFPP {
124
124
  // transactions: a Proof-of-Burn (pobTxid) and a Pin Claim (climTxid). The
125
125
  // function returns an object with the transaction ID of those two transacions.
126
126
  async createPinClaim (inObj = {}) {
127
+ let targetAddr
128
+
127
129
  try {
128
130
  const { cid, filename, fileSizeInMegabytes } = inObj
129
131
 
@@ -151,6 +153,12 @@ class PSFFPP {
151
153
  // const WRITE_PRICE = 0.08335233 // Cost in PSF tokens to pin 1MB
152
154
  const PSF_TOKEN_ID = '38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0'
153
155
 
156
+ // Get info and libraries from the wallet.
157
+ const addr = this.wallet.walletInfo.address
158
+ targetAddr = addr
159
+ const bchjs = this.wallet.bchjs
160
+ const wif = this.wallet.walletInfo.privateKey
161
+
154
162
  // Calculate the write cost
155
163
  const dataCost = writePrice * fileSizeInMegabytes
156
164
  const minCost = writePrice
@@ -161,11 +169,6 @@ class PSFFPP {
161
169
  const pobTxid = await this.wallet.burnTokens(actualCost, PSF_TOKEN_ID)
162
170
  // console.log(`Proof-of-burn TX: ${pobTxid}`)
163
171
 
164
- // Get info and libraries from the wallet.
165
- const addr = this.wallet.walletInfo.address
166
- const bchjs = this.wallet.bchjs
167
- const wif = this.wallet.walletInfo.privateKey
168
-
169
172
  // Get a UTXO to spend to generate the pin claim TX.
170
173
  let utxos = await this.wallet.getUtxos()
171
174
  utxos = utxos.bchUtxos
@@ -236,7 +239,7 @@ class PSFFPP {
236
239
  claimTxid
237
240
  }
238
241
  } catch (err) {
239
- console.error('Error in ps010/createPinClaim()')
242
+ console.error(`Error in psffpp/createPinClaim() with target addr ${targetAddr}`)
240
243
  throw err
241
244
  }
242
245
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "psffpp",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "PS010 PSF File Pinning Protocol",
5
5
  "main": "index.js",
6
6
  "type": "module",