Skip to content

Commit

Permalink
merge main with branch
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvoskamp committed Nov 6, 2024
2 parents bd6e251 + 05feaed commit e6ab96a
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 22 deletions.
24 changes: 24 additions & 0 deletions .changeset/six-pumpkins-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-scaffold-ui': patch
'@apps/laboratory': patch
'@reown/appkit': patch
'@reown/appkit-ui': patch
'@apps/demo': patch
'@apps/gallery': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-wallet': patch
---

Adds clientId to all blockchain api requests on a relay connection
24 changes: 24 additions & 0 deletions .changeset/twelve-pianos-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@reown/appkit-scaffold-ui': patch
'@apps/laboratory': patch
'@reown/appkit-ui': patch
'@apps/demo': patch
'@apps/gallery': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-wallet': patch
---

Improves SnackBar styles and routes proper relay messages to it on wc-connecting-view
24 changes: 24 additions & 0 deletions .changeset/wet-bulldogs-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@reown/appkit-scaffold-ui': patch
'@apps/laboratory': patch
'@reown/appkit': patch
'@reown/appkit-ui': patch
'@apps/demo': patch
'@apps/gallery': patch
'@reown/appkit-adapter-ethers': patch
'@reown/appkit-adapter-ethers5': patch
'@reown/appkit-adapter-polkadot': patch
'@reown/appkit-adapter-solana': patch
'@reown/appkit-adapter-wagmi': patch
'@reown/appkit-utils': patch
'@reown/appkit-cdn': patch
'@reown/appkit-common': patch
'@reown/appkit-core': patch
'@reown/appkit-experimental': patch
'@reown/appkit-polyfills': patch
'@reown/appkit-siwe': patch
'@reown/appkit-siwx': patch
'@reown/appkit-wallet': patch
---

Improves UX/UI of multi-account screen for embedded wallet
64 changes: 64 additions & 0 deletions .github/workflows/publish_canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish Canary Image
on:
workflow_dispatch:
push:
branches:
- main

concurrency: ${{ github.workflow }}

env:
TERM: linux

