3land_sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +352 -0
- package/assets/3land_rebrand.gif +0 -0
- package/assets/battle_sol.gif +0 -0
- package/assets/ds.jpeg +0 -0
- package/assets/future.webp +0 -0
- package/assets/music.mp3 +0 -0
- package/assets/niicl.gif +0 -0
- package/assets/og.png +0 -0
- package/assets/phone.glb +0 -0
- package/assets/testvid.mp4 +0 -0
- package/idl.json +7652 -0
- package/package.json +35 -0
- package/src/index.ts +89 -0
- package/src/library/Irys/irys.ts +412 -0
- package/src/library/Store.ts +613 -0
- package/src/library/implementation/storeImplementation.ts +385 -0
- package/src/library/instructions/store/buySingleEdition.ts +227 -0
- package/src/library/instructions/store/createSingleEdition.ts +49 -0
- package/src/library/instructions/store/createStore.ts +19 -0
- package/src/library/instructions/store/idl.ts +7622 -0
- package/src/library/instructions/store/uploadFilesIryis.ts +133 -0
- package/src/types/accounts/ArchiveDeposit.ts +207 -0
- package/src/types/accounts/Authority.ts +73 -0
- package/src/types/accounts/BurnDeposit.ts +111 -0
- package/src/types/accounts/BurnProgress.ts +97 -0
- package/src/types/accounts/BuyHistory.ts +121 -0
- package/src/types/accounts/BuyTrack.ts +94 -0
- package/src/types/accounts/Card.ts +185 -0
- package/src/types/accounts/CollectionRegistry.ts +145 -0
- package/src/types/accounts/CollectorRegistry.ts +145 -0
- package/src/types/accounts/CreatorRegistry.ts +153 -0
- package/src/types/accounts/CurrencyArtistProof.ts +113 -0
- package/src/types/accounts/GenericUser.ts +185 -0
- package/src/types/accounts/ItemArchive.ts +223 -0
- package/src/types/accounts/ItemReserveList.ts +87 -0
- package/src/types/accounts/ItemReserveList2.ts +73 -0
- package/src/types/accounts/LutVault.ts +97 -0
- package/src/types/accounts/Pack.ts +367 -0
- package/src/types/accounts/PackContent.ts +97 -0
- package/src/types/accounts/PackOpenHolder.ts +141 -0
- package/src/types/accounts/PackReceipt.ts +145 -0
- package/src/types/accounts/PackTraits.ts +101 -0
- package/src/types/accounts/Payment.ts +97 -0
- package/src/types/accounts/PoolVault.ts +177 -0
- package/src/types/accounts/RevealForMe.ts +139 -0
- package/src/types/accounts/SecureHolder.ts +97 -0
- package/src/types/accounts/Single.ts +301 -0
- package/src/types/accounts/Store.ts +180 -0
- package/src/types/accounts/StoresHolder.ts +131 -0
- package/src/types/accounts/ThreeId.ts +189 -0
- package/src/types/accounts/TokenManager.ts +217 -0
- package/src/types/accounts/ZeroCard.ts +73 -0
- package/src/types/accounts/ZeroContent.ts +89 -0
- package/src/types/accounts/ZeroOpenHolder.ts +183 -0
- package/src/types/accounts/index.ts +84 -0
- package/src/types/errors/anchor.ts +773 -0
- package/src/types/errors/index.ts +59 -0
- package/src/types/implementation/implementationTypes.ts +27 -0
- package/src/types/instructions/addBurn.ts +56 -0
- package/src/types/instructions/adjustDepositBurn.ts +33 -0
- package/src/types/instructions/archiveItem.ts +60 -0
- package/src/types/instructions/assignPackDelegate.ts +30 -0
- package/src/types/instructions/burnPay.ts +55 -0
- package/src/types/instructions/buyPack.ts +69 -0
- package/src/types/instructions/buyPay.ts +71 -0
- package/src/types/instructions/buyToken.ts +64 -0
- package/src/types/instructions/claimZeroCard.ts +106 -0
- package/src/types/instructions/closeDepositBurn.ts +47 -0
- package/src/types/instructions/closeRegisterTraits.ts +28 -0
- package/src/types/instructions/createCard.ts +56 -0
- package/src/types/instructions/createCollection.ts +68 -0
- package/src/types/instructions/createPack.ts +71 -0
- package/src/types/instructions/createSingle.ts +71 -0
- package/src/types/instructions/createStore.ts +50 -0
- package/src/types/instructions/createTokenLauncher.ts +82 -0
- package/src/types/instructions/createZeroCard.ts +76 -0
- package/src/types/instructions/deleteCard.ts +32 -0
- package/src/types/instructions/deletePack.ts +40 -0
- package/src/types/instructions/deleteSingle.ts +36 -0
- package/src/types/instructions/deleteTokenLauncher.ts +38 -0
- package/src/types/instructions/depositBurn.ts +55 -0
- package/src/types/instructions/donateUser.ts +84 -0
- package/src/types/instructions/feedPool.ts +61 -0
- package/src/types/instructions/feedTraits.ts +44 -0
- package/src/types/instructions/feedTree.ts +63 -0
- package/src/types/instructions/flagPack.ts +50 -0
- package/src/types/instructions/flagSingle.ts +47 -0
- package/src/types/instructions/gatePay.ts +59 -0
- package/src/types/instructions/index.ts +140 -0
- package/src/types/instructions/initialize.ts +46 -0
- package/src/types/instructions/openPack.ts +79 -0
- package/src/types/instructions/prepareCreator.ts +30 -0
- package/src/types/instructions/preparePack.ts +51 -0
- package/src/types/instructions/prepareTraits.ts +28 -0
- package/src/types/instructions/printPack.ts +95 -0
- package/src/types/instructions/printSingle.ts +108 -0
- package/src/types/instructions/recoverDepositBurn.ts +80 -0
- package/src/types/instructions/registerActivity.ts +43 -0
- package/src/types/instructions/registerCollector.ts +63 -0
- package/src/types/instructions/registerCreator.ts +48 -0
- package/src/types/instructions/registerGenericUser.ts +94 -0
- package/src/types/instructions/registerPackUploads.ts +44 -0
- package/src/types/instructions/registerTraits.ts +42 -0
- package/src/types/instructions/registerUser.ts +50 -0
- package/src/types/instructions/storeLutFor.ts +44 -0
- package/src/types/instructions/unwrapAndDestroy.ts +56 -0
- package/src/types/instructions/updateCard.ts +54 -0
- package/src/types/instructions/updatePack.ts +71 -0
- package/src/types/instructions/updateSingle.ts +64 -0
- package/src/types/instructions/updateStore.ts +47 -0
- package/src/types/instructions/withdrawFromStore.ts +26 -0
- package/src/types/programId.ts +42 -0
- package/src/types/types/AccountClass.ts +868 -0
- package/src/types/types/AccountHasher.ts +89 -0
- package/src/types/types/ActionAfter.ts +202 -0
- package/src/types/types/AllowedCurrencyArgs.ts +53 -0
- package/src/types/types/AuthorityGateTypes.ts +90 -0
- package/src/types/types/BurnCount.ts +60 -0
- package/src/types/types/BurnState.ts +88 -0
- package/src/types/types/BurnTrack.ts +64 -0
- package/src/types/types/BurnType.ts +118 -0
- package/src/types/types/BurnTypeBurn.ts +56 -0
- package/src/types/types/BuyHistoryClass.ts +90 -0
- package/src/types/types/CardClass.ts +56 -0
- package/src/types/types/CardState.ts +238 -0
- package/src/types/types/CardTrack.ts +76 -0
- package/src/types/types/Category.ts +72 -0
- package/src/types/types/CnftData.ts +85 -0
- package/src/types/types/CollectTrack.ts +61 -0
- package/src/types/types/Collection.ts +64 -0
- package/src/types/types/CompactCnftData.ts +76 -0
- package/src/types/types/CoolTimePerAmountArgs.ts +72 -0
- package/src/types/types/Creator.ts +72 -0
- package/src/types/types/CreatorGateArgs.ts +53 -0
- package/src/types/types/CurrencyArtistProof.ts +85 -0
- package/src/types/types/CurrencyType.ts +259 -0
- package/src/types/types/DateTraitInit.ts +61 -0
- package/src/types/types/DateTraitInitMap.ts +72 -0
- package/src/types/types/Deposit.ts +85 -0
- package/src/types/types/DepositFormat.ts +90 -0
- package/src/types/types/DepositState.ts +88 -0
- package/src/types/types/DepositSubtype.ts +90 -0
- package/src/types/types/DepositTrack.ts +69 -0
- package/src/types/types/DepositTrackType.ts +120 -0
- package/src/types/types/DepositType.ts +245 -0
- package/src/types/types/Earnings.ts +37 -0
- package/src/types/types/EditionStoreType.ts +120 -0
- package/src/types/types/EncryptedPayload.ts +61 -0
- package/src/types/types/ExtraParameter.ts +117 -0
- package/src/types/types/FakeBurnCount.ts +64 -0
- package/src/types/types/FakeDeposit.ts +64 -0
- package/src/types/types/FakeTraitPair.ts +61 -0
- package/src/types/types/FakeTraitValue.ts +61 -0
- package/src/types/types/FakeVolumeTrack.ts +64 -0
- package/src/types/types/FeeType.ts +118 -0
- package/src/types/types/FeedingTraits.ts +57 -0
- package/src/types/types/Filter.ts +64 -0
- package/src/types/types/FilterType.ts +56 -0
- package/src/types/types/GeneralStore.ts +56 -0
- package/src/types/types/GenericStore.ts +64 -0
- package/src/types/types/GenericValue.ts +172 -0
- package/src/types/types/GlobalFee.ts +85 -0
- package/src/types/types/GlobalState.ts +148 -0
- package/src/types/types/IndexDate.ts +94 -0
- package/src/types/types/IndexDates.ts +64 -0
- package/src/types/types/Item.ts +53 -0
- package/src/types/types/ItemClass.ts +88 -0
- package/src/types/types/ItemState.ts +298 -0
- package/src/types/types/ItemTrack.ts +76 -0
- package/src/types/types/ListingPerWalletArgs.ts +53 -0
- package/src/types/types/MemeVaultProof.ts +64 -0
- package/src/types/types/MetadataArgs.ts +207 -0
- package/src/types/types/NonFungibleTraitInit.ts +64 -0
- package/src/types/types/NonFungibleTraitInitMap.ts +84 -0
- package/src/types/types/OnlyBetweenTimesArgs.ts +76 -0
- package/src/types/types/OnlyTheseDOWArgs.ts +53 -0
- package/src/types/types/PackConfig.ts +98 -0
- package/src/types/types/PackOpenHolderState.ts +120 -0
- package/src/types/types/PackRule.ts +85 -0
- package/src/types/types/PackState.ts +118 -0
- package/src/types/types/PackType.ts +118 -0
- package/src/types/types/PaymentClass.ts +118 -0
- package/src/types/types/PoolAccess.ts +88 -0
- package/src/types/types/PoolState.ts +88 -0
- package/src/types/types/PoolType.ts +88 -0
- package/src/types/types/Popularity.ts +76 -0
- package/src/types/types/PopularityState.ts +630 -0
- package/src/types/types/PreviousDonationRecord.ts +76 -0
- package/src/types/types/Price.ts +64 -0
- package/src/types/types/PriceRule.ts +216 -0
- package/src/types/types/RecoverDeposit.ts +56 -0
- package/src/types/types/Rule.ts +199 -0
- package/src/types/types/SaleConfig.ts +102 -0
- package/src/types/types/SaleTrack.ts +85 -0
- package/src/types/types/SaleType.ts +148 -0
- package/src/types/types/Seed.ts +61 -0
- package/src/types/types/SelectedCard.ts +61 -0
- package/src/types/types/SelectedZeroCard.ts +61 -0
- package/src/types/types/SemiFungibleTraitInit.ts +61 -0
- package/src/types/types/SemiFungibleTraitInitMap.ts +72 -0
- package/src/types/types/ShortCreator.ts +64 -0
- package/src/types/types/ShortMetadata.ts +145 -0
- package/src/types/types/ShortMetadataArgs.ts +111 -0
- package/src/types/types/StoreConfig.ts +98 -0
- package/src/types/types/StoreRule.ts +145 -0
- package/src/types/types/SuperCategory.ts +61 -0
- package/src/types/types/TightCardMetadata.ts +120 -0
- package/src/types/types/TimeRangeType.ts +120 -0
- package/src/types/types/TimedPerWalletArgs.ts +53 -0
- package/src/types/types/TokenMetadata.ts +72 -0
- package/src/types/types/TokenProgramVersion.ts +90 -0
- package/src/types/types/TokenStandard.ts +150 -0
- package/src/types/types/TokenState.ts +88 -0
- package/src/types/types/TokenType.ts +88 -0
- package/src/types/types/TotalPerTimeArgs.ts +85 -0
- package/src/types/types/TotalPerTimeWalletArgs.ts +61 -0
- package/src/types/types/TrackRegistry.ts +90 -0
- package/src/types/types/TraitInit.ts +210 -0
- package/src/types/types/TraitPass.ts +60 -0
- package/src/types/types/TraitPassType.ts +225 -0
- package/src/types/types/TraitType.ts +267 -0
- package/src/types/types/TraitValue.ts +72 -0
- package/src/types/types/UnlocksAfter.ts +172 -0
- package/src/types/types/UnwrapMetadata.ts +156 -0
- package/src/types/types/UseMethod.ts +118 -0
- package/src/types/types/Uses.ts +76 -0
- package/src/types/types/VerifyCollectionMetadata.ts +109 -0
- package/src/types/types/VolumeTrack.ts +61 -0
- package/src/types/types/WrappedSource.ts +85 -0
- package/src/types/types/ZeroConfig.ts +85 -0
- package/src/types/types/index.ts +798 -0
- package/src/utility/Connection.ts +9 -0
- package/src/utility/Holders.ts +8 -0
- package/src/utility/PdaManager.ts +230 -0
- package/src/utility/config.ts +32 -0
- package/src/utility/utils.ts +191 -0
- package/src/utility/validation.ts +229 -0
- package/tsconfig.json +12 -0
package/README.md
ADDED
@@ -0,0 +1,352 @@
|
|
1
|
+
# 3Land Solana SDK
|
2
|
+
|
3
|
+
A Node.js SDK for interacting with 3Land's Solana programs. This SDK provides a simple and intuitive way to integrate with 3Land's smart contracts on the Solana blockchain.
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
1. [Prerequisites](#prerequisites)
|
8
|
+
2. [Installation](#installation)
|
9
|
+
3. [Network Configuration](#network-configuration)
|
10
|
+
- [Basic Network Selection](#basic-network-selection)
|
11
|
+
- [Custom Configuration](#custom-configuration)
|
12
|
+
- [Environment Setup](#environment-specific-setup)
|
13
|
+
4. [Wallet Setup](#wallet-setup)
|
14
|
+
- [Devnet Setup](#devnet-wallet-setup)
|
15
|
+
- [Mainnet Setup](#mainnet-wallet-setup)
|
16
|
+
5. [Usage](#usage)
|
17
|
+
- [Creating a Store](#creating-a-store)
|
18
|
+
- [Creating a Collection](#creating-a-collection)
|
19
|
+
- [Creating a Single Edition NFT](#creating-a-single-edition-nft)
|
20
|
+
- [Buying an NFT](#buying-an-nft)
|
21
|
+
6. [Features](#features)
|
22
|
+
7. [Error Handling](#error-handling)
|
23
|
+
8. [Contributing](#contributing)
|
24
|
+
9. [Support](#support)
|
25
|
+
10. [License](#license)
|
26
|
+
|
27
|
+
## Prerequisites
|
28
|
+
|
29
|
+
Before using this SDK, ensure you have the following installed:
|
30
|
+
|
31
|
+
- Node.js (v16 or higher)
|
32
|
+
- npm or yarn
|
33
|
+
- [Solana CLI Tools](https://docs.solana.com/cli/install-solana-cli-tools)
|
34
|
+
|
35
|
+
## Installation
|
36
|
+
|
37
|
+
Clone the repo
|
38
|
+
|
39
|
+
```bash
|
40
|
+
git clone https://github.com/biccsdev/3land_sdk.git
|
41
|
+
# TODO: add to npm
|
42
|
+
# npm install @3land/solana-sdk
|
43
|
+
# or
|
44
|
+
# yarn add @3land/solana-sdk
|
45
|
+
```
|
46
|
+
|
47
|
+
Run this command to install all the packages needed for the sdk
|
48
|
+
|
49
|
+
```bash
|
50
|
+
npm install
|
51
|
+
# or
|
52
|
+
yarn add
|
53
|
+
```
|
54
|
+
|
55
|
+
## Network Configuration
|
56
|
+
|
57
|
+
### Basic Network Selection
|
58
|
+
|
59
|
+
```typescript
|
60
|
+
import { Store, NetworkType } from "@3land/solana-sdk";
|
61
|
+
|
62
|
+
// For Devnet (default)
|
63
|
+
const devnetStore = new Store();
|
64
|
+
|
65
|
+
// For Mainnet
|
66
|
+
const mainnetStore = new Store({
|
67
|
+
network: NetworkType.MAINNET,
|
68
|
+
});
|
69
|
+
```
|
70
|
+
|
71
|
+
### Custom Configuration
|
72
|
+
|
73
|
+
```typescript
|
74
|
+
// Using custom RPC endpoint
|
75
|
+
const store = new Store({
|
76
|
+
network: NetworkType.MAINNET,
|
77
|
+
customEndpoint: "https://your-custom-rpc.com",
|
78
|
+
});
|
79
|
+
|
80
|
+
// Using custom configuration
|
81
|
+
const storeWithCustomConfig = new Store({
|
82
|
+
network: NetworkType.MAINNET,
|
83
|
+
customConfig: {
|
84
|
+
programId: "your_custom_program_id",
|
85
|
+
// other config options...
|
86
|
+
},
|
87
|
+
});
|
88
|
+
```
|
89
|
+
|
90
|
+
### Environment-Specific Setup
|
91
|
+
|
92
|
+
```typescript
|
93
|
+
import dotenv from "dotenv";
|
94
|
+
dotenv.config();
|
95
|
+
|
96
|
+
const store = new Store({
|
97
|
+
network: (process.env.SOLANA_NETWORK as NetworkType) || NetworkType.DEVNET,
|
98
|
+
customEndpoint: process.env.SOLANA_RPC_ENDPOINT,
|
99
|
+
customConfig: {
|
100
|
+
programId: process.env.PROGRAM_ID,
|
101
|
+
},
|
102
|
+
});
|
103
|
+
```
|
104
|
+
|
105
|
+
Example `.env` file:
|
106
|
+
|
107
|
+
```env
|
108
|
+
SOLANA_NETWORK=mainnet-beta
|
109
|
+
SOLANA_RPC_ENDPOINT=https://your-custom-rpc.com
|
110
|
+
PROGRAM_ID=your_program_id
|
111
|
+
```
|
112
|
+
|
113
|
+
## Wallet Setup
|
114
|
+
|
115
|
+
### Devnet Wallet Setup
|
116
|
+
|
117
|
+
```bash
|
118
|
+
solana-keygen new --outfile ~/.config/solana/devnet-wallet.json
|
119
|
+
solana config set --url https://api.devnet.solana.com
|
120
|
+
solana config set --keypair ~/.config/solana/devnet-wallet.json
|
121
|
+
solana airdrop 2
|
122
|
+
```
|
123
|
+
|
124
|
+
### Mainnet Wallet Setup
|
125
|
+
|
126
|
+
```bash
|
127
|
+
solana-keygen new --outfile ~/.config/solana/mainnet-wallet.json
|
128
|
+
solana config set --url https://api.mainnet-beta.solana.com
|
129
|
+
solana config set --keypair ~/.config/solana/mainnet-wallet.json
|
130
|
+
```
|
131
|
+
|
132
|
+
## Usage
|
133
|
+
|
134
|
+
### Creating a Store
|
135
|
+
|
136
|
+
```typescript
|
137
|
+
import { StoreConfig, FeeType } from "@3land/solana-sdk";
|
138
|
+
import { BN } from "bn.js";
|
139
|
+
|
140
|
+
try {
|
141
|
+
const storeConfig: StoreConfig = {
|
142
|
+
fee: new BN(1000000), // Fee in lamports
|
143
|
+
feePercentage: 5, // Must be between 0-100
|
144
|
+
feeType: new FeeType.AllMints(),
|
145
|
+
trust: payer.publicKey,
|
146
|
+
rules: [],
|
147
|
+
};
|
148
|
+
|
149
|
+
// Creator and storeId are optional, will default to payer.publicKey and random number
|
150
|
+
const createStoreTxId = await store.createStore(
|
151
|
+
walletKeypair,
|
152
|
+
"My 3Land Store",
|
153
|
+
storeConfig
|
154
|
+
);
|
155
|
+
|
156
|
+
console.log("Store created successfully:", createStoreTxId);
|
157
|
+
} catch (error) {
|
158
|
+
if (error.name === "ValidationError") {
|
159
|
+
console.error("Invalid parameters:", error.message);
|
160
|
+
} else {
|
161
|
+
console.error("Store creation failed:", error);
|
162
|
+
}
|
163
|
+
}
|
164
|
+
```
|
165
|
+
|
166
|
+
### Creating a Collection
|
167
|
+
|
168
|
+
```typescript
|
169
|
+
try {
|
170
|
+
const creator = new Creator({
|
171
|
+
address: payer.publicKey,
|
172
|
+
verified: false,
|
173
|
+
share: 100,
|
174
|
+
});
|
175
|
+
|
176
|
+
const metadata = {
|
177
|
+
symbol: "LAND", // Max 10 characters
|
178
|
+
name: "3Land Collection", // Max 32 characters
|
179
|
+
uri: "",
|
180
|
+
sellerFeeBasisPoints: new BN(0),
|
181
|
+
creators: [creator],
|
182
|
+
collection: null,
|
183
|
+
uses: null,
|
184
|
+
};
|
185
|
+
|
186
|
+
/ Prepare your image files
|
187
|
+
const imageBuffer = fs.readFileSync("path/to/image.gif").buffer;
|
188
|
+
const coverBuffer = fs.readFileSync("path/to/cover.jpeg").buffer;
|
189
|
+
|
190
|
+
const collectionOptions = {
|
191
|
+
symbol: "SDK",
|
192
|
+
metadata: {
|
193
|
+
name: metadata.name,
|
194
|
+
description: "3Land Collection Description",
|
195
|
+
files: {
|
196
|
+
file: {
|
197
|
+
arrayBuffer() {
|
198
|
+
return imageBuffer;
|
199
|
+
},
|
200
|
+
type: "image/png",
|
201
|
+
},
|
202
|
+
cover: {
|
203
|
+
arrayBuffer() {
|
204
|
+
return coverBuffer;
|
205
|
+
},
|
206
|
+
type: "image/png",
|
207
|
+
},
|
208
|
+
},
|
209
|
+
},
|
210
|
+
creators: metadata.creators,
|
211
|
+
traits: [{ attribute1: "value1" }, { attribute2: "value2" }],
|
212
|
+
sellerFeeBasisPoints: metadata.sellerFeeBasisPoints,
|
213
|
+
};
|
214
|
+
|
215
|
+
const collectionTx = await store.createCollection(
|
216
|
+
walletKeypair,
|
217
|
+
{ __kind: "V1", size: 0 },
|
218
|
+
metadata,
|
219
|
+
{
|
220
|
+
options: collectionOptions
|
221
|
+
},
|
222
|
+
false, // Mutable flag (optional)
|
223
|
+
0 // Supply (optional)
|
224
|
+
);
|
225
|
+
|
226
|
+
console.log("Collection created successfully:", collectionTx);
|
227
|
+
} catch (error) {
|
228
|
+
console.error("Collection creation failed:", error);
|
229
|
+
}
|
230
|
+
```
|
231
|
+
|
232
|
+
### Creating a Single Edition NFT
|
233
|
+
|
234
|
+
```typescript
|
235
|
+
try {
|
236
|
+
const metadata = {
|
237
|
+
name: "My 3Land NFT",
|
238
|
+
uri: "",
|
239
|
+
uriType: 1,
|
240
|
+
sellerFeeBasisPoints: 500,
|
241
|
+
collection: collectionPublicKey,
|
242
|
+
creators: [creator],
|
243
|
+
};
|
244
|
+
|
245
|
+
const saleConfig = {
|
246
|
+
prices: [
|
247
|
+
{
|
248
|
+
amount: new BN(1000000),
|
249
|
+
priceType: new CurrencyType.Native(),
|
250
|
+
},
|
251
|
+
],
|
252
|
+
priceType: new PriceRule.None(),
|
253
|
+
rules: [],
|
254
|
+
sendToVault: 0,
|
255
|
+
saleType: new SaleType.Normal(),
|
256
|
+
};
|
257
|
+
|
258
|
+
const singleEditionTx = await store.createSingleEdition(
|
259
|
+
walletKeypair,
|
260
|
+
storeAccount,
|
261
|
+
100, // Supply
|
262
|
+
metadata,
|
263
|
+
saleConfig,
|
264
|
+
[1, 0, 0], // Category
|
265
|
+
[1, 0], // Super Category
|
266
|
+
0, // Event Category
|
267
|
+
12345, // Hash Traits
|
268
|
+
collectionPublicKey,
|
269
|
+
{
|
270
|
+
options: nftOptions,
|
271
|
+
}
|
272
|
+
);
|
273
|
+
|
274
|
+
console.log("Single edition created successfully:", singleEditionTx);
|
275
|
+
} catch (error) {
|
276
|
+
console.error("Single edition creation failed:", error);
|
277
|
+
}
|
278
|
+
```
|
279
|
+
|
280
|
+
### Buying an NFT
|
281
|
+
|
282
|
+
```typescript
|
283
|
+
try {
|
284
|
+
// Most parameters are optional and have default values
|
285
|
+
const buyTx = await store.buySingleEdition(
|
286
|
+
walletKeypair,
|
287
|
+
[0, 0, 0, 0, 0, 0], // Distribution bumps
|
288
|
+
itemAddress // The NFT's item account address
|
289
|
+
);
|
290
|
+
|
291
|
+
console.log("Purchase successful:", buyTx);
|
292
|
+
} catch (error) {
|
293
|
+
console.error("Purchase failed:", error);
|
294
|
+
}
|
295
|
+
```
|
296
|
+
|
297
|
+
## Features
|
298
|
+
|
299
|
+
- **Store Management**
|
300
|
+
- Create and configure NFT stores
|
301
|
+
- Set custom fee structures
|
302
|
+
- **Collection Management**
|
303
|
+
- Create NFT collections
|
304
|
+
- Configure collection metadata
|
305
|
+
- **NFT Operations**
|
306
|
+
- Mint single edition NFTs
|
307
|
+
- Configure NFT metadata
|
308
|
+
- Set pricing and sale rules
|
309
|
+
- Handle NFT purchases
|
310
|
+
- **Built-in Validations**
|
311
|
+
- Input parameter validation
|
312
|
+
- Transaction error handling
|
313
|
+
- Comprehensive error messages
|
314
|
+
- **Decentralized Storage**
|
315
|
+
- Integrated with Irys for metadata storage
|
316
|
+
- Support for various file types (jpeg, png, glb, mp3, mp4)
|
317
|
+
- Automatic URI generation
|
318
|
+
|
319
|
+
### Error Types
|
320
|
+
|
321
|
+
```typescript
|
322
|
+
try {
|
323
|
+
// SDK operations
|
324
|
+
} catch (error) {
|
325
|
+
if (error.name === "ValidationError") {
|
326
|
+
// Handle validation errors
|
327
|
+
console.error("Invalid parameters:", error.message);
|
328
|
+
} else if (error instanceof SendTransactionError) {
|
329
|
+
// Handle Solana transaction errors
|
330
|
+
console.error("Transaction failed:", error.logs);
|
331
|
+
} else {
|
332
|
+
// Handle other errors
|
333
|
+
console.error("Operation failed:", error);
|
334
|
+
}
|
335
|
+
}
|
336
|
+
```
|
337
|
+
|
338
|
+
## Contributing
|
339
|
+
|
340
|
+
1. Fork the repository
|
341
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
342
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
343
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
344
|
+
5. Open a Pull Request
|
345
|
+
|
346
|
+
## Support
|
347
|
+
|
348
|
+
For support, please create an issue in the GitHub repository or contact the 3Land team directly.
|
349
|
+
|
350
|
+
## License
|
351
|
+
|
352
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
Binary file
|
Binary file
|
package/assets/ds.jpeg
ADDED
Binary file
|
Binary file
|
package/assets/music.mp3
ADDED
Binary file
|
package/assets/niicl.gif
ADDED
Binary file
|
package/assets/og.png
ADDED
Binary file
|
package/assets/phone.glb
ADDED
Binary file
|
Binary file
|