jnsdls edb95d00ca [Extensions] Expose permission detection logic (#4375)
### TL;DR

Exposed permission detection logic for the Extensions module.

### What changed?

- Added `is*Supported` functions for various permission-related operations.
- Exported these new functions to make them accessible to users.
- Implemented `isGetAllRoleMembersSupported` function to check if both `getRoleMember` and `getRoleMemberCount` are supported.
- Renamed `grant.ts` to `grantRole.ts` for consistency.

### How to test?

1. Import the new `is*Supported` functions from the permissions module.
2. Pass an array of contract function selectors to these functions.
3. Verify that they correctly identify whether the corresponding permission operations are supported.

Example:
```typescript
import { isGetAllRoleMembersSupported } from "thirdweb/extensions/permissions";

const supported = isGetAllRoleMembersSupported(["0x..."]);
console.log("getAllRoleMembers supported:", supported);
```

### Why make this change?

This change allows developers to programmatically detect which permission-related operations are supported by a given contract. This is particularly useful when working with contracts that may implement only a subset of the permissions interface, enabling more robust and flexible integration with various smart contracts.

---

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances the `thirdweb` package by exposing permission detection logic for various role-related operations.

### Detailed summary
- Exposes permission detection logic for `hasRole`, `revokeRole`, `getRoleAdmin`, `renounceRole`, and more
- Renamed `grant.js` to `grantRole.js`
- Added new exports for supported permission operations
- Added a new function `isGetAllRoleMembersSupported` to check support for `getAllRoleMembers` operation

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2024-09-04 06:56:14 +00:00
2024-04-10 08:44:09 -07:00
2024-02-06 13:52:51 -08:00
2024-08-23 17:08:31 +00:00
2024-06-18 22:42:01 -07:00
2023-03-31 01:28:56 +00:00
2024-08-22 16:36:54 +00:00
2024-08-06 15:44:36 -07:00
2024-08-22 16:36:54 +00:00



thirdweb TypeScript SDK

Build Status Join our Discord!

All-in-one web3 SDK for Browser, Node and Mobile apps

Features

  • Support for React & React-Native
  • First party support for Embedded Wallets (social/email login)
  • First party support for Account Abstraction
  • Instant connection to any chain with RPC Edge integration
  • Integrated IPFS upload/download
  • UI Components for connection, transactions, nft rendering
  • High level contract extensions for interacting with common standards
  • Automatic ABI resolution

Library Comparison

thirdweb Wagmi + Viem Ethers@6
Type safe contract API ✅ ✅ ✅
Type safe wallet API ✅ ✅ ✅
EVM utils ✅ ✅ ✅
RPC for any EVM ✅  ⚠️ public RPC only ❌
Automatic ABI Resolution ✅ ❌ ❌
IPFS Upload/Download ✅ ❌ ❌
Embedded wallet (email/ social login) ✅ ⚠️ via 3rd party ❌
Account abstraction (ERC4337) support ✅ ⚠️ via 3rd party ❌
Web3 wallet connectors ✅ ✅ ❌
Local wallet creation ✅ ✅ ✅
Auth (SIWE) ✅ ✅ ❌
Extensions functions for common standards ✅ ✅ ❌
React Hooks ✅ ✅ ❌
React UI components ✅ ❌ ❌
React Native Hooks ✅ ✅ ❌
React Native UI Components ✅ ❌ ❌

Contributing

We welcome contributions from all developers regardless of experience level. If you are interested in contributing, please read our Contributing Guide to learn how the repo works, how to test your changes, and how to submit a pull request.

See our open source page for more information on our open-source bounties and program.

Additional Resources

Support

For help or feedback, please visit our support site

Security

If you believe you have found a security vulnerability in any of our packages, we kindly ask you not to open a public issue; and to disclose this to us by emailing [email protected].

S
Description
No description provided
Readme
1.1 GiB
Languages
TypeScript 87.9%
MDX 11.1%
JavaScript 0.6%
CSS 0.4%