Skip to content

Commit 748f7d8

Browse files
authored
Fix: Add extension to relative imports (#1227)
* Add js extension to relative imports * Increment package versions
1 parent 43940b8 commit 748f7d8

File tree

100 files changed

+316
-311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+316
-311
lines changed

packages/coinbase/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/coinbase",
3-
"version": "2.1.0",
3+
"version": "2.1.1-alpha.1",
44
"description": "Coinbase SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -59,6 +59,6 @@
5959
},
6060
"dependencies": {
6161
"@coinbase/wallet-sdk": "^3.0.5",
62-
"@web3-onboard/common": "^2.2.0"
62+
"@web3-onboard/common": "^2.2.1-alpha.1"
6363
}
6464
}

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/common",
3-
"version": "2.2.0",
3+
"version": "2.2.1-alpha.1",
44
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",

packages/common/src/eip-1193.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import type {
44
ChainId,
55
EIP1193Provider,
66
ProviderAccounts
7-
} from './types'
8-
import { ProviderRpcError } from './errors'
7+
} from './types.js'
8+
import { ProviderRpcError } from './errors.js'
99

1010
/**
1111
* Takes a provider instance along with events

packages/common/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ProviderRpcErrorCode } from './types'
1+
import type { ProviderRpcErrorCode } from './types.js'
22

33
export class ProviderRpcError extends Error {
44
message: string

packages/common/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export { ProviderRpcError } from './errors'
2-
export { createEIP1193Provider } from './eip-1193'
3-
export { SofiaProLight, SofiaProRegular, SofiaProSemiBold } from './fonts'
4-
export { weiToEth } from './utils'
1+
export { ProviderRpcError } from './errors.js'
2+
export { createEIP1193Provider } from './eip-1193.js'
3+
export { SofiaProLight, SofiaProRegular, SofiaProSemiBold } from './fonts.js'
4+
export { weiToEth } from './utils.js'
55

6-
export * from './types'
7-
export * from './validation'
6+
export * from './types.js'
7+
export * from './validation.js'

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.8.0",
3+
"version": "2.8.1-alpha.1",
44
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -82,7 +82,7 @@
8282
"typescript": "^4.5.5"
8383
},
8484
"dependencies": {
85-
"@web3-onboard/common": "^2.2.0",
85+
"@web3-onboard/common": "^2.2.1-alpha.1",
8686
"bignumber.js": "^9.0.0",
8787
"bnc-sdk": "^4.4.1",
8888
"bowser": "^2.11.0",

packages/core/src/chain.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { firstValueFrom } from 'rxjs'
22
import { filter, map } from 'rxjs/operators'
33
import { ProviderRpcErrorCode } from '@web3-onboard/common'
4-
import { addNewChain, switchChain } from './provider'
5-
import { state } from './store'
6-
import { switchChainModal$ } from './streams'
7-
import { validateSetChainOptions } from './validation'
8-
import type { WalletState } from './types'
9-
import { toHexString } from './utils'
4+
import { addNewChain, switchChain } from './provider.js'
5+
import { state } from './store/index.js'
6+
import { switchChainModal$ } from './streams.js'
7+
import { validateSetChainOptions } from './validation.js'
8+
import type { WalletState } from './types.js'
9+
import { toHexString } from './utils.js'
1010

1111
async function setChain(options: {
1212
chainId: string | number

packages/core/src/configuration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Configuration } from './types'
2-
import { getDevice } from './utils'
1+
import type { Configuration } from './types.js'
2+
import { getDevice } from './utils.js'
33

44
export let configuration: Configuration = {
55
svelteInstance: null,

packages/core/src/connect.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { firstValueFrom } from 'rxjs'
22
import { filter, withLatestFrom, pluck } from 'rxjs/operators'
3-
import { configuration } from './configuration'
4-
import { state } from './store'
5-
import { setWalletModules } from './store/actions'
6-
import { connectWallet$, wallets$ } from './streams'
7-
import type { ConnectOptions, ConnectOptionsString, WalletState } from './types'
8-
import { wait } from './utils'
9-
import { validateConnectOptions } from './validation'
3+
import { configuration } from './configuration.js'
4+
import { state } from './store/index.js'
5+
import { setWalletModules } from './store/actions.js'
6+
import { connectWallet$, wallets$ } from './streams.js'
7+
import type {
8+
ConnectOptions,
9+
ConnectOptionsString,
10+
WalletState
11+
} from './types.js'
12+
import { wait } from './utils.js'
13+
import { validateConnectOptions } from './validation.js'
1014

1115
async function connect(
1216
options?: ConnectOptions | ConnectOptionsString
@@ -25,8 +29,8 @@ async function connect(
2529
if (!chains.length)
2630
throw new Error(
2731
'At least one chain must be set before attempting to connect a wallet'
28-
)
29-
32+
)
33+
3034
const { autoSelect } = options || {
3135
autoSelect: { label: '', disableModals: false }
3236
}

packages/core/src/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { configuration } from './configuration'
2-
import type { AppState } from './types'
1+
import { configuration } from './configuration.js'
2+
import type { AppState } from './types.js'
33

44
export const APP_INITIAL_STATE: AppState = {
55
wallets: [],
@@ -25,7 +25,7 @@ export const APP_INITIAL_STATE: AppState = {
2525
},
2626
notifications: [],
2727
locale: '',
28-
connect : {
28+
connect: {
2929
showSidebar: true
3030
}
3131
}

packages/core/src/disconnect.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { getBlocknativeSdk } from './services'
2-
import { state } from './store'
3-
import { removeWallet } from './store/actions'
4-
import { disconnectWallet$ } from './streams'
5-
import type { DisconnectOptions, WalletState } from './types'
6-
import { validateDisconnectOptions } from './validation'
1+
import { getBlocknativeSdk } from './services.js'
2+
import { state } from './store/index.js'
3+
import { removeWallet } from './store/actions.js'
4+
import { disconnectWallet$ } from './streams.js'
5+
import type { DisconnectOptions, WalletState } from './types.js'
6+
import { validateDisconnectOptions } from './validation.js'
77

88
async function disconnect(options: DisconnectOptions): Promise<WalletState[]> {
99
const error = validateDisconnectOptions(options)

packages/core/src/i18n/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { addMessages, init, getLocaleFromNavigator } from 'svelte-i18n'
22
import merge from 'lodash.merge'
33
import en from './en.json'
4-
import type { i18nOptions } from '../types'
4+
import type { i18nOptions } from '../types.js'
55

66
function initialize(options?: i18nOptions): void {
77
if (options) {

packages/core/src/index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { SofiaProRegular } from '@web3-onboard/common'
2-
import connectWallet from './connect'
3-
import disconnectWallet from './disconnect'
4-
import setChain from './chain'
5-
import { state } from './store'
6-
import { reset$ } from './streams'
7-
import initI18N from './i18n'
2+
import connectWallet from './connect.js'
3+
import disconnectWallet from './disconnect.js'
4+
import setChain from './chain.js'
5+
import { state } from './store/index.js'
6+
import { reset$ } from './streams.js'
7+
import initI18N from './i18n/index.js'
88
import App from './views/Index.svelte'
9-
import type { InitOptions, Notify } from './types'
10-
import { APP_INITIAL_STATE } from './constants'
11-
import { configuration, updateConfiguration } from './configuration'
12-
import updateBalances from './update-balances'
13-
import { chainIdToHex } from './utils'
14-
import { preflightNotifications } from './preflight-notifications'
9+
import type { InitOptions, Notify } from './types.js'
10+
import { APP_INITIAL_STATE } from './constants.js'
11+
import { configuration, updateConfiguration } from './configuration.js'
12+
import updateBalances from './update-balances.js'
13+
import { chainIdToHex } from './utils.js'
14+
import { preflightNotifications } from './preflight-notifications.js'
1515

1616
import {
1717
validateInitOptions,
1818
validateNotify,
1919
validateNotifyOptions
20-
} from './validation'
20+
} from './validation.js'
2121

2222
import {
2323
addChains,
@@ -28,7 +28,7 @@ import {
2828
setPrimaryWallet,
2929
setWalletModules,
3030
updateConnectModal
31-
} from './store/actions'
31+
} from './store/actions.js'
3232

3333
const API = {
3434
connectWallet,
@@ -65,7 +65,7 @@ export type {
6565
Notify,
6666
UpdateNotification,
6767
PreflightNotificationsOptions
68-
} from './types'
68+
} from './types.js'
6969

7070
export type { EIP1193Provider } from '@web3-onboard/common'
7171

packages/core/src/notify.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import type {
88
CustomNotification,
99
Notification,
1010
NotificationType
11-
} from './types'
11+
} from './types.js'
1212

13-
import { validateTransactionHandlerReturn } from './validation'
14-
import { state } from './store'
15-
import { addNotification } from './store/actions'
16-
import updateBalances from './update-balances'
17-
import { updateTransaction } from './streams'
13+
import { validateTransactionHandlerReturn } from './validation.js'
14+
import { state } from './store/index.js'
15+
import { addNotification } from './store/actions.js'
16+
import updateBalances from './update-balances.js'
17+
import { updateTransaction } from './streams.js'
1818

1919
export function handleTransactionUpdates(
2020
transaction: EthereumTransactionData

packages/core/src/preflight-notifications.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { nanoid } from 'nanoid'
33
import defaultCopy from './i18n/en.json'
44
import type { Network } from 'bnc-sdk'
55

6-
import type { Notification, PreflightNotificationsOptions } from './types'
7-
import { addNotification, removeNotification } from './store/actions'
8-
import { state } from './store'
9-
import { eventToType } from './notify'
10-
import { networkToChainId } from './utils'
11-
import { validatePreflightNotifications } from './validation'
6+
import type { Notification, PreflightNotificationsOptions } from './types.js'
7+
import { addNotification, removeNotification } from './store/actions.js'
8+
import { state } from './store/index.js'
9+
import { eventToType } from './notify.js'
10+
import { networkToChainId } from './utils.js'
11+
import { validatePreflightNotifications } from './validation.js'
1212

1313
let notificationsArr: Notification[]
1414
state.select('notifications').subscribe(notifications => {
@@ -18,8 +18,6 @@ state.select('notifications').subscribe(notifications => {
1818
export async function preflightNotifications(
1919
options: PreflightNotificationsOptions
2020
): Promise<string | void> {
21-
22-
2321
const invalid = validatePreflightNotifications(options)
2422

2523
if (invalid) {

packages/core/src/provider.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import type {
1515
} from '@web3-onboard/common'
1616

1717
import { weiToEth } from '@web3-onboard/common'
18-
import { disconnectWallet$ } from './streams'
19-
import type { Account, Address, Balances, Ens, WalletState } from './types'
20-
import { updateAccount, updateWallet } from './store/actions'
21-
import { validEnsChain } from './utils'
22-
import disconnect from './disconnect'
23-
import { state } from './store'
24-
import { getBlocknativeSdk } from './services'
18+
import { disconnectWallet$ } from './streams.js'
19+
import type { Account, Address, Balances, Ens, WalletState } from './types.js'
20+
import { updateAccount, updateWallet } from './store/actions.js'
21+
import { validEnsChain } from './utils.js'
22+
import disconnect from './disconnect.js'
23+
import { state } from './store/index.js'
24+
import { getBlocknativeSdk } from './services.js'
2525

2626
export const ethersProviders: {
2727
[key: string]: providers.StaticJsonRpcProvider
@@ -340,16 +340,17 @@ export async function getBalance(
340340
): Promise<Balances | null> {
341341
// chain we don't recognize and don't have a rpcUrl for requests
342342
if (!chain) return null
343-
343+
344344
const { wallets } = state.get()
345345

346346
try {
347347
const wallet = wallets.find(wallet => !!wallet.provider)
348348
const provider = wallet.provider
349-
const balanceHex = await provider.request({ method: 'eth_getBalance', params:[address,'latest'] })
350-
return balanceHex
351-
? { [chain.token || 'eth']: weiToEth(balanceHex) }
352-
: null
349+
const balanceHex = await provider.request({
350+
method: 'eth_getBalance',
351+
params: [address, 'latest']
352+
})
353+
return balanceHex ? { [chain.token || 'eth']: weiToEth(balanceHex) } : null
353354
} catch (error) {
354355
console.error(error)
355356
return null

packages/core/src/replacement.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { EthereumTransactionData, Network } from 'bnc-sdk'
22
import { BigNumber } from 'ethers'
3-
import { configuration } from './configuration'
4-
import { state } from './store'
5-
import type { WalletState } from './types'
6-
import { gweiToWeiHex, networkToChainId, toHexString } from './utils'
3+
import { configuration } from './configuration.js'
4+
import { state } from './store/index.js'
5+
import type { WalletState } from './types.js'
6+
import { gweiToWeiHex, networkToChainId, toHexString } from './utils.js'
77

88
const ACTIONABLE_EVENT_CODES: string[] = ['txPool']
99
const VALID_GAS_NETWORKS: Network[] = ['main', 'matic-main']

packages/core/src/services.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { MultiChain } from 'bnc-sdk'
2-
import { configuration } from './configuration'
3-
import { handleTransactionUpdates } from './notify'
2+
import { configuration } from './configuration.js'
3+
import { handleTransactionUpdates } from './notify.js'
44

55
let blocknativeSdk: MultiChain
66

packages/core/src/store/actions.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Chain, WalletInit, WalletModule } from '@web3-onboard/common'
22
import { nanoid } from 'nanoid'
3-
import { dispatch } from './index'
4-
import { configuration } from '../configuration'
3+
import { dispatch } from './index.js'
4+
import { configuration } from '../configuration.js'
55

66
import type {
77
Account,
@@ -27,7 +27,7 @@ import type {
2727
Notify,
2828
ConnectModalOptions,
2929
UpdateConnectModalAction
30-
} from '../types'
30+
} from '../types.js'
3131

3232
import {
3333
validateAccountCenterUpdate,
@@ -41,7 +41,7 @@ import {
4141
validateUpdateBalances,
4242
validateNotify,
4343
validateConnectModalUpdate
44-
} from '../validation'
44+
} from '../validation.js'
4545

4646
import {
4747
ADD_CHAINS,
@@ -58,7 +58,7 @@ import {
5858
REMOVE_NOTIFICATION,
5959
UPDATE_ALL_WALLETS,
6060
UPDATE_CONNECT_MODAL
61-
} from './constants'
61+
} from './constants.js'
6262

6363
export function addChains(chains: Chain[]): void {
6464
// chains are validated on init

0 commit comments

Comments
 (0)