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
@@ -0,0 +1,94 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface IndexDateFields {
|
7
|
+
hour: number
|
8
|
+
day: number
|
9
|
+
week: number
|
10
|
+
month: number
|
11
|
+
minRelative: number
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface IndexDateJSON {
|
15
|
+
hour: number
|
16
|
+
day: number
|
17
|
+
week: number
|
18
|
+
month: number
|
19
|
+
minRelative: number
|
20
|
+
}
|
21
|
+
|
22
|
+
export class IndexDate {
|
23
|
+
readonly hour: number
|
24
|
+
readonly day: number
|
25
|
+
readonly week: number
|
26
|
+
readonly month: number
|
27
|
+
readonly minRelative: number
|
28
|
+
|
29
|
+
constructor(fields: IndexDateFields) {
|
30
|
+
this.hour = fields.hour
|
31
|
+
this.day = fields.day
|
32
|
+
this.week = fields.week
|
33
|
+
this.month = fields.month
|
34
|
+
this.minRelative = fields.minRelative
|
35
|
+
}
|
36
|
+
|
37
|
+
static layout(property?: string) {
|
38
|
+
return borsh.struct(
|
39
|
+
[
|
40
|
+
borsh.u32("hour"),
|
41
|
+
borsh.u32("day"),
|
42
|
+
borsh.u32("week"),
|
43
|
+
borsh.u32("month"),
|
44
|
+
borsh.u8("minRelative"),
|
45
|
+
],
|
46
|
+
property
|
47
|
+
)
|
48
|
+
}
|
49
|
+
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
51
|
+
static fromDecoded(obj: any) {
|
52
|
+
return new IndexDate({
|
53
|
+
hour: obj.hour,
|
54
|
+
day: obj.day,
|
55
|
+
week: obj.week,
|
56
|
+
month: obj.month,
|
57
|
+
minRelative: obj.minRelative,
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
static toEncodable(fields: IndexDateFields) {
|
62
|
+
return {
|
63
|
+
hour: fields.hour,
|
64
|
+
day: fields.day,
|
65
|
+
week: fields.week,
|
66
|
+
month: fields.month,
|
67
|
+
minRelative: fields.minRelative,
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
toJSON(): IndexDateJSON {
|
72
|
+
return {
|
73
|
+
hour: this.hour,
|
74
|
+
day: this.day,
|
75
|
+
week: this.week,
|
76
|
+
month: this.month,
|
77
|
+
minRelative: this.minRelative,
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
static fromJSON(obj: IndexDateJSON): IndexDate {
|
82
|
+
return new IndexDate({
|
83
|
+
hour: obj.hour,
|
84
|
+
day: obj.day,
|
85
|
+
week: obj.week,
|
86
|
+
month: obj.month,
|
87
|
+
minRelative: obj.minRelative,
|
88
|
+
})
|
89
|
+
}
|
90
|
+
|
91
|
+
toEncodable() {
|
92
|
+
return IndexDate.toEncodable(this)
|
93
|
+
}
|
94
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface IndexDatesFields {
|
7
|
+
created: types.IndexDateFields
|
8
|
+
activity: types.IndexDateFields
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface IndexDatesJSON {
|
12
|
+
created: types.IndexDateJSON
|
13
|
+
activity: types.IndexDateJSON
|
14
|
+
}
|
15
|
+
|
16
|
+
export class IndexDates {
|
17
|
+
readonly created: types.IndexDate
|
18
|
+
readonly activity: types.IndexDate
|
19
|
+
|
20
|
+
constructor(fields: IndexDatesFields) {
|
21
|
+
this.created = new types.IndexDate({ ...fields.created })
|
22
|
+
this.activity = new types.IndexDate({ ...fields.activity })
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct(
|
27
|
+
[types.IndexDate.layout("created"), types.IndexDate.layout("activity")],
|
28
|
+
property
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
33
|
+
static fromDecoded(obj: any) {
|
34
|
+
return new IndexDates({
|
35
|
+
created: types.IndexDate.fromDecoded(obj.created),
|
36
|
+
activity: types.IndexDate.fromDecoded(obj.activity),
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
static toEncodable(fields: IndexDatesFields) {
|
41
|
+
return {
|
42
|
+
created: types.IndexDate.toEncodable(fields.created),
|
43
|
+
activity: types.IndexDate.toEncodable(fields.activity),
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
toJSON(): IndexDatesJSON {
|
48
|
+
return {
|
49
|
+
created: this.created.toJSON(),
|
50
|
+
activity: this.activity.toJSON(),
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
static fromJSON(obj: IndexDatesJSON): IndexDates {
|
55
|
+
return new IndexDates({
|
56
|
+
created: types.IndexDate.fromJSON(obj.created),
|
57
|
+
activity: types.IndexDate.fromJSON(obj.activity),
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
toEncodable() {
|
62
|
+
return IndexDates.toEncodable(this)
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface ItemFields {
|
7
|
+
metadata: types.MetadataArgsFields
|
8
|
+
}
|
9
|
+
|
10
|
+
export interface ItemJSON {
|
11
|
+
metadata: types.MetadataArgsJSON
|
12
|
+
}
|
13
|
+
|
14
|
+
export class Item {
|
15
|
+
readonly metadata: types.MetadataArgs
|
16
|
+
|
17
|
+
constructor(fields: ItemFields) {
|
18
|
+
this.metadata = new types.MetadataArgs({ ...fields.metadata })
|
19
|
+
}
|
20
|
+
|
21
|
+
static layout(property?: string) {
|
22
|
+
return borsh.struct([types.MetadataArgs.layout("metadata")], property)
|
23
|
+
}
|
24
|
+
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
26
|
+
static fromDecoded(obj: any) {
|
27
|
+
return new Item({
|
28
|
+
metadata: types.MetadataArgs.fromDecoded(obj.metadata),
|
29
|
+
})
|
30
|
+
}
|
31
|
+
|
32
|
+
static toEncodable(fields: ItemFields) {
|
33
|
+
return {
|
34
|
+
metadata: types.MetadataArgs.toEncodable(fields.metadata),
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
toJSON(): ItemJSON {
|
39
|
+
return {
|
40
|
+
metadata: this.metadata.toJSON(),
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
static fromJSON(obj: ItemJSON): Item {
|
45
|
+
return new Item({
|
46
|
+
metadata: types.MetadataArgs.fromJSON(obj.metadata),
|
47
|
+
})
|
48
|
+
}
|
49
|
+
|
50
|
+
toEncodable() {
|
51
|
+
return Item.toEncodable(this)
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface SingleJSON {
|
7
|
+
kind: "Single"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Single {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Single"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Single"
|
15
|
+
|
16
|
+
toJSON(): SingleJSON {
|
17
|
+
return {
|
18
|
+
kind: "Single",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Single: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface PackJSON {
|
30
|
+
kind: "Pack"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class Pack {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "Pack"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "Pack"
|
38
|
+
|
39
|
+
toJSON(): PackJSON {
|
40
|
+
return {
|
41
|
+
kind: "Pack",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
Pack: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
53
|
+
export function fromDecoded(obj: any): types.ItemClassKind {
|
54
|
+
if (typeof obj !== "object") {
|
55
|
+
throw new Error("Invalid enum object")
|
56
|
+
}
|
57
|
+
|
58
|
+
if ("Single" in obj) {
|
59
|
+
return new Single()
|
60
|
+
}
|
61
|
+
if ("Pack" in obj) {
|
62
|
+
return new Pack()
|
63
|
+
}
|
64
|
+
|
65
|
+
throw new Error("Invalid enum object")
|
66
|
+
}
|
67
|
+
|
68
|
+
export function fromJSON(obj: types.ItemClassJSON): types.ItemClassKind {
|
69
|
+
switch (obj.kind) {
|
70
|
+
case "Single": {
|
71
|
+
return new Single()
|
72
|
+
}
|
73
|
+
case "Pack": {
|
74
|
+
return new Pack()
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
export function layout(property?: string) {
|
80
|
+
const ret = borsh.rustEnum([
|
81
|
+
borsh.struct([], "Single"),
|
82
|
+
borsh.struct([], "Pack"),
|
83
|
+
])
|
84
|
+
if (property !== undefined) {
|
85
|
+
return ret.replicate(property)
|
86
|
+
}
|
87
|
+
return ret
|
88
|
+
}
|
@@ -0,0 +1,298 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface ActiveJSON {
|
7
|
+
kind: "Active"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Active {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Active"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Active"
|
15
|
+
|
16
|
+
toJSON(): ActiveJSON {
|
17
|
+
return {
|
18
|
+
kind: "Active",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Active: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface HiddenJSON {
|
30
|
+
kind: "Hidden"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class Hidden {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "Hidden"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "Hidden"
|
38
|
+
|
39
|
+
toJSON(): HiddenJSON {
|
40
|
+
return {
|
41
|
+
kind: "Hidden",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
Hidden: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface InactiveJSON {
|
53
|
+
kind: "Inactive"
|
54
|
+
}
|
55
|
+
|
56
|
+
export class Inactive {
|
57
|
+
static readonly discriminator = 2
|
58
|
+
static readonly kind = "Inactive"
|
59
|
+
readonly discriminator = 2
|
60
|
+
readonly kind = "Inactive"
|
61
|
+
|
62
|
+
toJSON(): InactiveJSON {
|
63
|
+
return {
|
64
|
+
kind: "Inactive",
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
toEncodable() {
|
69
|
+
return {
|
70
|
+
Inactive: {},
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
export interface RetiredJSON {
|
76
|
+
kind: "Retired"
|
77
|
+
}
|
78
|
+
|
79
|
+
export class Retired {
|
80
|
+
static readonly discriminator = 3
|
81
|
+
static readonly kind = "Retired"
|
82
|
+
readonly discriminator = 3
|
83
|
+
readonly kind = "Retired"
|
84
|
+
|
85
|
+
toJSON(): RetiredJSON {
|
86
|
+
return {
|
87
|
+
kind: "Retired",
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
toEncodable() {
|
92
|
+
return {
|
93
|
+
Retired: {},
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
export interface SoldOutJSON {
|
99
|
+
kind: "SoldOut"
|
100
|
+
}
|
101
|
+
|
102
|
+
export class SoldOut {
|
103
|
+
static readonly discriminator = 4
|
104
|
+
static readonly kind = "SoldOut"
|
105
|
+
readonly discriminator = 4
|
106
|
+
readonly kind = "SoldOut"
|
107
|
+
|
108
|
+
toJSON(): SoldOutJSON {
|
109
|
+
return {
|
110
|
+
kind: "SoldOut",
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
toEncodable() {
|
115
|
+
return {
|
116
|
+
SoldOut: {},
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
export interface NoneJSON {
|
122
|
+
kind: "None"
|
123
|
+
}
|
124
|
+
|
125
|
+
export class None {
|
126
|
+
static readonly discriminator = 5
|
127
|
+
static readonly kind = "None"
|
128
|
+
readonly discriminator = 5
|
129
|
+
readonly kind = "None"
|
130
|
+
|
131
|
+
toJSON(): NoneJSON {
|
132
|
+
return {
|
133
|
+
kind: "None",
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
toEncodable() {
|
138
|
+
return {
|
139
|
+
None: {},
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
export interface NotReadyJSON {
|
145
|
+
kind: "NotReady"
|
146
|
+
}
|
147
|
+
|
148
|
+
export class NotReady {
|
149
|
+
static readonly discriminator = 6
|
150
|
+
static readonly kind = "NotReady"
|
151
|
+
readonly discriminator = 6
|
152
|
+
readonly kind = "NotReady"
|
153
|
+
|
154
|
+
toJSON(): NotReadyJSON {
|
155
|
+
return {
|
156
|
+
kind: "NotReady",
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
toEncodable() {
|
161
|
+
return {
|
162
|
+
NotReady: {},
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
export interface NotReadyStartedJSON {
|
168
|
+
kind: "NotReadyStarted"
|
169
|
+
}
|
170
|
+
|
171
|
+
export class NotReadyStarted {
|
172
|
+
static readonly discriminator = 7
|
173
|
+
static readonly kind = "NotReadyStarted"
|
174
|
+
readonly discriminator = 7
|
175
|
+
readonly kind = "NotReadyStarted"
|
176
|
+
|
177
|
+
toJSON(): NotReadyStartedJSON {
|
178
|
+
return {
|
179
|
+
kind: "NotReadyStarted",
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
toEncodable() {
|
184
|
+
return {
|
185
|
+
NotReadyStarted: {},
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
export interface FlaggedJSON {
|
191
|
+
kind: "Flagged"
|
192
|
+
}
|
193
|
+
|
194
|
+
export class Flagged {
|
195
|
+
static readonly discriminator = 8
|
196
|
+
static readonly kind = "Flagged"
|
197
|
+
readonly discriminator = 8
|
198
|
+
readonly kind = "Flagged"
|
199
|
+
|
200
|
+
toJSON(): FlaggedJSON {
|
201
|
+
return {
|
202
|
+
kind: "Flagged",
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
toEncodable() {
|
207
|
+
return {
|
208
|
+
Flagged: {},
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
214
|
+
export function fromDecoded(obj: any): types.ItemStateKind {
|
215
|
+
if (typeof obj !== "object") {
|
216
|
+
throw new Error("Invalid enum object")
|
217
|
+
}
|
218
|
+
|
219
|
+
if ("Active" in obj) {
|
220
|
+
return new Active()
|
221
|
+
}
|
222
|
+
if ("Hidden" in obj) {
|
223
|
+
return new Hidden()
|
224
|
+
}
|
225
|
+
if ("Inactive" in obj) {
|
226
|
+
return new Inactive()
|
227
|
+
}
|
228
|
+
if ("Retired" in obj) {
|
229
|
+
return new Retired()
|
230
|
+
}
|
231
|
+
if ("SoldOut" in obj) {
|
232
|
+
return new SoldOut()
|
233
|
+
}
|
234
|
+
if ("None" in obj) {
|
235
|
+
return new None()
|
236
|
+
}
|
237
|
+
if ("NotReady" in obj) {
|
238
|
+
return new NotReady()
|
239
|
+
}
|
240
|
+
if ("NotReadyStarted" in obj) {
|
241
|
+
return new NotReadyStarted()
|
242
|
+
}
|
243
|
+
if ("Flagged" in obj) {
|
244
|
+
return new Flagged()
|
245
|
+
}
|
246
|
+
|
247
|
+
throw new Error("Invalid enum object")
|
248
|
+
}
|
249
|
+
|
250
|
+
export function fromJSON(obj: types.ItemStateJSON): types.ItemStateKind {
|
251
|
+
switch (obj.kind) {
|
252
|
+
case "Active": {
|
253
|
+
return new Active()
|
254
|
+
}
|
255
|
+
case "Hidden": {
|
256
|
+
return new Hidden()
|
257
|
+
}
|
258
|
+
case "Inactive": {
|
259
|
+
return new Inactive()
|
260
|
+
}
|
261
|
+
case "Retired": {
|
262
|
+
return new Retired()
|
263
|
+
}
|
264
|
+
case "SoldOut": {
|
265
|
+
return new SoldOut()
|
266
|
+
}
|
267
|
+
case "None": {
|
268
|
+
return new None()
|
269
|
+
}
|
270
|
+
case "NotReady": {
|
271
|
+
return new NotReady()
|
272
|
+
}
|
273
|
+
case "NotReadyStarted": {
|
274
|
+
return new NotReadyStarted()
|
275
|
+
}
|
276
|
+
case "Flagged": {
|
277
|
+
return new Flagged()
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
export function layout(property?: string) {
|
283
|
+
const ret = borsh.rustEnum([
|
284
|
+
borsh.struct([], "Active"),
|
285
|
+
borsh.struct([], "Hidden"),
|
286
|
+
borsh.struct([], "Inactive"),
|
287
|
+
borsh.struct([], "Retired"),
|
288
|
+
borsh.struct([], "SoldOut"),
|
289
|
+
borsh.struct([], "None"),
|
290
|
+
borsh.struct([], "NotReady"),
|
291
|
+
borsh.struct([], "NotReadyStarted"),
|
292
|
+
borsh.struct([], "Flagged"),
|
293
|
+
])
|
294
|
+
if (property !== undefined) {
|
295
|
+
return ret.replicate(property)
|
296
|
+
}
|
297
|
+
return ret
|
298
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { PublicKey } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
2
|
+
import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars
|
3
|
+
import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
|
4
|
+
import * as borsh from "@coral-xyz/borsh"
|
5
|
+
|
6
|
+
export interface ItemTrackFields {
|
7
|
+
state: types.ItemStateKind
|
8
|
+
supply: BN
|
9
|
+
created: BN
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface ItemTrackJSON {
|
13
|
+
state: types.ItemStateJSON
|
14
|
+
supply: string
|
15
|
+
created: string
|
16
|
+
}
|
17
|
+
|
18
|
+
export class ItemTrack {
|
19
|
+
readonly state: types.ItemStateKind
|
20
|
+
readonly supply: BN
|
21
|
+
readonly created: BN
|
22
|
+
|
23
|
+
constructor(fields: ItemTrackFields) {
|
24
|
+
this.state = fields.state
|
25
|
+
this.supply = fields.supply
|
26
|
+
this.created = fields.created
|
27
|
+
}
|
28
|
+
|
29
|
+
static layout(property?: string) {
|
30
|
+
return borsh.struct(
|
31
|
+
[
|
32
|
+
types.ItemState.layout("state"),
|
33
|
+
borsh.u64("supply"),
|
34
|
+
borsh.u64("created"),
|
35
|
+
],
|
36
|
+
property
|
37
|
+
)
|
38
|
+
}
|
39
|
+
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
41
|
+
static fromDecoded(obj: any) {
|
42
|
+
return new ItemTrack({
|
43
|
+
state: types.ItemState.fromDecoded(obj.state),
|
44
|
+
supply: obj.supply,
|
45
|
+
created: obj.created,
|
46
|
+
})
|
47
|
+
}
|
48
|
+
|
49
|
+
static toEncodable(fields: ItemTrackFields) {
|
50
|
+
return {
|
51
|
+
state: fields.state.toEncodable(),
|
52
|
+
supply: fields.supply,
|
53
|
+
created: fields.created,
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
toJSON(): ItemTrackJSON {
|
58
|
+
return {
|
59
|
+
state: this.state.toJSON(),
|
60
|
+
supply: this.supply.toString(),
|
61
|
+
created: this.created.toString(),
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
static fromJSON(obj: ItemTrackJSON): ItemTrack {
|
66
|
+
return new ItemTrack({
|
67
|
+
state: types.ItemState.fromJSON(obj.state),
|
68
|
+
supply: new BN(obj.supply),
|
69
|
+
created: new BN(obj.created),
|
70
|
+
})
|
71
|
+
}
|
72
|
+
|
73
|
+
toEncodable() {
|
74
|
+
return ItemTrack.toEncodable(this)
|
75
|
+
}
|
76
|
+
}
|