Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
11 changes: 10 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"root": true,
"extends": ["@react-native", "prettier", "plugin:valtio/recommended"],
"ignorePatterns": ["node_modules/", "build/", "lib/", "dist/", ".turbo", ".expo", "out/"],
"ignorePatterns": [
"node_modules/",
"build/",
"lib/",
"dist/",
".turbo",
".expo",
"out/",
"examples/"
],
"rules": {
"react/react-in-jsx-scope": 0,
"no-duplicate-imports": "error",
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=$(gh pr list --state open --author ${{ github.actor }} --json number --jq '.[0].number')
gh pr comment $PR_NUMBER --body "Published pre-release version: ${{ env.VERSION }}"
# Find PR associated with the current commit
PR_NUMBER=$(gh api repos/${{ github.repository }}/commits/${{ github.sha }}/pulls \
--jq '.[0].number' 2>/dev/null || echo "")

if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
gh pr comment $PR_NUMBER --body "Published pre-release version: ${{ env.VERSION }}"
echo "Commented on PR #$PR_NUMBER"
else
echo "No associated PR found. This might be a direct push to main."
fi
59 changes: 58 additions & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@ permissions:

on:
workflow_call:
inputs:
snapshot-tag:
description: 'Optional custom snapshot tag. If not provided, uses branch name'
required: false
type: string
outputs:
snapshot-tag:
description: 'The snapshot tag that was published'
value: ${{ jobs.snapshot.outputs.snapshot-tag }}
workflow_dispatch:
inputs:
snapshot-tag:
description: 'Optional custom snapshot tag. If not provided, uses branch name'
required: false
type: string

jobs:
snapshot:
Expand All @@ -15,10 +29,14 @@ jobs:
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
snapshot-tag: ${{ steps.get-snapshot-tag.outputs.tag }}

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup
uses: ./.github/actions/setup
Expand All @@ -32,14 +50,53 @@ jobs:
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
node .github/scripts/publish-initial-versions.js

- name: Determine Snapshot Tag
id: determine-tag
run: |
if [ -n "${{ inputs.snapshot-tag }}" ]; then
echo "tag=${{ inputs.snapshot-tag }}" >> $GITHUB_OUTPUT
else
snapshot=$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//' | sed 's/^-//')
# Validate it's not empty
if [ -z "$snapshot" ]; then
echo "::error::Invalid branch name for snapshot tag"
exit 1
fi
echo "tag=$snapshot" >> $GITHUB_OUTPUT
fi

- name: Check for Changesets
id: check-changesets
run: |
# Check if any changeset files exist (excluding README.md)
changeset_count=$(find .changeset -name "*.md" ! -name "README.md" | wc -l)
if [ "$changeset_count" -eq 0 ]; then
echo "has_changesets=false" >> $GITHUB_OUTPUT
echo "::warning::No changesets found. Skipping snapshot release."
exit 1
else
echo "has_changesets=true" >> $GITHUB_OUTPUT
echo "Found $changeset_count changeset(s). Proceeding with snapshot release."
fi

- name: Publish Snapshots
if: steps.check-changesets.outputs.has_changesets == 'true'
continue-on-error: false
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
snapshot=$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
snapshot="${{ steps.determine-tag.outputs.tag }}"
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
yarn run changeset version --no-git-tag --snapshot $snapshot
yarn run changeset:prepublish:ci
yarn run changeset publish --no-git-tag --snapshot $snapshot --tag $snapshot

- name: Get Snapshot Tag
id: get-snapshot-tag
run: |
if [ "${{ steps.check-changesets.outputs.has_changesets }}" == "true" ]; then
echo "tag=${{ steps.determine-tag.outputs.tag }}" >> $GITHUB_OUTPUT
else
echo "tag=" >> $GITHUB_OUTPUT
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ android.iml
# Cursor
.cursor
.cursor/mcp.json

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ test-results/
__mocks__/
scripts/
CHANGELOG.md

8 changes: 6 additions & 2 deletions apps/native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import { Button, Text } from '@reown/appkit-ui-react-native';
import { chains } from './src/utils/WagmiUtils';
import { OpenButton } from './src/components/OpenButton';
import { DisconnectButton } from './src/components/DisconnectButton';
import { SolanaAdapter, PhantomConnector, SolflareConnector } from '@reown/appkit-solana-react-native';
import {
SolanaAdapter,
PhantomConnector,
SolflareConnector
} from '@reown/appkit-solana-react-native';
import { BitcoinAdapter } from '@reown/appkit-bitcoin-react-native';
import { WagmiAdapter } from '@reown/appkit-wagmi-react-native';
import { ActionsView } from './src/views/ActionsView';
Expand Down Expand Up @@ -72,7 +76,7 @@ const appKit = createAppKit({
enableAnalytics: true,
storage,
// siwx: new ReownAuthentication(),
extraConnectors: [new PhantomConnector(), new SolflareConnector()],
extraConnectors: [new PhantomConnector(), new SolflareConnector()]
// tokens: {
// 'eip155:1': {
// address: '0xdAC17F958D2ee523a2206206994597C13D831ec7'
Expand Down
6 changes: 3 additions & 3 deletions apps/native/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ config.resolver.resolveRequest = (context, moduleName, platform) => {
workspaceRoot,
'node_modules/@walletconnect/ethereum-provider/dist/index.native.js'
);

return {
type: 'sourceFile',
filePath: nativePath,
filePath: nativePath
};
}

return context.resolveRequest(context, moduleName, platform);
};

Expand Down
3 changes: 2 additions & 1 deletion apps/native/src/views/BitcoinActionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export function BitcoinActionsView() {
signInputs: params.signInputs,
broadcast: params.broadcast
}
}, `bip122:${chainId}`
},
`bip122:${chainId}`
)) as SignPSBTResponse;

