@wagmi/connectors 5.3.10 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export const version = '5.3.10';
1
+ export const version = '5.5.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAA"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { CoinbaseWalletSDK, Preference, ProviderInterface } from '@coinbase/wallet-sdk';
1
+ import type { Preference, ProviderInterface, createCoinbaseWalletSDK } from '@coinbase/wallet-sdk';
2
2
  import type { Compute, Mutable, Omit } from '@wagmi/core/internal';
3
3
  import type { CoinbaseWalletProvider as CBW_Provider, CoinbaseWalletSDK as CBW_SDK } from 'cbw-sdk';
4
4
  type Version = '3' | '4';
@@ -22,12 +22,12 @@ export declare function coinbaseWallet<version extends Version>(parameters?: Coi
22
22
  export declare namespace coinbaseWallet {
23
23
  var type: "coinbaseWallet";
24
24
  }
25
- type Version4Parameters = Mutable<Omit<ConstructorParameters<typeof CoinbaseWalletSDK>[0], 'appChainIds'> & {
25
+ type Version4Parameters = Mutable<Omit<Parameters<typeof createCoinbaseWalletSDK>[0], 'appChainIds' | 'preference'> & {
26
26
  /**
27
27
  * Preference for the type of wallet to display.
28
28
  * @default 'all'
29
29
  */
30
- preference?: Preference['options'] | undefined;
30
+ preference?: Preference['options'] | Compute<Preference> | undefined;
31
31
  }>;
32
32
  declare function version4(parameters: Version4Parameters): import("@wagmi/core").CreateConnectorFn<ProviderInterface & {
33
33
  close?(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"coinbaseWallet.d.ts","sourceRo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CAAA;CACpC,GAAG,kBAAkB,CACvB,CAAA;AAGP,wBAAgB,cAAc,CAAC,OAAO,SAAS,OAAO,EACpD,UAAU,GAAE,wBAAwB,CAAC,OAAO,CAAa,GACxD,OAAO,SAAS,GAAG,GAClB,UAAU,CAAC,OAAO,QAAQ,CAAC,GAC3B,UAAU,CAAC,OAAO,QAAQ,CAAC,CAI9B;yBARe,cAAc;;;AAU9B,KAAK,kBAAkB,GAAG,OAAO,CAC/B,IAAI,CACF,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAC3C,aAAa,GACb,YAAY,CACf,GAAG;IAEF;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;CACrE,CACF,CAAA;AAED,iBAAS,QAAQ,CAAC,UAAU,EAAE,kBAAkB;cAGlC,IAAI;qDA6MjB;AAED,KAAK,kBAAkB,GAAG,OAAO,CAC/B,IAAI,CACF,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,EACxC,oBAAoB,CACrB,CACF,GAAG;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACzC,CAAA;AAED,iBAAS,QAAQ,CAAC,UAAU,EAAE,kBAAkB,2GA2N/C"}
@@ -1,2 +1,2 @@
1
- export declare const version = "5.3.10";
1
+ export declare const version = "5.5.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAA"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wagmi/connectors",
3
3
  "description": "Collection of connectors for Wagmi",
4
- "version": "5.3.10",
4
+ "version": "5.5.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "peerDependencies": {
31
31
  "typescript": ">=5.0.4",
32
32
  "viem": "2.x",
33
- "@wagmi/core": "2.14.6"
33
+ "@wagmi/core": "2.15.0"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "typescript": {
@@ -1,7 +1,7 @@
1
1
  import type {
2
- CoinbaseWalletSDK,
3
2
  Preference,
4
3
  ProviderInterface,
4
+ createCoinbaseWalletSDK,
5
5
  } from '@coinbase/wallet-sdk'
6
6
  import {
7
7
  ChainNotConfiguredError,
@@ -62,14 +62,16 @@ export function coinbaseWallet<version extends Version>(
62
62
 
63
63
  type Version4Parameters = Mutable<
64
64
  Omit<
65
- ConstructorParameters<typeof CoinbaseWalletSDK>[0],
66
- 'appChainIds' // set via wagmi config
65
+ Parameters<typeof createCoinbaseWalletSDK>[0],
66
+ | 'appChainIds' // set via wagmi config
67
+ | 'preference'
67
68
  > & {
69
+ // TODO(v3): Remove `Preference['options']`
68
70
  /**
69
71
  * Preference for the type of wallet to display.
70
72
  * @default 'all'
71
73
  */
72
- preference?: Preference['options'] | undefined
74
+ preference?: Preference['options'] | Compute<Preference> | undefined
73
75
  }
74
76
  >
75
77
 
@@ -79,7 +81,6 @@ function version4(parameters: Version4Parameters) {
79
81
  close?(): void
80
82
  }
81
83
 
82
- let sdk: CoinbaseWalletSDK | undefined
83
84
  let walletProvider: Provider | undefined
84
85
 
85
86
  let accountsChanged: Connector['onAccountsChanged'] | undefined
@@ -90,7 +91,6 @@ function version4(parameters: Version4Parameters) {
90
91
  id: 'coinbaseWalletSDK',
91
92
  name: 'Coinbase Wallet',
92
93
  rdns: 'com.coinbase.wallet',
93
- supportsSimulation: true,
94
94
  type: coinbaseWallet.type,
95
95
  async connect({ chainId } = {}) {
96
96
  try {
@@ -171,27 +171,23 @@ function version4(parameters: Version4Parameters) {
171
171
  },
172
172
  async getProvider() {
173
173
  if (!walletProvider) {
174
- // Unwrapping import for Vite compatibility.
175
- // See: https://github.com/vitejs/vite/issues/9703
176
- const CoinbaseWalletSDK = await (async () => {
177
- const SDK = await import('@coinbase/wallet-sdk')
178
- if (
179
- typeof SDK.CoinbaseWalletSDK !== 'function' &&
180
- typeof SDK.default === 'function'
181
- )
182
- return SDK.default
183
- return SDK.CoinbaseWalletSDK
174
+ const preference = (() => {
175
+ if (typeof parameters.preference === 'string')
176
+ return { options: parameters.preference }
177
+ return {
178
+ ...parameters.preference,
179
+ options: parameters.preference?.options ?? 'all',
180
+ }
184
181
  })()
185
182
 
186
- sdk = new CoinbaseWalletSDK({
183
+ const { createCoinbaseWalletSDK } = await import('@coinbase/wallet-sdk')
184
+ const sdk = createCoinbaseWalletSDK({
187
185
  ...parameters,
188
186
  appChainIds: config.chains.map((x) => x.id),
187
+ preference,
189
188
  })
190
189
 
191
- walletProvider = sdk.makeWeb3Provider({
192
- ...parameters,
193
- options: parameters.preference ?? 'all',
194
- })
190
+ walletProvider = sdk.getProvider()
195
191
  }
196
192
 
197
193
  return walletProvider
@@ -327,7 +323,6 @@ function version3(parameters: Version3Parameters) {
327
323
  return createConnector<Provider>((config) => ({
328
324
  id: 'coinbaseWalletSDK',
329
325
  name: 'Coinbase Wallet',
330
- supportsSimulation: true,
331
326
  type: coinbaseWallet.type,
332
327
  async connect({ chainId } = {}) {
333
328
  try {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.3.10'
1
+ export const version = '5.5.0'