Skip to content

[WIP] feat: multichain support #338

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

Draft
wants to merge 78 commits into
base: feat/onramp
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
75b93f1
chore: cloned scaffold and renamed to appkit-react-native
ignaciosantise Apr 8, 2025
aebda1c
chore: connect with basic ethers adapter
ignaciosantise Apr 9, 2025
4c95fae
chore: moved connectionscontroller to core, moved types to common
ignaciosantise Apr 9, 2025
3777d02
chore: restore session
ignaciosantise Apr 10, 2025
bc0ac74
chore: getting account balance from adapter
ignaciosantise Apr 11, 2025
ceb3156
chore: implemented missing functions in wagmi adapter
ignaciosantise Apr 11, 2025
a8e11d2
chore: get balance/switch network
ignaciosantise Apr 29, 2025
cf88456
chore: added basic solana adapter. getting account balances
ignaciosantise Apr 30, 2025
ddf374b
chore: removed unnecesary adapter methods, getting balance
ignaciosantise May 2, 2025
d352090
chore: added solana and ethers actions to sample app
ignaciosantise May 2, 2025
9021e56
chore: filter accountChanged
ignaciosantise May 2, 2025
112d665
chore: solved issue with balance
ignaciosantise May 2, 2025
11f1071
chore: improvements and added bitcoin basic adapter
ignaciosantise May 5, 2025
8da083a
chore: added clipboard client option
ignaciosantise May 5, 2025
f7fb6c1
chore: code improvements
ignaciosantise May 6, 2025
d9d690f
chore: added events and walletinfo hooks
ignaciosantise May 6, 2025
384abc9
chore: improved hooks
ignaciosantise May 6, 2025
886a216
chore: added default chain prop
ignaciosantise May 7, 2025
fe895b2
chore: type change
ignaciosantise May 7, 2025
c3051ef
chore: type fix
ignaciosantise May 8, 2025
0175ea0
chore: removed ethers client
ignaciosantise May 8, 2025
3d06ddf
chore: removed scaffold package
ignaciosantise May 8, 2025
33f77f1
chore: added wagmi connector + added common methods to blockchain ada…
ignaciosantise May 9, 2025
3451bb9
chore: removed common code of adapters, getting balance in chainChang…
ignaciosantise May 9, 2025
9c8570f
chore: improved wagmi connector
ignaciosantise May 12, 2025
71d6bb6
chore: fixed tests
ignaciosantise May 12, 2025
7f6621d
chore: changed lockfile
ignaciosantise May 12, 2025
ac50389
chore: changeset file
ignaciosantise May 12, 2025
6158106
chore: removed onramp changeset file
ignaciosantise May 12, 2025
35c5407
chore: changed snapshot action to create a package if it doesn't exist
ignaciosantise May 12, 2025
212fdfd
chore: modified snapshot action
ignaciosantise May 13, 2025
ddb535e
chore: modified snapshot action
ignaciosantise May 13, 2025
c8c2372
chore: modified snapshot action
ignaciosantise May 13, 2025
51e4bfb
chore: modified snapshot action
ignaciosantise May 13, 2025
bc514ee
chore: modified snapshot action
ignaciosantise May 13, 2025
10f5ec6
chore: modified snapshot action
ignaciosantise May 13, 2025
18d4aaa
chore: modified snapshot action
ignaciosantise May 13, 2025
e5d4e47
chore: replaced solana lib with fetch because of polyfill issue
ignaciosantise May 14, 2025
26aaeca
chore: checking for appkit instance in exported hooks
ignaciosantise May 15, 2025
d08f6cb
chore: removed ethers as a dependency for ethers adapter
ignaciosantise May 15, 2025
3c8618f
chore: enable activity list only for solana and evm
ignaciosantise May 15, 2025
10ca992
chore: fixed switchchain on wagmi connector
ignaciosantise May 15, 2025
63dd67e
chore: removed request method from adapters
ignaciosantise May 15, 2025
5a2ee6e
chore: added types to events
ignaciosantise May 15, 2025
e31429d
chore: updated lockfile
ignaciosantise May 16, 2025
b3eed6e
chore: solved wagmi issue when switching chain
ignaciosantise May 16, 2025
ed073a6
chore: check project id before fetching wallets
ignaciosantise May 19, 2025
f70c343
chore: AppKitNetwork type improvements
ignaciosantise May 19, 2025
89fb844
chore: hook changes, added same namespace adapters error
ignaciosantise May 20, 2025
40d26c1
chore: added alpha changeset
ignaciosantise May 20, 2025
1f2fe70
chore: exit pre version
ignaciosantise May 20, 2025
a7c05e9
chore: add alpha release action
ignaciosantise May 20, 2025
c4a5612
chore: removed alpha action
ignaciosantise May 20, 2025
8e3ea25
chore: add alpha release action
ignaciosantise May 20, 2025
c52afc3
chore: changed alpha action
ignaciosantise May 20, 2025
97625f9
chore: changed alpha action
ignaciosantise May 20, 2025
fc5b082
chore: changed alpha action
ignaciosantise May 20, 2025
db24147
chore: changed connections object to be a map, removed namespace para…
ignaciosantise May 29, 2025
793137c
chore: removed animations
ignaciosantise May 29, 2025
ae27abc
chore: renamed activeChain to caipNetwork
ignaciosantise May 29, 2025
c45114c
chore: init recent wallets
ignaciosantise May 29, 2025
d3ab4c1
chore: removed walletimage logic
ignaciosantise May 29, 2025
063f52e
chore: created files for each adapter, enabled swaps
ignaciosantise Jun 2, 2025
9e79be0
chore: convert tx to hex, ui improvements
ignaciosantise Jun 3, 2025
4c0be74
chore: implementing phantom connector + general improvements
ignaciosantise Jun 6, 2025
5d9a00f
chore: move storage logic to a util file
ignaciosantise Jun 6, 2025
7e7e55f
chore: use phantom connector for phantomwallet
ignaciosantise Jun 6, 2025
ed0c151
chore: setting storage correctly
ignaciosantise Jun 6, 2025
5140434
chore: restore session in phantom connector
ignaciosantise Jun 6, 2025
5f71dfb
chore: changeset file
ignaciosantise Jun 9, 2025
db39978
chore: removed extra params from redirect link
ignaciosantise Jun 9, 2025
aa017fd
chore: bump version
ignaciosantise Jun 10, 2025
b09d2f1
chore: prettier
ignaciosantise Jun 10, 2025
c24e9e0
chore: fixed versions
ignaciosantise Jun 10, 2025
f39727b
chore: add changeset file
ignaciosantise Jun 10, 2025
c2c30c9
chore: solve versions
ignaciosantise Jun 10, 2025
815f47c
chore: bump version
ignaciosantise Jun 13, 2025
0eb4de5
Merge pull request #360 from reown-com/feat/multichain-phantom
ignaciosantise Jun 13, 2025
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
13 changes: 13 additions & 0 deletions .changeset/brown-snakes-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@reown/appkit-scaffold-utils-react-native': patch
'@reown/appkit-bitcoin-react-native': patch
'@reown/appkit-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-solana-react-native': patch
'@reown/appkit-wagmi-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ui-react-native': patch
---

