fix: update buffer-layout to fix downstream bundler issues (#18529)

* fix: update buffer-layout to fix downstream bundler issues

* chore: run check on generated type declaration
This commit is contained in:
Justin Starry
2021-07-08 20:01:11 -05:00
committed by GitHub
parent 6188283ba6
commit 4fb1c9da26
23 changed files with 141 additions and 1196 deletions

View File

@@ -1,3 +1,5 @@
import type {Buffer} from 'buffer';
import {Connection} from '../connection';
import type {TransactionSignature} from '../transaction';
import type {ConfirmOptions} from '../connection';

View File

@@ -1,7 +1,7 @@
import {Buffer} from 'buffer';
export const toBuffer = (arr: Buffer | Uint8Array | Array<number>): Buffer => {
if (arr instanceof Buffer) {
if (Buffer.isBuffer(arr)) {
return arr;
} else if (arr instanceof Uint8Array) {
return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength);