Closed FabienCoutant closed 1 month ago
Hello,
I have extensive experience working with React and I can work on this issue. The solution involves adjusting the address property in UseAccountResult to use the Address type.
@FabienCoutant
I want to help fix the issue where useAccount.address should return an Address type. I am good with React and TypeScript. I can make this change quickly and correctly.
Please assign this issue to me. Thanks,
Good suggestion. Will be in v3.
Address as 0x${string}
? I remember not having a good experience when I first started using it.
Please consider returning a BigNumberish
, that's what starknet.js
use.
The goal is to have a getAddress
function that validates the address and returns 0x${string}
. That way it catches bugs related to passing things that are not addresses so functions that expect addresses.
I am applying to this issue via OnlyDust platform.
@fracek , I'd love to take on this task. This is my second comment on this issue. I have extensive knowledge of React and TypeScript types, and I'll deliver a solution to this issue within a short period of time.
@fracek,
I was ready to tackle this issue when you told me to wait for ODHack 7. I was mentioned earlier on this issue to tackle it. Can i go ahead to open a PR
as instructed?
@Benjtalkshow that sounds good. Can you open a PR against the develop
branch where you add the getAddress
helper (in an utils.ts
file for example) that simply invokes validateAndParseAddress
from starknet.js and casts the result as 0x${string}
?
Hello @fracek isn't this issue already fixed here:
@Benjtalkshow that sounds good. Can you open a PR against the
develop
branch where you add thegetAddress
helper (in anutils.ts
file for example) that simply invokesvalidateAndParseAddress
from starknet.js and casts the result as0x${string}
?
@fracek , I am just seeing that you mentioned me. Am I still eligible to open a PR? I am available and ready to hop on the issue as soon as possible.
Yes of course! Since I commented I made some changes so now you should make a PR against the main
branch. BTW if you wait ~10 days or so you can do this work as part of the next OD Hack
Yes of course! Since I commented I made some changes so now you should make a PR against the
main
branch. BTW if you wait ~10 days or so you can do this work as part of the next OD Hack
Ok. I will wait then. Thanks a lot. Can I get the telegram group link?
We will release the telegram group once OD Hack starts!
can I work on this issue @FabienCoutant
I am applying to this issue via OnlyDust platform.
@FabienCoutant Can I work on this issue?
Implement or Utilize useAccount
Hook: Integrate the useAccount
hook within your component to retrieve the UseAccountResult
object, which contains all the necessary account-related properties.
Access Account Properties: Use properties like account
, address
, connector
, and chainId
from the UseAccountResult
object to display or manage the connected account's details within your application.
Handle Connection States: Check the boolean flags (isConnecting
, isReconnecting
, isConnected
, isDisconnected
) to control the UI or trigger actions based on whether the account is connecting, reconnecting, connected, or disconnected.
Utilize status
Property: Use the status
property to get the overall connection status, which can guide decisions on what to display or actions to take based on the account's state.
Test and Verify: Thoroughly test the integration to ensure that all properties and status flags correctly represent the account's state in different scenarios, including initial connection, reconnection, and disconnection.
Can i please be assigned to this issue @fracek
Can i please be assigned to this issue @fracek
@ShantelPeters please apply via OnlyDust : )
I am applying to this issue via OnlyDust platform.
I'm a frontend developer, my first time contributing to this repo it would take me a maximum of 4 working day to complete this issue and I have over 30 + contributions
in intend to solve this issue in following this step:
import { Address } from 'your-address-type-definition-file':
export type UseAccountResult = {
/** The connected account object. */
account?: AccountInterface;
/** The address of the connected account. */
address?: Address;
/** The connected connector. */
connector?: Connector;
/** Connector's chain id */
chainId?: bigint;
/** True if connecting. */
isConnecting?: boolean;
/** True if reconnecting. */
isReconnecting?: boolean;
/** True if connected. */
isConnected?: boolean;
/** True if disconnected. */
isDisconnected?: boolean;
/** The connection status. */
status: AccountStatus;
};
export type Address = `0x${string}`;
Update Usage Across the Codebase: After updating the type definition, i will ensure that all places in the codebase where useAccount() is used or where the address field is accessed are updated to reflect this new type definition. This might include updating function parameters, state variables, or any other structures that expect an Address type.
Testing: After making these changes, i will test the application to ensure that the new type definition does not introduce any issues. I will ensure that the address is being handled correctly and that type-checking passes without errors.
@fracek , You said I should work on this issue during this ODHack. Can you assign the issue to me now? I already applied through onlydust.
Hello @fracek isn't this issue already fixed here:
Hey, yes that specific issue is solved but we need the getAddress
helper still.
Hey @Benjtalkshow you need to add the getAddress helper I described above.
Hey @Benjtalkshow you need to add the getAddress helper I described above.
Alright. Thanks for giving me the oppurtunity
useAccount()
hook return the following type:The
address
should be typed asAddress
instead ofstring