-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from reown-com/feat/wallet-features
feat: wallet features
- Loading branch information
Showing
134 changed files
with
5,593 additions
and
1,897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
'@reown/appkit-coinbase-ethers-react-native': minor | ||
'@reown/appkit-coinbase-wagmi-react-native': minor | ||
'@reown/appkit-scaffold-utils-react-native': minor | ||
'@reown/appkit-auth-ethers-react-native': minor | ||
'@reown/appkit-auth-wagmi-react-native': minor | ||
'@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-siwe-react-native': minor | ||
'@reown/appkit-ui-react-native': minor | ||
--- | ||
|
||
feat: added wallet features for universal wallets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export const erc20ABI = [ | ||
{ | ||
type: 'function', | ||
name: 'transfer', | ||
stateMutability: 'nonpayable', | ||
inputs: [ | ||
{ | ||
name: '_to', | ||
type: 'address' | ||
}, | ||
{ | ||
name: '_value', | ||
type: 'uint256' | ||
} | ||
], | ||
outputs: [ | ||
{ | ||
name: '', | ||
type: 'bool' | ||
} | ||
] | ||
}, | ||
{ | ||
type: 'function', | ||
name: 'transferFrom', | ||
stateMutability: 'nonpayable', | ||
inputs: [ | ||
{ | ||
name: '_from', | ||
type: 'address' | ||
}, | ||
{ | ||
name: '_to', | ||
type: 'address' | ||
}, | ||
{ | ||
name: '_value', | ||
type: 'uint256' | ||
} | ||
], | ||
outputs: [ | ||
{ | ||
name: '', | ||
type: 'bool' | ||
} | ||
] | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
export const usdtABI = [ | ||
{ | ||
type: 'function', | ||
name: 'transfer', | ||
stateMutability: 'nonpayable', | ||
inputs: [ | ||
{ | ||
name: 'recipient', | ||
type: 'address' | ||
}, | ||
{ | ||
name: 'amount', | ||
type: 'uint256' | ||
} | ||
], | ||
outputs: [] | ||
}, | ||
{ | ||
type: 'function', | ||
name: 'transferFrom', | ||
stateMutability: 'nonpayable', | ||
inputs: [ | ||
{ | ||
name: 'sender', | ||
type: 'address' | ||
}, | ||
{ | ||
name: 'recipient', | ||
type: 'address' | ||
}, | ||
{ | ||
name: 'amount', | ||
type: 'uint256' | ||
} | ||
], | ||
outputs: [ | ||
{ | ||
name: '', | ||
type: 'bool' | ||
} | ||
] | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
export { ConstantsUtil } from './utils/ConstantsUtil'; | ||
export { ContractUtil } from './utils/ContractUtil'; | ||
export { DateUtil } from './utils/DateUtil'; | ||
export { NamesUtil } from './utils/NamesUtil'; | ||
export { NetworkUtil } from './utils/NetworkUtil'; | ||
export { NumberUtil } from './utils/NumberUtil'; | ||
export { erc20ABI } from './contracts/erc20'; | ||
export * from './utils/TypeUtil'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,25 @@ | ||
export const ConstantsUtil = { | ||
WC_NAME_SUFFIX: '.reown.id', | ||
WC_NAME_SUFFIX_LEGACY: '.wcn.id', | ||
BLOCKCHAIN_API_RPC_URL: 'https://rpc.walletconnect.org', | ||
PULSE_API_URL: 'https://pulse.walletconnect.org', | ||
API_URL: 'https://api.web3modal.org', | ||
COINBASE_CONNECTOR_ID: 'coinbaseWallet', | ||
COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa' | ||
COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', | ||
USDT_CONTRACT_ADDRESSES: [ | ||
// Mainnet | ||
'0xdac17f958d2ee523a2206206994597c13d831ec7', | ||
// Polygon | ||
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f', | ||
// Avalanche | ||
'0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7', | ||
// Cosmos | ||
'0x919C1c267BC06a7039e03fcc2eF738525769109c', | ||
// Celo | ||
'0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e', | ||
// Binance | ||
'0x55d398326f99059fF775485246999027B3197955', | ||
// Arbitrum | ||
'0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { erc20ABI } from '../contracts/erc20'; | ||
import { usdtABI } from '../contracts/usdt'; | ||
import { ConstantsUtil } from './ConstantsUtil'; | ||
|
||
export const ContractUtil = { | ||
getERC20Abi: (tokenAddress: string) => { | ||
if (ConstantsUtil.USDT_CONTRACT_ADDRESSES.includes(tokenAddress)) { | ||
return usdtABI; | ||
} | ||
|
||
return erc20ABI; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import dayjs from 'dayjs'; | ||
import englishLocale from 'dayjs/locale/en.js'; | ||
import relativeTime from 'dayjs/plugin/relativeTime.js'; | ||
import updateLocale from 'dayjs/plugin/updateLocale.js'; | ||
|
||
dayjs.extend(relativeTime); | ||
dayjs.extend(updateLocale); | ||
|
||
const localeObject = { | ||
...englishLocale, | ||
name: 'en-web3-modal', | ||
relativeTime: { | ||
future: 'in %s', | ||
past: '%s ago', | ||
s: '%d sec', | ||
m: '1 min', | ||
mm: '%d min', | ||
h: '1 hr', | ||
hh: '%d hrs', | ||
d: '1 d', | ||
dd: '%d d', | ||
M: '1 mo', | ||
MM: '%d mo', | ||
y: '1 yr', | ||
yy: '%d yr' | ||
} | ||
}; | ||
|
||
dayjs.locale('en-appkit', localeObject); | ||
|
||
export const DateUtil = { | ||
getYear(date: string = new Date().toISOString()) { | ||
return dayjs(date).year(); | ||
}, | ||
|
||
getRelativeDateFromNow(date: string | number) { | ||
return dayjs(date).locale('en-appkit').fromNow(true); | ||
}, | ||
|
||
formatDate(date: string | number, format = 'DD MMM') { | ||
return dayjs(date).format(format); | ||
}, | ||
|
||
getMonth(month: number) { | ||
return dayjs().month(month).format('MMMM'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ConstantsUtil } from './ConstantsUtil'; | ||
|
||
export const NamesUtil = { | ||
isReownName(value: string) { | ||
return ( | ||
value?.endsWith(ConstantsUtil.WC_NAME_SUFFIX_LEGACY) || | ||
value?.endsWith(ConstantsUtil.WC_NAME_SUFFIX) | ||
); | ||
} | ||
}; |
Oops, something went wrong.