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,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 PriceFields {
|
7
|
+
amount: BN
|
8
|
+
priceType: types.CurrencyTypeKind
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface PriceJSON {
|
12
|
+
amount: string
|
13
|
+
priceType: types.CurrencyTypeJSON
|
14
|
+
}
|
15
|
+
|
16
|
+
export class Price {
|
17
|
+
readonly amount: BN
|
18
|
+
readonly priceType: types.CurrencyTypeKind
|
19
|
+
|
20
|
+
constructor(fields: PriceFields) {
|
21
|
+
this.amount = fields.amount
|
22
|
+
this.priceType = fields.priceType
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct(
|
27
|
+
[borsh.u64("amount"), types.CurrencyType.layout("priceType")],
|
28
|
+
property
|
29
|
+
)
|
30
|
+
}
|
31
|
+
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
33
|
+
static fromDecoded(obj: any) {
|
34
|
+
return new Price({
|
35
|
+
amount: obj.amount,
|
36
|
+
priceType: types.CurrencyType.fromDecoded(obj.priceType),
|
37
|
+
})
|
38
|
+
}
|
39
|
+
|
40
|
+
static toEncodable(fields: PriceFields) {
|
41
|
+
return {
|
42
|
+
amount: fields.amount,
|
43
|
+
priceType: fields.priceType.toEncodable(),
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
toJSON(): PriceJSON {
|
48
|
+
return {
|
49
|
+
amount: this.amount.toString(),
|
50
|
+
priceType: this.priceType.toJSON(),
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
static fromJSON(obj: PriceJSON): Price {
|
55
|
+
return new Price({
|
56
|
+
amount: new BN(obj.amount),
|
57
|
+
priceType: types.CurrencyType.fromJSON(obj.priceType),
|
58
|
+
})
|
59
|
+
}
|
60
|
+
|
61
|
+
toEncodable() {
|
62
|
+
return Price.toEncodable(this)
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,216 @@
|
|
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 NoneJSON {
|
7
|
+
kind: "None"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class None {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "None"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "None"
|
15
|
+
|
16
|
+
toJSON(): NoneJSON {
|
17
|
+
return {
|
18
|
+
kind: "None",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
None: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface AndJSON {
|
30
|
+
kind: "And"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class And {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "And"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "And"
|
38
|
+
|
39
|
+
toJSON(): AndJSON {
|
40
|
+
return {
|
41
|
+
kind: "And",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
And: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface OrJSON {
|
53
|
+
kind: "Or"
|
54
|
+
}
|
55
|
+
|
56
|
+
export class Or {
|
57
|
+
static readonly discriminator = 2
|
58
|
+
static readonly kind = "Or"
|
59
|
+
readonly discriminator = 2
|
60
|
+
readonly kind = "Or"
|
61
|
+
|
62
|
+
toJSON(): OrJSON {
|
63
|
+
return {
|
64
|
+
kind: "Or",
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
toEncodable() {
|
69
|
+
return {
|
70
|
+
Or: {},
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
export type BondingLinearFields = {
|
76
|
+
initial: BN
|
77
|
+
rate: BN
|
78
|
+
index: number
|
79
|
+
max: number
|
80
|
+
min: number
|
81
|
+
}
|
82
|
+
export type BondingLinearValue = {
|
83
|
+
initial: BN
|
84
|
+
rate: BN
|
85
|
+
index: number
|
86
|
+
max: number
|
87
|
+
min: number
|
88
|
+
}
|
89
|
+
|
90
|
+
export interface BondingLinearJSON {
|
91
|
+
kind: "BondingLinear"
|
92
|
+
value: {
|
93
|
+
initial: string
|
94
|
+
rate: string
|
95
|
+
index: number
|
96
|
+
max: number
|
97
|
+
min: number
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
export class BondingLinear {
|
102
|
+
static readonly discriminator = 3
|
103
|
+
static readonly kind = "BondingLinear"
|
104
|
+
readonly discriminator = 3
|
105
|
+
readonly kind = "BondingLinear"
|
106
|
+
readonly value: BondingLinearValue
|
107
|
+
|
108
|
+
constructor(value: BondingLinearFields) {
|
109
|
+
this.value = {
|
110
|
+
initial: value.initial,
|
111
|
+
rate: value.rate,
|
112
|
+
index: value.index,
|
113
|
+
max: value.max,
|
114
|
+
min: value.min,
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
toJSON(): BondingLinearJSON {
|
119
|
+
return {
|
120
|
+
kind: "BondingLinear",
|
121
|
+
value: {
|
122
|
+
initial: this.value.initial.toString(),
|
123
|
+
rate: this.value.rate.toString(),
|
124
|
+
index: this.value.index,
|
125
|
+
max: this.value.max,
|
126
|
+
min: this.value.min,
|
127
|
+
},
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
toEncodable() {
|
132
|
+
return {
|
133
|
+
BondingLinear: {
|
134
|
+
initial: this.value.initial,
|
135
|
+
rate: this.value.rate,
|
136
|
+
index: this.value.index,
|
137
|
+
max: this.value.max,
|
138
|
+
min: this.value.min,
|
139
|
+
},
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
145
|
+
export function fromDecoded(obj: any): types.PriceRuleKind {
|
146
|
+
if (typeof obj !== "object") {
|
147
|
+
throw new Error("Invalid enum object")
|
148
|
+
}
|
149
|
+
|
150
|
+
if ("None" in obj) {
|
151
|
+
return new None()
|
152
|
+
}
|
153
|
+
if ("And" in obj) {
|
154
|
+
return new And()
|
155
|
+
}
|
156
|
+
if ("Or" in obj) {
|
157
|
+
return new Or()
|
158
|
+
}
|
159
|
+
if ("BondingLinear" in obj) {
|
160
|
+
const val = obj["BondingLinear"]
|
161
|
+
return new BondingLinear({
|
162
|
+
initial: val["initial"],
|
163
|
+
rate: val["rate"],
|
164
|
+
index: val["index"],
|
165
|
+
max: val["max"],
|
166
|
+
min: val["min"],
|
167
|
+
})
|
168
|
+
}
|
169
|
+
|
170
|
+
throw new Error("Invalid enum object")
|
171
|
+
}
|
172
|
+
|
173
|
+
export function fromJSON(obj: types.PriceRuleJSON): types.PriceRuleKind {
|
174
|
+
switch (obj.kind) {
|
175
|
+
case "None": {
|
176
|
+
return new None()
|
177
|
+
}
|
178
|
+
case "And": {
|
179
|
+
return new And()
|
180
|
+
}
|
181
|
+
case "Or": {
|
182
|
+
return new Or()
|
183
|
+
}
|
184
|
+
case "BondingLinear": {
|
185
|
+
return new BondingLinear({
|
186
|
+
initial: new BN(obj.value.initial),
|
187
|
+
rate: new BN(obj.value.rate),
|
188
|
+
index: obj.value.index,
|
189
|
+
max: obj.value.max,
|
190
|
+
min: obj.value.min,
|
191
|
+
})
|
192
|
+
}
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
export function layout(property?: string) {
|
197
|
+
const ret = borsh.rustEnum([
|
198
|
+
borsh.struct([], "None"),
|
199
|
+
borsh.struct([], "And"),
|
200
|
+
borsh.struct([], "Or"),
|
201
|
+
borsh.struct(
|
202
|
+
[
|
203
|
+
borsh.u64("initial"),
|
204
|
+
borsh.u64("rate"),
|
205
|
+
borsh.u8("index"),
|
206
|
+
borsh.u32("max"),
|
207
|
+
borsh.u16("min"),
|
208
|
+
],
|
209
|
+
"BondingLinear"
|
210
|
+
),
|
211
|
+
])
|
212
|
+
if (property !== undefined) {
|
213
|
+
return ret.replicate(property)
|
214
|
+
}
|
215
|
+
return ret
|
216
|
+
}
|
@@ -0,0 +1,56 @@
|
|
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 RecoverDepositFields {
|
7
|
+
cnft: types.CnftDataFields | null
|
8
|
+
}
|
9
|
+
|
10
|
+
export interface RecoverDepositJSON {
|
11
|
+
cnft: types.CnftDataJSON | null
|
12
|
+
}
|
13
|
+
|
14
|
+
export class RecoverDeposit {
|
15
|
+
readonly cnft: types.CnftData | null
|
16
|
+
|
17
|
+
constructor(fields: RecoverDepositFields) {
|
18
|
+
this.cnft = (fields.cnft && new types.CnftData({ ...fields.cnft })) || null
|
19
|
+
}
|
20
|
+
|
21
|
+
static layout(property?: string) {
|
22
|
+
return borsh.struct(
|
23
|
+
[borsh.option(types.CnftData.layout(), "cnft")],
|
24
|
+
property
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
29
|
+
static fromDecoded(obj: any) {
|
30
|
+
return new RecoverDeposit({
|
31
|
+
cnft: (obj.cnft && types.CnftData.fromDecoded(obj.cnft)) || null,
|
32
|
+
})
|
33
|
+
}
|
34
|
+
|
35
|
+
static toEncodable(fields: RecoverDepositFields) {
|
36
|
+
return {
|
37
|
+
cnft: (fields.cnft && types.CnftData.toEncodable(fields.cnft)) || null,
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
toJSON(): RecoverDepositJSON {
|
42
|
+
return {
|
43
|
+
cnft: (this.cnft && this.cnft.toJSON()) || null,
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
static fromJSON(obj: RecoverDepositJSON): RecoverDeposit {
|
48
|
+
return new RecoverDeposit({
|
49
|
+
cnft: (obj.cnft && types.CnftData.fromJSON(obj.cnft)) || null,
|
50
|
+
})
|
51
|
+
}
|
52
|
+
|
53
|
+
toEncodable() {
|
54
|
+
return RecoverDeposit.toEncodable(this)
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,199 @@
|
|
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 type UnlocksAfterFields = {
|
7
|
+
rule: types.ActionAfterKind
|
8
|
+
}
|
9
|
+
export type UnlocksAfterValue = {
|
10
|
+
rule: types.ActionAfterKind
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface UnlocksAfterJSON {
|
14
|
+
kind: "UnlocksAfter"
|
15
|
+
value: {
|
16
|
+
rule: types.ActionAfterJSON
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
export class UnlocksAfter {
|
21
|
+
static readonly discriminator = 0
|
22
|
+
static readonly kind = "UnlocksAfter"
|
23
|
+
readonly discriminator = 0
|
24
|
+
readonly kind = "UnlocksAfter"
|
25
|
+
readonly value: UnlocksAfterValue
|
26
|
+
|
27
|
+
constructor(value: UnlocksAfterFields) {
|
28
|
+
this.value = {
|
29
|
+
rule: value.rule,
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
toJSON(): UnlocksAfterJSON {
|
34
|
+
return {
|
35
|
+
kind: "UnlocksAfter",
|
36
|
+
value: {
|
37
|
+
rule: this.value.rule.toJSON(),
|
38
|
+
},
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
toEncodable() {
|
43
|
+
return {
|
44
|
+
UnlocksAfter: {
|
45
|
+
rule: this.value.rule.toEncodable(),
|
46
|
+
},
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
export type UnwrapsAfterFields = {
|
52
|
+
rule: types.ActionAfterKind
|
53
|
+
}
|
54
|
+
export type UnwrapsAfterValue = {
|
55
|
+
rule: types.ActionAfterKind
|
56
|
+
}
|
57
|
+
|
58
|
+
export interface UnwrapsAfterJSON {
|
59
|
+
kind: "UnwrapsAfter"
|
60
|
+
value: {
|
61
|
+
rule: types.ActionAfterJSON
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
export class UnwrapsAfter {
|
66
|
+
static readonly discriminator = 1
|
67
|
+
static readonly kind = "UnwrapsAfter"
|
68
|
+
readonly discriminator = 1
|
69
|
+
readonly kind = "UnwrapsAfter"
|
70
|
+
readonly value: UnwrapsAfterValue
|
71
|
+
|
72
|
+
constructor(value: UnwrapsAfterFields) {
|
73
|
+
this.value = {
|
74
|
+
rule: value.rule,
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
toJSON(): UnwrapsAfterJSON {
|
79
|
+
return {
|
80
|
+
kind: "UnwrapsAfter",
|
81
|
+
value: {
|
82
|
+
rule: this.value.rule.toJSON(),
|
83
|
+
},
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
toEncodable() {
|
88
|
+
return {
|
89
|
+
UnwrapsAfter: {
|
90
|
+
rule: this.value.rule.toEncodable(),
|
91
|
+
},
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
export type WrappedSourceFields = {
|
97
|
+
rule: types.WrappedSourceFields
|
98
|
+
}
|
99
|
+
export type WrappedSourceValue = {
|
100
|
+
rule: types.WrappedSource
|
101
|
+
}
|
102
|
+
|
103
|
+
export interface WrappedSourceJSON {
|
104
|
+
kind: "WrappedSource"
|
105
|
+
value: {
|
106
|
+
rule: types.WrappedSourceJSON
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
export class WrappedSource {
|
111
|
+
static readonly discriminator = 2
|
112
|
+
static readonly kind = "WrappedSource"
|
113
|
+
readonly discriminator = 2
|
114
|
+
readonly kind = "WrappedSource"
|
115
|
+
readonly value: WrappedSourceValue
|
116
|
+
|
117
|
+
constructor(value: WrappedSourceFields) {
|
118
|
+
this.value = {
|
119
|
+
rule: new types.WrappedSource({ ...value.rule }),
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
toJSON(): WrappedSourceJSON {
|
124
|
+
return {
|
125
|
+
kind: "WrappedSource",
|
126
|
+
value: {
|
127
|
+
rule: this.value.rule.toJSON(),
|
128
|
+
},
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
toEncodable() {
|
133
|
+
return {
|
134
|
+
WrappedSource: {
|
135
|
+
rule: types.WrappedSource.toEncodable(this.value.rule),
|
136
|
+
},
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
142
|
+
export function fromDecoded(obj: any): types.RuleKind {
|
143
|
+
if (typeof obj !== "object") {
|
144
|
+
throw new Error("Invalid enum object")
|
145
|
+
}
|
146
|
+
|
147
|
+
if ("UnlocksAfter" in obj) {
|
148
|
+
const val = obj["UnlocksAfter"]
|
149
|
+
return new UnlocksAfter({
|
150
|
+
rule: types.ActionAfter.fromDecoded(val["rule"]),
|
151
|
+
})
|
152
|
+
}
|
153
|
+
if ("UnwrapsAfter" in obj) {
|
154
|
+
const val = obj["UnwrapsAfter"]
|
155
|
+
return new UnwrapsAfter({
|
156
|
+
rule: types.ActionAfter.fromDecoded(val["rule"]),
|
157
|
+
})
|
158
|
+
}
|
159
|
+
if ("WrappedSource" in obj) {
|
160
|
+
const val = obj["WrappedSource"]
|
161
|
+
return new WrappedSource({
|
162
|
+
rule: types.WrappedSource.fromDecoded(val["rule"]),
|
163
|
+
})
|
164
|
+
}
|
165
|
+
|
166
|
+
throw new Error("Invalid enum object")
|
167
|
+
}
|
168
|
+
|
169
|
+
export function fromJSON(obj: types.RuleJSON): types.RuleKind {
|
170
|
+
switch (obj.kind) {
|
171
|
+
case "UnlocksAfter": {
|
172
|
+
return new UnlocksAfter({
|
173
|
+
rule: types.ActionAfter.fromJSON(obj.value.rule),
|
174
|
+
})
|
175
|
+
}
|
176
|
+
case "UnwrapsAfter": {
|
177
|
+
return new UnwrapsAfter({
|
178
|
+
rule: types.ActionAfter.fromJSON(obj.value.rule),
|
179
|
+
})
|
180
|
+
}
|
181
|
+
case "WrappedSource": {
|
182
|
+
return new WrappedSource({
|
183
|
+
rule: types.WrappedSource.fromJSON(obj.value.rule),
|
184
|
+
})
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
export function layout(property?: string) {
|
190
|
+
const ret = borsh.rustEnum([
|
191
|
+
borsh.struct([types.ActionAfter.layout("rule")], "UnlocksAfter"),
|
192
|
+
borsh.struct([types.ActionAfter.layout("rule")], "UnwrapsAfter"),
|
193
|
+
borsh.struct([types.WrappedSource.layout("rule")], "WrappedSource"),
|
194
|
+
])
|
195
|
+
if (property !== undefined) {
|
196
|
+
return ret.replicate(property)
|
197
|
+
}
|
198
|
+
return ret
|
199
|
+
}
|
@@ -0,0 +1,102 @@
|
|
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 SaleConfigFields {
|
7
|
+
prices: Array<types.PriceFields>
|
8
|
+
priceType: types.PriceRuleKind
|
9
|
+
rules: Array<types.RuleKind>
|
10
|
+
sendToVault: number
|
11
|
+
saleType: types.SaleTypeKind
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface SaleConfigJSON {
|
15
|
+
prices: Array<types.PriceJSON>
|
16
|
+
priceType: types.PriceRuleJSON
|
17
|
+
rules: Array<types.RuleJSON>
|
18
|
+
sendToVault: number
|
19
|
+
saleType: types.SaleTypeJSON
|
20
|
+
}
|
21
|
+
|
22
|
+
export class SaleConfig {
|
23
|
+
readonly prices: Array<types.Price>
|
24
|
+
readonly priceType: types.PriceRuleKind
|
25
|
+
readonly rules: Array<types.RuleKind>
|
26
|
+
readonly sendToVault: number
|
27
|
+
readonly saleType: types.SaleTypeKind
|
28
|
+
|
29
|
+
constructor(fields: SaleConfigFields) {
|
30
|
+
this.prices = fields.prices.map((item) => new types.Price({ ...item }))
|
31
|
+
this.priceType = fields.priceType
|
32
|
+
this.rules = fields.rules
|
33
|
+
this.sendToVault = fields.sendToVault
|
34
|
+
this.saleType = fields.saleType
|
35
|
+
}
|
36
|
+
|
37
|
+
static layout(property?: string) {
|
38
|
+
return borsh.struct(
|
39
|
+
[
|
40
|
+
borsh.vec(types.Price.layout(), "prices"),
|
41
|
+
types.PriceRule.layout("priceType"),
|
42
|
+
borsh.vec(types.Rule.layout(), "rules"),
|
43
|
+
borsh.u8("sendToVault"),
|
44
|
+
types.SaleType.layout("saleType"),
|
45
|
+
],
|
46
|
+
property
|
47
|
+
)
|
48
|
+
}
|
49
|
+
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
51
|
+
static fromDecoded(obj: any) {
|
52
|
+
return new SaleConfig({
|
53
|
+
prices: obj.prices.map(
|
54
|
+
(
|
55
|
+
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
56
|
+
) => types.Price.fromDecoded(item)
|
57
|
+
),
|
58
|
+
priceType: types.PriceRule.fromDecoded(obj.priceType),
|
59
|
+
rules: obj.rules.map(
|
60
|
+
(
|
61
|
+
item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
|
62
|
+
) => types.Rule.fromDecoded(item)
|
63
|
+
),
|
64
|
+
sendToVault: obj.sendToVault,
|
65
|
+
saleType: types.SaleType.fromDecoded(obj.saleType),
|
66
|
+
})
|
67
|
+
}
|
68
|
+
|
69
|
+
static toEncodable(fields: SaleConfigFields) {
|
70
|
+
return {
|
71
|
+
prices: fields.prices.map((item) => types.Price.toEncodable(item)),
|
72
|
+
priceType: fields.priceType.toEncodable(),
|
73
|
+
rules: fields.rules.map((item) => item.toEncodable()),
|
74
|
+
sendToVault: fields.sendToVault,
|
75
|
+
saleType: fields.saleType.toEncodable(),
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
toJSON(): SaleConfigJSON {
|
80
|
+
return {
|
81
|
+
prices: this.prices.map((item) => item.toJSON()),
|
82
|
+
priceType: this.priceType.toJSON(),
|
83
|
+
rules: this.rules.map((item) => item.toJSON()),
|
84
|
+
sendToVault: this.sendToVault,
|
85
|
+
saleType: this.saleType.toJSON(),
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
static fromJSON(obj: SaleConfigJSON): SaleConfig {
|
90
|
+
return new SaleConfig({
|
91
|
+
prices: obj.prices.map((item) => types.Price.fromJSON(item)),
|
92
|
+
priceType: types.PriceRule.fromJSON(obj.priceType),
|
93
|
+
rules: obj.rules.map((item) => types.Rule.fromJSON(item)),
|
94
|
+
sendToVault: obj.sendToVault,
|
95
|
+
saleType: types.SaleType.fromJSON(obj.saleType),
|
96
|
+
})
|
97
|
+
}
|
98
|
+
|
99
|
+
toEncodable() {
|
100
|
+
return SaleConfig.toEncodable(this)
|
101
|
+
}
|
102
|
+
}
|
@@ -0,0 +1,85 @@
|
|
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 SaleTrackFields {
|
7
|
+
created: BN
|
8
|
+
sold: BN
|
9
|
+
earned: BN
|
10
|
+
collectors: BN
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface SaleTrackJSON {
|
14
|
+
created: string
|
15
|
+
sold: string
|
16
|
+
earned: string
|
17
|
+
collectors: string
|
18
|
+
}
|
19
|
+
|
20
|
+
export class SaleTrack {
|
21
|
+
readonly created: BN
|
22
|
+
readonly sold: BN
|
23
|
+
readonly earned: BN
|
24
|
+
readonly collectors: BN
|
25
|
+
|
26
|
+
constructor(fields: SaleTrackFields) {
|
27
|
+
this.created = fields.created
|
28
|
+
this.sold = fields.sold
|
29
|
+
this.earned = fields.earned
|
30
|
+
this.collectors = fields.collectors
|
31
|
+
}
|
32
|
+
|
33
|
+
static layout(property?: string) {
|
34
|
+
return borsh.struct(
|
35
|
+
[
|
36
|
+
borsh.u64("created"),
|
37
|
+
borsh.u64("sold"),
|
38
|
+
borsh.u64("earned"),
|
39
|
+
borsh.u64("collectors"),
|
40
|
+
],
|
41
|
+
property
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
static fromDecoded(obj: any) {
|
47
|
+
return new SaleTrack({
|
48
|
+
created: obj.created,
|
49
|
+
sold: obj.sold,
|
50
|
+
earned: obj.earned,
|
51
|
+
collectors: obj.collectors,
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
static toEncodable(fields: SaleTrackFields) {
|
56
|
+
return {
|
57
|
+
created: fields.created,
|
58
|
+
sold: fields.sold,
|
59
|
+
earned: fields.earned,
|
60
|
+
collectors: fields.collectors,
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
toJSON(): SaleTrackJSON {
|
65
|
+
return {
|
66
|
+
created: this.created.toString(),
|
67
|
+
sold: this.sold.toString(),
|
68
|
+
earned: this.earned.toString(),
|
69
|
+
collectors: this.collectors.toString(),
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
static fromJSON(obj: SaleTrackJSON): SaleTrack {
|
74
|
+
return new SaleTrack({
|
75
|
+
created: new BN(obj.created),
|
76
|
+
sold: new BN(obj.sold),
|
77
|
+
earned: new BN(obj.earned),
|
78
|
+
collectors: new BN(obj.collectors),
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
toEncodable() {
|
83
|
+
return SaleTrack.toEncodable(this)
|
84
|
+
}
|
85
|
+
}
|