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

feat: added multi-wallets support #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"lint": "next lint"
},
"dependencies": {
"@argent/get-starknet": "^2.1.1",
"@starknet-react/core": "^0.4.4",
"get-starknet": "^1.4.2",
"@starknet-react/core": "^0.11.0",
"next": "12.0.10",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "^7.27.1",
"starknet": "^2.5.1"
"starknet": "^3.9.0"
},
"devDependencies": {
"@types/node": "17.0.17",
Expand Down
6 changes: 3 additions & 3 deletions src/components/ConnectWallet.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useStarknet } from '@starknet-react/core'
import { InjectedConnector, useStarknet } from '@starknet-react/core'

export function ConnectWallet() {
const { account, connectBrowserWallet } = useStarknet()
const { account, connect } = useStarknet()

if (account) {
return <p>Account: {account}</p>
}

return <button onClick={connectBrowserWallet}>Connect</button>
return <button onClick={() => connect(new InjectedConnector())}>Connect</button>
}
2 changes: 1 addition & 1 deletion src/components/IncrementCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function IncrementCounter() {

return (
<div>
<button onClick={() => invoke({ args: { amount: '0x1' } })}>Increment Counter by 1</button>
<button onClick={() => invoke({ args: [{ amount: '0x1' }] })}>Increment Counter by 1</button>
</div>
)
}
2 changes: 1 addition & 1 deletion src/hooks/counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CounterAbi from '~/abi/counter.json'

export function useCounterContract() {
return useContract({
abi: CounterAbi.abi as Abi[],
abi: CounterAbi.abi as Abi,
address: '0x036486801b8f42e950824cba55b2df8cccb0af2497992f807a7e1d9abd2c6ba1',
})
}
2 changes: 1 addition & 1 deletion src/hooks/sns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SNSAbi from '~/abi/sns_abi.json'

export function useSNSContract() {
return useContract({
abi: SNSAbi.abi as Abi[],
abi: SNSAbi.abi as Abi,
address: '0x02ef8e28b8d7fc96349c76a0607def71c678975dbd60508b9c343458c4758fac',
})
}
4 changes: 2 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const Home: NextPage = () => {
console.log('frontend not connected to SNS contract')
} else {
let data_dec_str = string_to_felt_bn(data['nameRequired']).toString()
invokeSnsRegister({ args: { name: data_dec_str } })
invokeSnsRegister({ args: [{ name: data_dec_str }] })
console.log('invoked sns_register() with ', data_dec_str)
}
}

return (
<div>
<h3>Argent X Wallet</h3>
<h3>StarkNet Wallet</h3>
<ConnectWallet />

<h3>Starknet Name Service / SNS</h3>
Expand Down
Loading