Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9b8f08e
- Installed rescript
amit-singhs Sep 20, 2022
d004024
- Implemented initialization of all modules
amit-singhs Sep 20, 2022
6e46476
- Implemented initialization of all modules
amit-singhs Sep 20, 2022
dcff7f7
- Implemented some config initialisations
amit-singhs Sep 22, 2022
8568791
- Changed return type of `bufferFromString`
amit-singhs Sep 22, 2022
be2ebc7
- Implemented `Buffer` module from `Nodejs`
amit-singhs Sep 22, 2022
41de206
- Implemented `new` bindings
amit-singhs Sep 22, 2022
a540f35
-Initialized two more modules
amit-singhs Sep 22, 2022
1acc54e
- Renamed the `env` variables
amit-singhs Sep 23, 2022
75b9810
- Removed commented code
amit-singhs Sep 23, 2022
16bca18
- Implemented instantiation through new keyword
amit-singhs Sep 23, 2022
6741ea9
- Implemented two different modules for `ECPair`
amit-singhs Sep 26, 2022
3d22434
- Implemented module bodies for some modules
amit-singhs Sep 26, 2022
a0c5c0c
- Created an `es6` class based api to expose BchRe
amit-singhs Sep 30, 2022
0821ad0
- Added `Script` module in the returned object
amit-singhs Oct 5, 2022
1e9a9ce
- Implemented `Crypto` module
amit-singhs Oct 5, 2022
eb79e7a
- Commiting all pending files
amit-singhs Oct 5, 2022
d21cf60
- Implemented all the modules
amit-singhs Oct 5, 2022
f8ad952
- Changed the address type to `t` in Address mod
amit-singhs Oct 6, 2022
2037aba
- Changed the ECPair type to t
amit-singhs Oct 6, 2022
9c822d7
- Changed the HDNode type to t
amit-singhs Oct 6, 2022
6a6331d
- Changed `Mnemonic` type to `t`
amit-singhs Oct 6, 2022
9d14e17
- Changed the `TransactionBuilder` type to `t`
amit-singhs Oct 6, 2022
eb7604a
- Changed `BitcoinCash` type to `t`
amit-singhs Oct 6, 2022
84c98a9
- Implemented `ECPair` and `Encryption` module
amit-singhs Oct 6, 2022
a2c82f8
- Implemented `Generating` module
amit-singhs Oct 6, 2022
23d4188
- Implemented `Price` module
amit-singhs Oct 6, 2022
5564fdd
- Implemented `Script` module
amit-singhs Oct 6, 2022
287bc5a
- Implemented `Util`,`Schnorr` & `SLP` modules
amit-singhs Oct 6, 2022
9cde1b6
- Implemented `Utxo` & `Transaction` modules
amit-singhs Oct 6, 2022
8b64eed
- Implemented `DSProof` & `Ecash` module
amit-singhs Oct 6, 2022
634ac0a
- Implemented `PsfSlpIndexer` module
amit-singhs Oct 6, 2022
30ad308
- Implemented `Electrumx` module
amit-singhs Oct 6, 2022
0e80ebb
- Implemented `Control` module
amit-singhs Oct 6, 2022
eb1b204
- Implemented `Mining` module
amit-singhs Oct 6, 2022
6f54cf7
- Implemented `RawTransactions` module
amit-singhs Oct 6, 2022
1e9d800
- Implemented `Blockchain` module
amit-singhs Oct 6, 2022
d1fb56d
- Moved require method into `BitcoinCash` module
amit-singhs Oct 7, 2022
21a8bc9
- Created `require` method in `Crypto` module
amit-singhs Oct 7, 2022
8ea6276
- Implemented `require` method in `Generating` mod
amit-singhs Oct 7, 2022
0e8b9d0
- Implemented `require` method inside modules
amit-singhs Oct 7, 2022
bc7f4bf
- Removed the earlier used common`require` method
amit-singhs Oct 7, 2022
222deb1
- Removed commented code, was for new modules
amit-singhs Oct 7, 2022
c792c3e
- Removed redundant commented code
amit-singhs Oct 7, 2022
4cca033
- Corrected the `ecash`
amit-singhs Oct 7, 2022
f209ad6
- Renamed all newModule methods to `new`
amit-singhs Oct 7, 2022
85490c7
- Attempt to create a wrapped method
amit-singhs Oct 10, 2022
4e20ad6
Merge branch 'Permissionless-Software-Foundation:master' into issue/2…
Oct 10, 2022
d5b7e4a
fix(tests): Removing integration tests that trips rate limit
christroutner Oct 13, 2022
62e56c8
Merge pull request #251 from Permissionless-Software-Foundation/ct-un…
christroutner Oct 13, 2022
70b47c9
- Implemented @module and @new
amit-singhs Oct 13, 2022
e5ef85c
- Formatted the code.
amit-singhs Oct 13, 2022
9e27749
Merge branch 'master' into issue/2-create-rescript-file-for-bchjs
amit-singhs Oct 14, 2022
1d91eed
Fixing script in package.json
christroutner Oct 16, 2022
9326fd6
fix(utxo.get()): Detecting out-of-sync SLP indexer, protecting tokens
christroutner Nov 1, 2022
906d9b2
Merge pull request #252 from Permissionless-Software-Foundation/ct-un…
christroutner Nov 1, 2022
055cd7f
fix(encryption): Adding documentation for the encryption library
christroutner Dec 14, 2022
e01a18b
Merge pull request #253 from Permissionless-Software-Foundation/ct-un…
christroutner Dec 14, 2022
8eaa7ed
Merge branch 'Permissionless-Software-Foundation:master' into issue/2…
Jan 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "bch-re",
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"package-specs": [
{
"module": "commonjs",
"in-source": true
}
],
"suffix": ".bs.js",
"bs-dependencies": ["rescript-nodejs"]
}
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:integration:local:bchn": "export RESTURL=http://localhost:3000/v5/ && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
"test:integration:local:testnet": "RESTURL=http://localhost:4000/v5/ mocha --timeout 30000 test/integration/chains/testnet",
"test:integration:decatur:bchn": "export RESTURL=http://192.168.2.129:3000/v5/ && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
"test:integration:decatur:abc": "export RESTURL=http://192.168.2.141:3000/v5/ && mocha --timeout 30000 test/integration && mocha --timeout 30000 test/integration/chains/abc/",
"test:integration:decatur:abc": "export RESTURL=http://192.168.2.142:3000/v5/ && mocha --timeout 30000 test/integration && mocha --timeout 30000 test/integration/chains/abc/",
"test:integration:temp:bchn": "export RESTURL=http://157.90.174.219:3000/v5/ && mocha --timeout 30000 test/integration/",
"test:temp": "export RESTURL=http://localhost:3000/v5/ && mocha --timeout 30000 -g '#Encryption' test/integration/",
"test:temp2": "mocha --timeout=30000 -g '#TransactionLib' test/unit/",
Expand All @@ -28,7 +28,9 @@
"coverage": "nyc report --reporter=text-lcov | coveralls",
"coverage:report": "nyc --reporter=html mocha --timeout 25000 test/unit/",
"docs": "./node_modules/.bin/apidoc -i src/ -o docs",
"lint": "standard --env mocha --fix"
"lint": "standard --env mocha --fix",
"res:build": "rescript",
"res:start": "rescript build -w"
},
"license": "MIT",
"homepage": "https://github.com/Permissionless-Software-Foundation/bch-js",
Expand Down Expand Up @@ -56,6 +58,7 @@
"ecashaddrjs": "1.0.7",
"ini": "1.3.8",
"randombytes": "2.0.6",
"rescript-nodejs": "^14.3.1",
"safe-buffer": "5.1.2",
"satoshi-bitcoin": "1.0.4",
"slp-mdm": "0.0.6",
Expand All @@ -78,17 +81,13 @@
"mocha": "9.2.1",
"node-mocks-http": "1.7.0",
"nyc": "15.1.0",
"rescript": "^10.0.1",
"semantic-release": "^19.0.2",
"sinon": "9.2.2",
"standard": "^16.0.4"
},
"apidoc": {
"title": "bch-js",
"url": "bchjs."
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
}
}
22 changes: 22 additions & 0 deletions src/encryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,28 @@ class Encryption {
_this = this
}

/**
* @api encryption.getPubKey() getPubKey()
* @apiName Encryption getPubKey()
* @apiGroup Encryption
* @apiDescription Get the public key for an address
* Given an address, the command will search the blockchain for a public
* key associated with that address. The address needs to have made at least
* one spend transaction, in order for its public key to be retrievable.
*
* @apiExample Example usage:
*(async () => {
* try {
* const addr = 'bitcoincash:qqlrzp23w08434twmvr4fxw672whkjy0py26r63g3d'
* const pubkey = await bchjs.encryption.getPubKey(addr);
* console.log(pubkey);
* } catch(err) {
* console.error(err)
* }
*})()
*
*/

// Search the blockchain for a public key associated with a BCH address.
async getPubKey (addr) {
try {
Expand Down
Loading