Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0062123
chore: WIP swaps
ignaciosantise Nov 25, 2024
5930137
chore: wip swaps
ignaciosantise Nov 26, 2024
72117c6
chore: added swap details and toggle component
ignaciosantise Nov 26, 2024
f9dcce2
chore: improvements in token selector, ui improvements
ignaciosantise Nov 27, 2024
90b97d5
chore: show provider fee in usd, navigate to preview
ignaciosantise Nov 28, 2024
c4ebec4
chore: swap preview + swap call function
ignaciosantise Nov 29, 2024
51f0098
chore: reload balance and transactions after swap
ignaciosantise Nov 29, 2024
480f22e
Merge branch 'develop' into feat/swaps
ignaciosantise Nov 29, 2024
30758a5
chore: added unsupported network view
ignaciosantise Nov 29, 2024
09fedf1
chore: refresh swap when selecting a new source token
ignaciosantise Nov 29, 2024
ec3e36e
chore: change loading after setting new prices
ignaciosantise Nov 29, 2024
8e29603
chore: refresh values after pressing max button
ignaciosantise Dec 2, 2024
a9af22d
chore: added suggested token selector
ignaciosantise Dec 2, 2024
662cc69
chore: reset swap state when network is changed and in swap navigation
ignaciosantise Dec 2, 2024
96b592e
chore: added info modal
ignaciosantise Dec 3, 2024
3393457
chore: simplified info modal component
ignaciosantise Dec 3, 2024
ede9670
chore: made info buttons more pressable
ignaciosantise Dec 3, 2024
46f0731
Merge branch 'develop' into feat/swaps
ignaciosantise Dec 4, 2024
2c18a80
Merge branch 'develop' into feat/swaps
ignaciosantise Dec 17, 2024
9d99688
Merge branch 'develop' into feat/swaps
ignaciosantise Dec 17, 2024
35e5d73
chore: create github releases using changesets
ignaciosantise Dec 19, 2024
8bbbb44
Merge pull request #295 from reown-com/chore/github-releases
ignaciosantise Dec 19, 2024
e3d9822
fix: remove source token from suggested tokens
ignaciosantise Dec 31, 2024
26a6d24
fix: show activity correctly
ignaciosantise Jan 14, 2025
a2a8e6b
chore: added swap to eoa account view
ignaciosantise Jan 14, 2025
acbdb55
chore: dont call swap if source and to tokens are the same
ignaciosantise Jan 14, 2025
fb2af73
chore: added bundle id in secure site url, disable loader on auth pro…
ignaciosantise Jan 15, 2025
8e26686
Merge branch 'develop' into feat/swaps
ignaciosantise Jan 15, 2025
f4a4344
chore: code improvements
ignaciosantise Jan 15, 2025
278023f
chore: added changeset file
ignaciosantise Jan 15, 2025
be91240
chore: code improvements
ignaciosantise Jan 15, 2025
f4774e1
Merge pull request #299 from reown-com/feat/swaps
ignaciosantise Jan 16, 2025
db1e2a8
feat: added ability to change themeMode and override accent color
ignaciosantise Jan 16, 2025
0cb238a
chore: changed changeset file
ignaciosantise Jan 16, 2025
3a72107
chore: apply theme to account buttons
ignaciosantise Jan 16, 2025
4f7f3f6
chore: import issue
ignaciosantise Jan 16, 2025
736e2b3
chore: fixed test
ignaciosantise Jan 16, 2025
370ca23
chore: fixed test
ignaciosantise Jan 16, 2025
5c222b6
Merge pull request #300 from reown-com/feat/theme
ignaciosantise Jan 17, 2025
24e8d7f
Merge pull request #300 from reown-com/feat/theme
ignaciosantise Jan 17, 2025
36d4636
Merge pull request #303 from reown-com/fix/social-loading
ignaciosantise Jan 20, 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
18 changes: 18 additions & 0 deletions .changeset/cyan-melons-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-scaffold-react-native': patch
'@reown/appkit-ethers5-react-native': patch
'@reown/appkit-common-react-native': patch
'@reown/appkit-ethers-react-native': patch
'@reown/appkit-wallet-react-native': patch
'@reown/appkit-wagmi-react-native': patch
'@reown/appkit-core-react-native': patch
'@reown/appkit-ui-react-native': patch
'@reown/appkit-auth-ethers-react-native': patch
'@reown/appkit-auth-wagmi-react-native': patch
'@reown/appkit-coinbase-ethers-react-native': patch
'@reown/appkit-coinbase-wagmi-react-native': patch
'@reown/appkit-scaffold-utils-react-native': patch
'@reown/appkit-siwe-react-native': patch
---