jobs:
push:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ECR_DEPLOYER }}
aws-region: ${{ vars.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'

- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build, tag, and push image to Amazon ECR
uses: docker/build-push-action@v5
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: web3modal-canary
IMAGE_TAG: V4
with:
context: .
file: Dockerfile.canary
push: true
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
8 changes: 2 additions & 6 deletions apps/laboratory/tests/smart-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ smartAccountTest('it should switch to smart account and sign', async () => {
await page.togglePreferredAccountType()
await validator.expectChangePreferredAccountToShow(EOA)
await page.closeModal()

// Need some time for Lab UI to refresh state
await page.page.waitForTimeout(1000)
await validator.expectAccountButtonReady()

await page.sign()
await page.approveSign()
Expand All @@ -115,9 +113,7 @@ smartAccountTest('it should switch to eoa and sign', async () => {
await page.togglePreferredAccountType()
await validator.expectChangePreferredAccountToShow(SMART_ACCOUNT)
await page.closeModal()

// Need some time for Lab UI to refresh state
await page.page.waitForTimeout(1000)
await validator.expectAccountButtonReady()

await page.sign()
await page.approveSign()
Expand Down
15 changes: 15 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,18 @@ async function checkChangesetFiles() {
}
}
checkChangesetFiles()

// -- Check Workflows ------------------------------------------------------------
function checkWorkflows() {
const updatedWorkflows = updated_files.filter(f => f.includes('.github/workflows/'))
const deletedWorkflows = deleted_files.filter(f => f.includes('.github/workflows/'))

for (const f of deletedWorkflows) {
fail(`Workflow file(s) ${f} has been deleted`)
}

for (const f of updatedWorkflows) {
warn(`Workflow file ${f} has been modified`)
}
}
checkWorkflows()
3 changes: 2 additions & 1 deletion packages/appkit/src/networks/solana/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const solana = defineChain({
blockExplorers: { default: { name: 'Solscan', url: 'https://solscan.io' } },
testnet: false,
chainNamespace: 'solana',
caipNetworkId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
caipNetworkId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
deprecatedCaipNetworkId: 'solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ'
})
3 changes: 2 additions & 1 deletion packages/appkit/src/networks/solana/solanaDevnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const solanaDevnet = defineChain({
blockExplorers: { default: { name: 'Solscan', url: 'https://solscan.io' } },
testnet: true,
chainNamespace: 'solana',
caipNetworkId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1'
caipNetworkId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1',
deprecatedCaipNetworkId: 'solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K'
})
3 changes: 2 additions & 1 deletion packages/appkit/src/tests/mocks/AppKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export const mockAppKit = {
getPreferredAccountType: vi.fn().mockReturnValue('eoa'),
getCaipNetwork: vi.fn().mockReturnValue(mainnet),
setApprovedCaipNetworksData: vi.fn(),
getAddress: vi.fn().mockReturnValue('0xE62a3eD41B21447b67a63880607CD2E746A0E35d')
getAddress: vi.fn().mockReturnValue('0xE62a3eD41B21447b67a63880607CD2E746A0E35d'),
setClientId: vi.fn()
} as unknown as AppKit

export default mockAppKit
8 changes: 6 additions & 2 deletions packages/appkit/src/tests/mocks/UniversalProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const mockProvider = {
}
},
solana: {
chains: ['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'],
chains: [
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
'solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ'
],
methods: [
'solana_signMessage',
'solana_signTransaction',
Expand Down Expand Up @@ -96,7 +99,8 @@ export const mockProvider = {
keychain: {
has: vi.fn().mockResolvedValue(true),
set: vi.fn()
}
},
getClientId: vi.fn().mockReturnValue('mock_client_id')
},
relayer: {
subscriber: {
Expand Down
5 changes: 4 additions & 1 deletion packages/appkit/src/tests/utils/HelpersUtil.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ describe('WcHelpersUtil', () => {
'solana_signAndSendTransaction'
],
events: ['accountsChanged', 'chainChanged'],
chains: ['solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'],
chains: [
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
'solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ'
],
rpcMap: {
'5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'https://api.mainnet-beta.solana.com'
}
Expand Down
12 changes: 12 additions & 0 deletions packages/appkit/src/utils/HelpersUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { NamespaceConfig, Namespace } from '@walletconnect/universal-provid
import type { CaipNetwork, CaipNetworkId, ChainNamespace } from '@reown/appkit-common'
import type { SessionTypes } from '@walletconnect/types'
import { EnsController } from '@reown/appkit-core'
import { solana, solanaDevnet } from '../networks/index.js'

export const WcHelpersUtil = {
getMethodsByChainNamespace(chainNamespace: ChainNamespace): string[] {
Expand Down Expand Up @@ -61,6 +62,17 @@ export const WcHelpersUtil = {

namespace.chains.push(caipNetworkId)

// Workaround for wallets that only support deprecated Solana network ID
switch (caipNetworkId) {
case solana.caipNetworkId:
namespace.chains.push(solana.deprecatedCaipNetworkId)
break
case solanaDevnet.deprecatedCaipNetworkId:
namespace.chains.push(solanaDevnet.deprecatedCaipNetworkId)
break
default:
}

if (namespace?.rpcMap && rpcUrl) {
namespace.rpcMap[id] = rpcUrl
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ export class W3mConnectingWcView extends LitElement {
})
ConnectionController.setWcError(true)
if (CoreHelperUtil.isAllowedRetry(this.lastRetry)) {
SnackController.showError('Declined')
SnackController.showError((error as BaseError).message ?? 'Declined')
this.lastRetry = Date.now()
this.initializeConnection(true)
} else {
SnackController.showError((error as BaseError).message ?? 'Connection error')
}
}
}
Expand Down
14 changes: 9 additions & 5 deletions packages/scaffold-ui/src/views/w3m-profile-view/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
AccountController,
ChainController,
ConnectionController,
ConnectorController,
CoreHelperUtil,
ModalController,
Expand Down Expand Up @@ -31,6 +32,8 @@ export class W3mProfileView extends LitElement {

@state() private accounts = AccountController.state.allAccounts

@state() private loading = false

public constructor() {
super()
this.usubscribe.push(
Expand Down Expand Up @@ -126,14 +129,14 @@ export class W3mProfileView extends LitElement {
}

private async onSwitchAccount(account: AccountType) {
AccountController.setShouldUpdateToAddress(account.address, ChainController.state.activeChain)
this.loading = true
const emailConnector = ConnectorController.getAuthConnector()
if (!emailConnector) {
return
if (emailConnector) {
await ConnectionController.setPreferredAccountType(account.type)
}

await emailConnector.provider.setPreferredAccount(account.type)
await emailConnector.provider.connect()
AccountController.setShouldUpdateToAddress(account.address, ChainController.state.activeChain)
this.loading = false
}

private accountTemplate(account: AccountType) {
Expand All @@ -146,6 +149,7 @@ export class W3mProfileView extends LitElement {
size="md"
variant="accent"
@click=${() => this.onSwitchAccount(account)}
.loading=${this.loading}
>Switch</wui-button
>`}
</wui-list-account>`
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/composites/wui-list-account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ export class WuiListAccount extends LitElement {
>
</wui-flex>
<wui-flex gap="s" alignItems="center">
<slot name="action"></slot>
${this.fetchingBalance
? html`<wui-loading-spinner size="sm" color="accent-100"></wui-loading-spinner>`
: html` <wui-text variant="small-400">$${this.balance.toFixed(2)}</wui-text>`}
<slot name="action"></slot>
</wui-flex>
</wui-flex>
`
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/src/composites/wui-snackbar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import { css } from 'lit'
export default css`
:host {
display: flex;
column-gap: var(--wui-spacing-xs);
column-gap: var(--wui-spacing-s);
align-items: center;
padding: var(--wui-spacing-xs) var(--wui-spacing-m) var(--wui-spacing-xs) var(--wui-spacing-xs);
border-radius: var(--wui-border-radius-3xl);
border-radius: var(--wui-border-radius-s);
border: 1px solid var(--wui-color-gray-glass-005);
box-sizing: border-box;
max-height: 40px;
background-color: var(--wui-color-bg-175);
box-shadow:
0px 14px 64px -4px rgba(0, 0, 0, 0.15),
0px 8px 22px -6px rgba(0, 0, 0, 0.15);
max-width: 300px;
}
:host wui-loading-spinner {
Expand Down

0 comments on commit e6ab96a

Please sign in to comment.