Skip to content

Commit bf08c48

Browse files
authored
Merge pull request #524 from fmorency/bump-web3auth-9
chore: bump web3auth to 9.5.0
2 parents 4f79057 + 6ce7587 commit bf08c48

File tree

6 files changed

+565
-610
lines changed

6 files changed

+565
-610
lines changed

wallets/web3auth/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
"@cosmos-kit/core": "^2.15.1",
6161
"@solana/web3.js": "^1.77.3",
6262
"@toruslabs/eccrypto": "^2.1.1",
63-
"@web3auth/base": "^8.12.4",
64-
"@web3auth/base-provider": "^8.12.4",
65-
"@web3auth/ethereum-provider": "^8.12.4",
66-
"@web3auth/no-modal": "^8.12.4",
67-
"@web3auth/openlogin-adapter": "^8.12.4",
68-
"@web3auth/solana-provider": "^8.12.4",
63+
"@web3auth/base": "^9.5.0",
64+
"@web3auth/base-provider": "^9.5.0",
65+
"@web3auth/ethereum-provider": "^9.5.0",
66+
"@web3auth/no-modal": "^9.5.0",
67+
"@web3auth/auth-adapter": "^9.5.0",
68+
"@web3auth/solana-provider": "^9.5.0",
6969
"ethereum-cryptography": "^2.1.2",
7070
"url": "^0.11.1"
7171
},

wallets/web3auth/src/extension/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { OfflineDirectSigner } from '@cosmjs/proto-signing';
44
import { DappEnv, WalletClient } from '@cosmos-kit/core';
55
import { makeADR36AminoSignDoc } from '@keplr-wallet/cosmos';
66
import eccrypto from '@toruslabs/eccrypto';
7+
import { LOGIN_PROVIDER } from '@web3auth/auth-adapter';
78
import { UserInfo } from '@web3auth/base';
8-
import { LOGIN_PROVIDER } from '@web3auth/openlogin-adapter';
99

1010
import { Web3AuthSigner } from './signer';
1111
import { Web3AuthClientOptions } from './types';

wallets/web3auth/src/extension/main-wallet.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MainWalletBase } from '@cosmos-kit/core';
2-
import { getHashQueryParams } from '@toruslabs/openlogin';
3-
import { OPENLOGIN_NETWORK } from '@web3auth/openlogin-adapter';
2+
import { getHashQueryParams } from '@web3auth/auth-adapter';
3+
import { WEB3AUTH_NETWORK } from '@web3auth/base';
44