fix: set loading when account data is being synced in appkit-wagmi
18 changes: 18 additions & 0 deletions .changeset/fair-ravens-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-scaffold-react-native': minor
'@reown/appkit-ethers5-react-native': minor
'@reown/appkit-common-react-native': minor
'@reown/appkit-ethers-react-native': minor
'@reown/appkit-wallet-react-native': minor
'@reown/appkit-wagmi-react-native': minor
'@reown/appkit-core-react-native': minor
'@reown/appkit-ui-react-native': minor
'@reown/appkit-auth-ethers-react-native': minor
'@reown/appkit-auth-wagmi-react-native': minor
'@reown/appkit-coinbase-ethers-react-native': minor
'@reown/appkit-coinbase-wagmi-react-native': minor
'@reown/appkit-scaffold-utils-react-native': minor
'@reown/appkit-siwe-react-native': minor
---

feat: swaps feature
18 changes: 18 additions & 0 deletions .changeset/late-cycles-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@reown/appkit-scaffold-react-native': minor
'@reown/appkit-ethers5-react-native': minor
'@reown/appkit-common-react-native': minor
'@reown/appkit-ethers-react-native': minor
'@reown/appkit-wallet-react-native': minor
'@reown/appkit-wagmi-react-native': minor
'@reown/appkit-core-react-native': minor
'@reown/appkit-ui-react-native': minor
'@reown/appkit-auth-ethers-react-native': minor
'@reown/appkit-auth-wagmi-react-native': minor
'@reown/appkit-coinbase-ethers-react-native': minor
'@reown/appkit-coinbase-wagmi-react-native': minor
'@reown/appkit-scaffold-utils-react-native': minor
'@reown/appkit-siwe-react-native': minor
---

feat: added ability to change themeMode and override accent color
15 changes: 7 additions & 8 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@ jobs:
commit: 'chore: version packages'
publish: yarn run changeset:publish
version: yarn run changeset:version
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create Github Release
if: steps.changesets.outputs.published == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(node -pe "require('./package.json').version")
gh release create "v$VERSION" --generate-notes --target main
# - name: Create Github Release
# if: steps.changesets.outputs.published == 'true'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# VERSION=$(node -pe "require('./package.json').version")
# gh release create "v$VERSION" --generate-notes --target main

- name: Publish NPM pre-release
if: steps.changesets.outputs.published != 'true'
Expand Down
10 changes: 9 additions & 1 deletion apps/native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@reown/appkit-wagmi-react-native';

import { authConnector } from '@reown/appkit-auth-wagmi-react-native';
import { Text } from '@reown/appkit-ui-react-native';

import { siweConfig } from './src/utils/SiweUtils';

Expand Down Expand Up @@ -76,7 +77,8 @@ createAppKit({
features: {
email: true,
socials: ['x', 'discord', 'apple'],
emailShowWallets: true
emailShowWallets: true,
swaps: true
}
});

