From b634f38ed7ac47093239bbea80a44ee0913b2c6a Mon Sep 17 00:00:00 2001 From: prakash-shelar1891 Date: Fri, 25 Oct 2024 12:08:17 +0530 Subject: [PATCH 1/2] add note for addressGroup --- docs/sdk/web3-react.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/sdk/web3-react.md b/docs/sdk/web3-react.md index 0bb973bf..53d853af 100644 --- a/docs/sdk/web3-react.md +++ b/docs/sdk/web3-react.md @@ -51,6 +51,15 @@ parameter is optional. If specified, the wallet provider will connect to an address in the specified group, otherwise the wallet provider will connect to address from any group. +Note: When interacting with a deployed smart contract, use the same `addressGroup` that was specified during deployment. To identify the `addressGroup` of a deployed contract, use the following code: + +```typescript +const nftCollection = NFTCollection.at(contractAddress); +const index = await nftCollection.groupIndex; +``` + +This code retrieves the group index associated with the contract, confirming the correct `addressGroup`. + The `displayAccount` parameter in the `AlephiumConnectButton` component is used to specify the content displayed after the wallet is connected. By default, the connected address will be displayed. From bd1d381fc0c87201d3ea523f371cb16a518d152b Mon Sep 17 00:00:00 2001 From: prakash-shelar1891 Date: Fri, 25 Oct 2024 14:46:01 +0530 Subject: [PATCH 2/2] Add groupOfAddress method --- docs/sdk/web3-react.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdk/web3-react.md b/docs/sdk/web3-react.md index 53d853af..dec4fad3 100644 --- a/docs/sdk/web3-react.md +++ b/docs/sdk/web3-react.md @@ -54,8 +54,8 @@ will connect to address from any group. Note: When interacting with a deployed smart contract, use the same `addressGroup` that was specified during deployment. To identify the `addressGroup` of a deployed contract, use the following code: ```typescript -const nftCollection = NFTCollection.at(contractAddress); -const index = await nftCollection.groupIndex; +import { groupOfAddress } from '@alephium/web3'; +const index = groupOfAddress(contractAddress); ``` This code retrieves the group index associated with the contract, confirming the correct `addressGroup`.