Skip to content
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

[v3] Mobile and other improvements #1237

Merged
merged 8 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/laboratory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"next": "13.4.12",
"framer-motion": "10.14.0",
"framer-motion": "10.15.0",
"wagmi": "1.3.9",
"viem": "1.4.2"
}
Expand Down
112 changes: 56 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@typescript-eslint/parser": "6.2.0",
"@types/react": "18.2.17",
"@types/react-dom": "18.2.7",
"eslint": "8.45.0",
"eslint": "8.46.0",
"eslint-config-prettier": "8.9.0",
"lerna": "7.1.4",
"prettier": "3.0.0",
Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/controllers/AccountController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface AccountControllerState {
caipAddress?: CaipAddress
address?: string
balance?: string
balanceSymbol?: string
profileName?: string
profileImage?: string
}
Expand Down Expand Up @@ -41,8 +42,12 @@ export const AccountController = {
state.address = caipAddress ? CoreHelperUtil.getPlainAddress(caipAddress) : undefined
},

setBalance(balance: AccountControllerState['balance']) {
setBalance(
balance: AccountControllerState['balance'],
balanceSymbol: AccountControllerState['balanceSymbol']
) {
state.balance = balance
state.balanceSymbol = balanceSymbol
},

setProfileName(profileName: AccountControllerState['profileName']) {
Expand All @@ -58,6 +63,7 @@ export const AccountController = {
state.caipAddress = undefined
state.address = undefined
state.balance = undefined
state.balanceSymbol = undefined
state.profileName = undefined
state.profileImage = undefined
}
Expand Down
4 changes: 3 additions & 1 deletion packages/core/tests/controllers/AccountController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AccountController } from '../../index'
// -- Setup --------------------------------------------------------------------
const caipAddress = 'eip155:1:0x123'
const balance = '0.100'
const balanceSymbol = 'ETH'
const profileName = 'john.eth'
const profileImage = 'https://ipfs.com/0x123.png'

Expand All @@ -25,8 +26,9 @@ describe('AccountController', () => {
})

it('should update state correctly on setBalance()', () => {
AccountController.setBalance(balance)
AccountController.setBalance(balance, balanceSymbol)
expect(AccountController.state.balance).toEqual(balance)
expect(AccountController.state.balanceSymbol).toEqual(balanceSymbol)
})

it('should update state correctly on setProfileName()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/scaffold-html/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class Web3ModalScaffoldHtml {
AccountController.setCaipAddress(caipAddress)
}

protected setBalance: (typeof AccountController)['setBalance'] = balance => {
AccountController.setBalance(balance)
protected setBalance: (typeof AccountController)['setBalance'] = (balance, balanceSymbol) => {
AccountController.setBalance(balance, balanceSymbol)
}

protected setProfileName: (typeof AccountController)['setProfileName'] = profileName => {
Expand Down
Loading