Expand All @@ -88,6 +90,9 @@ export default function Native() {
<QueryClientProvider client={queryClient}>
<SafeAreaView style={[styles.container, isDarkMode && styles.dark]}>
<StatusBar style="auto" />
<Text variant="medium-title-600" style={styles.title}>
AppKit for React Native
</Text>
<AppKitButton
connectStyle={styles.button}
accountStyle={styles.button}
Expand Down Expand Up @@ -121,6 +126,9 @@ const styles = StyleSheet.create({
text: {
marginBottom: 20
},
title: {
marginBottom: 30
},
button: {
marginVertical: 6
}
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
"test": "turbo run test --parallel",
"clean": "turbo clean && rm -rf node_modules && watchman watch-del-all",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\" --ignore-path .gitignore",
"changeset:prepublish": "yarn run clean; yarn install; yarn version:update; yarn run lint && yarn run prettier; yarn run build; yarn run test;",
"changeset:publish": "yarn run changeset:prepublish; yarn run changeset publish --no-git-tag",
"playwright:test": "cd apps/native && yarn playwright:test",
"changeset:prepublish": "yarn run clean; yarn install; yarn version:update; yarn run lint && yarn run prettier; yarn run build; yarn run test",
"changeset:publish": "yarn run changeset:prepublish; yarn run changeset publish",
"changeset:version": "changeset version; yarn run version:update; yarn install --refresh-lockfile",
"version:update": "./scripts/bump-version.sh"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/common/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset']
};
5 changes: 5 additions & 0 deletions packages/common/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const commonConfig = {
...require('../../jest.config'),
setupFilesAfterEnv: ['../../jest-setup.ts']
};
module.exports = commonConfig;
24 changes: 24 additions & 0 deletions packages/common/src/__tests__/NamesUtil.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ConstantsUtil, NamesUtil } from '../index';

describe('NamesUtil', () => {
describe('isReownName', () => {
test('returns true for names ending with legacy suffix', () => {
const legacyName = `testname${ConstantsUtil.WC_NAME_SUFFIX_LEGACY}`;
expect(NamesUtil.isReownName(legacyName)).toBe(true);
});

test('returns true for names ending with current suffix', () => {
const currentName = `testname${ConstantsUtil.WC_NAME_SUFFIX}`;
expect(NamesUtil.isReownName(currentName)).toBe(true);
});

test('returns false for names not ending with either suffix', () => {
expect(NamesUtil.isReownName('testname')).toBe(false);
expect(NamesUtil.isReownName('testname.com')).toBe(false);
});

test('returns false for empty string', () => {
expect(NamesUtil.isReownName('')).toBe(false);
});
});
});
46 changes: 46 additions & 0 deletions packages/common/src/__tests__/NumberUtil.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { NumberUtil } from '../utils/NumberUtil';

// -- Tests --------------------------------------------------------------------
describe('NumberUtil', () => {
it('should return isGreaterThan as expected', () => {
const isGreaterThan = NumberUtil.bigNumber('6.348').isGreaterThan('0');
expect(isGreaterThan).toBe(true);
});
});

describe('NumberUtil.parseLocalStringToNumber', () => {
it('should return 0 when value is undefined', () => {
const result = NumberUtil.parseLocalStringToNumber(undefined);
expect(result).toBe(0);
});

it('should return the number when value is a string', () => {
const result = NumberUtil.parseLocalStringToNumber('123.45');
expect(result).toBe(123.45);
});

it('should return the number when value is a string with a lot of decimals', () => {
const result = NumberUtil.parseLocalStringToNumber('123.4567890123456789');
expect(result).toBe(123.4567890123456789);
});

it('should return the number when value is a string with zero and a lot of decimals', () => {
const result = NumberUtil.parseLocalStringToNumber('0.000000000000000001');
expect(result).toBe(0.000000000000000001);
});

it('should return the number when value is a string with a negative sign', () => {
const result = NumberUtil.parseLocalStringToNumber('-123.45');
expect(result).toBe(-123.45);
});

it('should return the number when value is a string with commas', () => {
const result = NumberUtil.parseLocalStringToNumber('123,456.78');
expect(result).toBe(123456.78);
});

it('should return the number when value is a string with a lot of commas', () => {
const result = NumberUtil.parseLocalStringToNumber('123,456,789.123,456,789');
expect(result).toBe(123456789.123456789);
});
});
45 changes: 43 additions & 2 deletions packages/common/src/utils/NumberUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import * as BigNumber from 'bignumber.js';

export const NumberUtil = {
bigNumber(value: BigNumber.BigNumber.Value) {
if (typeof value === 'string') {
return new BigNumber.BigNumber(value.replace(/,/g, ''));
}

return new BigNumber.BigNumber(value);
},

Expand All @@ -16,8 +20,8 @@ export const NumberUtil = {
return BigNumber.BigNumber(0);
}

const aBigNumber = new BigNumber.BigNumber(a);
const bBigNumber = new BigNumber.BigNumber(b);
const aBigNumber = new BigNumber.BigNumber(typeof a === 'string' ? a.replace(/,/gu, '') : a);
const bBigNumber = new BigNumber.BigNumber(typeof b === 'string' ? b.replace(/,/gu, '') : b);

return aBigNumber.multipliedBy(bBigNumber);
},
Expand All @@ -27,5 +31,42 @@ export const NumberUtil = {
number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;

return roundedNumber;
},

/**
* Format the given number or string to human readable numbers with the given number of decimals
* @param value - The value to format. It could be a number or string. If it's a string, it will be parsed to a float then formatted.
* @param decimals - number of decimals after dot
* @returns
*/
formatNumberToLocalString(value: string | number | undefined, decimals = 2) {
if (value === undefined) {
return '0.00';
}

if (typeof value === 'number') {
return value.toLocaleString('en-US', {
maximumFractionDigits: decimals,
minimumFractionDigits: decimals
});
}

return parseFloat(value).toLocaleString('en-US', {
maximumFractionDigits: decimals,
minimumFractionDigits: decimals
});
},
/**
* Parse a formatted local string back to a number
* @param value - The formatted string to parse
* @returns
*/
parseLocalStringToNumber(value: string | undefined) {
if (value === undefined) {
return 0;
}

// Remove any commas used as thousand separators and parse the float
return parseFloat(value.replace(/,/gu, ''));
}
};
6 changes: 6 additions & 0 deletions packages/common/src/utils/TypeUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,9 @@ export interface TransactionQuantity {
}

export type SocialProvider = 'apple' | 'x' | 'discord' | 'farcaster';

export type ThemeMode = 'dark' | 'light';

export interface ThemeVariables {
accent?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ThemeController } from '../../index';
describe('ThemeController', () => {
it('should have valid default state', () => {
expect(ThemeController.state).toEqual({
themeMode: 'dark',
themeMode: undefined,
themeVariables: {}
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/controllers/ApiController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const ApiController = {
'x-sdk-type': sdkType,
'x-sdk-version': sdkVersion,
'User-Agent': ApiUtil.getUserAgent(),
'Origin': ApiUtil.getOrigin()
'origin': ApiUtil.getOrigin()
};
},

Expand Down
Loading
Loading