refactor: use buffer-layout to clean up buffer encoding
This commit is contained in:
18
web3.js/src/layout.js
Normal file
18
web3.js/src/layout.js
Normal file
@ -0,0 +1,18 @@
|
||||
// @flow
|
||||
|
||||
import * as BufferLayout from 'buffer-layout';
|
||||
|
||||
|
||||
/**
|
||||
* Layout for a public key
|
||||
*/
|
||||
export const publicKey = (property: string = 'publicKey'): Object => {
|
||||
return BufferLayout.blob(32, property);
|
||||
};
|
||||
|
||||
/**
|
||||
* Layout for a 256bit unsigned value
|
||||
*/
|
||||
export const uint256 = (property: string = 'uint256'): Object => {
|
||||
return BufferLayout.blob(32, property);
|
||||
};
|
Reference in New Issue
Block a user