Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"unicorn/relative-url-style": ["error", "always"],
"unicorn/throw-new-error": "error",
"unused-imports/no-unused-imports-ts": "error",
"@dimensiondev/no-bigint": "error",
"@dimensiondev/no-jsx-template-literal": "error",
"@dimensiondev/no-locale-case": "error",
"@dimensiondev/no-number-constructor": "off",
Expand Down
2 changes: 1 addition & 1 deletion packages/mask/.webpack/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export function createConfiguration(rawFlags: BuildFlags): Configuration {
destructuring: true,
forOf: true,
module: false,
bigIntLiteral: false,
bigIntLiteral: true,
// Our iOS App doesn't support dynamic import (it requires a heavy post-build time transform).
dynamicImport: !(runtime.architecture === 'app' && runtime.engine === 'safari'),
},
Expand Down
24 changes: 13 additions & 11 deletions packages/polyfills/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,29 @@ Extra:

## Supporting browsers

- Safari 13.4+ (Released on Sept 2019)
- Chrome Last 2 versions (about 3 months) (91+ at 7/23/2021)
- Firefox Last 2 versions (about 3 months) (97+ at 7/23/2021)
- Safari 14+ (Released on Sept 2020)
- Chrome Last 2 versions (about 3 months) (98+ at 3/4/2022)
- Firefox Last 2 versions (about 3 months) (97+ at 3/4/2022)
- GeckoView 91 (last updated at 7/23/2021).

## ES Syntax and APIs
## Targeting ES Syntax and APIs

We're targeting syntax and libraries to ES2020.

Fell free to add polyfill (or install it from npm).
For proposals, stage 2 or higher can be considered.
- Syntax: ES2020
- Library: ES2022 (with [core-js](https://github.com/zloirock/core-js)).

### Caution

Those features are not easy to polyfill.

- ES2017: SharedArrayBuffer and Atomics
- ES2018: - (Syntax) RegExp Lookbehind Assertions (Safari not supported)
- ES2020: BigInt (requires Safari 15)
- ES2020:
- BigInt64Array (requires Safari 15)
- BigUint64Array (requires Safari 15)
- DataView.prototype.getBigInt64 (requires Safari 15)
- DataView.prototype.getBigUint64 (requires Safari 15)
- ES2021:
- WeakReference (requires Safari 15)
- (Syntax) Logical Assignment (requires Safari 14)
- ES2022:
- ⭐ C l a s s ⭐ F i e l d s ⭐ (requires Safari 15)
- Class initialization block (Safari not supported, Firefox 93+)
Expand All @@ -44,7 +47,6 @@ Check and polyfill before using.
### Simply polyfilled

- Intl.ListFormat
- EventTarget.constructor (requires Safari 14)

### Using polyfill

Expand Down
4 changes: 2 additions & 2 deletions packages/polyfills/builder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let polyfillVersion = '__'
const lockfile = await readFile(lockfilePath)
const hash = createHash('sha256')
hash.update(lockfile)
polyfillVersion = 'v3' + hash.digest('hex')
polyfillVersion = 'v4' + hash.digest('hex')
}

const versionFilePath = fileURLToPath(new URL('./dist/version.txt', import.meta.url))
Expand All @@ -29,7 +29,7 @@ if ((await readFile(versionFilePath, 'utf-8').catch(() => '')) === polyfillVersi
await builder({
modules: ['es', 'web'],
targets: [
'iOS >= 13.4',
'iOS >= 14.0',
// Android
'Firefox >= 91',
'last 2 Chrome versions',
Expand Down
Empty file.

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions packages/polyfills/web-apis/worker.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import './implementation/EventTarget.constructor'
import './implementation/Blob.prototype.arrayBuffer'
export {}
3 changes: 1 addition & 2 deletions packages/web3-kit/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// bigint is not in our list. iOS doesn't support that.
export type Primitive = string | number | boolean | symbol | undefined | null
export type Primitive = string | number | boolean | symbol | undefined | null | bigint
3 changes: 1 addition & 2 deletions packages/web3-shared/evm/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ export interface CryptoPrice {
export type ChainIdOptionalRecord<T> = { [k in ChainId]?: T }
export type ChainIdRecord<T> = { [k in ChainId]: T }

// bigint is not in our list. iOS doesn't support that.
export type Primitive = string | number | boolean | symbol | undefined | null
export type Primitive = string | number | boolean | symbol | undefined | null | bigint

export type Web3Constants = Record<string, { [K in ChainId]: Primitive | Primitive[] }>

Expand Down