Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
306debb029 Version Packages (#302)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-12 10:57:32 -07:00
Joaquim VergesandGitHub 86f0ceff46 [React] Remove useAddress hook for now (#301) 2022-10-12 17:54:14 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
7f0d1ec947 Version Packages (#300)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-10-12 10:23:15 -07:00
Joaquim VergesandGitHub b1218cbd7d [React] Recreate SDK on wallet changes to propagate to useAddress and other hooks (#299) 2022-10-12 10:12:21 -07:00
Joaquim Verges 97ef35ce0f [SDK] docstrings for claim conditions 2022-10-12 08:48:58 -07:00
23 changed files with 94 additions and 53 deletions
+4
View File
@@ -1,5 +1,9 @@
# @thirdweb-dev/auth
## 2.0.16
## 2.0.15
## 2.0.14
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "2.0.14",
"version": "2.0.16",
"exports": {
"./next": {
"module": "./next/dist/thirdweb-dev-auth-next.esm.js",
+14
View File
@@ -1,5 +1,19 @@
# thirdweb
## 0.8.2
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.2.4
## 0.8.1
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.2.3
## 0.8.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.8.0",
"version": "0.8.2",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/react
## 3.2.4
### Patch Changes
- [#301](https://github.com/thirdweb-dev/js/pull/301) [`86f0cef`](https://github.com/thirdweb-dev/js/commit/86f0ceff46f72df8ebd81f843e3c66a245f23992) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Remove useAddress hook for now
## 3.2.3
### Patch Changes
- [#299](https://github.com/thirdweb-dev/js/pull/299) [`b1218cb`](https://github.com/thirdweb-dev/js/commit/b1218cbd7d97ca7949d94a7e4ab93fef4ffbacd5) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Recreate SDK on wallet changes for hook propagation
## 3.2.2
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.2.2",
"version": "3.2.4",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useEdition } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const edition = useEdition("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "edition")
*
* // Now you can use the edition contract in the rest of the component
*
* // For example, this function will return all the NFTs on this contract
* async function getNFTs() {
* const nfts = await edition.getAll()
* const nfts = await contract.getAll()
* return nfts
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useEditionDrop } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const editionDrop = useEditionDrop("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "edition-drop")
*
* // Now you can use the edition drop contract in the rest of the component
*
* // For example, this function will let the connected wallet claim a new NFT
* async function claim(tokenId, quantity) {
* await editionDrop.claim(tokenId, quantity)
* await contract.claim(tokenId, quantity)
* }
*
* ...
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useMarketplace } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const marketplace = useMarketplace("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "marketplace")
*
* // Now you can use the marketplace contract in the rest of the component
*
* // For example, this function will return all the listings on the marketplace
* async function getListings() {
* const listings = await marketplace.getAll()
* const listings = await contract.getAll()
* return listings
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useMultiwrap } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const multiwrap = useMultiwrap("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "multiwrap")
*
* // Now you can use the multiwrap contract in the rest of the component
*
* // For example, this function will let the connected wallet wrap tokens
* async function wrap(tokensToWrap, wrappedNFTMetadata) {
* await multiwrap.wrap(tokensToWrap, wrappedNFTMetadata)
* await contract.wrap(tokensToWrap, wrappedNFTMetadata)
* }
*
* ...
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useNFTCollection } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const nftCollection = useNFTCollection("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useNFTCollection("<YOUR-CONTRACT-ADDRESS>", "nft-collection")
*
* // Now you can use the nftCollection contract in the rest of the component
*
* // For example, this function will return all the NFTs on this contract
* async function getNFTs() {
* const nfts = await nftCollection.getAll()
* const nfts = await contract.getAll()
* return nfts
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useNFTDrop } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const nftDrop = useNFTDrop("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "nft-drop")
*
* // Now you can use the nft drop contract in the rest of the component
*
* // For example, this function will let the connected wallet claim a new NFT
* async function claim(quantity) {
* await nftDrop.claim(quantity)
* await contract.claim(quantity)
* }
*
* ...
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { usePack } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const pack = usePack("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = usePack("<YOUR-CONTRACT-ADDRESS>", "pack")
*
* // Now you can use the pack contract in the rest of the component
*
* // For example, this function will get all the packs on this contract
* async function getPacks() {
* const packs = await pack.getAll()
* const packs = await contract.getAll()
* return packs
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useSignatureDrop } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const signatureDrop = useSignatureDrop("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "signature-drop")
*
* // Now you can use the Signature drop contract in the rest of the component
*
* // For example, this function will let the connected wallet claim a new NFT
* async function claim(quantity) {
* await signatureDrop.claim(quantity)
* await contract.claim(quantity)
* }
*
* ...
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useSplit } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const split = useSplit("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "split")
*
* // Now you can use the split contract in the rest of the component
*
* // For example, this function will retrun all the receipients of the split
* async function getRecipients() {
* const recipients = await split.getAllRecipients()
* const recipients = await contract.getAllRecipients()
* return recipients
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useToken } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const token = useToken("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "token")
*
* // Now you can use the token contract in the rest of the component
*
* // For example, this function will get the connected wallets token balance
* async function balance() {
* const balance = await token.balance()
* const balance = await contract.balance()
* return balance
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useTokenDrop } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const tokenDrop = useTokenDrop("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "token-drop")
*
* // Now you can use the token drop contract in the rest of the component
*
* // For example, this function will get the connected wallets token balance
* async function balance() {
* const balance = await tokenDrop.balance()
* const balance = await contract.balance()
* return balance
* }
*
@@ -8,16 +8,16 @@ import { useContract } from "../async/contracts";
*
* @example
* ```javascript
* import { useVote } from '@thirdweb-dev/react'
* import { useContract } from '@thirdweb-dev/react'
*
* export default function Component() {
* const vote = useVote("<YOUR-CONTRACT-ADDRESS>")
* const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "vote")
*
* // Now you can use the vote contract in the rest of the component
*
* // For example, this function will get all the proposals on this contract
* async function getProposals() {
* const proposals = await vote.getAll()
* const proposals = await contract.getAll()
* return proposals
* }
*
@@ -1,11 +0,0 @@
import { useSDK } from "../../providers/base";
/**
* Get the currently connected wallet address
*
* @returns the address of the connected wallet (in base58 string format)
*/
export function useAddress() {
const sdk = useSDK();
return sdk?.wallet?.getAddress();
}
-1
View File
@@ -35,5 +35,4 @@ export * from "./hooks/token/useTransferToken";
export * from "./hooks/auth";
//Wallet
export * from "./hooks/wallet/useAddress";
export * from "./hooks/wallet/useBalance";
+4
View File
@@ -1,5 +1,9 @@
# @thirdweb-dev/sdk
## 3.2.4
## 3.2.3
## 3.2.2
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.2.2",
"version": "3.2.4",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
+20 -1
View File
@@ -41,7 +41,6 @@ export class NFTDrop {
private nft: NFTHelper;
public accountType = "nft-drop" as const;
public publicKey: PublicKey;
public claimConditions: ClaimConditions;
public get network() {
const url = new URL(this.metaplex.connection.rpcEndpoint);
// try this first to avoid hitting `custom` network for alchemy urls
@@ -54,6 +53,26 @@ export class NFTDrop {
return this.metaplex.cluster;
}
/**
* Manage the claim conditions for this drop
*
* @example
* ```jsx
* // set your claim conditions
* await program.claimConditions.set({
* maxClaimable: 100,
* price: 0.5,
* startTime: new Date(),
* });
*
* // get your claim conditions
* const conditions = await program.claimConditions.get();
* console.log(conditions.maxClaimable);
* console.log(conditions.claimedSupply);
* ```
*/
public claimConditions: ClaimConditions;
constructor(
dropAddress: string,
metaplex: Metaplex,