@web3auth/modal 10.5.4 → 10.5.6
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.
- package/dist/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/react/wagmi/provider.js +15 -1
- package/dist/lib.cjs/packages/modal/src/vue/wagmi/provider.js +15 -1
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/react/wagmi/provider.js +16 -2
- package/dist/lib.esm/packages/modal/src/vue/wagmi/provider.js +16 -2
- package/dist/modal.umd.min.js +1 -1
- package/package.json +3 -3
|
@@ -130,6 +130,20 @@ function WagmiProvider(_ref) {
|
|
|
130
130
|
web3Auth,
|
|
131
131
|
isInitialized
|
|
132
132
|
} = useWeb3Auth.useWeb3Auth();
|
|
133
|
+
const getTransport = chain => {
|
|
134
|
+
const {
|
|
135
|
+
wsTarget,
|
|
136
|
+
rpcTarget,
|
|
137
|
+
fallbackWsTargets = [],
|
|
138
|
+
fallbackRpcTargets = []
|
|
139
|
+
} = chain;
|
|
140
|
+
const transports = [];
|
|
141
|
+
if (wsTarget) transports.push(viem.webSocket(wsTarget));
|
|
142
|
+
if (fallbackWsTargets.length > 0) transports.push(...fallbackWsTargets.map(target => viem.webSocket(target)));
|
|
143
|
+
if (rpcTarget) transports.push(viem.http(rpcTarget));
|
|
144
|
+
if (fallbackRpcTargets.length > 0) transports.push(...fallbackRpcTargets.map(target => viem.http(target)));
|
|
145
|
+
return wagmi.fallback(transports);
|
|
146
|
+
};
|
|
133
147
|
const finalConfig = react.useMemo(() => {
|
|
134
148
|
var _web3Auth$coreOptions;
|
|
135
149
|
web3Auth === null || web3Auth === void 0 || web3Auth.setAnalyticsProperties({
|
|
@@ -180,7 +194,7 @@ function WagmiProvider(_ref) {
|
|
|
180
194
|
} else {
|
|
181
195
|
wagmiChains.push(wagmiChain);
|
|
182
196
|
}
|
|
183
|
-
finalConfig.transports[wagmiChain.id] =
|
|
197
|
+
finalConfig.transports[wagmiChain.id] = getTransport(chain);
|
|
184
198
|
});
|
|
185
199
|
finalConfig.chains = [wagmiChains[0], ...wagmiChains.slice(1)];
|
|
186
200
|
}
|
|
@@ -141,6 +141,20 @@ const WagmiProvider = vue.defineComponent({
|
|
|
141
141
|
} = useWeb3Auth.useWeb3Auth();
|
|
142
142
|
const finalConfig = vue.shallowRef(constants.defaultWagmiConfig);
|
|
143
143
|
const configKey = vue.ref(auth.randomId());
|
|
144
|
+
const getTransport = chain => {
|
|
145
|
+
const {
|
|
146
|
+
wsTarget,
|
|
147
|
+
rpcTarget,
|
|
148
|
+
fallbackWsTargets = [],
|
|
149
|
+
fallbackRpcTargets = []
|
|
150
|
+
} = chain;
|
|
151
|
+
const transports = [];
|
|
152
|
+
if (wsTarget) transports.push(viem.webSocket(wsTarget));
|
|
153
|
+
if (fallbackWsTargets.length > 0) transports.push(...fallbackWsTargets.map(target => viem.webSocket(target)));
|
|
154
|
+
if (rpcTarget) transports.push(viem.http(rpcTarget));
|
|
155
|
+
if (fallbackRpcTargets.length > 0) transports.push(...fallbackRpcTargets.map(target => viem.http(target)));
|
|
156
|
+
return viem.fallback(transports);
|
|
157
|
+
};
|
|
144
158
|
const defineWagmiConfig = () => {
|
|
145
159
|
var _web3Auth$value;
|
|
146
160
|
const configParams = _objectSpread(_objectSpread({
|
|
@@ -187,7 +201,7 @@ const WagmiProvider = vue.defineComponent({
|
|
|
187
201
|
} else {
|
|
188
202
|
wagmiChains.push(wagmiChain);
|
|
189
203
|
}
|
|
190
|
-
configParams.transports[wagmiChain.id] =
|
|
204
|
+
configParams.transports[wagmiChain.id] = getTransport(chain);
|
|
191
205
|
});
|
|
192
206
|
configParams.chains = [wagmiChains[0], ...wagmiChains.slice(1)];
|
|
193
207
|
}
|
|
@@ -3,7 +3,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
3
3
|
import { CHAIN_NAMESPACES, WalletInitializationError, log } from '@web3auth/no-modal';
|
|
4
4
|
import { useMemo, createElement, useEffect, Fragment } from 'react';
|
|
5
5
|
import { defineChain, webSocket, http } from 'viem';
|
|
6
|
-
import { createConfig, WagmiProvider as WagmiProvider$1, useConfig, useReconnect, useAccountEffect } from 'wagmi';
|
|
6
|
+
import { createConfig, WagmiProvider as WagmiProvider$1, fallback, useConfig, useReconnect, useAccountEffect } from 'wagmi';
|
|
7
7
|
import { injected } from 'wagmi/connectors';
|
|
8
8
|
import '@babel/runtime/helpers/defineProperty';
|
|
9
9
|
import '@web3auth/auth';
|
|
@@ -129,6 +129,20 @@ function WagmiProvider(_ref) {
|
|
|
129
129
|
web3Auth,
|
|
130
130
|
isInitialized
|
|
131
131
|
} = useWeb3Auth();
|
|
132
|
+
const getTransport = chain => {
|
|
133
|
+
const {
|
|
134
|
+
wsTarget,
|
|
135
|
+
rpcTarget,
|
|
136
|
+
fallbackWsTargets = [],
|
|
137
|
+
fallbackRpcTargets = []
|
|
138
|
+
} = chain;
|
|
139
|
+
const transports = [];
|
|
140
|
+
if (wsTarget) transports.push(webSocket(wsTarget));
|
|
141
|
+
if (fallbackWsTargets.length > 0) transports.push(...fallbackWsTargets.map(target => webSocket(target)));
|
|
142
|
+
if (rpcTarget) transports.push(http(rpcTarget));
|
|
143
|
+
if (fallbackRpcTargets.length > 0) transports.push(...fallbackRpcTargets.map(target => http(target)));
|
|
144
|
+
return fallback(transports);
|
|
145
|
+
};
|
|
132
146
|
const finalConfig = useMemo(() => {
|
|
133
147
|
var _web3Auth$coreOptions;
|
|
134
148
|
web3Auth === null || web3Auth === void 0 || web3Auth.setAnalyticsProperties({
|
|
@@ -179,7 +193,7 @@ function WagmiProvider(_ref) {
|
|
|
179
193
|
} else {
|
|
180
194
|
wagmiChains.push(wagmiChain);
|
|
181
195
|
}
|
|
182
|
-
finalConfig.transports[wagmiChain.id] =
|
|
196
|
+
finalConfig.transports[wagmiChain.id] = getTransport(chain);
|
|
183
197
|
});
|
|
184
198
|
finalConfig.chains = [wagmiChains[0], ...wagmiChains.slice(1)];
|
|
185
199
|
}
|
|
@@ -4,7 +4,7 @@ import { useConfig, useReconnect, useAccountEffect, configKey, createConfig } fr
|
|
|
4
4
|
import { injected } from '@wagmi/vue/connectors';
|
|
5
5
|
import { randomId } from '@web3auth/auth';
|
|
6
6
|
import { log, CHAIN_NAMESPACES, WalletInitializationError } from '@web3auth/no-modal';
|
|
7
|
-
import { defineChain, webSocket, http } from 'viem';
|
|
7
|
+
import { defineChain, webSocket, http, fallback } from 'viem';
|
|
8
8
|
import { defineComponent, h, watch, provide, shallowRef, ref } from 'vue';
|
|
9
9
|
import '@web3auth/no-modal/vue';
|
|
10
10
|
import { useWeb3Auth } from '../composables/useWeb3Auth.js';
|
|
@@ -142,6 +142,20 @@ const WagmiProvider = defineComponent({
|
|
|
142
142
|
} = useWeb3Auth();
|
|
143
143
|
const finalConfig = shallowRef(defaultWagmiConfig);
|
|
144
144
|
const configKey = ref(randomId());
|
|
145
|
+
const getTransport = chain => {
|
|
146
|
+
const {
|
|
147
|
+
wsTarget,
|
|
148
|
+
rpcTarget,
|
|
149
|
+
fallbackWsTargets = [],
|
|
150
|
+
fallbackRpcTargets = []
|
|
151
|
+
} = chain;
|
|
152
|
+
const transports = [];
|
|
153
|
+
if (wsTarget) transports.push(webSocket(wsTarget));
|
|
154
|
+
if (fallbackWsTargets.length > 0) transports.push(...fallbackWsTargets.map(target => webSocket(target)));
|
|
155
|
+
if (rpcTarget) transports.push(http(rpcTarget));
|
|
156
|
+
if (fallbackRpcTargets.length > 0) transports.push(...fallbackRpcTargets.map(target => http(target)));
|
|
157
|
+
return fallback(transports);
|
|
158
|
+
};
|
|
145
159
|
const defineWagmiConfig = () => {
|
|
146
160
|
var _web3Auth$value;
|
|
147
161
|
const configParams = _objectSpread(_objectSpread({
|
|
@@ -188,7 +202,7 @@ const WagmiProvider = defineComponent({
|
|
|
188
202
|
} else {
|
|
189
203
|
wagmiChains.push(wagmiChain);
|
|
190
204
|
}
|
|
191
|
-
configParams.transports[wagmiChain.id] =
|
|
205
|
+
configParams.transports[wagmiChain.id] = getTransport(chain);
|
|
192
206
|
});
|
|
193
207
|
configParams.chains = [wagmiChains[0], ...wagmiChains.slice(1)];
|
|
194
208
|
}
|