onSignSuccess(`${response.psbt}-${response.txid}`);
Expand Down
3 changes: 2 additions & 1 deletion apps/native/src/views/EthersActionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function EthersActionsView() {
{
method: 'personal_sign',
params: [hexMessage, address]
},`eip155:${chainId}`
},
`eip155:${chainId}`
);

onSignSuccess(signature);
Expand Down
9 changes: 7 additions & 2 deletions apps/native/src/views/EventsView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { useAppKitLogs, useAppKitEvents, useAppKitEventSubscription, useAppKitState } from '@reown/appkit-react-native';
import {
useAppKitLogs,
useAppKitEvents,
useAppKitEventSubscription,
useAppKitState
} from '@reown/appkit-react-native';
import { FlexView, Text } from '@reown/appkit-ui-react-native';
import { useState } from 'react';
import { type ViewStyle, type StyleProp, StyleSheet } from 'react-native';
Expand All @@ -12,7 +17,7 @@ export function EventsView({ style }: Props) {
const { isOpen } = useAppKitState();
const { logs } = useAppKitLogs();
const [eventCount, setEventCount] = useState(0);
const lastLog = logs.slice(-1)[0]
const lastLog = logs.slice(-1)[0];

useAppKitEventSubscription('MODAL_OPEN', () => {
setEventCount(prev => prev + 1);
Expand Down
12 changes: 8 additions & 4 deletions apps/native/src/views/SolanaActionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export function SolanaActionsView() {
// For other wallets, it might be needed if they don't infer from session
};
const { signature } = (await provider.request(
{ method: 'solana_signMessage', params }, `solana:${chainId}`
{ method: 'solana_signMessage', params },
`solana:${chainId}`
)) as { signature: string };
onSignSuccess(signature, 'Sign Message successful');
} catch (error) {
Expand Down Expand Up @@ -88,7 +89,8 @@ export function SolanaActionsView() {
{
method: 'solana_signTransaction',
params
},`solana:${chainId}`
},
`solana:${chainId}`
)) as { signature?: string; transaction?: string };
if (result.signature) {
onSignSuccess(`Signature: ${result.signature}`, 'Sign Transaction successful');
Expand Down Expand Up @@ -144,7 +146,8 @@ export function SolanaActionsView() {
{
method: 'solana_signAndSendTransaction',
params
},`solana:${chainId}`
},
`solana:${chainId}`
)) as { signature: string };
onSignSuccess(`Tx Signature: ${signature}`, 'Sign & Send Tx successful');
// Optionally, you can confirm the transaction here using the signature and connection
Expand Down Expand Up @@ -208,7 +211,8 @@ export function SolanaActionsView() {
{
method: 'solana_signAllTransactions',
params
}, `solana:${chainId}`
},
`solana:${chainId}`
)) as { transactions?: string[]; signatures?: string[] }; // Adjust based on provider's typical response

