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,259 @@
|
|
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 NativeJSON {
|
7
|
+
kind: "Native"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Native {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Native"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Native"
|
15
|
+
|
16
|
+
toJSON(): NativeJSON {
|
17
|
+
return {
|
18
|
+
kind: "Native",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Native: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export type SplFields = {
|
30
|
+
id: PublicKey
|
31
|
+
}
|
32
|
+
export type SplValue = {
|
33
|
+
id: PublicKey
|
34
|
+
}
|
35
|
+
|
36
|
+
export interface SplJSON {
|
37
|
+
kind: "Spl"
|
38
|
+
value: {
|
39
|
+
id: string
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
export class Spl {
|
44
|
+
static readonly discriminator = 1
|
45
|
+
static readonly kind = "Spl"
|
46
|
+
readonly discriminator = 1
|
47
|
+
readonly kind = "Spl"
|
48
|
+
readonly value: SplValue
|
49
|
+
|
50
|
+
constructor(value: SplFields) {
|
51
|
+
this.value = {
|
52
|
+
id: value.id,
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
toJSON(): SplJSON {
|
57
|
+
return {
|
58
|
+
kind: "Spl",
|
59
|
+
value: {
|
60
|
+
id: this.value.id.toString(),
|
61
|
+
},
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
toEncodable() {
|
66
|
+
return {
|
67
|
+
Spl: {
|
68
|
+
id: this.value.id,
|
69
|
+
},
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
export type CollectionFields = {
|
75
|
+
id: PublicKey
|
76
|
+
}
|
77
|
+
export type CollectionValue = {
|
78
|
+
id: PublicKey
|
79
|
+
}
|
80
|
+
|
81
|
+
export interface CollectionJSON {
|
82
|
+
kind: "Collection"
|
83
|
+
value: {
|
84
|
+
id: string
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
export class Collection {
|
89
|
+
static readonly discriminator = 2
|
90
|
+
static readonly kind = "Collection"
|
91
|
+
readonly discriminator = 2
|
92
|
+
readonly kind = "Collection"
|
93
|
+
readonly value: CollectionValue
|
94
|
+
|
95
|
+
constructor(value: CollectionFields) {
|
96
|
+
this.value = {
|
97
|
+
id: value.id,
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
toJSON(): CollectionJSON {
|
102
|
+
return {
|
103
|
+
kind: "Collection",
|
104
|
+
value: {
|
105
|
+
id: this.value.id.toString(),
|
106
|
+
},
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
toEncodable() {
|
111
|
+
return {
|
112
|
+
Collection: {
|
113
|
+
id: this.value.id,
|
114
|
+
},
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
export type CreatorFields = {
|
120
|
+
id: PublicKey
|
121
|
+
}
|
122
|
+
export type CreatorValue = {
|
123
|
+
id: PublicKey
|
124
|
+
}
|
125
|
+
|
126
|
+
export interface CreatorJSON {
|
127
|
+
kind: "Creator"
|
128
|
+
value: {
|
129
|
+
id: string
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
export class Creator {
|
134
|
+
static readonly discriminator = 3
|
135
|
+
static readonly kind = "Creator"
|
136
|
+
readonly discriminator = 3
|
137
|
+
readonly kind = "Creator"
|
138
|
+
readonly value: CreatorValue
|
139
|
+
|
140
|
+
constructor(value: CreatorFields) {
|
141
|
+
this.value = {
|
142
|
+
id: value.id,
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
toJSON(): CreatorJSON {
|
147
|
+
return {
|
148
|
+
kind: "Creator",
|
149
|
+
value: {
|
150
|
+
id: this.value.id.toString(),
|
151
|
+
},
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
toEncodable() {
|
156
|
+
return {
|
157
|
+
Creator: {
|
158
|
+
id: this.value.id,
|
159
|
+
},
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
export interface NoneJSON {
|
165
|
+
kind: "None"
|
166
|
+
}
|
167
|
+
|
168
|
+
export class None {
|
169
|
+
static readonly discriminator = 4
|
170
|
+
static readonly kind = "None"
|
171
|
+
readonly discriminator = 4
|
172
|
+
readonly kind = "None"
|
173
|
+
|
174
|
+
toJSON(): NoneJSON {
|
175
|
+
return {
|
176
|
+
kind: "None",
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
toEncodable() {
|
181
|
+
return {
|
182
|
+
None: {},
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
188
|
+
export function fromDecoded(obj: any): types.CurrencyTypeKind {
|
189
|
+
if (typeof obj !== "object") {
|
190
|
+
throw new Error("Invalid enum object")
|
191
|
+
}
|
192
|
+
|
193
|
+
if ("Native" in obj) {
|
194
|
+
return new Native()
|
195
|
+
}
|
196
|
+
if ("Spl" in obj) {
|
197
|
+
const val = obj["Spl"]
|
198
|
+
return new Spl({
|
199
|
+
id: val["id"],
|
200
|
+
})
|
201
|
+
}
|
202
|
+
if ("Collection" in obj) {
|
203
|
+
const val = obj["Collection"]
|
204
|
+
return new Collection({
|
205
|
+
id: val["id"],
|
206
|
+
})
|
207
|
+
}
|
208
|
+
if ("Creator" in obj) {
|
209
|
+
const val = obj["Creator"]
|
210
|
+
return new Creator({
|
211
|
+
id: val["id"],
|
212
|
+
})
|
213
|
+
}
|
214
|
+
if ("None" in obj) {
|
215
|
+
return new None()
|
216
|
+
}
|
217
|
+
|
218
|
+
throw new Error("Invalid enum object")
|
219
|
+
}
|
220
|
+
|
221
|
+
export function fromJSON(obj: types.CurrencyTypeJSON): types.CurrencyTypeKind {
|
222
|
+
switch (obj.kind) {
|
223
|
+
case "Native": {
|
224
|
+
return new Native()
|
225
|
+
}
|
226
|
+
case "Spl": {
|
227
|
+
return new Spl({
|
228
|
+
id: new PublicKey(obj.value.id),
|
229
|
+
})
|
230
|
+
}
|
231
|
+
case "Collection": {
|
232
|
+
return new Collection({
|
233
|
+
id: new PublicKey(obj.value.id),
|
234
|
+
})
|
235
|
+
}
|
236
|
+
case "Creator": {
|
237
|
+
return new Creator({
|
238
|
+
id: new PublicKey(obj.value.id),
|
239
|
+
})
|
240
|
+
}
|
241
|
+
case "None": {
|
242
|
+
return new None()
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
export function layout(property?: string) {
|
248
|
+
const ret = borsh.rustEnum([
|
249
|
+
borsh.struct([], "Native"),
|
250
|
+
borsh.struct([borsh.publicKey("id")], "Spl"),
|
251
|
+
borsh.struct([borsh.publicKey("id")], "Collection"),
|
252
|
+
borsh.struct([borsh.publicKey("id")], "Creator"),
|
253
|
+
borsh.struct([], "None"),
|
254
|
+
])
|
255
|
+
if (property !== undefined) {
|
256
|
+
return ret.replicate(property)
|
257
|
+
}
|
258
|
+
return ret
|
259
|
+
}
|
@@ -0,0 +1,61 @@
|
|
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 DateTraitInitFields {
|
7
|
+
hash: BN
|
8
|
+
date: number
|
9
|
+
}
|
10
|
+
|
11
|
+
export interface DateTraitInitJSON {
|
12
|
+
hash: string
|
13
|
+
date: number
|
14
|
+
}
|
15
|
+
|
16
|
+
export class DateTraitInit {
|
17
|
+
readonly hash: BN
|
18
|
+
readonly date: number
|
19
|
+
|
20
|
+
constructor(fields: DateTraitInitFields) {
|
21
|
+
this.hash = fields.hash
|
22
|
+
this.date = fields.date
|
23
|
+
}
|
24
|
+
|
25
|
+
static layout(property?: string) {
|
26
|
+
return borsh.struct([borsh.u64("hash"), borsh.u32("date")], property)
|
27
|
+
}
|
28
|
+
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
static fromDecoded(obj: any) {
|
31
|
+
return new DateTraitInit({
|
32
|
+
hash: obj.hash,
|
33
|
+
date: obj.date,
|
34
|
+
})
|
35
|
+
}
|
36
|
+
|
37
|
+
static toEncodable(fields: DateTraitInitFields) {
|
38
|
+
return {
|
39
|
+
hash: fields.hash,
|
40
|
+
date: fields.date,
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
toJSON(): DateTraitInitJSON {
|
45
|
+
return {
|
46
|
+
hash: this.hash.toString(),
|
47
|
+
date: this.date,
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
static fromJSON(obj: DateTraitInitJSON): DateTraitInit {
|
52
|
+
return new DateTraitInit({
|
53
|
+
hash: new BN(obj.hash),
|
54
|
+
date: obj.date,
|
55
|
+
})
|
56
|
+
}
|
57
|
+
|
58
|
+
toEncodable() {
|
59
|
+
return DateTraitInit.toEncodable(this)
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,72 @@
|
|
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 DateTraitInitMapFields {
|
7
|
+
hash: BN
|
8
|
+
date: number
|
9
|
+
index: number
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface DateTraitInitMapJSON {
|
13
|
+
hash: string
|
14
|
+
date: number
|
15
|
+
index: number
|
16
|
+
}
|
17
|
+
|
18
|
+
export class DateTraitInitMap {
|
19
|
+
readonly hash: BN
|
20
|
+
readonly date: number
|
21
|
+
readonly index: number
|
22
|
+
|
23
|
+
constructor(fields: DateTraitInitMapFields) {
|
24
|
+
this.hash = fields.hash
|
25
|
+
this.date = fields.date
|
26
|
+
this.index = fields.index
|
27
|
+
}
|
28
|
+
|
29
|
+
static layout(property?: string) {
|
30
|
+
return borsh.struct(
|
31
|
+
[borsh.u64("hash"), borsh.u32("date"), borsh.u32("index")],
|
32
|
+
property
|
33
|
+
)
|
34
|
+
}
|
35
|
+
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
37
|
+
static fromDecoded(obj: any) {
|
38
|
+
return new DateTraitInitMap({
|
39
|
+
hash: obj.hash,
|
40
|
+
date: obj.date,
|
41
|
+
index: obj.index,
|
42
|
+
})
|
43
|
+
}
|
44
|
+
|
45
|
+
static toEncodable(fields: DateTraitInitMapFields) {
|
46
|
+
return {
|
47
|
+
hash: fields.hash,
|
48
|
+
date: fields.date,
|
49
|
+
index: fields.index,
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
toJSON(): DateTraitInitMapJSON {
|
54
|
+
return {
|
55
|
+
hash: this.hash.toString(),
|
56
|
+
date: this.date,
|
57
|
+
index: this.index,
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
static fromJSON(obj: DateTraitInitMapJSON): DateTraitInitMap {
|
62
|
+
return new DateTraitInitMap({
|
63
|
+
hash: new BN(obj.hash),
|
64
|
+
date: obj.date,
|
65
|
+
index: obj.index,
|
66
|
+
})
|
67
|
+
}
|
68
|
+
|
69
|
+
toEncodable() {
|
70
|
+
return DateTraitInitMap.toEncodable(this)
|
71
|
+
}
|
72
|
+
}
|
@@ -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 DepositFields {
|
7
|
+
depositType: types.DepositTypeKind
|
8
|
+
format: types.DepositFormatKind
|
9
|
+
interestHash: BN
|
10
|
+
proofSize: number
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface DepositJSON {
|
14
|
+
depositType: types.DepositTypeJSON
|
15
|
+
format: types.DepositFormatJSON
|
16
|
+
interestHash: string
|
17
|
+
proofSize: number
|
18
|
+
}
|
19
|
+
|
20
|
+
export class Deposit {
|
21
|
+
readonly depositType: types.DepositTypeKind
|
22
|
+
readonly format: types.DepositFormatKind
|
23
|
+
readonly interestHash: BN
|
24
|
+
readonly proofSize: number
|
25
|
+
|
26
|
+
constructor(fields: DepositFields) {
|
27
|
+
this.depositType = fields.depositType
|
28
|
+
this.format = fields.format
|
29
|
+
this.interestHash = fields.interestHash
|
30
|
+
this.proofSize = fields.proofSize
|
31
|
+
}
|
32
|
+
|
33
|
+
static layout(property?: string) {
|
34
|
+
return borsh.struct(
|
35
|
+
[
|
36
|
+
types.DepositType.layout("depositType"),
|
37
|
+
types.DepositFormat.layout("format"),
|
38
|
+
borsh.u64("interestHash"),
|
39
|
+
borsh.u8("proofSize"),
|
40
|
+
],
|
41
|
+
property
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
46
|
+
static fromDecoded(obj: any) {
|
47
|
+
return new Deposit({
|
48
|
+
depositType: types.DepositType.fromDecoded(obj.depositType),
|
49
|
+
format: types.DepositFormat.fromDecoded(obj.format),
|
50
|
+
interestHash: obj.interestHash,
|
51
|
+
proofSize: obj.proofSize,
|
52
|
+
})
|
53
|
+
}
|
54
|
+
|
55
|
+
static toEncodable(fields: DepositFields) {
|
56
|
+
return {
|
57
|
+
depositType: fields.depositType.toEncodable(),
|
58
|
+
format: fields.format.toEncodable(),
|
59
|
+
interestHash: fields.interestHash,
|
60
|
+
proofSize: fields.proofSize,
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
toJSON(): DepositJSON {
|
65
|
+
return {
|
66
|
+
depositType: this.depositType.toJSON(),
|
67
|
+
format: this.format.toJSON(),
|
68
|
+
interestHash: this.interestHash.toString(),
|
69
|
+
proofSize: this.proofSize,
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
static fromJSON(obj: DepositJSON): Deposit {
|
74
|
+
return new Deposit({
|
75
|
+
depositType: types.DepositType.fromJSON(obj.depositType),
|
76
|
+
format: types.DepositFormat.fromJSON(obj.format),
|
77
|
+
interestHash: new BN(obj.interestHash),
|
78
|
+
proofSize: obj.proofSize,
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
toEncodable() {
|
83
|
+
return Deposit.toEncodable(this)
|
84
|
+
}
|
85
|
+
}
|
@@ -0,0 +1,90 @@
|
|
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 CnftJSON {
|
7
|
+
kind: "Cnft"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Cnft {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Cnft"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Cnft"
|
15
|
+
|
16
|
+
toJSON(): CnftJSON {
|
17
|
+
return {
|
18
|
+
kind: "Cnft",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Cnft: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface NftJSON {
|
30
|
+
kind: "Nft"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class Nft {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "Nft"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "Nft"
|
38
|
+
|
39
|
+
toJSON(): NftJSON {
|
40
|
+
return {
|
41
|
+
kind: "Nft",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
Nft: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
53
|
+
export function fromDecoded(obj: any): types.DepositFormatKind {
|
54
|
+
if (typeof obj !== "object") {
|
55
|
+
throw new Error("Invalid enum object")
|
56
|
+
}
|
57
|
+
|
58
|
+
if ("Cnft" in obj) {
|
59
|
+
return new Cnft()
|
60
|
+
}
|
61
|
+
if ("Nft" in obj) {
|
62
|
+
return new Nft()
|
63
|
+
}
|
64
|
+
|
65
|
+
throw new Error("Invalid enum object")
|
66
|
+
}
|
67
|
+
|
68
|
+
export function fromJSON(
|
69
|
+
obj: types.DepositFormatJSON
|
70
|
+
): types.DepositFormatKind {
|
71
|
+
switch (obj.kind) {
|
72
|
+
case "Cnft": {
|
73
|
+
return new Cnft()
|
74
|
+
}
|
75
|
+
case "Nft": {
|
76
|
+
return new Nft()
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
export function layout(property?: string) {
|
82
|
+
const ret = borsh.rustEnum([
|
83
|
+
borsh.struct([], "Cnft"),
|
84
|
+
borsh.struct([], "Nft"),
|
85
|
+
])
|
86
|
+
if (property !== undefined) {
|
87
|
+
return ret.replicate(property)
|
88
|
+
}
|
89
|
+
return ret
|
90
|
+
}
|
@@ -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 AvailableJSON {
|
7
|
+
kind: "Available"
|
8
|
+
}
|
9
|
+
|
10
|
+
export class Available {
|
11
|
+
static readonly discriminator = 0
|
12
|
+
static readonly kind = "Available"
|
13
|
+
readonly discriminator = 0
|
14
|
+
readonly kind = "Available"
|
15
|
+
|
16
|
+
toJSON(): AvailableJSON {
|
17
|
+
return {
|
18
|
+
kind: "Available",
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
toEncodable() {
|
23
|
+
return {
|
24
|
+
Available: {},
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface BurningJSON {
|
30
|
+
kind: "Burning"
|
31
|
+
}
|
32
|
+
|
33
|
+
export class Burning {
|
34
|
+
static readonly discriminator = 1
|
35
|
+
static readonly kind = "Burning"
|
36
|
+
readonly discriminator = 1
|
37
|
+
readonly kind = "Burning"
|
38
|
+
|
39
|
+
toJSON(): BurningJSON {
|
40
|
+
return {
|
41
|
+
kind: "Burning",
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
toEncodable() {
|
46
|
+
return {
|
47
|
+
Burning: {},
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
53
|
+
export function fromDecoded(obj: any): types.DepositStateKind {
|
54
|
+
if (typeof obj !== "object") {
|
55
|
+
throw new Error("Invalid enum object")
|
56
|
+
}
|
57
|
+
|
58
|
+
if ("Available" in obj) {
|
59
|
+
return new Available()
|
60
|
+
}
|
61
|
+
if ("Burning" in obj) {
|
62
|
+
return new Burning()
|
63
|
+
}
|
64
|
+
|
65
|
+
throw new Error("Invalid enum object")
|
66
|
+
}
|
67
|
+
|
68
|
+
export function fromJSON(obj: types.DepositStateJSON): types.DepositStateKind {
|
69
|
+
switch (obj.kind) {
|
70
|
+
case "Available": {
|
71
|
+
return new Available()
|
72
|
+
}
|
73
|
+
case "Burning": {
|
74
|
+
return new Burning()
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
export function layout(property?: string) {
|
80
|
+
const ret = borsh.rustEnum([
|
81
|
+
borsh.struct([], "Available"),
|
82
|
+
borsh.struct([], "Burning"),
|
83
|
+
])
|
84
|
+
if (property !== undefined) {
|
85
|
+
return ret.replicate(property)
|
86
|
+
}
|
87
|
+
return ret
|
88
|
+
}
|