Skip to content

Commit

Permalink
Merge pull request #34 from Nesopie/feat/hybrid
Browse files Browse the repository at this point in the history
feat: hybrid cjs and esm support
  • Loading branch information
junderw authored Jun 25, 2024
2 parents 316963a + 93a373a commit 6a6965b
Show file tree
Hide file tree
Showing 13 changed files with 2,968 additions and 5,968 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,14 @@ jobs:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run standard
- run: npm run standard
gitdiff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run gitdiff
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.nyc_output
coverage
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ Bitcoin Wallet Import Format encoding/decoding module.
## Example

``` javascript
var wif = require('wif')
import * as wif from "wif"
var privateKey = Buffer.from('0000000000000000000000000000000000000000000000000000000000000001', 'hex')
var key = wif.encode(128, privateKey, true) // for the testnet use: wif.encode(239, ...
var key = wif.encode({version: 128, privateKey, compressed: true}) // for the testnet use: wif.encode(239, ...
// => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

var obj = wif.decode(key)
// => {
// version: 128,
// privateKey: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01>,
// privateKey: Uint8Array(32) [
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 0, 0, 0, 0, 0,
// 0, 0, 0, 0, 1
// ],
// compressed: true
//}

Expand Down
Loading

0 comments on commit 6a6965b

Please sign in to comment.