if (result.transactions) {
Expand Down
8 changes: 6 additions & 2 deletions apps/native/src/views/WagmiActionsView.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { StyleSheet } from 'react-native';
import { Button, Text, FlexView } from '@reown/appkit-ui-react-native';
import { useSignMessage, useSendTransaction, useEstimateGas } from 'wagmi';
import { useSignMessage, useSendTransaction, useEstimateGas, useAccount } from 'wagmi';
import { Hex, parseEther } from 'viem';
import { SendTransactionData, SignMessageData } from 'wagmi/query';
import { ToastUtils } from '../utils/ToastUtils';

export function WagmiActionsView() {
const { isConnected } = useAccount();

const onSignSuccess = (data: SignMessageData) => {
ToastUtils.showSuccessToast('Signature successful', data);
Expand Down Expand Up @@ -35,7 +36,10 @@ export function WagmiActionsView() {
data: '0x' as Hex
};

const { data: gas, isError: isGasError } = useEstimateGas(TX);
const { data: gas, isError: isGasError } = useEstimateGas({
...TX,
query: { enabled: isConnected }
});

const { isPending: isSending, sendTransaction } = useSendTransaction({
mutation: {
Expand Down
12 changes: 9 additions & 3 deletions apps/native/src/views/WalletInfoView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ export function WalletInfoView({ style }: Props) {
Connected to
</Text>
<FlexView flexDirection="row" alignItems="center">
{walletInfo?.icons?.[0] ? <Image style={styles.logo} source={{ uri: walletInfo?.icons?.[0] }} /> : null}
{walletInfo?.icons?.[0] ? (
<Image style={styles.logo} source={{ uri: walletInfo?.icons?.[0] }} />
) : null}
{walletInfo?.name ? <Text variant="small-400">{walletInfo?.name}</Text> : null}
</FlexView>
{address ? <Text ellipsizeMode="middle" numberOfLines={1} variant="small-400">Address: {address}</Text> : null}
{chain?.name ? <Text variant="small-400">Chain: {chain?.name}</Text> : null}
{address ? (
<Text ellipsizeMode="middle" numberOfLines={1} variant="small-400">
Address: {address}
</Text>
) : null}
{chain?.name ? <Text variant="small-400">Chain: {chain?.name}</Text> : null}
</FlexView>
) : null;
}
Expand Down
1 change: 0 additions & 1 deletion apps/native/tests/shared/fixtures/w3m-wallet-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,4 @@ export const testConnectedMW = base.extend<ModalWalletFixture>({
}
});


export { expect } from '@playwright/test';
4 changes: 2 additions & 2 deletions apps/native/tests/shared/pages/OnRampPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export class OnRampPage {
async getPaymentCurrency() {
const currencyInput = this.page.getByTestId('currency-input-symbol');
await expect(currencyInput).toBeVisible({ timeout: 5000 });
return currencyInput.innerText();

return currencyInput.innerText();
}

async clickSelectCountry() {
Expand Down
21 changes: 12 additions & 9 deletions apps/native/tests/wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,18 @@ sampleWalletTest('it should disconnect using hook', async () => {
await modalValidator.expectDisconnected();
});

sampleWalletTest('it should disconnect and close modal when disconnecting from wallet', async () => {
await modalValidator.expectDisconnected();
await modalPage.qrCodeFlow(modalPage, walletPage);
await modalValidator.expectConnected();
await modalPage.openAccountModal();
await walletPage.disconnectConnection();
await modalValidator.expectModalNotVisible();
await walletPage.page.waitForTimeout(500);
});
sampleWalletTest(
'it should disconnect and close modal when disconnecting from wallet',
async () => {
await modalValidator.expectDisconnected();
await modalPage.qrCodeFlow(modalPage, walletPage);
await modalValidator.expectConnected();
await modalPage.openAccountModal();
await walletPage.disconnectConnection();
await modalValidator.expectModalNotVisible();
await walletPage.page.waitForTimeout(500);
}
);

sampleWalletTest('it should disconnect as expected', async () => {
await modalPage.qrCodeFlow(modalPage, walletPage);
Expand Down
1 change: 1 addition & 0 deletions examples/expo-multichain/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EXPO_PUBLIC_PROJECT_ID='...'
Loading
Loading