@psf/bch-js 6.5.3 → 6.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psf/bch-js",
3
- "version": "6.5.3",
3
+ "version": "6.5.5",
4
4
  "description": "A JavaScript library for working with Bitcoin Cash, eCash, and SLP Tokens",
5
5
  "author": "Chris Troutner <chris.troutner@gmail.com>",
6
6
  "contributors": [
package/src/encryption.js CHANGED
@@ -32,6 +32,28 @@ class Encryption {
32
32
  _this = this
33
33
  }
34
34
 
35
+ /**
36
+ * @api encryption.getPubKey() getPubKey()
37
+ * @apiName Encryption getPubKey()
38
+ * @apiGroup Encryption
39
+ * @apiDescription Get the public key for an address
40
+ * Given an address, the command will search the blockchain for a public
41
+ * key associated with that address. The address needs to have made at least
42
+ * one spend transaction, in order for its public key to be retrievable.
43
+ *
44
+ * @apiExample Example usage:
45
+ *(async () => {
46
+ * try {
47
+ * const addr = 'bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d'
48
+ * const pubkey = await bchjs.encryption.getPubKey(addr);
49
+ * console.log(pubkey);
50
+ * } catch(err) {
51
+ * console.error(err)
52
+ * }
53
+ *})()
54
+ *
55
+ */
56
+
35
57
  // Search the blockchain for a public key associated with a BCH address.
36
58
  async getPubKey (addr) {
37
59
  try {
@@ -126,7 +126,7 @@ describe('#UTXO', () => {
126
126
  describe('#isValid', () => {
127
127
  it('should return true for valid UTXO with fullnode properties', async () => {
128
128
  const utxo = {
129
- txid: 'b94e1ff82eb5781f98296f0af2488ff06202f12ee92b0175963b8dba688d1b40',
129
+ txid: '260d4fb4006a330660c805327c840d569d7547b7e3e9659fb423b3a041c2e254',
130
130
  vout: 0
131
131
  }
132
132
 
@@ -138,7 +138,7 @@ describe('#UTXO', () => {
138
138
 
139
139
  it('should return true for valid UTXO with fulcrum properties', async () => {
140
140
  const utxo = {
141
- tx_hash: 'b94e1ff82eb5781f98296f0af2488ff06202f12ee92b0175963b8dba688d1b40',
141
+ tx_hash: '260d4fb4006a330660c805327c840d569d7547b7e3e9659fb423b3a041c2e254',
142
142
  tx_pos: 0
143
143
  }
144
144
 
@@ -173,7 +173,7 @@ describe('#UTXO', () => {
173
173
  })
174
174
 
175
175
  it('should process output of Utxo.get()', async () => {
176
- const utxo = await bchjs.Utxo.get('bitcoincash:qr4yscpw9jgq8ltajfeknpj32kamkf9knujffcdhyq')
176
+ const utxo = await bchjs.Utxo.get('bitcoincash:qqgahqa5zkknmhmvsc98jndpwn3r77gqgc02x03jce')
177
177
  // console.log(`utxo: ${JSON.stringify(utxo, null, 2)}`)
178
178
 
179
179
  const result = await bchjs.Utxo.isValid(utxo.bchUtxos[0])