Skip to content

Commit

Permalink
I update to latest version.
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetmantech committed Jan 18, 2024
1 parent d74a76a commit 82c5ead
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Getting started

- Documentation can be found here: [docs.onchainmagic.xyz](https://docs.onchainmagic.xyz)

```bash
npm install onchain-magic
# or
Expand Down
11 changes: 9 additions & 2 deletions hooks/use1155Collect.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
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();
const zora1155DropContract = useMemo(
() => new Contract(zora1155Drop, abi, signer),
[zora1155Drop, signer]
);
const { sale } = useZoraFixedPriceSaleStrategy(minterAddress);

const mintWithRewards = async (
tokenId: string,
to: 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]
Expand All @@ -27,7 +34,7 @@ const use1155Collect = (zora1155Drop: string, minterAddress: string) => {
minterArguments,
referral,
{
value: "1554000000000000",
value,
}
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onchain-magic",
"version": "0.2.5",
"version": "0.2.6",
"private": false,
"type": "module",
"peerDependencies": {
Expand Down

0 comments on commit 82c5ead

Please sign in to comment.