-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK] Feature: Adds Multiwrap and LoyaltyCard Extensions (#5529)
CNCT-2438 <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces enhancements to the `thirdweb` library by adding support for a new `LoyaltyCard` extension, improving event handling, and updating the `github_checks` workflow to validate PR branches for issue references. ### Detailed summary - Added `ignore` pattern in `codecov.yml`. - Updated `issue.yml` to check PR body and branch name for valid issue references. - Implemented `LoyaltyCard` extension with deployment support and event handling. - Added new functions for `TokensMinted`, `TokensUnwrapped`, and `TokensWrapped` events. - Updated `Multiwrap` and `LoyaltyCard` ABIs. - Added tests for deploying `LoyaltyCard` and other ERC721 types. > The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/erc721/__generated__/Multiwrap/write/unwrap.ts`, `packages/thirdweb/src/extensions/erc721/__generated__/Multiwrap/write/wrap.ts`, `packages/thirdweb/src/extensions/erc721/__generated__/LoyaltyCard/write/mintWithSignature.ts`, `packages/thirdweb/src/extensions/erc721/__generated__/Multiwrap/write/initialize.ts`, `packages/thirdweb/src/extensions/erc721/__generated__/LoyaltyCard/write/initialize.ts` > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
- Loading branch information
1 parent
9d3c8ac
commit 7488102
Showing
29 changed files
with
2,809 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
"thirdweb": minor | ||
--- | ||
|
||
Adds LoyaltyCard extensions and support for ERC721 deployment. | ||
|
||
```ts | ||
import { deployERC721Contract } from "thirdweb/deploys"; | ||
|
||
const loyaltyCardContractAddress = await deployERC721Contract({ | ||
chain: "your-chain-id", // replace with your chain ID | ||
client: yourThirdwebClient, // replace with your Thirdweb client instance | ||
account: yourAccount, // replace with your account details | ||
type: "LoyaltyCard", | ||
params: { | ||
name: "MyLoyaltyCard", | ||
symbol: "LOYAL", | ||
description: "A loyalty card NFT contract", | ||
image: "path/to/image.png", // replace with your image path | ||
defaultAdmin: "0xYourAdminAddress", // replace with your admin address | ||
royaltyRecipient: "0xYourRoyaltyRecipient", // replace with your royalty recipient address | ||
royaltyBps: 500n, // 5% royalty | ||
trustedForwarders: ["0xTrustedForwarderAddress"], // replace with your trusted forwarder addresses | ||
saleRecipient: "0xYourSaleRecipient", // replace with your sale recipient address | ||
platformFeeBps: 200n, // 2% platform fee | ||
platformFeeRecipient: "0xYourPlatformFeeRecipient", // replace with your platform fee recipient address | ||
}, | ||
}); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ coverage: | |
target: 80% | ||
flags: | ||
- packages | ||
ignore: | ||
- "**/__generated__/**" | ||
|
||
|
||
github_checks: | ||
|
14 changes: 14 additions & 0 deletions
14
packages/thirdweb/scripts/generate/abis/erc721/LoyaltyCard.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
"constructor()", | ||
"function cancel(uint256 tokenId)", | ||
"function initialize(address _defaultAdmin, string _name, string _symbol, string _contractURI, address[] _trustedForwarders, address _saleRecipient, address _royaltyRecipient, uint128 _royaltyBps, uint128 _platformFeeBps, address _platformFeeRecipient)", | ||
"function mintTo(address _to, string _uri) returns (uint256 tokenIdMinted)", | ||
"function mintWithSignature((address to, address royaltyRecipient, uint256 royaltyBps, address primarySaleRecipient, uint256 quantity, uint256 pricePerToken, address currency, uint128 validityStartTimestamp, uint128 validityEndTimestamp, string uri) _req, bytes _signature) payable returns (address signer)", | ||
"function nextTokenIdToMint() view returns (uint256)", | ||
"function revoke(uint256 tokenId)", | ||
"function supportsInterface(bytes4 interfaceId) view returns (bool)", | ||
"function tokenURI(uint256 _tokenId) view returns (string)", | ||
"function totalMinted() view returns (uint256)", | ||
"event TokensMinted(address indexed mintedTo, uint256 indexed tokenIdMinted, string uri)", | ||
"event TokensMintedWithSignature(address indexed signer, address indexed mintedTo, uint256 indexed tokenIdMinted, (address to, address royaltyRecipient, uint256 royaltyBps, address primarySaleRecipient, uint256 quantity, uint256 pricePerToken, address currency, uint128 validityStartTimestamp, uint128 validityEndTimestamp, string uri) mintRequest)" | ||
] |
15 changes: 15 additions & 0 deletions
15
packages/thirdweb/scripts/generate/abis/erc721/Multiwrap.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
"constructor(address _nativeTokenWrapper)", | ||
"event TokensWrapped(address indexed wrapper, address indexed recipientOfWrappedToken, uint256 indexed tokenIdOfWrappedToken, (address assetContract, uint8 tokenType, uint256 tokenId, uint256 amount)[] wrappedContents)", | ||
"event TokensUnwrapped(address indexed unwrapper, address indexed recipientOfWrappedContents, uint256 indexed tokenIdOfWrappedToken)", | ||
"function contractType() pure returns (bytes32)", | ||
"function contractVersion() pure returns (uint8)", | ||
"function getWrappedContents(uint256 _tokenId) view returns ((address assetContract, uint8 tokenType, uint256 tokenId, uint256 amount)[] contents)", | ||
"function initialize(address _defaultAdmin, string _name, string _symbol, string _contractURI, address[] _trustedForwarders, address _royaltyRecipient, uint256 _royaltyBps)", | ||
"function nextTokenIdToMint() view returns (uint256)", | ||
"function supportsInterface(bytes4 interfaceId) view returns (bool)", | ||
"function tokenURI(uint256 _tokenId) view returns (string)", | ||
"function unwrap(uint256 _tokenId, address _recipient)", | ||
"function wrap((address assetContract, uint8 tokenType, uint256 tokenId, uint256 amount)[] _tokensToWrap, string _uriForWrappedToken, address _recipient) payable returns (uint256 tokenId)", | ||
"receive() external payable" | ||
] |
47 changes: 47 additions & 0 deletions
47
packages/thirdweb/src/extensions/erc721/__generated__/LoyaltyCard/events/TokensMinted.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
...rdweb/src/extensions/erc721/__generated__/LoyaltyCard/events/TokensMintedWithSignature.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
packages/thirdweb/src/extensions/erc721/__generated__/LoyaltyCard/read/nextTokenIdToMint.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.