@niftykit/diamond 0.2.3 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ Or use it via CDN
|
|
|
22
22
|
|
|
23
23
|
## How to use
|
|
24
24
|
|
|
25
|
+
### Drop Collection
|
|
26
|
+
|
|
25
27
|
```typescript
|
|
26
28
|
// using ethers.js
|
|
27
29
|
import { ethers } from 'ethers';
|
|
@@ -33,7 +35,60 @@ const signer = provider.getSigner();
|
|
|
33
35
|
|
|
34
36
|
const diamond = await Diamond.create(signer, 'YOUR-SDK-KEY');
|
|
35
37
|
|
|
38
|
+
// minter
|
|
39
|
+
const recipient = await signer.getAddress();
|
|
40
|
+
|
|
41
|
+
// get current price
|
|
42
|
+
const price = await diamond.apps.drop.price();
|
|
43
|
+
|
|
36
44
|
// mint 1 NFT
|
|
37
|
-
await diamond.apps.drop
|
|
45
|
+
const tx = await state.diamond.apps.drop.mintTo(recipient, 1, {
|
|
46
|
+
value: price,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await tx.wait();
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Edition Collection
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// using ethers.js
|
|
57
|
+
import { ethers } from 'ethers';
|
|
58
|
+
import Diamond from '@niftykit/diamond';
|
|
59
|
+
|
|
60
|
+
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');
|
|
61
|
+
await provider.send('eth_requestAccounts', []);
|
|
62
|
+
const signer = provider.getSigner();
|
|
63
|
+
|
|
64
|
+
const diamond = await Diamond.create(signer, 'YOUR-SDK-KEY');
|
|
65
|
+
|
|
66
|
+
// edition id
|
|
67
|
+
const editionId = 0; // change this to your edition id
|
|
68
|
+
|
|
69
|
+
// get edition price
|
|
70
|
+
const price = await diamond.apps.edition.getEditionPrice(editionId);
|
|
71
|
+
|
|
72
|
+
// minter
|
|
73
|
+
const recipient = await signer.getAddress();
|
|
74
|
+
|
|
75
|
+
// check presale (if any)
|
|
76
|
+
const verify = await state.diamond.verifyForEdition(
|
|
77
|
+
recipient,
|
|
78
|
+
editionId
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// mint 1 NFT
|
|
82
|
+
const tx = await diamond.apps.edition.mintEdition(
|
|
83
|
+
recipient,
|
|
84
|
+
editionId,
|
|
85
|
+
1,
|
|
86
|
+
verify?.proof ?? [],
|
|
87
|
+
{
|
|
88
|
+
value: price,
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
await tx.wait();
|
|
38
93
|
|
|
39
94
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niftykit/diamond",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "NiftyKit Diamond SDK",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"axios": "^1.3.2",
|
|
49
49
|
"ethers": "^5.7.2"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "012ceae30e08f938c894fbee05336d8ee46fb683"
|
|
52
52
|
}
|