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

added docstring to usecontract and use token balance hooks #216

Conversation

Redarcher9
Copy link
Contributor

Closes #190

Description

Added docstring to useContract and useTokenBalance hooks

📝 Additional Information

Anything else you'd want reviewers to know.

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2022

🦋 Changeset detected

Latest commit: 3d00718

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@web3-ui/hooks Minor
@web3-ui/core Patch
example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Redarcher9
Copy link
Contributor Author

@Nazeeh21 , I've raised a pull request for issue #190

@Nazeeh21 Nazeeh21 requested a review from Dhaiwat10 January 6, 2022 19:45
@@ -9,6 +9,20 @@ interface Props {
accountAddress: string;
}

/**
* @dev Hook to use account token balance
Copy link
Member

@Nazeeh21 Nazeeh21 Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Hook to get the token balance of the account would be more appropriate

Copy link
Contributor Author

@Redarcher9 Redarcher9 Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this hook going to get used when something like a button saying "usetokenbalance" is clicked?.

@@ -9,6 +9,20 @@ interface Props {
accountAddress: string;
}

/**
* @dev Hook to use account token balance
* @param {string} tokenAddress Address of the token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param tokenAddress Address of the token

/**
* @dev Hook to use account token balance
* @param {string} tokenAddress Address of the token
* @param {string} accountAddress Address of the account
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param accountAddress Address of the account

* @param {string} tokenAddress Address of the token
* @param {string} accountAddress Address of the account
* @returns {
* balance {string}: balance in Wei converted to string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

balance: gives account balance for the token in Wei as a string

* @param {string} accountAddress Address of the account
* @returns {
* balance {string}: balance in Wei converted to string.
* loading {boolean}: True until transaction is undergoing, false when error is caught.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loading: True until the transaction is executing, false otherwise

@@ -2,6 +2,16 @@ import React from 'react';
import { Web3Context } from '../Provider';
import { Contract } from 'ethers';

/**
* @dev Hook to use a contract
* @param {string} address contract address
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param address contract address

@@ -2,6 +2,16 @@ import React from 'react';
import { Web3Context } from '../Provider';
import { Contract } from 'ethers';

/**
* @dev Hook to use a contract
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dev Hook to get the contract instance from ABI and contract address

/**
* @dev Hook to use a contract
* @param {string} address contract address
* @param {string} accountAddress contract ABI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param abi contract ABI

* @param {string} address contract address
* @param {string} accountAddress contract ABI
* @returns {
* contract {string}: Current contract in use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contract: An instance of the current contract

* @param {string} accountAddress contract ABI
* @returns {
* contract {string}: Current contract in use
* isReady {boolean}: True when contract is set, false otherwise.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isReady: True when the contract is ready to use, false otherwise.

@Redarcher9 Redarcher9 requested a review from Nazeeh21 January 7, 2022 17:40
/**
* @dev Hook to get the token balance of the account
* @param tokenAddress Address of the token
* param accountAddress Address of the account
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param accountAddress Address of the account

Copy link
Member

@Nazeeh21 Nazeeh21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall nice, just a minor change is needed. Sorry for not adding the @ in the suggested review.

@Redarcher9 Redarcher9 requested a review from Nazeeh21 January 7, 2022 18:58
@Redarcher9
Copy link
Contributor Author

Hey @Nazeeh21 , sorry my bad I should have checked before commiting the change

@with-heart
Copy link
Member

You should remove these files:

  • .changeset/rude-chefs-love.md
  • .vscode/settings.json

Changesets add entries to the CHANGELOG file so we should only create them with messages relevant to our users, and local VSCode settings shouldn't be checked in :)

@Redarcher9
Copy link
Contributor Author

Redarcher9 commented Jan 7, 2022

Hi @with-heart ,

Thanks for your inputs. I'll make the changes and commit it.
I've a quick question for you though, what's the correct way to use changeset? Should I run the yarn changeset command after committing and pushing my code?

.changeset/three-donuts-sniff.md Outdated Show resolved Hide resolved
packages/hooks/src/hooks/useContract.ts Outdated Show resolved Hide resolved
packages/hooks/src/hooks/useTokenBalance.ts Outdated Show resolved Hide resolved
packages/hooks/src/hooks/useContract.ts Outdated Show resolved Hide resolved
@with-heart
Copy link
Member

I've a quick question for you though, what's the correct way to use changeset? Should I run the yarn changeset command after committing and pushing my code?

Yeap that's fine! Usually adding changesets is the last thing I do when making a PR

Redarcher9 and others added 4 commits January 8, 2022 01:13
Co-authored-by: with-heart <with.heart+git@pm.me>
Co-authored-by: with-heart <with.heart+git@pm.me>
Co-authored-by: with-heart <with.heart+git@pm.me>
Co-authored-by: with-heart <with.heart+git@pm.me>
@Redarcher9 Redarcher9 requested a review from with-heart January 7, 2022 19:46
@Redarcher9
Copy link
Contributor Author

Redarcher9 commented Jan 9, 2022

Hi @with-heart @Nazeeh21 ,
Can you please review my pull request? I've made the requested changes.

@Nazeeh21
Copy link
Member

Nazeeh21 commented Jan 9, 2022

Sure, will review it tomorrow

@Nazeeh21
Copy link
Member

Changes LGTM. We'll merge it once @with-heart approves it.
Thanks.

@Dhaiwat10 Dhaiwat10 merged commit ece14b2 into Developer-DAO:main Jan 11, 2022
@Dhaiwat10
Copy link
Member

@allcontributors please add @Redarcher9 for docs!

@allcontributors
Copy link
Contributor

@Dhaiwat10

I've put up a pull request to add @Redarcher9! 🎉

@github-actions github-actions bot mentioned this pull request Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add docstring for useContract and useTokenBalance hook
4 participants