55
import { Web3AuthChainWallet } from './chain-wallet';
66
import { Web3AuthClient } from './client';
@@ -29,7 +29,7 @@ export class Web3AuthWallet extends MainWalletBase {
2929

3030
if (
3131
typeof options.client?.web3AuthNetwork !== 'string' ||
32-
!Object.values(OPENLOGIN_NETWORK).includes(
32+
!Object.values(WEB3AUTH_NETWORK).includes(
3333
options.client.web3AuthNetwork
3434
)
3535
) {
@@ -69,9 +69,7 @@ export class Web3AuthWallet extends MainWalletBase {
6969
return;
7070
}
7171

72-
// Same logic used in `@web3auth/openlogin-adapter` >
73-
// `@toruslabs/openlogin` init function to determine if the adapter should
74-
// attempt to connect from the redirect.
72+
// Same logic used in `@web3auth/auth-adapter` >
7573
const redirectResult = getHashQueryParams();
7674
const shouldAutoConnect =
7775
Object.keys(redirectResult).length > 0 &&

wallets/web3auth/src/extension/types.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { AminoSignResponse, StdSignDoc } from '@cosmjs/amino';
22
import { AccountData, DirectSignResponse } from '@cosmjs/proto-signing';
33
import { Wallet } from '@cosmos-kit/core';
44
import { Ecies } from '@toruslabs/eccrypto';
5-
import { Web3AuthNoModalOptions } from '@web3auth/base';
65
import {
76
LOGIN_PROVIDER_TYPE,
8-
OPENLOGIN_NETWORK_TYPE,
9-
} from '@web3auth/openlogin-adapter';
7+
WEB3AUTH_NETWORK_TYPE,
8+
} from '@web3auth/auth-adapter';
9+
import { Web3AuthNoModalOptions } from '@web3auth/base';
1010
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
1111

1212
export type Web3AuthWalletInfo = Wallet & { options: Web3AuthClientOptions };
@@ -24,7 +24,7 @@ export type Web3AuthClientOptions = {
2424
// Web3Auth client options.
2525
client: {
2626
clientId: string;
27-
web3AuthNetwork: OPENLOGIN_NETWORK_TYPE;
27+
web3AuthNetwork: WEB3AUTH_NETWORK_TYPE;
2828
} & Omit<Web3AuthNoModalOptions, 'chainConfig'> & {
2929
chainConfig?: Omit<
3030
Web3AuthNoModalOptions['chainConfig'],

wallets/web3auth/src/extension/utils.ts

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import { sha256 } from '@cosmjs/crypto';
22
import { toUtf8 } from '@cosmjs/encoding';
33
import eccrypto, { Ecies } from '@toruslabs/eccrypto';
4+
import { AuthAdapter, AuthLoginParams } from '@web3auth/auth-adapter';
45
import {
56
ADAPTER_STATUS,
67
CHAIN_NAMESPACES,
78
CustomChainConfig,
89
SafeEventEmitterProvider,
10+
UX_MODE,
911
WALLET_ADAPTERS,
1012
} from '@web3auth/base';
1113
import { CommonPrivateKeyProvider } from '@web3auth/base-provider';
1214
import { Web3AuthNoModal } from '@web3auth/no-modal';
13-
import {
14-
OpenloginAdapter,
15-
OpenloginLoginParams,
16-
UX_MODE,
17-
} from '@web3auth/openlogin-adapter';
1815

1916
import {
2017
FromWorkerMessage,
@@ -126,15 +123,21 @@ export const connectClientAndProvider = async (
126123
chainId: 'other',
127124
rpcTarget: 'other',
128125
displayName: 'other',
129-
blockExplorer: 'other',
126+
blockExplorerUrl: 'other',
130127
ticker: 'other',
131128
tickerName: 'other',
132129
...options.client.chainConfig,
133130
chainNamespace: CHAIN_NAMESPACES.OTHER,
134131
};
132+
const privateKeyProvider = new CommonPrivateKeyProvider({
133+
config: {
134+
chainConfig,
135+
},
136+
});
135137
const client = new Web3AuthNoModal({
136138
...options.client,
137139
chainConfig,
140+
privateKeyProvider,
138141
});
139142

140143
// Popups are blocked by default on mobile browsers, so use redirect. Popup is
@@ -154,29 +157,23 @@ export const connectClientAndProvider = async (
154157
);
155158
}
156159

157-
const privateKeyProvider = new CommonPrivateKeyProvider({
158-
config: {
159-
chainConfig,
160-
},
161-
});
162-
const openloginAdapter = new OpenloginAdapter({
163-
privateKeyProvider,
160+
const authAdapter = new AuthAdapter({
164161
adapterSettings: {
165162
uxMode,
166163
},
167164
});
168-
client.configureAdapter(openloginAdapter);
165+
client.configureAdapter(authAdapter);
169166

170167
await client.init();
171168

172169
let provider = client.connected ? client.provider : null;
173170
if (!client.connected && !dontAttemptLogin) {
174171
try {
175172
const loginHint = options.getLoginHint?.();
176-
provider = await client.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
173+
provider = await client.connectTo(WALLET_ADAPTERS.AUTH, {
177174
loginProvider: options.loginProvider,
178175
login_hint: loginHint,
179-
} as OpenloginLoginParams);
176+
} as AuthLoginParams);
180177
} catch (err) {
181178
// Unnecessary error thrown during redirect, so log and ignore it.
182179
if (

0 commit comments

Comments
 (0)