Skip to content

Commit

Permalink
feat(core): add address module into core module
Browse files Browse the repository at this point in the history
add method of core.generateAddress(privateKey) for generating address object
  • Loading branch information
Keith-CY committed May 15, 2019
1 parent fc22aa9 commit d5d75ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ckb-sdk-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"url": "https://github.com/nervosnetwork/ckb-sdk-js/issues"
},
"dependencies": {
"@nervosnetwork/ckb-sdk-address": "0.11.0",
"@nervosnetwork/ckb-sdk-rpc": "0.11.0",
"@nervosnetwork/ckb-sdk-utils": "0.11.0",
"@nervosnetwork/ckb-types": "0.11.0"
Expand Down
8 changes: 8 additions & 0 deletions packages/ckb-sdk-core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import RPC from '@nervosnetwork/ckb-sdk-rpc'
import Address from '@nervosnetwork/ckb-sdk-address'
import * as utils from '@nervosnetwork/ckb-sdk-utils'

class Core {
Expand Down Expand Up @@ -34,6 +35,13 @@ class Core {
public get utils() {
return this._utils
}

public generateAddress = (privateKey: string) =>
new Address(privateKey, {
prefix: utils.AddressPrefix.Mainnet,
type: utils.AddressType.BinIdx,
binIdx: utils.AddressBinIdx.P2PH,
})
}

export default Core

0 comments on commit d5d75ec

Please sign in to comment.