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,94 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface RegisterGenericUserArgs {
8
+ username: string
9
+ subApp: BN
10
+ subWallet: PublicKey
11
+ category: BN
12
+ lut: PublicKey | null
13
+ genericData: Array<types.GenericStoreFields> | null
14
+ arweave: string | null
15
+ cnft: types.CompactCnftDataFields | null
16
+ }
17
+
18
+ export interface RegisterGenericUserAccounts {
19
+ genericUser: PublicKey
20
+ storeAccount: PublicKey
21
+ profileHolder: PublicKey
22
+ categoryHolder: PublicKey
23
+ oldCategoryHolder: PublicKey
24
+ payer: PublicKey
25
+ merkleTree: PublicKey
26
+ treeAuthority: PublicKey
27
+ merkleManager: PublicKey
28
+ logWrapper: PublicKey
29
+ bubblegumProgram: PublicKey
30
+ compressionProgram: PublicKey
31
+ tokenMetadataProgram: PublicKey
32
+ systemProgram: PublicKey
33
+ }
34
+
35
+ export const layout = borsh.struct([
36
+ borsh.str("username"),
37
+ borsh.u64("subApp"),
38
+ borsh.publicKey("subWallet"),
39
+ borsh.u64("category"),
40
+ borsh.option(borsh.publicKey(), "lut"),
41
+ borsh.option(borsh.vec(types.GenericStore.layout()), "genericData"),
42
+ borsh.option(borsh.str(), "arweave"),
43
+ borsh.option(types.CompactCnftData.layout(), "cnft"),
44
+ ])
45
+
46
+ export function registerGenericUser(
47
+ args: RegisterGenericUserArgs,
48
+ accounts: RegisterGenericUserAccounts,
49
+ programId: PublicKey = PROGRAM_ID
50
+ ) {
51
+ const keys: Array<AccountMeta> = [
52
+ { pubkey: accounts.genericUser, isSigner: false, isWritable: true },
53
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: false },
54
+ { pubkey: accounts.profileHolder, isSigner: false, isWritable: true },
55
+ { pubkey: accounts.categoryHolder, isSigner: false, isWritable: true },
56
+ { pubkey: accounts.oldCategoryHolder, isSigner: false, isWritable: true },
57
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
58
+ { pubkey: accounts.merkleTree, isSigner: false, isWritable: true },
59
+ { pubkey: accounts.treeAuthority, isSigner: false, isWritable: true },
60
+ { pubkey: accounts.merkleManager, isSigner: false, isWritable: true },
61
+ { pubkey: accounts.logWrapper, isSigner: false, isWritable: false },
62
+ { pubkey: accounts.bubblegumProgram, isSigner: false, isWritable: false },
63
+ { pubkey: accounts.compressionProgram, isSigner: false, isWritable: false },
64
+ {
65
+ pubkey: accounts.tokenMetadataProgram,
66
+ isSigner: false,
67
+ isWritable: false,
68
+ },
69
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
70
+ ]
71
+ const identifier = Buffer.from([88, 117, 40, 186, 159, 251, 166, 17])
72
+ const buffer = Buffer.alloc(1000)
73
+ const len = layout.encode(
74
+ {
75
+ username: args.username,
76
+ subApp: args.subApp,
77
+ subWallet: args.subWallet,
78
+ category: args.category,
79
+ lut: args.lut,
80
+ genericData:
81
+ (args.genericData &&
82
+ args.genericData.map((item) =>
83
+ types.GenericStore.toEncodable(item)
84
+ )) ||
85
+ null,
86
+ arweave: args.arweave,
87
+ cnft: (args.cnft && types.CompactCnftData.toEncodable(args.cnft)) || null,
88
+ },
89
+ buffer
90
+ )
91
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
92
+ const ix = new TransactionInstruction({ keys, programId, data })
93
+ return ix
94
+ }
@@ -0,0 +1,44 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface RegisterPackUploadsArgs {
8
+ arweave: string | null
9
+ }
10
+
11
+ export interface RegisterPackUploadsAccounts {
12
+ packAccount: PublicKey
13
+ packUploads: PublicKey
14
+ newPackUploads: PublicKey
15
+ payer: PublicKey
16
+ systemProgram: PublicKey
17
+ }
18
+
19
+ export const layout = borsh.struct([borsh.option(borsh.str(), "arweave")])
20
+
21
+ export function registerPackUploads(
22
+ args: RegisterPackUploadsArgs,
23
+ accounts: RegisterPackUploadsAccounts,
24
+ programId: PublicKey = PROGRAM_ID
25
+ ) {
26
+ const keys: Array<AccountMeta> = [
27
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: false },
28
+ { pubkey: accounts.packUploads, isSigner: false, isWritable: true },
29
+ { pubkey: accounts.newPackUploads, isSigner: false, isWritable: true },
30
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
31
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
32
+ ]
33
+ const identifier = Buffer.from([80, 187, 217, 185, 19, 245, 172, 5])
34
+ const buffer = Buffer.alloc(1000)
35
+ const len = layout.encode(
36
+ {
37
+ arweave: args.arweave,
38
+ },
39
+ buffer
40
+ )
41
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
42
+ const ix = new TransactionInstruction({ keys, programId, data })
43
+ return ix
44
+ }
@@ -0,0 +1,42 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface RegisterTraitsArgs {
8
+ traits: Array<string>
9
+ }
10
+
11
+ export interface RegisterTraitsAccounts {
12
+ packAccount: PublicKey
13
+ packTraitsRegistry: PublicKey
14
+ payer: PublicKey
15
+ systemProgram: PublicKey
16
+ }
17
+
18
+ export const layout = borsh.struct([borsh.vec(borsh.str(), "traits")])
19
+
20
+ export function registerTraits(
21
+ args: RegisterTraitsArgs,
22
+ accounts: RegisterTraitsAccounts,
23
+ programId: PublicKey = PROGRAM_ID
24
+ ) {
25
+ const keys: Array<AccountMeta> = [
26
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
27
+ { pubkey: accounts.packTraitsRegistry, isSigner: false, isWritable: true },
28
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
29
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
30
+ ]
31
+ const identifier = Buffer.from([74, 33, 255, 80, 173, 251, 200, 233])
32
+ const buffer = Buffer.alloc(1000)
33
+ const len = layout.encode(
34
+ {
35
+ traits: args.traits,
36
+ },
37
+ buffer
38
+ )
39
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
40
+ const ix = new TransactionInstruction({ keys, programId, data })
41
+ return ix
42
+ }
@@ -0,0 +1,50 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface RegisterUserArgs {
8
+ username: string
9
+ sub: PublicKey
10
+ lut: PublicKey
11
+ }
12
+
13
+ export interface RegisterUserAccounts {
14
+ threeId: PublicKey
15
+ storeAccount: PublicKey
16
+ payer: PublicKey
17
+ systemProgram: PublicKey
18
+ }
19
+
20
+ export const layout = borsh.struct([
21
+ borsh.str("username"),
22
+ borsh.publicKey("sub"),
23
+ borsh.publicKey("lut"),
24
+ ])
25
+
26
+ export function registerUser(
27
+ args: RegisterUserArgs,
28
+ accounts: RegisterUserAccounts,
29
+ programId: PublicKey = PROGRAM_ID
30
+ ) {
31
+ const keys: Array<AccountMeta> = [
32
+ { pubkey: accounts.threeId, isSigner: false, isWritable: true },
33
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: false },
34
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
35
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
36
+ ]
37
+ const identifier = Buffer.from([2, 241, 150, 223, 99, 214, 116, 97])
38
+ const buffer = Buffer.alloc(1000)
39
+ const len = layout.encode(
40
+ {
41
+ username: args.username,
42
+ sub: args.sub,
43
+ lut: args.lut,
44
+ },
45
+ buffer
46
+ )
47
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
48
+ const ix = new TransactionInstruction({ keys, programId, data })
49
+ return ix
50
+ }
@@ -0,0 +1,44 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface StoreLutForArgs {
8
+ forKey: PublicKey
9
+ id: string
10
+ }
11
+
12
+ export interface StoreLutForAccounts {
13
+ lutAccount: PublicKey
14
+ vaultAccount: PublicKey
15
+ payer: PublicKey
16
+ systemProgram: PublicKey
17
+ }
18
+
19
+ export const layout = borsh.struct([borsh.publicKey("forKey"), borsh.str("id")])
20
+
21
+ export function storeLutFor(
22
+ args: StoreLutForArgs,
23
+ accounts: StoreLutForAccounts,
24
+ programId: PublicKey = PROGRAM_ID
25
+ ) {
26
+ const keys: Array<AccountMeta> = [
27
+ { pubkey: accounts.lutAccount, isSigner: false, isWritable: false },
28
+ { pubkey: accounts.vaultAccount, isSigner: false, isWritable: true },
29
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
30
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
31
+ ]
32
+ const identifier = Buffer.from([211, 207, 87, 134, 241, 224, 30, 70])
33
+ const buffer = Buffer.alloc(1000)
34
+ const len = layout.encode(
35
+ {
36
+ forKey: args.forKey,
37
+ id: args.id,
38
+ },
39
+ buffer
40
+ )
41
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
42
+ const ix = new TransactionInstruction({ keys, programId, data })
43
+ return ix
44
+ }
@@ -0,0 +1,56 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UnwrapAndDestroyArgs {
8
+ metadata: types.UnwrapMetadataFields
9
+ }
10
+
11
+ export interface UnwrapAndDestroyAccounts {
12
+ itemAccount: PublicKey
13
+ packAccount: PublicKey
14
+ /** CHECK */
15
+ currency: PublicKey
16
+ /** CHECK */
17
+ splVaultFrom: PublicKey
18
+ /** CHECK */
19
+ splVaultTo: PublicKey
20
+ /** CHECK */
21
+ merkleTree: PublicKey
22
+ owner: PublicKey
23
+ tokenProgram: PublicKey
24
+ systemProgram: PublicKey
25
+ }
26
+
27
+ export const layout = borsh.struct([types.UnwrapMetadata.layout("metadata")])
28
+
29
+ export function unwrapAndDestroy(
30
+ args: UnwrapAndDestroyArgs,
31
+ accounts: UnwrapAndDestroyAccounts,
32
+ programId: PublicKey = PROGRAM_ID
33
+ ) {
34
+ const keys: Array<AccountMeta> = [
35
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: true },
36
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
37
+ { pubkey: accounts.currency, isSigner: false, isWritable: false },
38
+ { pubkey: accounts.splVaultFrom, isSigner: false, isWritable: true },
39
+ { pubkey: accounts.splVaultTo, isSigner: false, isWritable: true },
40
+ { pubkey: accounts.merkleTree, isSigner: false, isWritable: false },
41
+ { pubkey: accounts.owner, isSigner: true, isWritable: false },
42
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
43
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
44
+ ]
45
+ const identifier = Buffer.from([228, 12, 214, 168, 124, 166, 135, 250])
46
+ const buffer = Buffer.alloc(1000)
47
+ const len = layout.encode(
48
+ {
49
+ metadata: types.UnwrapMetadata.toEncodable(args.metadata),
50
+ },
51
+ buffer
52
+ )
53
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
54
+ const ix = new TransactionInstruction({ keys, programId, data })
55
+ return ix
56
+ }
@@ -0,0 +1,54 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UpdateCardArgs {
8
+ supply: number | null
9
+ metadata: types.MetadataArgsFields | null
10
+ state: types.CardStateKind | null
11
+ }
12
+
13
+ export interface UpdateCardAccounts {
14
+ packAccount: PublicKey
15
+ cardAccount: PublicKey
16
+ packContent: PublicKey
17
+ creator: PublicKey
18
+ systemProgram: PublicKey
19
+ }
20
+
21
+ export const layout = borsh.struct([
22
+ borsh.option(borsh.u32(), "supply"),
23
+ borsh.option(types.MetadataArgs.layout(), "metadata"),
24
+ borsh.option(types.CardState.layout(), "state"),
25
+ ])
26
+
27
+ export function updateCard(
28
+ args: UpdateCardArgs,
29
+ accounts: UpdateCardAccounts,
30
+ programId: PublicKey = PROGRAM_ID
31
+ ) {
32
+ const keys: Array<AccountMeta> = [
33
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
34
+ { pubkey: accounts.cardAccount, isSigner: false, isWritable: true },
35
+ { pubkey: accounts.packContent, isSigner: false, isWritable: true },
36
+ { pubkey: accounts.creator, isSigner: true, isWritable: true },
37
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
38
+ ]
39
+ const identifier = Buffer.from([216, 82, 240, 120, 78, 100, 66, 33])
40
+ const buffer = Buffer.alloc(1000)
41
+ const len = layout.encode(
42
+ {
43
+ supply: args.supply,
44
+ metadata:
45
+ (args.metadata && types.MetadataArgs.toEncodable(args.metadata)) ||
46
+ null,
47
+ state: (args.state && args.state.toEncodable()) || null,
48
+ },
49
+ buffer
50
+ )
51
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
52
+ const ix = new TransactionInstruction({ keys, programId, data })
53
+ return ix
54
+ }
@@ -0,0 +1,71 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UpdatePackArgs {
8
+ supply: BN | null
9
+ metadata: types.MetadataArgsFields | null
10
+ saleConfig: types.SaleConfigFields | null
11
+ state: types.ItemStateKind | null
12
+ category: Array<number> | null
13
+ packConfig: types.PackConfigFields | null
14
+ }
15
+
16
+ export interface UpdatePackAccounts {
17
+ storeAccount: PublicKey
18
+ packAccount: PublicKey
19
+ packContent: PublicKey
20
+ packReserveList: PublicKey
21
+ prevCreatorRegistry: PublicKey
22
+ creator: PublicKey
23
+ systemProgram: PublicKey
24
+ }
25
+
26
+ export const layout = borsh.struct([
27
+ borsh.option(borsh.u64(), "supply"),
28
+ borsh.option(types.MetadataArgs.layout(), "metadata"),
29
+ borsh.option(types.SaleConfig.layout(), "saleConfig"),
30
+ borsh.option(types.ItemState.layout(), "state"),
31
+ borsh.option(borsh.array(borsh.u16(), 3), "category"),
32
+ borsh.option(types.PackConfig.layout(), "packConfig"),
33
+ ])
34
+
35
+ export function updatePack(
36
+ args: UpdatePackArgs,
37
+ accounts: UpdatePackAccounts,
38
+ programId: PublicKey = PROGRAM_ID
39
+ ) {
40
+ const keys: Array<AccountMeta> = [
41
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
42
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
43
+ { pubkey: accounts.packContent, isSigner: false, isWritable: false },
44
+ { pubkey: accounts.packReserveList, isSigner: false, isWritable: true },
45
+ { pubkey: accounts.prevCreatorRegistry, isSigner: false, isWritable: true },
46
+ { pubkey: accounts.creator, isSigner: true, isWritable: true },
47
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
48
+ ]
49
+ const identifier = Buffer.from([71, 204, 227, 31, 168, 43, 152, 234])
50
+ const buffer = Buffer.alloc(1000)
51
+ const len = layout.encode(
52
+ {
53
+ supply: args.supply,
54
+ metadata:
55
+ (args.metadata && types.MetadataArgs.toEncodable(args.metadata)) ||
56
+ null,
57
+ saleConfig:
58
+ (args.saleConfig && types.SaleConfig.toEncodable(args.saleConfig)) ||
59
+ null,
60
+ state: (args.state && args.state.toEncodable()) || null,
61
+ category: args.category,
62
+ packConfig:
63
+ (args.packConfig && types.PackConfig.toEncodable(args.packConfig)) ||
64
+ null,
65
+ },
66
+ buffer
67
+ )
68
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
69
+ const ix = new TransactionInstruction({ keys, programId, data })
70
+ return ix
71
+ }
@@ -0,0 +1,64 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UpdateSingleArgs {
8
+ supply: BN | null
9
+ metadata: types.MetadataArgsFields | null
10
+ saleConfig: types.SaleConfigFields | null
11
+ state: types.ItemStateKind | null
12
+ category: Array<number> | null
13
+ }
14
+
15
+ export interface UpdateSingleAccounts {
16
+ storeAccount: PublicKey
17
+ itemAccount: PublicKey
18
+ itemReserveList: PublicKey
19
+ prevCreatorRegistry: PublicKey
20
+ creator: PublicKey
21
+ systemProgram: PublicKey
22
+ }
23
+
24
+ export const layout = borsh.struct([
25
+ borsh.option(borsh.u64(), "supply"),
26
+ borsh.option(types.MetadataArgs.layout(), "metadata"),
27
+ borsh.option(types.SaleConfig.layout(), "saleConfig"),
28
+ borsh.option(types.ItemState.layout(), "state"),
29
+ borsh.option(borsh.array(borsh.u16(), 3), "category"),
30
+ ])
31
+
32
+ export function updateSingle(
33
+ args: UpdateSingleArgs,
34
+ accounts: UpdateSingleAccounts,
35
+ programId: PublicKey = PROGRAM_ID
36
+ ) {
37
+ const keys: Array<AccountMeta> = [
38
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
39
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: true },
40
+ { pubkey: accounts.itemReserveList, isSigner: false, isWritable: true },
41
+ { pubkey: accounts.prevCreatorRegistry, isSigner: false, isWritable: true },
42
+ { pubkey: accounts.creator, isSigner: true, isWritable: true },
43
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
44
+ ]
45
+ const identifier = Buffer.from([106, 229, 174, 154, 252, 16, 158, 144])
46
+ const buffer = Buffer.alloc(1000)
47
+ const len = layout.encode(
48
+ {
49
+ supply: args.supply,
50
+ metadata:
51
+ (args.metadata && types.MetadataArgs.toEncodable(args.metadata)) ||
52
+ null,
53
+ saleConfig:
54
+ (args.saleConfig && types.SaleConfig.toEncodable(args.saleConfig)) ||
55
+ null,
56
+ state: (args.state && args.state.toEncodable()) || null,
57
+ category: args.category,
58
+ },
59
+ buffer
60
+ )
61
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
62
+ const ix = new TransactionInstruction({ keys, programId, data })
63
+ return ix
64
+ }
@@ -0,0 +1,47 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface UpdateStoreArgs {
8
+ name: string
9
+ storeConfig: types.StoreConfigFields
10
+ }
11
+
12
+ export interface UpdateStoreAccounts {
13
+ holderAccount: PublicKey
14
+ storeAccount: PublicKey
15
+ creator: PublicKey
16
+ systemProgram: PublicKey
17
+ }
18
+
19
+ export const layout = borsh.struct([
20
+ borsh.str("name"),
21
+ types.StoreConfig.layout("storeConfig"),
22
+ ])
23
+
24
+ export function updateStore(
25
+ args: UpdateStoreArgs,
26
+ accounts: UpdateStoreAccounts,
27
+ programId: PublicKey = PROGRAM_ID
28
+ ) {
29
+ const keys: Array<AccountMeta> = [
30
+ { pubkey: accounts.holderAccount, isSigner: false, isWritable: true },
31
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
32
+ { pubkey: accounts.creator, isSigner: true, isWritable: true },
33
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
34
+ ]
35
+ const identifier = Buffer.from([169, 49, 137, 251, 233, 234, 172, 103])
36
+ const buffer = Buffer.alloc(1000)
37
+ const len = layout.encode(
38
+ {
39
+ name: args.name,
40
+ storeConfig: types.StoreConfig.toEncodable(args.storeConfig),
41
+ },
42
+ buffer
43
+ )
44
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
45
+ const ix = new TransactionInstruction({ keys, programId, data })
46
+ return ix
47
+ }
@@ -0,0 +1,26 @@
1
+ import { TransactionInstruction, PublicKey, AccountMeta } 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 borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars
4
+ import * as types from "../types" // eslint-disable-line @typescript-eslint/no-unused-vars
5
+ import { PROGRAM_ID } from "../programId"
6
+
7
+ export interface WithdrawFromStoreAccounts {
8
+ storeAccount: PublicKey
9
+ creator: PublicKey
10
+ systemProgram: PublicKey
11
+ }
12
+
13
+ export function withdrawFromStore(
14
+ accounts: WithdrawFromStoreAccounts,
15
+ programId: PublicKey = PROGRAM_ID
16
+ ) {
17
+ const keys: Array<AccountMeta> = [
18
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
19
+ { pubkey: accounts.creator, isSigner: true, isWritable: true },
20
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
21
+ ]
22
+ const identifier = Buffer.from([210, 94, 98, 179, 211, 206, 143, 252])
23
+ const data = identifier
24
+ const ix = new TransactionInstruction({ keys, programId, data })
25
+ return ix
26
+ }
@@ -0,0 +1,42 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import { toPublicKey } from "../utility/PdaManager";
3
+
4
+ // Program ID defined in the provided IDL. Do not edit, it will get overwritten.
5
+ export const PROGRAM_ID_IDL = new PublicKey(
6
+ "HgtiJuEcdN6bN6WyYpamL3QKpyMcF8g8FxutDQNB96J9"
7
+ );
8
+
9
+ // This constant will not get overwritten on subsequent code generations and it's safe to modify it's value.
10
+ export const PROGRAM_ID: PublicKey = PROGRAM_ID_IDL;
11
+
12
+ export const BUBBLEGUM_PROGRAM_ID = toPublicKey(
13
+ "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
14
+ );
15
+
16
+ export const DEVNET_PROGRAM_ID = toPublicKey(
17
+ "GyPCu89S63P9NcCQAtuSJesiefhhgpGWrNVJs4bF2cSK"
18
+ );
19
+
20
+ export const PROGRAM_CNFT = toPublicKey(
21
+ "HgtiJuEcdN6bN6WyYpamL3QKpyMcF8g8FxutDQNB96J9"
22
+ );
23
+ export const TOKEN_METADATA_PROGRAM_ID = toPublicKey(
24
+ "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
25
+ );
26
+ export const TOKEN_PROGRAM_ID = toPublicKey(
27
+ "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
28
+ );
29
+ export const SPL_ACCOUNT_COMPRESSION_PROGRAM_ID = toPublicKey(
30
+ "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
31
+ );
32
+ export const SPL_NOOP_PROGRAM_ID = toPublicKey(
33
+ "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
34
+ );
35
+ export const PROGRAM_CLAIMZ = toPublicKey(
36
+ "52zRX47uXYzpYDmW4PVQTnxjrNhYaCsVEauXm8xF9ARq"
37
+ );
38
+
39
+ export const SPL_ASSOCIATED_TOKEN_ACCOUNT_PROGRAM_ID = toPublicKey(
40
+ "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
41
+ );
42
+ export const SOLANA_ENDPOINT = "https://api.devnet.solana.com";