chore: bump alpha
18 changes: 0 additions & 18 deletions .changeset/slimy-apricots-complain.md

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"react-hooks/exhaustive-deps": "warn",
"no-console": ["error", { "allow": ["warn"] }],
"newline-before-return": "error",
"radix": "off"
"radix": "off",
"dot-notation": "off"
},
"parserOptions": {
"requireConfigFile": false
Expand Down
170 changes: 170 additions & 0 deletions .github/scripts/publish-initial-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
const { execSync, spawnSync } = require('child_process');
const fs = require('fs');
const path = require('path');

// Helper function to run commands and handle errors
function runCommand(command, args, options) {
console.log(
`Executing: ${command} ${args.join(' ')} ${options && options.cwd ? `in ${options.cwd}` : ''}`
);
const result = spawnSync(command, args, { stdio: 'inherit', ...options });
if (result.error) {
console.error(`Error executing ${command}:`, result.error);
throw result.error;
}
if (result.status !== 0) {
const message = `Command failed: ${command} ${args.join(' ')} exited with status ${
result.status
}`;
console.error(message);
throw new Error(message);
}
return result;
}

console.log('Starting initial package publishing process...');

let packagesToPublish = [];
const rootDir = process.cwd();

const packagesToExclude = ['@apps/native', '@apps/gallery', 'appkit-react-native'];

try {
// Get workspace info using yarn workspaces list --json
// Yarn v1 outputs newline-delimited JSON objects
const rawOutput = execSync('yarn workspaces list --json', { encoding: 'utf8' });
const lines = rawOutput
.trim()
.split('\n')
.filter(line => line.trim() !== '');
const workspacePackages = lines.map(line => JSON.parse(line));

for (const pkgData of workspacePackages) {
console.log(`[DEBUG] Processing workspace entry: ${JSON.stringify(pkgData)}`);

// Skip the root package (identified by location '.') or any package without a defined location
if (pkgData.location === '.' || !pkgData.location) {
console.log(
`[DEBUG] Skipping root or undefined location package: ${pkgData.name} at ${pkgData.location}`
);
continue;
}

// Skip excluded packages
if (packagesToExclude.includes(pkgData.name)) {
console.log(`Skipping excluded package: ${pkgData.name}`);
continue;
}

const pkgName = pkgData.name;
const pkgDir = path.resolve(rootDir, pkgData.location);

// Check if package exists on npm
console.log(`Checking NPM status for ${pkgName}...`);
const npmViewResult = spawnSync('npm', ['view', pkgName, 'version'], { encoding: 'utf8' });

// If npm view exits with 0 and has output, package exists.
// Otherwise (non-zero exit or empty output), it likely doesn't.
if (npmViewResult.status === 0 && npmViewResult.stdout && npmViewResult.stdout.trim() !== '') {
console.log(
`Package ${pkgName} (version: ${npmViewResult.stdout.trim()}) already exists on NPM. Skipping initial publish.`
);
} else {
console.log(
`Package ${pkgName} does not appear to exist on NPM or has no published versions.`
);
if (fs.existsSync(path.join(pkgDir, 'package.json'))) {
const packageJsonContent = fs.readFileSync(path.join(pkgDir, 'package.json'), 'utf8');
const parsedPackageJson = JSON.parse(packageJsonContent);
console.log(
`[DEBUG] package.json for ${pkgName}: private=${parsedPackageJson.private}, version=${parsedPackageJson.version}`
); // Added for debugging
packagesToPublish.push({ name: pkgName, dir: pkgDir });
} else {
console.warn(`Skipping ${pkgName}: package.json not found in ${pkgDir}`);
}
}
}
} catch (error) {
console.error('Error processing workspace info or checking NPM status:', error.message);
process.exit(1); // Critical error, exit
}

if (packagesToPublish.length === 0) {
console.log('No new packages to publish initially.');
} else {
console.log(
`Found ${packagesToPublish.length} new package(s) to publish initially: ${packagesToPublish
.map(p => p.name)
.join(', ')}`
);

// Conditionally run changeset:prepublish if there are packages to publish
if (packagesToPublish.length > 0) {
console.log('New packages found. Running changeset:prepublish to build packages...');
try {
runCommand('yarn', ['run', 'changeset:prepublish']); // Assumes it runs from rootDir
console.log('changeset:prepublish completed successfully.');
} catch (prepublishError) {
console.error('Failed to run changeset:prepublish:', prepublishError.message);
process.exit(1); // Exit if build fails, as publishing would also fail
}
}
}

let hasPublishErrors = false;
for (const pkg of packagesToPublish) {
console.log(`[DEBUG] Attempting to publish from list: ${JSON.stringify(pkg)}`); // Added for debugging
console.log(`Attempting to publish ${pkg.name} from ${pkg.dir} with alpha tag...`);
const packageJsonPath = path.join(pkg.dir, 'package.json');
let originalPackageJson = '';
try {
originalPackageJson = fs.readFileSync(packageJsonPath, 'utf8');
const parsedPackageJson = JSON.parse(originalPackageJson);

if (parsedPackageJson.private === true) {
console.log(`Package ${pkg.name} is private, skipping initial publish.`);
continue; // Skip to the next package
}

console.log(`Temporarily setting version of ${pkg.name} to 0.0.1 for initial publish.`);
parsedPackageJson.version = '0.0.1';
fs.writeFileSync(packageJsonPath, JSON.stringify(parsedPackageJson, null, 2));

runCommand('yarn', ['npm', 'publish', '--access', 'public', '--tag', 'alpha'], {
cwd: pkg.dir
});
// console.log(
// `DRY RUN: Would publish ${pkg.name} from ${pkg.dir} with version 0.0.1 and alpha tag.`
// );
// console.log(
// `DRY RUN: Command would be: yarn npm publish --access public --tag alpha (in ${pkg.dir})`
// );
} catch (publishError) {
// runCommand already logs error details if it's from there
console.error(`Failed to publish ${pkg.name}: ${publishError.message}`);
hasPublishErrors = true; // Mark that an error occurred but continue trying other packages
} finally {
// Restore original package.json
if (originalPackageJson) {
console.log(`Restoring original package.json for ${pkg.name}.`);
try {
fs.writeFileSync(packageJsonPath, originalPackageJson);
} catch (restoreError) {
console.error(
`CRITICAL: Failed to restore original package.json for ${pkg.name}: ${restoreError.message}`
);
// This is a more critical error, as it leaves the repo in a modified state.
// Depending on desired behavior, you might want to ensure this error is highly visible
// or even causes the entire workflow to fail more loudly.
hasPublishErrors = true; // Ensure the overall process is marked as failed.
}
}
}
}

console.log('Initial package publishing process finished.');
if (hasPublishErrors) {
console.error('One or more packages failed during initial publishing.');
process.exit(1); // Exit with error if any package failed to publish
}
79 changes: 79 additions & 0 deletions .github/workflows/alpha-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Alpha Release

on:
workflow_dispatch:

jobs:
alpha-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Environment and Install Dependencies (Immutable)
uses: ./.github/actions/setup

- name: Configure Git User
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
shell: bash

- name: Enter Pre-mode
run: yarn changeset pre enter alpha
shell: bash

- name: Version Packages for Alpha
run: yarn changeset version
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update Lockfile
run: yarn install
shell: bash

- name: Build Packages
run: yarn changeset:prepublish
shell: bash

- name: Configure NPM for Publishing
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
shell: bash

- name: Publish Alpha to NPM
run: yarn changeset publish
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Exit Pre-mode and Commit Changes
run: |
yarn changeset pre exit
# Check if pre.json was actually deleted (it should be)
if [ ! -f .changeset/pre.json ]; then
echo "pre.json successfully deleted by 'changeset pre exit'."
# Add the potential deletion of pre.json to git.
# If pre.json didn't exist or wasn't tracked, this might not add anything, which is fine.
git add .changeset/pre.json || echo "No pre.json to stage or pre.json was not tracked."
# Commit only if there are changes to commit (i.e., pre.json was deleted and staged)
if ! git diff --staged --quiet; then
git commit -m "chore: exit changeset pre-mode"
else
echo "No changes to commit for pre-mode exit."
fi
else
echo "Warning: .changeset/pre.json still exists after 'changeset pre exit'."
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Push Changes and Tags
run: |
git push --follow-tags
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v4

- name:
- name: Setup Environment
uses: ./.github/actions/setup

- name: Create Release Pull Request or Publish to NPM
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ jobs:
- name: Setup
uses: ./.github/actions/setup

- name: Publish Initial Versions for New Packages
continue-on-error: false
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
node .github/scripts/publish-initial-versions.js

- name: Publish Snapshots
continue-on-error: false
env:
Expand Down
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.changeset/
.github/
.maestro/
.turbo/
.vscode/
.yarn/
.yarnrc.yml
.yarn.lock
2 changes: 1 addition & 1 deletion apps/gallery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build:gallery": "storybook build -o out"
},
"dependencies": {
"@reown/appkit-ui-react-native": "1.2.3",
"@reown/appkit-ui-react-native": "2.0.0-alpha.1",
"@storybook/theming": "^8.3.0"
}
}
Loading