Skip to content

Commit

Permalink
feat(utils): rename the method of lockScriptToHash to scriptToHash
Browse files Browse the repository at this point in the history
BREAKING CHANGE: rename the method of lockScriptToHash to scriptToHash
  • Loading branch information
Keith-CY committed Aug 23, 2019
1 parent 96eeb76 commit 40cdbaa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/ckb-sdk-utils/__tests__/ckb-utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {
bytesToHex,
utf8ToHex,
hexToUtf8,
lockScriptToHash,
scriptToHash,
PERSONAL,
} = ckbUtils

Expand Down Expand Up @@ -161,7 +161,7 @@ describe('scriptToHash', () => {
}
test.each(Object.keys(fixtures))('%s', fixtureName => {
const fixture = fixtures[fixtureName]
const lockHash = lockScriptToHash(fixture.script)
const lockHash = scriptToHash(fixture.script)
expect(lockHash).toBe(fixture.lockHash)
})
})
Expand Down
6 changes: 1 addition & 5 deletions packages/ckb-sdk-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,7 @@ export enum ScriptHashType {
Type = 'Type',
}

export const lockScriptToHash = ({
codeHash = '',
args = [],
hashType = ScriptHashType.Data,
}: CKBComponents.Script) => {
export const scriptToHash = ({ codeHash = '', args = [], hashType = ScriptHashType.Data }: CKBComponents.Script) => {
const s = blake2b(32, null, null, PERSONAL)
if (codeHash) {
s.update(hexToBytes(codeHash.replace(/^0x/, '')))
Expand Down

0 comments on commit 40cdbaa

Please sign in to comment.