Skip to content

Commit

Permalink
Merge pull request #56 from dotbitHQ/fix/verify-address
Browse files Browse the repository at this point in the history
chore: update README.md
  • Loading branch information
web3max authored Jul 7, 2023
2 parents 8495d5d + a44cf9a commit 1091ba8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions docs/api/dotbit.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,18 +722,18 @@ Get the avatar of a given account.

For details, please refer to the documentation of [@dotbit/plugin-avatar](https://github.com/mozwell/dotbit.js/blob/main/packages/plugin-avatar/README.md)

## verifyAddrsByAccount(address, account, subAccount, verifyType)
Check if the given address has the specified SubDID under the account.
## verifyAddrsByAccount(address, mainAccount, subAccount, verifyType)
Verify whether the provided address has associated SubDIDs within the given main account, serving as a gateway for community member participation.
### Parameters
- address: `string` Address to be verified.
- account: `string` Specified .bit account.
- mainAccount: `string` Specified .bit account.
- (Optional)subAccount: `string` Specified SubDID. `subAccount` is an optional field. If subAccount is empty, it will default to checking if the given address has at least one SubDID under any specified account.
- (Optional)verifyType: `number` The `verifyType` is an optional field with a default value of 0, where 0 represents that the `address` is the owner address of the SubDID, and 1 represents that the `address` is the manager address of the SubDID.
### Return Value
Promise\<`boolean`>
### Example
```javascript
// Check if the owner address has the SubDID 'leon.leonx.bit' under the account 'leonx.bit'.
// Check if the owner address has the SubDID 'leon.leonx.bit' under the main account 'leonx.bit'.
dotbit.verifyAddrsByAccount(
'0xC72B6f66017246d6A7f159F5C2BF358188AD9ECa',
'leonx.bit',
Expand All @@ -743,7 +743,7 @@ dotbit.verifyAddrsByAccount(
// The printed result would be like:
true

// Check if the manager address has any SubDID under the account 'leonx.bit'.
// Check if the manager address has any SubDID under the main account 'leonx.bit'.
dotbit.verifyAddrsByAccount(
'0xC72B6f66017246d6A7f159F5C2BF358188AD9ECa',
'leonx.bit',
Expand Down
6 changes: 3 additions & 3 deletions src/DotBit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ export class DotBit {
/**
* Check if the address has the specified SubDID under the designated account.
* @param address
* @param account
* @param mainAccount
* @param subAccount
* @param verifyType default 0 === "owner", 1 === "manager"
*/
async verifyAddrsByAccount (address: string, account: string, subAccount?: string, verifyType?: number){
return await this.bitIndexer.subAccountVerify(address, account, subAccount, verifyType)
async verifyAddrsByAccount (address: string, mainAccount: string, subAccount?: string, verifyType?: number){
return await this.bitIndexer.subAccountVerify(address, mainAccount, subAccount, verifyType)
}
}
2 changes: 1 addition & 1 deletion src/fetchers/BitIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class BitIndexer {
}

/**
* Check if the address has the specified SubDID under the designated account.
* Verify whether the provided address has associated SubDIDs within the given main account, serving as a gateway for community member participation.
* @param address
* @param account
* @param subAccount
Expand Down

0 comments on commit 1091ba8

Please sign in to comment.