3land_sdk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. package/README.md +352 -0
  2. package/assets/3land_rebrand.gif +0 -0
  3. package/assets/battle_sol.gif +0 -0
  4. package/assets/ds.jpeg +0 -0
  5. package/assets/future.webp +0 -0
  6. package/assets/music.mp3 +0 -0
  7. package/assets/niicl.gif +0 -0
  8. package/assets/og.png +0 -0
  9. package/assets/phone.glb +0 -0
  10. package/assets/testvid.mp4 +0 -0
  11. package/idl.json +7652 -0
  12. package/package.json +35 -0
  13. package/src/index.ts +89 -0
  14. package/src/library/Irys/irys.ts +412 -0
  15. package/src/library/Store.ts +613 -0
  16. package/src/library/implementation/storeImplementation.ts +385 -0
  17. package/src/library/instructions/store/buySingleEdition.ts +227 -0
  18. package/src/library/instructions/store/createSingleEdition.ts +49 -0
  19. package/src/library/instructions/store/createStore.ts +19 -0
  20. package/src/library/instructions/store/idl.ts +7622 -0
  21. package/src/library/instructions/store/uploadFilesIryis.ts +133 -0
  22. package/src/types/accounts/ArchiveDeposit.ts +207 -0
  23. package/src/types/accounts/Authority.ts +73 -0
  24. package/src/types/accounts/BurnDeposit.ts +111 -0
  25. package/src/types/accounts/BurnProgress.ts +97 -0
  26. package/src/types/accounts/BuyHistory.ts +121 -0
  27. package/src/types/accounts/BuyTrack.ts +94 -0
  28. package/src/types/accounts/Card.ts +185 -0
  29. package/src/types/accounts/CollectionRegistry.ts +145 -0
  30. package/src/types/accounts/CollectorRegistry.ts +145 -0
  31. package/src/types/accounts/CreatorRegistry.ts +153 -0
  32. package/src/types/accounts/CurrencyArtistProof.ts +113 -0
  33. package/src/types/accounts/GenericUser.ts +185 -0
  34. package/src/types/accounts/ItemArchive.ts +223 -0
  35. package/src/types/accounts/ItemReserveList.ts +87 -0
  36. package/src/types/accounts/ItemReserveList2.ts +73 -0
  37. package/src/types/accounts/LutVault.ts +97 -0
  38. package/src/types/accounts/Pack.ts +367 -0
  39. package/src/types/accounts/PackContent.ts +97 -0
  40. package/src/types/accounts/PackOpenHolder.ts +141 -0
  41. package/src/types/accounts/PackReceipt.ts +145 -0
  42. package/src/types/accounts/PackTraits.ts +101 -0
  43. package/src/types/accounts/Payment.ts +97 -0
  44. package/src/types/accounts/PoolVault.ts +177 -0
  45. package/src/types/accounts/RevealForMe.ts +139 -0
  46. package/src/types/accounts/SecureHolder.ts +97 -0
  47. package/src/types/accounts/Single.ts +301 -0
  48. package/src/types/accounts/Store.ts +180 -0
  49. package/src/types/accounts/StoresHolder.ts +131 -0
  50. package/src/types/accounts/ThreeId.ts +189 -0
  51. package/src/types/accounts/TokenManager.ts +217 -0
  52. package/src/types/accounts/ZeroCard.ts +73 -0
  53. package/src/types/accounts/ZeroContent.ts +89 -0
  54. package/src/types/accounts/ZeroOpenHolder.ts +183 -0
  55. package/src/types/accounts/index.ts +84 -0
  56. package/src/types/errors/anchor.ts +773 -0
  57. package/src/types/errors/index.ts +59 -0
  58. package/src/types/implementation/implementationTypes.ts +27 -0
  59. package/src/types/instructions/addBurn.ts +56 -0
  60. package/src/types/instructions/adjustDepositBurn.ts +33 -0
  61. package/src/types/instructions/archiveItem.ts +60 -0
  62. package/src/types/instructions/assignPackDelegate.ts +30 -0
  63. package/src/types/instructions/burnPay.ts +55 -0
  64. package/src/types/instructions/buyPack.ts +69 -0
  65. package/src/types/instructions/buyPay.ts +71 -0
  66. package/src/types/instructions/buyToken.ts +64 -0
  67. package/src/types/instructions/claimZeroCard.ts +106 -0
  68. package/src/types/instructions/closeDepositBurn.ts +47 -0
  69. package/src/types/instructions/closeRegisterTraits.ts +28 -0
  70. package/src/types/instructions/createCard.ts +56 -0
  71. package/src/types/instructions/createCollection.ts +68 -0
  72. package/src/types/instructions/createPack.ts +71 -0
  73. package/src/types/instructions/createSingle.ts +71 -0
  74. package/src/types/instructions/createStore.ts +50 -0
  75. package/src/types/instructions/createTokenLauncher.ts +82 -0
  76. package/src/types/instructions/createZeroCard.ts +76 -0
  77. package/src/types/instructions/deleteCard.ts +32 -0
  78. package/src/types/instructions/deletePack.ts +40 -0
  79. package/src/types/instructions/deleteSingle.ts +36 -0
  80. package/src/types/instructions/deleteTokenLauncher.ts +38 -0
  81. package/src/types/instructions/depositBurn.ts +55 -0
  82. package/src/types/instructions/donateUser.ts +84 -0
  83. package/src/types/instructions/feedPool.ts +61 -0
  84. package/src/types/instructions/feedTraits.ts +44 -0
  85. package/src/types/instructions/feedTree.ts +63 -0
  86. package/src/types/instructions/flagPack.ts +50 -0
  87. package/src/types/instructions/flagSingle.ts +47 -0
  88. package/src/types/instructions/gatePay.ts +59 -0
  89. package/src/types/instructions/index.ts +140 -0
  90. package/src/types/instructions/initialize.ts +46 -0
  91. package/src/types/instructions/openPack.ts +79 -0
  92. package/src/types/instructions/prepareCreator.ts +30 -0
  93. package/src/types/instructions/preparePack.ts +51 -0
  94. package/src/types/instructions/prepareTraits.ts +28 -0
  95. package/src/types/instructions/printPack.ts +95 -0
  96. package/src/types/instructions/printSingle.ts +108 -0
  97. package/src/types/instructions/recoverDepositBurn.ts +80 -0
  98. package/src/types/instructions/registerActivity.ts +43 -0
  99. package/src/types/instructions/registerCollector.ts +63 -0
  100. package/src/types/instructions/registerCreator.ts +48 -0
  101. package/src/types/instructions/registerGenericUser.ts +94 -0
  102. package/src/types/instructions/registerPackUploads.ts +44 -0
  103. package/src/types/instructions/registerTraits.ts +42 -0
  104. package/src/types/instructions/registerUser.ts +50 -0
  105. package/src/types/instructions/storeLutFor.ts +44 -0
  106. package/src/types/instructions/unwrapAndDestroy.ts +56 -0
  107. package/src/types/instructions/updateCard.ts +54 -0
  108. package/src/types/instructions/updatePack.ts +71 -0
  109. package/src/types/instructions/updateSingle.ts +64 -0
  110. package/src/types/instructions/updateStore.ts +47 -0
  111. package/src/types/instructions/withdrawFromStore.ts +26 -0
  112. package/src/types/programId.ts +42 -0
  113. package/src/types/types/AccountClass.ts +868 -0
  114. package/src/types/types/AccountHasher.ts +89 -0
  115. package/src/types/types/ActionAfter.ts +202 -0
  116. package/src/types/types/AllowedCurrencyArgs.ts +53 -0
  117. package/src/types/types/AuthorityGateTypes.ts +90 -0
  118. package/src/types/types/BurnCount.ts +60 -0
  119. package/src/types/types/BurnState.ts +88 -0
  120. package/src/types/types/BurnTrack.ts +64 -0
  121. package/src/types/types/BurnType.ts +118 -0
  122. package/src/types/types/BurnTypeBurn.ts +56 -0
  123. package/src/types/types/BuyHistoryClass.ts +90 -0
  124. package/src/types/types/CardClass.ts +56 -0
  125. package/src/types/types/CardState.ts +238 -0
  126. package/src/types/types/CardTrack.ts +76 -0
  127. package/src/types/types/Category.ts +72 -0
  128. package/src/types/types/CnftData.ts +85 -0
  129. package/src/types/types/CollectTrack.ts +61 -0
  130. package/src/types/types/Collection.ts +64 -0
  131. package/src/types/types/CompactCnftData.ts +76 -0
  132. package/src/types/types/CoolTimePerAmountArgs.ts +72 -0
  133. package/src/types/types/Creator.ts +72 -0
  134. package/src/types/types/CreatorGateArgs.ts +53 -0
  135. package/src/types/types/CurrencyArtistProof.ts +85 -0
  136. package/src/types/types/CurrencyType.ts +259 -0
  137. package/src/types/types/DateTraitInit.ts +61 -0
  138. package/src/types/types/DateTraitInitMap.ts +72 -0
  139. package/src/types/types/Deposit.ts +85 -0
  140. package/src/types/types/DepositFormat.ts +90 -0
  141. package/src/types/types/DepositState.ts +88 -0
  142. package/src/types/types/DepositSubtype.ts +90 -0
  143. package/src/types/types/DepositTrack.ts +69 -0
  144. package/src/types/types/DepositTrackType.ts +120 -0
  145. package/src/types/types/DepositType.ts +245 -0
  146. package/src/types/types/Earnings.ts +37 -0
  147. package/src/types/types/EditionStoreType.ts +120 -0
  148. package/src/types/types/EncryptedPayload.ts +61 -0
  149. package/src/types/types/ExtraParameter.ts +117 -0
  150. package/src/types/types/FakeBurnCount.ts +64 -0
  151. package/src/types/types/FakeDeposit.ts +64 -0
  152. package/src/types/types/FakeTraitPair.ts +61 -0
  153. package/src/types/types/FakeTraitValue.ts +61 -0
  154. package/src/types/types/FakeVolumeTrack.ts +64 -0
  155. package/src/types/types/FeeType.ts +118 -0
  156. package/src/types/types/FeedingTraits.ts +57 -0
  157. package/src/types/types/Filter.ts +64 -0
  158. package/src/types/types/FilterType.ts +56 -0
  159. package/src/types/types/GeneralStore.ts +56 -0
  160. package/src/types/types/GenericStore.ts +64 -0
  161. package/src/types/types/GenericValue.ts +172 -0
  162. package/src/types/types/GlobalFee.ts +85 -0
  163. package/src/types/types/GlobalState.ts +148 -0
  164. package/src/types/types/IndexDate.ts +94 -0
  165. package/src/types/types/IndexDates.ts +64 -0
  166. package/src/types/types/Item.ts +53 -0
  167. package/src/types/types/ItemClass.ts +88 -0
  168. package/src/types/types/ItemState.ts +298 -0
  169. package/src/types/types/ItemTrack.ts +76 -0
  170. package/src/types/types/ListingPerWalletArgs.ts +53 -0
  171. package/src/types/types/MemeVaultProof.ts +64 -0
  172. package/src/types/types/MetadataArgs.ts +207 -0
  173. package/src/types/types/NonFungibleTraitInit.ts +64 -0
  174. package/src/types/types/NonFungibleTraitInitMap.ts +84 -0
  175. package/src/types/types/OnlyBetweenTimesArgs.ts +76 -0
  176. package/src/types/types/OnlyTheseDOWArgs.ts +53 -0
  177. package/src/types/types/PackConfig.ts +98 -0
  178. package/src/types/types/PackOpenHolderState.ts +120 -0
  179. package/src/types/types/PackRule.ts +85 -0
  180. package/src/types/types/PackState.ts +118 -0
  181. package/src/types/types/PackType.ts +118 -0
  182. package/src/types/types/PaymentClass.ts +118 -0
  183. package/src/types/types/PoolAccess.ts +88 -0
  184. package/src/types/types/PoolState.ts +88 -0
  185. package/src/types/types/PoolType.ts +88 -0
  186. package/src/types/types/Popularity.ts +76 -0
  187. package/src/types/types/PopularityState.ts +630 -0
  188. package/src/types/types/PreviousDonationRecord.ts +76 -0
  189. package/src/types/types/Price.ts +64 -0
  190. package/src/types/types/PriceRule.ts +216 -0
  191. package/src/types/types/RecoverDeposit.ts +56 -0
  192. package/src/types/types/Rule.ts +199 -0
  193. package/src/types/types/SaleConfig.ts +102 -0
  194. package/src/types/types/SaleTrack.ts +85 -0
  195. package/src/types/types/SaleType.ts +148 -0
  196. package/src/types/types/Seed.ts +61 -0
  197. package/src/types/types/SelectedCard.ts +61 -0
  198. package/src/types/types/SelectedZeroCard.ts +61 -0
  199. package/src/types/types/SemiFungibleTraitInit.ts +61 -0
  200. package/src/types/types/SemiFungibleTraitInitMap.ts +72 -0
  201. package/src/types/types/ShortCreator.ts +64 -0
  202. package/src/types/types/ShortMetadata.ts +145 -0
  203. package/src/types/types/ShortMetadataArgs.ts +111 -0
  204. package/src/types/types/StoreConfig.ts +98 -0
  205. package/src/types/types/StoreRule.ts +145 -0
  206. package/src/types/types/SuperCategory.ts +61 -0
  207. package/src/types/types/TightCardMetadata.ts +120 -0
  208. package/src/types/types/TimeRangeType.ts +120 -0
  209. package/src/types/types/TimedPerWalletArgs.ts +53 -0
  210. package/src/types/types/TokenMetadata.ts +72 -0
  211. package/src/types/types/TokenProgramVersion.ts +90 -0
  212. package/src/types/types/TokenStandard.ts +150 -0
  213. package/src/types/types/TokenState.ts +88 -0
  214. package/src/types/types/TokenType.ts +88 -0
  215. package/src/types/types/TotalPerTimeArgs.ts +85 -0
  216. package/src/types/types/TotalPerTimeWalletArgs.ts +61 -0
  217. package/src/types/types/TrackRegistry.ts +90 -0
  218. package/src/types/types/TraitInit.ts +210 -0
  219. package/src/types/types/TraitPass.ts +60 -0
  220. package/src/types/types/TraitPassType.ts +225 -0
  221. package/src/types/types/TraitType.ts +267 -0
  222. package/src/types/types/TraitValue.ts +72 -0
  223. package/src/types/types/UnlocksAfter.ts +172 -0
  224. package/src/types/types/UnwrapMetadata.ts +156 -0
  225. package/src/types/types/UseMethod.ts +118 -0
  226. package/src/types/types/Uses.ts +76 -0
  227. package/src/types/types/VerifyCollectionMetadata.ts +109 -0
  228. package/src/types/types/VolumeTrack.ts +61 -0
  229. package/src/types/types/WrappedSource.ts +85 -0
  230. package/src/types/types/ZeroConfig.ts +85 -0
  231. package/src/types/types/index.ts +798 -0
  232. package/src/utility/Connection.ts +9 -0
  233. package/src/utility/Holders.ts +8 -0
  234. package/src/utility/PdaManager.ts +230 -0
  235. package/src/utility/config.ts +32 -0
  236. package/src/utility/utils.ts +191 -0
  237. package/src/utility/validation.ts +229 -0
  238. package/tsconfig.json +12 -0
