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,59 @@
1
+ import { PublicKey } from "@solana/web3.js"
2
+ import { PROGRAM_ID } from "../programId"
3
+ import * as anchor from "./anchor"
4
+
5
+ export function fromCode(
6
+ code: number,
7
+ logs?: string[]
8
+ ): anchor.AnchorError | null {
9
+ return anchor.fromCode(code, logs)
10
+ }
11
+
12
+ function hasOwnProperty<X extends object, Y extends PropertyKey>(
13
+ obj: X,
14
+ prop: Y
15
+ ): obj is X & Record<Y, unknown> {
16
+ return Object.hasOwnProperty.call(obj, prop)
17
+ }
18
+
19
+ const errorRe = /Program (\w+) failed: custom program error: (\w+)/
20
+
21
+ export function fromTxError(
22
+ err: unknown,
23
+ programId: PublicKey = PROGRAM_ID
24
+ ): anchor.AnchorError | null {
25
+ if (
26
+ typeof err !== "object" ||
27
+ err === null ||
28
+ !hasOwnProperty(err, "logs") ||
29
+ !Array.isArray(err.logs)
30
+ ) {
31
+ return null
32
+ }
33
+
34
+ let firstMatch: RegExpExecArray | null = null
35
+ for (const logLine of err.logs) {
36
+ firstMatch = errorRe.exec(logLine)
37
+ if (firstMatch !== null) {
38
+ break
39
+ }
40
+ }
41
+
42
+ if (firstMatch === null) {
43
+ return null
44
+ }
45
+
46
+ const [programIdRaw, codeRaw] = firstMatch.slice(1)
47
+ if (programIdRaw !== programId.toString()) {
48
+ return null
49
+ }
50
+
51
+ let errorCode: number
52
+ try {
53
+ errorCode = parseInt(codeRaw, 16)
54
+ } catch (parseErr) {
55
+ return null
56
+ }
57
+
58
+ return fromCode(errorCode, err.logs)
59
+ }
@@ -0,0 +1,27 @@
1
+ export interface StoreInitOptions {
2
+ // Make walletPath optional
3
+ walletPath?: string;
4
+ // Add privateKey option - can be array of numbers, Uint8Array, or base58 string
5
+ privateKey?: number[] | Uint8Array | string;
6
+ }
7
+ export interface CreateStoreParams {
8
+ storeName: string;
9
+ storeFee: number;
10
+ }
11
+
12
+ export interface CreateCollectionOptions {
13
+ collectionSymbol: string;
14
+ collectionName: string;
15
+ collectionDescription: string;
16
+ }
17
+
18
+ export interface CreateSingleOptions {
19
+ itemName: string;
20
+ sellerFee: number;
21
+ itemSymbol: string;
22
+ itemDescription: string;
23
+ traits: any;
24
+ price: number;
25
+ mainImageUrl?: string;
26
+ coverImageUrl?: string;
27
+ }
@@ -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 AddBurnArgs {
8
+ metadata: types.MetadataArgsFields
9
+ randomBase: number
10
+ }
11
+
12
+ export interface AddBurnAccounts {
13
+ burnProgress: PublicKey
14
+ reserveList: PublicKey
15
+ itemAccount: PublicKey
16
+ packAccount: PublicKey
17
+ /** CHECK */
18
+ owner: PublicKey
19
+ payer: PublicKey
20
+ bubblegumProgram: PublicKey
21
+ systemProgram: PublicKey
22
+ }
23
+
24
+ export const layout = borsh.struct([
25
+ types.MetadataArgs.layout("metadata"),
26
+ borsh.u32("randomBase"),
27
+ ])
28
+
29
+ export function addBurn(
30
+ args: AddBurnArgs,
31
+ accounts: AddBurnAccounts,
32
+ programId: PublicKey = PROGRAM_ID
33
+ ) {
34
+ const keys: Array<AccountMeta> = [
35
+ { pubkey: accounts.burnProgress, isSigner: false, isWritable: true },
36
+ { pubkey: accounts.reserveList, isSigner: false, isWritable: false },
37
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: false },
38
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: false },
39
+ { pubkey: accounts.owner, isSigner: false, isWritable: false },
40
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
41
+ { pubkey: accounts.bubblegumProgram, isSigner: false, isWritable: false },
42
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
43
+ ]
44
+ const identifier = Buffer.from([183, 93, 81, 201, 185, 34, 138, 89])
45
+ const buffer = Buffer.alloc(1000)
46
+ const len = layout.encode(
47
+ {
48
+ metadata: types.MetadataArgs.toEncodable(args.metadata),
49
+ randomBase: args.randomBase,
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,33 @@
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 AdjustDepositBurnAccounts {
8
+ burnDeposit: PublicKey
9
+ itemAccount: PublicKey
10
+ packAccount: PublicKey
11
+ /** CHECK */
12
+ owner: PublicKey
13
+ payer: PublicKey
14
+ systemProgram: PublicKey
15
+ }
16
+
17
+ export function adjustDepositBurn(
18
+ accounts: AdjustDepositBurnAccounts,
19
+ programId: PublicKey = PROGRAM_ID
20
+ ) {
21
+ const keys: Array<AccountMeta> = [
22
+ { pubkey: accounts.burnDeposit, isSigner: false, isWritable: true },
23
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: false },
24
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: false },
25
+ { pubkey: accounts.owner, isSigner: false, isWritable: true },
26
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
27
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
28
+ ]
29
+ const identifier = Buffer.from([14, 147, 177, 8, 228, 194, 77, 173])
30
+ const data = identifier
31
+ const ix = new TransactionInstruction({ keys, programId, data })
32
+ return ix
33
+ }
@@ -0,0 +1,60 @@
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 ArchiveItemArgs {
8
+ storeBump: number
9
+ }
10
+
11
+ export interface ArchiveItemAccounts {
12
+ storeAccount: PublicKey
13
+ itemAccount: PublicKey
14
+ archiveDeposit: PublicKey
15
+ treeAuthority: PublicKey
16
+ creatorAuthority: PublicKey
17
+ merkleTree: PublicKey
18
+ merkleManager: PublicKey
19
+ owner: PublicKey
20
+ payer: PublicKey
21
+ logWrapper: PublicKey
22
+ bubblegumProgram: PublicKey
23
+ compressionProgram: PublicKey
24
+ systemProgram: PublicKey
25
+ }
26
+
27
+ export const layout = borsh.struct([borsh.u8("storeBump")])
28
+
29
+ export function archiveItem(
30
+ args: ArchiveItemArgs,
31
+ accounts: ArchiveItemAccounts,
32
+ programId: PublicKey = PROGRAM_ID
33
+ ) {
34
+ const keys: Array<AccountMeta> = [
35
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
36
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: true },
37
+ { pubkey: accounts.archiveDeposit, isSigner: false, isWritable: true },
38
+ { pubkey: accounts.treeAuthority, isSigner: false, isWritable: true },
39
+ { pubkey: accounts.creatorAuthority, isSigner: false, isWritable: false },
40
+ { pubkey: accounts.merkleTree, isSigner: false, isWritable: true },
41
+ { pubkey: accounts.merkleManager, isSigner: false, isWritable: true },
42
+ { pubkey: accounts.owner, isSigner: false, isWritable: true },
43
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
44
+ { pubkey: accounts.logWrapper, isSigner: false, isWritable: false },
45
+ { pubkey: accounts.bubblegumProgram, isSigner: false, isWritable: false },
46
+ { pubkey: accounts.compressionProgram, isSigner: false, isWritable: false },
47
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
48
+ ]
49
+ const identifier = Buffer.from([177, 109, 250, 153, 152, 3, 226, 250])
50
+ const buffer = Buffer.alloc(1000)
51
+ const len = layout.encode(
52
+ {
53
+ storeBump: args.storeBump,
54
+ },
55
+ buffer
56
+ )
57
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
58
+ const ix = new TransactionInstruction({ keys, programId, data })
59
+ return ix
60
+ }
@@ -0,0 +1,30 @@
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 AssignPackDelegateAccounts {
8
+ storeAccount: PublicKey
9
+ packAccount: PublicKey
10
+ delegateAccount: PublicKey
11
+ payer: PublicKey
12
+ systemProgram: PublicKey
13
+ }
14
+
15
+ export function assignPackDelegate(
16
+ accounts: AssignPackDelegateAccounts,
17
+ programId: PublicKey = PROGRAM_ID
18
+ ) {
19
+ const keys: Array<AccountMeta> = [
20
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: false },
21
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
22
+ { pubkey: accounts.delegateAccount, isSigner: false, isWritable: false },
23
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
24
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
25
+ ]
26
+ const identifier = Buffer.from([198, 232, 96, 161, 111, 26, 135, 46])
27
+ const data = identifier
28
+ const ix = new TransactionInstruction({ keys, programId, data })
29
+ return ix
30
+ }
@@ -0,0 +1,55 @@
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 BurnPayArgs {
8
+ metadata: types.MetadataArgsFields | null
9
+ }
10
+
11
+ export interface BurnPayAccounts {
12
+ paymentAccount: PublicKey
13
+ itemAccount: PublicKey
14
+ packAccount: PublicKey
15
+ holderAccount: PublicKey
16
+ /** CHECK */
17
+ owner: PublicKey
18
+ payer: PublicKey
19
+ bubblegumProgram: PublicKey
20
+ systemProgram: PublicKey
21
+ }
22
+
23
+ export const layout = borsh.struct([
24
+ borsh.option(types.MetadataArgs.layout(), "metadata"),
25
+ ])
26
+
27
+ export function burnPay(
28
+ args: BurnPayArgs,
29
+ accounts: BurnPayAccounts,
30
+ programId: PublicKey = PROGRAM_ID
31
+ ) {
32
+ const keys: Array<AccountMeta> = [
33
+ { pubkey: accounts.paymentAccount, isSigner: false, isWritable: true },
34
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: false },
35
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: false },
36
+ { pubkey: accounts.holderAccount, isSigner: false, isWritable: false },
37
+ { pubkey: accounts.owner, isSigner: false, isWritable: false },
38
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
39
+ { pubkey: accounts.bubblegumProgram, isSigner: false, isWritable: false },
40
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
41
+ ]
42
+ const identifier = Buffer.from([214, 127, 55, 7, 47, 102, 214, 237])
43
+ const buffer = Buffer.alloc(1000)
44
+ const len = layout.encode(
45
+ {
46
+ metadata:
47
+ (args.metadata && types.MetadataArgs.toEncodable(args.metadata)) ||
48
+ null,
49
+ },
50
+ buffer
51
+ )
52
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
53
+ const ix = new TransactionInstruction({ keys, programId, data })
54
+ return ix
55
+ }
@@ -0,0 +1,69 @@
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 BuyPackArgs {
8
+ proof: types.CurrencyArtistProofFields | null
9
+ amountPerPack: number
10
+ randomBase: BN
11
+ fee: number
12
+ }
13
+
14
+ export interface BuyPackAccounts {
15
+ owner: PublicKey
16
+ packAccount: PublicKey
17
+ packOpenAccount: PublicKey
18
+ storeAccount: PublicKey
19
+ packContent: PublicKey
20
+ paymentAccount: PublicKey
21
+ claimer: PublicKey
22
+ buytrackAccount: PublicKey
23
+ payer: PublicKey
24
+ randomizer: PublicKey
25
+ systemProgram: PublicKey
26
+ }
27
+
28
+ export const layout = borsh.struct([
29
+ borsh.option(types.CurrencyArtistProof.layout(), "proof"),
30
+ borsh.u8("amountPerPack"),
31
+ borsh.u64("randomBase"),
32
+ borsh.u8("fee"),
33
+ ])
34
+
35
+ export function buyPack(
36
+ args: BuyPackArgs,
37
+ accounts: BuyPackAccounts,
38
+ programId: PublicKey = PROGRAM_ID
39
+ ) {
40
+ const keys: Array<AccountMeta> = [
41
+ { pubkey: accounts.owner, isSigner: false, isWritable: false },
42
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
43
+ { pubkey: accounts.packOpenAccount, isSigner: false, isWritable: true },
44
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
45
+ { pubkey: accounts.packContent, isSigner: false, isWritable: true },
46
+ { pubkey: accounts.paymentAccount, isSigner: false, isWritable: true },
47
+ { pubkey: accounts.claimer, isSigner: false, isWritable: true },
48
+ { pubkey: accounts.buytrackAccount, isSigner: false, isWritable: true },
49
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
50
+ { pubkey: accounts.randomizer, isSigner: true, isWritable: false },
51
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
52
+ ]
53
+ const identifier = Buffer.from([151, 46, 141, 93, 174, 5, 49, 173])
54
+ const buffer = Buffer.alloc(1000)
55
+ const len = layout.encode(
56
+ {
57
+ proof:
58
+ (args.proof && types.CurrencyArtistProof.toEncodable(args.proof)) ||
59
+ null,
60
+ amountPerPack: args.amountPerPack,
61
+ randomBase: args.randomBase,
62
+ fee: args.fee,
63
+ },
64
+ buffer
65
+ )
66
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
67
+ const ix = new TransactionInstruction({ keys, programId, data })
68
+ return ix
69
+ }
@@ -0,0 +1,71 @@
1
+ import {
2
+ TransactionInstruction,
3
+ PublicKey,
4
+ AccountMeta,
5
+ } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
6
+ import BN from "bn.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
7
+ import * as borsh from "@coral-xyz/borsh"; // eslint-disable-line @typescript-eslint/no-unused-vars
8
+ import * as types from "../types"; // eslint-disable-line @typescript-eslint/no-unused-vars
9
+ import { PROGRAM_ID } from "../programId";
10
+
11
+ export interface BuyPayArgs {
12
+ distributionBumps: Array<number>;
13
+ }
14
+
15
+ export interface BuyPayAccounts {
16
+ paymentAccount: PublicKey;
17
+ itemAccount: PublicKey;
18
+ packAccount: PublicKey;
19
+ burnDeposit: PublicKey;
20
+ poolVault: PublicKey;
21
+ holderAccount: PublicKey;
22
+ /** CHECK */
23
+ owner: PublicKey;
24
+ payer: PublicKey;
25
+ systemProgram: PublicKey;
26
+ }
27
+
28
+ export const layout = borsh.struct([
29
+ borsh.array(borsh.u8(), 6, "distributionBumps"),
30
+ ]);
31
+
32
+ export function buyPay(
33
+ args: BuyPayArgs,
34
+ accounts: BuyPayAccounts,
35
+ extraAccounts: any[],
36
+ programId: PublicKey = PROGRAM_ID
37
+ ) {
38
+ console.log("reer: ", extraAccounts[0].pubkey);
39
+ const keys: Array<AccountMeta> = [
40
+ { pubkey: accounts.paymentAccount, isSigner: false, isWritable: true },
41
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: false },
42
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: false },
43
+ { pubkey: accounts.burnDeposit, isSigner: false, isWritable: true },
44
+ { pubkey: accounts.poolVault, isSigner: false, isWritable: true },
45
+ { pubkey: accounts.holderAccount, isSigner: false, isWritable: false },
46
+ { pubkey: accounts.owner, isSigner: false, isWritable: false },
47
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
48
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
49
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
50
+ ];
51
+ console.log("keyss: ", keys.length);
52
+ for (let item of extraAccounts) {
53
+ keys.push({
54
+ pubkey: item.pubkey,
55
+ isSigner: item.isSigner,
56
+ isWritable: item.isWritable,
57
+ });
58
+ }
59
+ console.log("keyss afte: ", keys.length, keys);
60
+ const identifier = Buffer.from([100, 229, 162, 27, 130, 173, 68, 1]);
61
+ const buffer = Buffer.alloc(1000);
62
+ const len = layout.encode(
63
+ {
64
+ distributionBumps: args.distributionBumps,
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 BuyTokenArgs {
8
+ amount: BN
9
+ }
10
+
11
+ export interface BuyTokenAccounts {
12
+ tokenManager: PublicKey
13
+ tokenAccount: PublicKey
14
+ tokenMintRegistry: PublicKey
15
+ tokenGlobalRegistry: PublicKey
16
+ mint: PublicKey
17
+ storeAccount: PublicKey
18
+ payer: PublicKey
19
+ tokenProgram: PublicKey
20
+ associatedTokenProgram: PublicKey
21
+ tokenMetadataProgram: PublicKey
22
+ systemProgram: PublicKey
23
+ }
24
+
25
+ export const layout = borsh.struct([borsh.u64("amount")])
26
+
27
+ export function buyToken(
28
+ args: BuyTokenArgs,
29
+ accounts: BuyTokenAccounts,
30
+ programId: PublicKey = PROGRAM_ID
31
+ ) {
32
+ const keys: Array<AccountMeta> = [
33
+ { pubkey: accounts.tokenManager, isSigner: false, isWritable: true },
34
+ { pubkey: accounts.tokenAccount, isSigner: false, isWritable: true },
35
+ { pubkey: accounts.tokenMintRegistry, isSigner: false, isWritable: true },
36
+ { pubkey: accounts.tokenGlobalRegistry, isSigner: false, isWritable: true },
37
+ { pubkey: accounts.mint, isSigner: false, isWritable: true },
38
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
39
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
40
+ { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false },
41
+ {
42
+ pubkey: accounts.associatedTokenProgram,
43
+ isSigner: false,
44
+ isWritable: false,
45
+ },
46
+ {
47
+ pubkey: accounts.tokenMetadataProgram,
48
+ isSigner: false,
49
+ isWritable: false,
50
+ },
51
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
52
+ ]
53
+ const identifier = Buffer.from([138, 127, 14, 91, 38, 87, 115, 105])
54
+ const buffer = Buffer.alloc(1000)
55
+ const len = layout.encode(
56
+ {
57
+ amount: args.amount,
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,106 @@
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 ClaimZeroCardArgs {
8
+ leafIndex: number
9
+ root: Array<number>
10
+ bumps: Array<number>
11
+ metadata: types.TightCardMetadataFields
12
+ }
13
+
14
+ export interface ClaimZeroCardAccounts {
15
+ storeAccount: PublicKey
16
+ claimer: PublicKey
17
+ packOpenAccountKeep: PublicKey
18
+ packOpenAccountClose: PublicKey
19
+ treeAuthority: PublicKey
20
+ creatorAuthority: PublicKey
21
+ merkleTreeVerifier: PublicKey
22
+ merkleTree: PublicKey
23
+ packAccount: PublicKey
24
+ merkleManager: PublicKey
25
+ /**
26
+ * If there is no collecton authority record PDA then
27
+ * this must be the Bubblegum program address.
28
+ */
29
+ collectionAuthorityRecordPda: PublicKey
30
+ editionAccount: PublicKey
31
+ collectionMetadata: PublicKey
32
+ collectionMint: PublicKey
33
+ bubblegumSigner: PublicKey
34
+ /** CHECK */
35
+ owner: PublicKey
36
+ payer: PublicKey
37
+ logWrapper: PublicKey
38
+ bubblegumProgram: PublicKey
39
+ compressionProgram: PublicKey
40
+ tokenMetadataProgram: PublicKey
41
+ systemProgram: PublicKey
42
+ }
43
+
44
+ export const layout = borsh.struct([
45
+ borsh.u32("leafIndex"),
46
+ borsh.array(borsh.u8(), 32, "root"),
47
+ borsh.array(borsh.u8(), 7, "bumps"),
48
+ types.TightCardMetadata.layout("metadata"),
49
+ ])
50
+
51
+ export function claimZeroCard(
52
+ args: ClaimZeroCardArgs,
53
+ accounts: ClaimZeroCardAccounts,
54
+ programId: PublicKey = PROGRAM_ID
55
+ ) {
56
+ const keys: Array<AccountMeta> = [
57
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: true },
58
+ { pubkey: accounts.claimer, isSigner: false, isWritable: true },
59
+ { pubkey: accounts.packOpenAccountKeep, isSigner: false, isWritable: true },
60
+ {
61
+ pubkey: accounts.packOpenAccountClose,
62
+ isSigner: false,
63
+ isWritable: true,
64
+ },
65
+ { pubkey: accounts.treeAuthority, isSigner: false, isWritable: true },
66
+ { pubkey: accounts.creatorAuthority, isSigner: false, isWritable: false },
67
+ { pubkey: accounts.merkleTreeVerifier, isSigner: false, isWritable: false },
68
+ { pubkey: accounts.merkleTree, isSigner: false, isWritable: true },
69
+ { pubkey: accounts.packAccount, isSigner: false, isWritable: true },
70
+ { pubkey: accounts.merkleManager, isSigner: false, isWritable: true },
71
+ {
72
+ pubkey: accounts.collectionAuthorityRecordPda,
73
+ isSigner: false,
74
+ isWritable: false,
75
+ },
76
+ { pubkey: accounts.editionAccount, isSigner: false, isWritable: false },
77
+ { pubkey: accounts.collectionMetadata, isSigner: false, isWritable: true },
78
+ { pubkey: accounts.collectionMint, isSigner: false, isWritable: false },
79
+ { pubkey: accounts.bubblegumSigner, isSigner: false, isWritable: false },
80
+ { pubkey: accounts.owner, isSigner: false, isWritable: false },
81
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
82
+ { pubkey: accounts.logWrapper, isSigner: false, isWritable: false },
83
+ { pubkey: accounts.bubblegumProgram, isSigner: false, isWritable: false },
84
+ { pubkey: accounts.compressionProgram, isSigner: false, isWritable: false },
85
+ {
86
+ pubkey: accounts.tokenMetadataProgram,
87
+ isSigner: false,
88
+ isWritable: false,
89
+ },
90
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
91
+ ]
92
+ const identifier = Buffer.from([149, 81, 178, 212, 49, 205, 69, 140])
93
+ const buffer = Buffer.alloc(1000)
94
+ const len = layout.encode(
95
+ {
96
+ leafIndex: args.leafIndex,
97
+ root: args.root,
98
+ bumps: args.bumps,
99
+ metadata: types.TightCardMetadata.toEncodable(args.metadata),
100
+ },
101
+ buffer
102
+ )
103
+ const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len)
104
+ const ix = new TransactionInstruction({ keys, programId, data })
105
+ return ix
106
+ }
@@ -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 CloseDepositBurnArgs {
8
+ identifier: BN
9
+ }
10
+
11
+ export interface CloseDepositBurnAccounts {
12
+ burnDeposit: PublicKey
13
+ itemAccount: PublicKey
14
+ storeAccount: PublicKey
15
+ /** CHECK */
16
+ owner: PublicKey
17
+ payer: PublicKey
18
+ systemProgram: PublicKey
19
+ }
20
+
21
+ export const layout = borsh.struct([borsh.u64("identifier")])
22
+
23
+ export function closeDepositBurn(
24
+ args: CloseDepositBurnArgs,
25
+ accounts: CloseDepositBurnAccounts,
26
+ programId: PublicKey = PROGRAM_ID
27
+ ) {
28
+ const keys: Array<AccountMeta> = [
29
+ { pubkey: accounts.burnDeposit, isSigner: false, isWritable: true },
30
+ { pubkey: accounts.itemAccount, isSigner: false, isWritable: true },
31
+ { pubkey: accounts.storeAccount, isSigner: false, isWritable: false },
32
+ { pubkey: accounts.owner, isSigner: false, isWritable: true },
33
+ { pubkey: accounts.payer, isSigner: true, isWritable: true },
34
+ { pubkey: accounts.systemProgram, isSigner: false, isWritable: false },
35
+ ]
36
+ const identifier = Buffer.from([196, 93, 226, 119, 194, 66, 195, 77])
37
+ const buffer = Buffer.alloc(1000)
38
+ const len = layout.encode(
39
+ {
40
+ identifier: args.identifier,
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
+ }