Fix Buffer warning
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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[] {
|
||||
|
||||
@@ -84,7 +84,7 @@ abstract class BaseIterator implements Iterable<CalldataBlock> {
|
||||
}
|
||||
return {
|
||||
done: true,
|
||||
value: new BlobCalldataBlock('', '', '', new Buffer('')),
|
||||
value: new BlobCalldataBlock('', '', '', Buffer.from('')),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user