@@ -0,0 +1,111 @@
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 ShortMetadataArgsFields {
7
+ name: string
8
+ uri: string
9
+ uriType: number
10
+ sellerFeeBasisPoints: number
11
+ collection: PublicKey
12
+ creators: Array<types.ShortCreatorFields>
13
+ }
14
+
15
+ export interface ShortMetadataArgsJSON {
16
+ name: string
17
+ uri: string
18
+ uriType: number
19
+ sellerFeeBasisPoints: number
20
+ collection: string
21
+ creators: Array<types.ShortCreatorJSON>
22
+ }
23
+
24
+ export class ShortMetadataArgs {
25
+ readonly name: string
26
+ readonly uri: string
27
+ readonly uriType: number
28
+ readonly sellerFeeBasisPoints: number
29
+ readonly collection: PublicKey
30
+ readonly creators: Array<types.ShortCreator>
31
+
32
+ constructor(fields: ShortMetadataArgsFields) {
33
+ this.name = fields.name
34
+ this.uri = fields.uri
35
+ this.uriType = fields.uriType
36
+ this.sellerFeeBasisPoints = fields.sellerFeeBasisPoints
37
+ this.collection = fields.collection
38
+ this.creators = fields.creators.map(
39
+ (item) => new types.ShortCreator({ ...item })
40
+ )
41
+ }
42
+
43
+ static layout(property?: string) {
44
+ return borsh.struct(
45
+ [
46
+ borsh.str("name"),
47
+ borsh.str("uri"),
48
+ borsh.u8("uriType"),
49
+ borsh.u16("sellerFeeBasisPoints"),
50
+ borsh.publicKey("collection"),
51
+ borsh.vec(types.ShortCreator.layout(), "creators"),
52
+ ],
53
+ property
54
+ )
55
+ }
56
+
57
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
+ static fromDecoded(obj: any) {
59
+ return new ShortMetadataArgs({
60
+ name: obj.name,
61
+ uri: obj.uri,
62
+ uriType: obj.uriType,
63
+ sellerFeeBasisPoints: obj.sellerFeeBasisPoints,
64
+ collection: obj.collection,
65
+ creators: obj.creators.map(
66
+ (
67
+ item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
68
+ ) => types.ShortCreator.fromDecoded(item)
69
+ ),
70
+ })
71
+ }
72
+
73
+ static toEncodable(fields: ShortMetadataArgsFields) {
74
+ return {
75
+ name: fields.name,
76
+ uri: fields.uri,
77
+ uriType: fields.uriType,
78
+ sellerFeeBasisPoints: fields.sellerFeeBasisPoints,
79
+ collection: fields.collection,
80
+ creators: fields.creators.map((item) =>
81
+ types.ShortCreator.toEncodable(item)
82
+ ),
83
+ }
84
+ }
85
+
86
+ toJSON(): ShortMetadataArgsJSON {
87
+ return {
88
+ name: this.name,
89
+ uri: this.uri,
90
+ uriType: this.uriType,
91
+ sellerFeeBasisPoints: this.sellerFeeBasisPoints,
92
+ collection: this.collection.toString(),
93
+ creators: this.creators.map((item) => item.toJSON()),
94
+ }
95
+ }
96
+
97
+ static fromJSON(obj: ShortMetadataArgsJSON): ShortMetadataArgs {
98
+ return new ShortMetadataArgs({
99
+ name: obj.name,
100
+ uri: obj.uri,
101
+ uriType: obj.uriType,
102
+ sellerFeeBasisPoints: obj.sellerFeeBasisPoints,
103
+ collection: new PublicKey(obj.collection),
104
+ creators: obj.creators.map((item) => types.ShortCreator.fromJSON(item)),
105
+ })
106
+ }
107
+
108
+ toEncodable() {
109
+ return ShortMetadataArgs.toEncodable(this)
110
+ }
111
+ }
@@ -0,0 +1,98 @@
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 StoreConfigFields {
7
+ fee: BN
8
+ feePercentage: number
9
+ feeType: types.FeeTypeKind
10
+ trust: PublicKey
11
+ rules: Array<types.StoreRuleKind>
12
+ }
13
+
14
+ export interface StoreConfigJSON {
15
+ fee: string
16
+ feePercentage: number
17
+ feeType: types.FeeTypeJSON
18
+ trust: string
19
+ rules: Array<types.StoreRuleJSON>
20
+ }
21
+
22
+ export class StoreConfig {
23
+ readonly fee: BN
24
+ readonly feePercentage: number
25
+ readonly feeType: types.FeeTypeKind
26
+ readonly trust: PublicKey
27
+ readonly rules: Array<types.StoreRuleKind>
28
+
29
+ constructor(fields: StoreConfigFields) {
30
+ this.fee = fields.fee
31
+ this.feePercentage = fields.feePercentage
32
+ this.feeType = fields.feeType
33
+ this.trust = fields.trust
34
+ this.rules = fields.rules
35
+ }
36
+
37
+ static layout(property?: string) {
38
+ return borsh.struct(
39
+ [
40
+ borsh.u64("fee"),
41
+ borsh.u16("feePercentage"),
42
+ types.FeeType.layout("feeType"),
43
+ borsh.publicKey("trust"),
44
+ borsh.vec(types.StoreRule.layout(), "rules"),
45
+ ],
46
+ property
47
+ )
48
+ }
49
+
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ static fromDecoded(obj: any) {
52
+ return new StoreConfig({
53
+ fee: obj.fee,
54
+ feePercentage: obj.feePercentage,
55
+ feeType: types.FeeType.fromDecoded(obj.feeType),
56
+ trust: obj.trust,
57
+ rules: obj.rules.map(
58
+ (
59
+ item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
60
+ ) => types.StoreRule.fromDecoded(item)
61
+ ),
62
+ })
63
+ }
64
+
65
+ static toEncodable(fields: StoreConfigFields) {
66
+ return {
67
+ fee: fields.fee,
68
+ feePercentage: fields.feePercentage,
69
+ feeType: fields.feeType.toEncodable(),
70
+ trust: fields.trust,
71
+ rules: fields.rules.map((item) => item.toEncodable()),
72
+ }
73
+ }
74
+
75
+ toJSON(): StoreConfigJSON {
76
+ return {
77
+ fee: this.fee.toString(),
78
+ feePercentage: this.feePercentage,
79
+ feeType: this.feeType.toJSON(),
80
+ trust: this.trust.toString(),
81
+ rules: this.rules.map((item) => item.toJSON()),
82
+ }
83
+ }
84
+
85
+ static fromJSON(obj: StoreConfigJSON): StoreConfig {
86
+ return new StoreConfig({
87
+ fee: new BN(obj.fee),
88
+ feePercentage: obj.feePercentage,
89
+ feeType: types.FeeType.fromJSON(obj.feeType),
90
+ trust: new PublicKey(obj.trust),
91
+ rules: obj.rules.map((item) => types.StoreRule.fromJSON(item)),
92
+ })
93
+ }
94
+
95
+ toEncodable() {
96
+ return StoreConfig.toEncodable(this)
97
+ }
98
+ }
@@ -0,0 +1,145 @@
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 ListingPerWalletFields = {
7
+ config: types.ListingPerWalletArgsFields
8
+ }
9
+ export type ListingPerWalletValue = {
10
+ config: types.ListingPerWalletArgs
11
+ }
12
+
13
+ export interface ListingPerWalletJSON {
14
+ kind: "ListingPerWallet"
15
+ value: {
16
+ config: types.ListingPerWalletArgsJSON
17
+ }
18
+ }
19
+
20
+ export class ListingPerWallet {
21
+ static readonly discriminator = 0
22
+ static readonly kind = "ListingPerWallet"
23
+ readonly discriminator = 0
24
+ readonly kind = "ListingPerWallet"
25
+ readonly value: ListingPerWalletValue
26
+
27
+ constructor(value: ListingPerWalletFields) {
28
+ this.value = {
29
+ config: new types.ListingPerWalletArgs({ ...value.config }),
30
+ }
31
+ }
32
+
33
+ toJSON(): ListingPerWalletJSON {
34
+ return {
35
+ kind: "ListingPerWallet",
36
+ value: {
37
+ config: this.value.config.toJSON(),
38
+ },
39
+ }
40
+ }
41
+
42
+ toEncodable() {
43
+ return {
44
+ ListingPerWallet: {
45
+ config: types.ListingPerWalletArgs.toEncodable(this.value.config),
46
+ },
47
+ }
48
+ }
49
+ }
50
+
51
+ export type AllowedCurrencyFields = {
52
+ config: types.CurrencyTypeKind
53
+ }
54
+ export type AllowedCurrencyValue = {
55
+ config: types.CurrencyTypeKind
56
+ }
57
+
58
+ export interface AllowedCurrencyJSON {
59
+ kind: "AllowedCurrency"
60
+ value: {
61
+ config: types.CurrencyTypeJSON
62
+ }
63
+ }
64
+
65
+ export class AllowedCurrency {
66
+ static readonly discriminator = 1
67
+ static readonly kind = "AllowedCurrency"
68
+ readonly discriminator = 1
69
+ readonly kind = "AllowedCurrency"
70
+ readonly value: AllowedCurrencyValue
71
+
72
+ constructor(value: AllowedCurrencyFields) {
73
+ this.value = {
74
+ config: value.config,
75
+ }
76
+ }
77
+
78
+ toJSON(): AllowedCurrencyJSON {
79
+ return {
80
+ kind: "AllowedCurrency",
81
+ value: {
82
+ config: this.value.config.toJSON(),
83
+ },
84
+ }
85
+ }
86
+
87
+ toEncodable() {
88
+ return {
89
+ AllowedCurrency: {
90
+ config: this.value.config.toEncodable(),
91
+ },
92
+ }
93
+ }
94
+ }
95
+
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
+ export function fromDecoded(obj: any): types.StoreRuleKind {
98
+ if (typeof obj !== "object") {
99
+ throw new Error("Invalid enum object")
100
+ }
101
+
102
+ if ("ListingPerWallet" in obj) {
103
+ const val = obj["ListingPerWallet"]
104
+ return new ListingPerWallet({
105
+ config: types.ListingPerWalletArgs.fromDecoded(val["config"]),
106
+ })
107
+ }
108
+ if ("AllowedCurrency" in obj) {
109
+ const val = obj["AllowedCurrency"]
110
+ return new AllowedCurrency({
111
+ config: types.CurrencyType.fromDecoded(val["config"]),
112
+ })
113
+ }
114
+
115
+ throw new Error("Invalid enum object")
116
+ }
117
+
118
+ export function fromJSON(obj: types.StoreRuleJSON): types.StoreRuleKind {
119
+ switch (obj.kind) {
120
+ case "ListingPerWallet": {
121
+ return new ListingPerWallet({
122
+ config: types.ListingPerWalletArgs.fromJSON(obj.value.config),
123
+ })
124
+ }
125
+ case "AllowedCurrency": {
126
+ return new AllowedCurrency({
127
+ config: types.CurrencyType.fromJSON(obj.value.config),
128
+ })
129
+ }
130
+ }
131
+ }
132
+
133
+ export function layout(property?: string) {
134
+ const ret = borsh.rustEnum([
135
+ borsh.struct(
136
+ [types.ListingPerWalletArgs.layout("config")],
137
+ "ListingPerWallet"
138
+ ),
139
+ borsh.struct([types.CurrencyType.layout("config")], "AllowedCurrency"),
140
+ ])
141
+ if (property !== undefined) {
142
+ return ret.replicate(property)
143
+ }
144
+ return ret
145
+ }
@@ -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 SuperCategoryFields {
7
+ cat1: number
8
+ cat2: number
9
+ }
10
+
11
+ export interface SuperCategoryJSON {
12
+ cat1: number
13
+ cat2: number
14
+ }
15
+
16
+ export class SuperCategory {
17
+ readonly cat1: number
18
+ readonly cat2: number
19
+
20
+ constructor(fields: SuperCategoryFields) {
21
+ this.cat1 = fields.cat1
22
+ this.cat2 = fields.cat2
23
+ }
24
+
25
+ static layout(property?: string) {
26
+ return borsh.struct([borsh.u8("cat1"), borsh.u8("cat2")], property)
27
+ }
28
+
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ static fromDecoded(obj: any) {
31
+ return new SuperCategory({
32
+ cat1: obj.cat1,
33
+ cat2: obj.cat2,
34
+ })
35
+ }
36
+
37
+ static toEncodable(fields: SuperCategoryFields) {
38
+ return {
39
+ cat1: fields.cat1,
40
+ cat2: fields.cat2,
41
+ }
42
+ }
43
+
44
+ toJSON(): SuperCategoryJSON {
45
+ return {
46
+ cat1: this.cat1,
47
+ cat2: this.cat2,
48
+ }
49
+ }
50
+
51
+ static fromJSON(obj: SuperCategoryJSON): SuperCategory {
52
+ return new SuperCategory({
53
+ cat1: obj.cat1,
54
+ cat2: obj.cat2,
55
+ })
56
+ }
57
+
58
+ toEncodable() {
59
+ return SuperCategory.toEncodable(this)
60
+ }
61
+ }
@@ -0,0 +1,120 @@
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 TightCardMetadataFields {
7
+ traitHash: BN
8
+ name: string
9
+ arweave: string
10
+ royalty: number
11
+ chunkSize: number
12
+ creators: Array<types.ShortCreatorFields>
13
+ uploader: PublicKey | null
14
+ }
15
+
16
+ export interface TightCardMetadataJSON {
17
+ traitHash: string
18
+ name: string
19
+ arweave: string
20
+ royalty: number
21
+ chunkSize: number
22
+ creators: Array<types.ShortCreatorJSON>
23
+ uploader: string | null
24
+ }
25
+
26
+ export class TightCardMetadata {
27
+ readonly traitHash: BN
28
+ readonly name: string
29
+ readonly arweave: string
30
+ readonly royalty: number
31
+ readonly chunkSize: number
32
+ readonly creators: Array<types.ShortCreator>
33
+ readonly uploader: PublicKey | null
34
+
35
+ constructor(fields: TightCardMetadataFields) {
36
+ this.traitHash = fields.traitHash
37
+ this.name = fields.name
38
+ this.arweave = fields.arweave
39
+ this.royalty = fields.royalty
40
+ this.chunkSize = fields.chunkSize
41
+ this.creators = fields.creators.map(
42
+ (item) => new types.ShortCreator({ ...item })
43
+ )
44
+ this.uploader = fields.uploader
45
+ }
46
+
47
+ static layout(property?: string) {
48
+ return borsh.struct(
49
+ [
50
+ borsh.u64("traitHash"),
51
+ borsh.str("name"),
52
+ borsh.str("arweave"),
53
+ borsh.u16("royalty"),
54
+ borsh.u8("chunkSize"),
55
+ borsh.vec(types.ShortCreator.layout(), "creators"),
56
+ borsh.option(borsh.publicKey(), "uploader"),
57
+ ],
58
+ property
59
+ )
60
+ }
61
+
62
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ static fromDecoded(obj: any) {
64
+ return new TightCardMetadata({
65
+ traitHash: obj.traitHash,
66
+ name: obj.name,
67
+ arweave: obj.arweave,
68
+ royalty: obj.royalty,
69
+ chunkSize: obj.chunkSize,
70
+ creators: obj.creators.map(
71
+ (
72
+ item: any /* eslint-disable-line @typescript-eslint/no-explicit-any */
73
+ ) => types.ShortCreator.fromDecoded(item)
74
+ ),
75
+ uploader: obj.uploader,
76
+ })
77
+ }
78
+
79
+ static toEncodable(fields: TightCardMetadataFields) {
80
+ return {
81
+ traitHash: fields.traitHash,
82
+ name: fields.name,
83
+ arweave: fields.arweave,
84
+ royalty: fields.royalty,
85
+ chunkSize: fields.chunkSize,
86
+ creators: fields.creators.map((item) =>
87
+ types.ShortCreator.toEncodable(item)
88
+ ),
89
+ uploader: fields.uploader,
90
+ }
91
+ }
92
+
93
+ toJSON(): TightCardMetadataJSON {
94
+ return {
95
+ traitHash: this.traitHash.toString(),
96
+ name: this.name,
97
+ arweave: this.arweave,
98
+ royalty: this.royalty,
99
+ chunkSize: this.chunkSize,
100
+ creators: this.creators.map((item) => item.toJSON()),
101
+ uploader: (this.uploader && this.uploader.toString()) || null,
102
+ }
103
+ }
104
+
105
+ static fromJSON(obj: TightCardMetadataJSON): TightCardMetadata {
106
+ return new TightCardMetadata({
107
+ traitHash: new BN(obj.traitHash),
108
+ name: obj.name,
109
+ arweave: obj.arweave,
110
+ royalty: obj.royalty,
111
+ chunkSize: obj.chunkSize,
112
+ creators: obj.creators.map((item) => types.ShortCreator.fromJSON(item)),
113
+ uploader: (obj.uploader && new PublicKey(obj.uploader)) || null,
114
+ })
115
+ }
116
+
117
+ toEncodable() {
118
+ return TightCardMetadata.toEncodable(this)
119
+ }
120
+ }
@@ -0,0 +1,120 @@
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 BetweenHoursJSON {
7
+ kind: "BetweenHours"
8
+ }
9
+
10
+ export class BetweenHours {
11
+ static readonly discriminator = 0
12
+ static readonly kind = "BetweenHours"
13
+ readonly discriminator = 0
14
+ readonly kind = "BetweenHours"
15
+
16
+ toJSON(): BetweenHoursJSON {
17
+ return {
18
+ kind: "BetweenHours",
19
+ }
20
+ }
21
+
22
+ toEncodable() {
23
+ return {
24
+ BetweenHours: {},
25
+ }
26
+ }
27
+ }
28
+
29
+ export interface BetweenDaysJSON {
30
+ kind: "BetweenDays"
31
+ }
32
+
33
+ export class BetweenDays {
34
+ static readonly discriminator = 1
35
+ static readonly kind = "BetweenDays"
36
+ readonly discriminator = 1
37
+ readonly kind = "BetweenDays"
38
+
39
+ toJSON(): BetweenDaysJSON {
40
+ return {
41
+ kind: "BetweenDays",
42
+ }
43
+ }
44
+
45
+ toEncodable() {
46
+ return {
47
+ BetweenDays: {},
48
+ }
49
+ }
50
+ }
51
+
52
+ export interface BetweenHoursNegateJSON {
53
+ kind: "BetweenHoursNegate"
54
+ }
55
+
56
+ export class BetweenHoursNegate {
57
+ static readonly discriminator = 2
58
+ static readonly kind = "BetweenHoursNegate"
59
+ readonly discriminator = 2
60
+ readonly kind = "BetweenHoursNegate"
61
+
62
+ toJSON(): BetweenHoursNegateJSON {
63
+ return {
64
+ kind: "BetweenHoursNegate",
65
+ }
66
+ }
67
+
68
+ toEncodable() {
69
+ return {
70
+ BetweenHoursNegate: {},
71
+ }
72
+ }
73
+ }
74
+
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ export function fromDecoded(obj: any): types.TimeRangeTypeKind {
77
+ if (typeof obj !== "object") {
78
+ throw new Error("Invalid enum object")
79
+ }
80
+
81
+ if ("BetweenHours" in obj) {
82
+ return new BetweenHours()
83
+ }
84
+ if ("BetweenDays" in obj) {
85
+ return new BetweenDays()
86
+ }
87
+ if ("BetweenHoursNegate" in obj) {
88
+ return new BetweenHoursNegate()
89
+ }
90
+
91
+ throw new Error("Invalid enum object")
92
+ }
93
+
94
+ export function fromJSON(
95
+ obj: types.TimeRangeTypeJSON
96
+ ): types.TimeRangeTypeKind {
97
+ switch (obj.kind) {
98
+ case "BetweenHours": {
99
+ return new BetweenHours()
100
+ }
101
+ case "BetweenDays": {
102
+ return new BetweenDays()
103
+ }
104
+ case "BetweenHoursNegate": {
105
+ return new BetweenHoursNegate()
106
+ }
107
+ }
108
+ }
109
+
110
+ export function layout(property?: string) {
111
+ const ret = borsh.rustEnum([
112
+ borsh.struct([], "BetweenHours"),
113
+ borsh.struct([], "BetweenDays"),
114
+ borsh.struct([], "BetweenHoursNegate"),
115
+ ])
116
+ if (property !== undefined) {
117
+ return ret.replicate(property)
118
+ }
119
+ return ret
120
+ }
@@ -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 TimedPerWalletArgsFields {
7
+ amount: number
8
+ }
9
+
10
+ export interface TimedPerWalletArgsJSON {
11
+ amount: number
12
+ }
13
+
14
+ export class TimedPerWalletArgs {
15
+ readonly amount: number
16
+
17
+ constructor(fields: TimedPerWalletArgsFields) {
18
+ this.amount = fields.amount
19
+ }
20
+
21
+ static layout(property?: string) {
22
+ return borsh.struct([borsh.u16("amount")], property)
23
+ }
24
+
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ static fromDecoded(obj: any) {
27
+ return new TimedPerWalletArgs({
28
+ amount: obj.amount,
29
+ })
30
+ }
31
+
32
+ static toEncodable(fields: TimedPerWalletArgsFields) {
33
+ return {
34
+ amount: fields.amount,
35
+ }
36
+ }
37
+
38
+ toJSON(): TimedPerWalletArgsJSON {
39
+ return {
40
+ amount: this.amount,
41
+ }
42
+ }
43
+
44
+ static fromJSON(obj: TimedPerWalletArgsJSON): TimedPerWalletArgs {
45
+ return new TimedPerWalletArgs({
46
+ amount: obj.amount,
47
+ })
48
+ }
49
+
50
+ toEncodable() {
51
+ return TimedPerWalletArgs.toEncodable(this)
52
+ }
53
+ }