From 82c5ead24ee72d82c560288a52c15b6d996c1eb5 Mon Sep 17 00:00:00 2001 From: Sweets Sweetman Date: Wed, 17 Jan 2024 22:27:44 -0300 Subject: [PATCH] I update to latest version. --- CHANGELOG.md | 6 ++++++ README.md | 2 ++ hooks/use1155Collect.ts | 11 +++++++++-- package.json | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff30f64..653a0da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # onchain-magic +## 0.2.6 + +### Patch Changes + +- I read drop price using saleStrategy instead of hard-coded. + ## 0.2.5 ### Patch Changes diff --git a/README.md b/README.md index 7a82051..93b8216 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ## Getting started +- Documentation can be found here: [docs.onchainmagic.xyz](https://docs.onchainmagic.xyz) + ```bash npm install onchain-magic # or diff --git a/hooks/use1155Collect.ts b/hooks/use1155Collect.ts index 9a32892..f8b469e 100644 --- a/hooks/use1155Collect.ts +++ b/hooks/use1155Collect.ts @@ -1,7 +1,8 @@ import { useMemo } from "react"; -import { Contract, utils } from "ethers"; +import { BigNumber, Contract, utils } from "ethers"; import { useEthersSigner } from "./useEthersSigner"; import abi from "../lib/abi/Zora1155Drop.json"; +import { useZoraFixedPriceSaleStrategy } from ".."; const use1155Collect = (zora1155Drop: string, minterAddress: string) => { const signer = useEthersSigner(); @@ -9,6 +10,7 @@ const use1155Collect = (zora1155Drop: string, minterAddress: string) => { () => new Contract(zora1155Drop, abi, signer), [zora1155Drop, signer] ); + const { sale } = useZoraFixedPriceSaleStrategy(minterAddress); const mintWithRewards = async ( tokenId: string, @@ -16,6 +18,11 @@ const use1155Collect = (zora1155Drop: string, minterAddress: string) => { referral: string, comment = "🪄🪄🪄" ) => { + const response = await sale(zora1155Drop, "1"); + const zoraFee = BigNumber.from("777000000000000"); + const value = BigNumber.from(response.pricePerToken.toString()).add( + zoraFee + ); const minterArguments = utils.defaultAbiCoder.encode( ["address", "string"], [to, comment] @@ -27,7 +34,7 @@ const use1155Collect = (zora1155Drop: string, minterAddress: string) => { minterArguments, referral, { - value: "1554000000000000", + value, } ); diff --git a/package.json b/package.json index 0d687ac..56055ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onchain-magic", - "version": "0.2.5", + "version": "0.2.6", "private": false, "type": "module", "peerDependencies": {