Fix Buffer warning

This commit is contained in:
Amir Bandeali
2019-09-01 19:14:28 -07:00
parent 18b65a61ff
commit 9974e10069
4 changed files with 5 additions and 5 deletions

View File

@@ -6,8 +6,8 @@ import { constants } from '../../utils/constants';
import { CalldataBlock } from '../calldata_block';
export class PointerCalldataBlock extends CalldataBlock {
public static readonly RAW_DATA_START = new Buffer('<');
public static readonly RAW_DATA_END = new Buffer('>');
public static readonly RAW_DATA_START = Buffer.from('<');
public static readonly RAW_DATA_END = Buffer.from('>');
private static readonly _DEPENDENT_PAYLOAD_SIZE_IN_BYTES = 32;
private static readonly _EMPTY_HEADER_SIZE = 0;
private readonly _parent: CalldataBlock;

View File

@@ -38,7 +38,7 @@ export class SetCalldataBlock extends CalldataBlock {
if (this._header !== undefined) {
return this._header;
}
return new Buffer('');
return Buffer.from('');
}
public getMembers(): CalldataBlock[] {

View File

@@ -84,7 +84,7 @@ abstract class BaseIterator implements Iterable<CalldataBlock> {
}
return {
done: true,
value: new BlobCalldataBlock('', '', '', new Buffer('')),
value: new BlobCalldataBlock('', '', '', Buffer.from('')),
};
},
};

View File

@@ -27,7 +27,7 @@ export class StringDataType extends AbstractBlobDataType {
public encodeValue(value: string): Buffer {
// Encoded value is of the form: <length><value>, with each field padded to be word-aligned.
// 1/3 Construct the value
const valueBuf = new Buffer(value);
const valueBuf = Buffer.from(value);
const valueLengthInBytes = valueBuf.byteLength;
const wordsToStoreValuePadded = Math.ceil(valueLengthInBytes / constants.EVM_WORD_WIDTH_IN_BYTES);
const bytesToStoreValuePadded = wordsToStoreValuePadded * constants.EVM_WORD_WIDTH_IN_BYTES;