import { Buffer } from 'buffer'

/** tronweb / WalletConnect 等库在浏览器里会用到 Node 的 Buffer、global */
type GlobalPolyfills = typeof globalThis & { Buffer?: typeof Buffer; global?: typeof globalThis }

const g = globalThis as GlobalPolyfills
if (g.Buffer === undefined) {
  g.Buffer = Buffer
}
if (g.global === undefined) {
  g.global = globalThis
}
