Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethereum wallets selector. #1106

Merged
merged 47 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2c61d49
feat: Ethereum wallets mvp.
paouvrard Apr 24, 2024
8461c0b
feat: Relayer onboarding.
paouvrard May 3, 2024
0c468be
fix: Use near_getPublicKey api.
paouvrard May 8, 2024
8391e5b
feat: Get receipt and txStatus.
paouvrard May 14, 2024
16b5927
fix: Remove RLP_EXECUTE check.
paouvrard May 15, 2024
cee568b
fix: Handling of network switch from wallet.
paouvrard May 15, 2024
28b2468
style: Update logo.
paouvrard May 15, 2024
9a0a901
fix: Re-apply rlp_execute limitation to relayer key.
paouvrard May 15, 2024
fc18d7c
build: Upgrade web3Modal, add WC example.
paouvrard May 16, 2024
6c137e1
feat: Query estimateGas (also fixes MetaMask mobile).
paouvrard May 20, 2024
07705d4
fix: Improve modal text.
paouvrard May 21, 2024
27540ee
style: Modal lint.
paouvrard May 21, 2024
7a6c373
fix: Improve onboarding text.
paouvrard May 22, 2024
d26fbb0
feat: Parse error from NEAR transaction.
paouvrard May 23, 2024
d2a0f3e
build: Update assets ethereum-wallets-icon.png.
paouvrard May 27, 2024
73aff7a
feat: Network not supported error message.
paouvrard May 27, 2024
a52e7e2
feat: Optional wagmiCore param and dynamic import.
paouvrard May 27, 2024
396fab0
fix: Dynamic import on page reload.
paouvrard May 28, 2024
ec044bb
Add modal styling (#5)
santerisarle May 29, 2024
4deef6f
refactor: Remove rpcUrl param, get explorer url from wagmiConfig.
paouvrard May 29, 2024
ccb803d
chore: Improve docs.
paouvrard May 29, 2024
34608cd
build: Fix lint.
paouvrard May 29, 2024
ab88d31
More design (#6)
santerisarle May 31, 2024
f141026
style: Tweak text.
paouvrard May 31, 2024
72abcca
fix: Custom chainId.
paouvrard Jun 5, 2024
ab2bed4
style: Hide yocto deposit.
paouvrard Jun 5, 2024
5e8a9af
fix: Improve NEAR tx error parsing.
paouvrard Jun 13, 2024
e2e738b
feat: Add alwaysOnboardDuringSignIn option.
paouvrard Jun 20, 2024
104bec4
fix: Improve error handling during signIn.
paouvrard Jun 21, 2024
35841f8
feat: Log in with Ethereum flow.
paouvrard Jun 24, 2024
1fea570
fix: Check isConnecting state.
paouvrard Jun 24, 2024
447254b
docs: Log in with Ethereum flow.
paouvrard Jun 24, 2024
fb701d0
feat: Web3Modal is optional, default to injected wallet.
paouvrard Jun 25, 2024
9a984a1
fix: Wait for missing txStatus and receipt.
paouvrard Jun 26, 2024
bc9203a
fix: Handle alternative error message.
paouvrard Jun 26, 2024
34d0f82
fix: Tweak log in with Ethereum flow.
paouvrard Jun 26, 2024
a727916
fix: Disconnect wallet when switch to account without LAK.
paouvrard Jun 26, 2024
8c93268
fix: Use wagmi.simulateContract.
paouvrard Jun 28, 2024
35e85a1
feat: Confirm action and allow retry. (#11)
paouvrard Jul 1, 2024
a40b498
fix: Hide Web3Modal after signIn.
paouvrard Jul 1, 2024
d8e4619
chore: Rename.
paouvrard Jul 1, 2024
3348741
feat: 1wei free onboarding.
paouvrard Jul 10, 2024
d1967c1
Merge branch 'dev' into ethereum-wallets
paouvrard Jul 16, 2024
71533ff
build: Upgrade Ethereum dependencies.
paouvrard Jul 16, 2024
4574982
Merge branch 'dev' into ethereum-wallets
paouvrard Jul 25, 2024
2221a62
build: Fix Angular.
paouvrard Jul 25, 2024
6a4757d
feat: Chain switch modal. (#13)
paouvrard Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More design (#6)
* Improve transfer type design

* Format JSON better

* Add text highlight

* Add spinner

* Add explorer link

* Clean up
  • Loading branch information
santerisarle authored May 31, 2024
commit ab88d319d79fce91767fd1b69535c9e2715fc180
109 changes: 97 additions & 12 deletions packages/ethereum-wallets/src/lib/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,23 @@ export function createModal({
width: 24px;
}

.ethereum-wallet-tx-explorer-link {
height: 24px;
width: 24px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
}
.ethereum-wallet-tx-explorer-link:hover {
background-color: #DDF3E4;
}
.ethereum-wallet-tx-explorer-link svg {
height: 16px;
width: 16px;
color: #202020;
}

.ethereum-wallet-tx.ethereum-wallet-tx-signing {
background-color: #F9F9F9;
padding-bottom: 10px;
Expand Down Expand Up @@ -230,6 +247,7 @@ export function createModal({
padding: 10px;
background: #F1F1F1;
border-radius: 8px;
width: 100%;
max-width: 100%;
overflow: auto;
}
Expand All @@ -241,9 +259,12 @@ export function createModal({
color: #646464;
word-wrap: break-word;
overflow-wrap: break-word;
white-space: pre-wrap;
margin: 0;
}

.ethereum-wallet-txs-status {
position: relative;
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -260,6 +281,42 @@ export function createModal({
font-size: 14px;
line-height: 20px;
}

.ethereum-wallet-tx-highlight {
position: relative;
z-index: 1;
}
.ethereum-wallet-tx-highlight::before {
content: "";
position: absolute;
top: -4px;
left: -6px;
right: -6px;
bottom: -4px;
z-index: -1;
background-color: #DDF3E4;
border-radius: 8px;
}

.ethereum-wallet-spinner {
position: absolute;
right: 14px;
top: 16px;
width: 16px;
height: 16px;
border: 2px solid #384EAC;
border-bottom-color: transparent;
border-radius: 50%;
animation: rotation 1s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
`;

// Create a style element and append the CSS styles
Expand Down Expand Up @@ -294,7 +351,7 @@ export function createModal({
txs.length === 1 &&
txs[0].actions.length === 1 &&
txs[0].actions[0].type === "AddKey"
? "<h2 class='ethereum-wallet-modal-h2'>Log in</h2>"
? "<h2>Log in</h2>"
: txs.length === 1 &&
txs[0].actions.length === 1 &&
txs[0].actions[0].type === "DeleteKey"
Expand Down Expand Up @@ -361,7 +418,6 @@ export function createModal({
const isActive = i === selectedIndex;
const isPending = i > selectedIndex;
const isSent = selectedIndex < ethTxHashes.length;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const explorerLink =
i < ethTxHashes.length
? `${explorerUrl}/tx/${ethTxHashes[i]}`
Expand All @@ -383,7 +439,18 @@ export function createModal({
isCompleted
? `
<div class="ethereum-wallet-tx-list-header">
<p>Transaction ${txNumber}</p>
<div style="display: flex; align-items: center; column-gap: 8px;">
<p>Transaction ${txNumber}</p>
${
explorerLink
? `
<a href="${explorerLink}" target="_blank" rel="noopener noreferrer" aria-label="Open explorer link" class="ethereum-wallet-tx-explorer-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor"><path d="M6.22 8.72a.75.75 0 0 0 1.06 1.06l5.22-5.22v1.69a.75.75 0 0 0 1.5 0v-3.5a.75.75 0 0 0-.75-.75h-3.5a.75.75 0 0 0 0 1.5h1.69L6.22 8.72Z"/><path d="M3.5 6.75c0-.69.56-1.25 1.25-1.25H7A.75.75 0 0 0 7 4H4.75A2.75 2.75 0 0 0 2 6.75v4.5A2.75 2.75 0 0 0 4.75 14h4.5A2.75 2.75 0 0 0 12 11.25V9a.75.75 0 0 0-1.5 0v2.25c0 .69-.56 1.25-1.25 1.25h-4.5c-.69 0-1.25-.56-1.25-1.25v-4.5Z"/></svg>
</a>
`
: ""
}
</div>
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#fff" fill-opacity=".01" d="M0 0h24v24H0z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12 1.403C6.148 1.403 1.403 6.147 1.403 12c0 5.852 4.745 10.596 10.597 10.596 5.852 0 10.596-4.744 10.596-10.596 0-5.853-4.744-10.597-10.596-10.597ZM2.923 12a9.077 9.077 0 1 1 18.153 0 9.077 9.077 0 0 1-18.153 0Zm13.331-3.14a.8.8 0 1 0-1.308-.92l-4.514 6.414L8.57 12.46a.8.8 0 0 0-1.142 1.121l2.534 2.58a.8.8 0 0 0 1.225-.1l5.066-7.2Z" fill="#30A46C"/></svg>
</div>
`
Expand Down Expand Up @@ -472,11 +539,13 @@ export function createModal({
</div>
<div class="ethereum-wallet-tx-info-row">
<dt>Type</dt>
<dd>${tx.actions[0].params.methodName}</dd>
<dd class="ethereum-wallet-tx-highlight">${
tx.actions[0].params.methodName
}</dd>
</div>
<div class="ethereum-wallet-tx-info-row">
<dt>Deposit</dt>
<dd>${formatUnits(
<dd class="ethereum-wallet-tx-highlight">${formatUnits(
BigInt(tx.actions[0].params.deposit),
24
)} NEAR</dd>
Expand All @@ -485,15 +554,30 @@ export function createModal({
`
: tx.actions[0].type === "Transfer"
? `
<div class="ethereum-wallet-tx-info-text">
<p>
Transfer ${formatUnits(
<dl>
<div class="ethereum-wallet-tx-info-row">
<dt>From</dt>
<dd>${tx.signerId}</dd>
</div>
<div class="ethereum-wallet-tx-info-row">
<dt>To</dt>
<dd>${tx.receiverId}</dd>
</div>
<div class="ethereum-wallet-tx-info-row">
<dt>Type</dt>
<dd class="ethereum-wallet-tx-highlight">${
tx.actions[0].type
}</dd>
</div>
<div class="ethereum-wallet-tx-info-row">
<dt>Amount</dt>
<dd class="ethereum-wallet-tx-highlight">${formatUnits(
BigInt(tx.actions[0].params.deposit),
24
)} NEAR from ${tx.signerId} to ${tx.receiverId}
</p>
</div>
`
)} NEAR</dd>
</div>
</dl>
`
: `
<div class="ethereum-wallet-tx-info-text">
<p>Unknown transaction type.</p>
Expand All @@ -513,6 +597,7 @@ export function createModal({
: "Sign the transaction in your wallet..."
}
</p>
${isSent ? `<div class="ethereum-wallet-spinner"></div>` : ""}
</div>
`
}
Expand Down
Loading