Skip to content

Commit

Permalink
feat: Add alwaysOnboardDuringSignIn option.
Browse files Browse the repository at this point in the history
  • Loading branch information
paouvrard committed Jun 20, 2024
1 parent 5e8a9af commit e2e738b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/ethereum-wallets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Project ID is required, please obtain it from [walletconnect.com](https://wallet
- `chainId` (`number?`): Chain ID of the NEAR web3 rpc to connect to. Defaults to `397` (`mainnet`) or `398` (`testnet`) depending on the `setupWalletSelector` network configuration.
- `iconUrl` (`string?`): Image URL for the icon shown in the modal. This can also be a relative path or base64 encoded image. Defaults to `./assets/ethereum-wallets-icon.png`.
- `wagmiCore` (`typeof import("@wagmi/core")?`): Optional, @wagmi/core functions can be overidden by the dapp to interract with the wallet.
- `alwaysOnboardDuringSignIn` (`boolean?`): A dapp without SignIn access key will not onboard the relayer by default, this option does the relayer onboarding during login.

Developent options (before the NEAR protocol upgrade to support 0x accounts natively):

Expand Down
5 changes: 5 additions & 0 deletions packages/ethereum-wallets/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface EthereumWalletsParams {
};
wagmiCore?: WagmiCoreActionsType;
chainId?: number;
alwaysOnboardDuringSignIn?: boolean;
iconUrl?: string;
devMode?: boolean;
devModeAccount?: string;
Expand Down Expand Up @@ -95,6 +96,7 @@ const EthereumWallets: WalletBehaviourFactory<
wagmiConfig,
web3Modal,
chainId,
alwaysOnboardDuringSignIn = false,
devMode,
devModeAccount = "eth-wallet.testnet",
},
Expand Down Expand Up @@ -792,6 +794,9 @@ const EthereumWallets: WalletBehaviourFactory<
throw error;
}
}
} else if (alwaysOnboardDuringSignIn) {
// Check onboarding status and onboard the relayer if needed.
await signAndSendTransactions([]);
}
const accountLogIn = {
accountId,
Expand Down

0 comments on commit e2e738b

Please sign in to comment.