@macalinao/clients-mpl-bubblegum 0.0.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/README.md +15 -1
  2. package/dist/generated/accounts/index.d.ts +2 -0
  3. package/dist/generated/accounts/treeConfig.d.ts +48 -0
  4. package/dist/generated/accounts/treeConfig.d.ts.map +1 -0
  5. package/dist/generated/accounts/treeConfig.js +84 -0
  6. package/dist/generated/accounts/treeConfig.js.map +1 -0
  7. package/dist/generated/accounts/voucher.d.ts +39 -0
  8. package/dist/generated/accounts/voucher.d.ts.map +1 -0
  9. package/dist/generated/accounts/voucher.js +75 -0
  10. package/dist/generated/accounts/voucher.js.map +1 -0
  11. package/dist/generated/errors/bubblegum.d.ts +131 -0
  12. package/dist/generated/errors/bubblegum.d.ts.map +1 -0
  13. package/dist/generated/errors/bubblegum.js +188 -0
  14. package/dist/generated/errors/bubblegum.js.map +1 -0
  15. package/dist/generated/errors/index.d.ts +1 -0
  16. package/dist/generated/index.d.ts +63 -0
  17. package/dist/generated/instructions/burn.d.ts +76 -0
  18. package/dist/generated/instructions/burn.d.ts.map +1 -0
  19. package/dist/generated/instructions/burn.js +176 -0
  20. package/dist/generated/instructions/burn.js.map +1 -0
  21. package/dist/generated/instructions/burnV2.d.ts +113 -0
  22. package/dist/generated/instructions/burnV2.d.ts.map +1 -0
  23. package/dist/generated/instructions/burnV2.js +247 -0
  24. package/dist/generated/instructions/burnV2.js.map +1 -0
  25. package/dist/generated/instructions/cancelRedeem.d.ts +60 -0
  26. package/dist/generated/instructions/cancelRedeem.d.ts.map +1 -0
  27. package/dist/generated/instructions/cancelRedeem.js +162 -0
  28. package/dist/generated/instructions/cancelRedeem.js.map +1 -0
  29. package/dist/generated/instructions/closeTreeV2.d.ts +69 -0
  30. package/dist/generated/instructions/closeTreeV2.d.ts.map +1 -0
  31. package/dist/generated/instructions/closeTreeV2.js +160 -0
  32. package/dist/generated/instructions/closeTreeV2.js.map +1 -0
  33. package/dist/generated/instructions/collectV2.d.ts +33 -0
  34. package/dist/generated/instructions/collectV2.d.ts.map +1 -0
  35. package/dist/generated/instructions/collectV2.js +72 -0
  36. package/dist/generated/instructions/collectV2.js.map +1 -0
  37. package/dist/generated/instructions/compress.d.ts +76 -0
  38. package/dist/generated/instructions/compress.d.ts.map +1 -0
  39. package/dist/generated/instructions/compress.js +241 -0
  40. package/dist/generated/instructions/compress.js.map +1 -0
  41. package/dist/generated/instructions/createTree.d.ts +68 -0
  42. package/dist/generated/instructions/createTree.d.ts.map +1 -0
  43. package/dist/generated/instructions/createTree.js +172 -0
  44. package/dist/generated/instructions/createTree.js.map +1 -0
  45. package/dist/generated/instructions/createTreeV2.d.ts +70 -0
  46. package/dist/generated/instructions/createTreeV2.d.ts.map +1 -0
  47. package/dist/generated/instructions/createTreeV2.js +176 -0
  48. package/dist/generated/instructions/createTreeV2.js.map +1 -0
  49. package/dist/generated/instructions/decompressV1.d.ts +79 -0
  50. package/dist/generated/instructions/decompressV1.d.ts.map +1 -0
  51. package/dist/generated/instructions/decompressV1.js +259 -0
  52. package/dist/generated/instructions/decompressV1.js.map +1 -0
  53. package/dist/generated/instructions/delegate.d.ts +79 -0
  54. package/dist/generated/instructions/delegate.d.ts.map +1 -0
  55. package/dist/generated/instructions/delegate.js +187 -0
  56. package/dist/generated/instructions/delegate.js.map +1 -0
  57. package/dist/generated/instructions/delegateAndFreezeV2.d.ts +98 -0
  58. package/dist/generated/instructions/delegateAndFreezeV2.d.ts.map +1 -0
  59. package/dist/generated/instructions/delegateAndFreezeV2.js +208 -0
  60. package/dist/generated/instructions/delegateAndFreezeV2.js.map +1 -0
  61. package/dist/generated/instructions/delegateV2.d.ts +98 -0
  62. package/dist/generated/instructions/delegateV2.d.ts.map +1 -0
  63. package/dist/generated/instructions/delegateV2.js +208 -0
  64. package/dist/generated/instructions/delegateV2.js.map +1 -0
  65. package/dist/generated/instructions/freezeV2.d.ts +105 -0
  66. package/dist/generated/instructions/freezeV2.d.ts.map +1 -0
  67. package/dist/generated/instructions/freezeV2.js +217 -0
  68. package/dist/generated/instructions/freezeV2.js.map +1 -0
  69. package/dist/generated/instructions/index.d.ts +36 -0
  70. package/dist/generated/instructions/mintToCollectionV1.d.ts +100 -0
  71. package/dist/generated/instructions/mintToCollectionV1.d.ts.map +1 -0
  72. package/dist/generated/instructions/mintToCollectionV1.js +284 -0
  73. package/dist/generated/instructions/mintToCollectionV1.js.map +1 -0
  74. package/dist/generated/instructions/mintV1.d.ts +67 -0
  75. package/dist/generated/instructions/mintV1.d.ts.map +1 -0
  76. package/dist/generated/instructions/mintV1.js +185 -0
  77. package/dist/generated/instructions/mintV1.js.map +1 -0
  78. package/dist/generated/instructions/mintV2.d.ts +92 -0
  79. package/dist/generated/instructions/mintV2.d.ts.map +1 -0
  80. package/dist/generated/instructions/mintV2.js +252 -0
  81. package/dist/generated/instructions/mintV2.js.map +1 -0
  82. package/dist/generated/instructions/redeem.d.ts +79 -0
  83. package/dist/generated/instructions/redeem.d.ts.map +1 -0
  84. package/dist/generated/instructions/redeem.js +187 -0
  85. package/dist/generated/instructions/redeem.js.map +1 -0
  86. package/dist/generated/instructions/setAndVerifyCollection.d.ts +139 -0
  87. package/dist/generated/instructions/setAndVerifyCollection.d.ts.map +1 -0
  88. package/dist/generated/instructions/setAndVerifyCollection.js +302 -0
  89. package/dist/generated/instructions/setAndVerifyCollection.js.map +1 -0
  90. package/dist/generated/instructions/setCollectionV2.d.ts +131 -0
  91. package/dist/generated/instructions/setCollectionV2.d.ts.map +1 -0
  92. package/dist/generated/instructions/setCollectionV2.js +264 -0
  93. package/dist/generated/instructions/setCollectionV2.js.map +1 -0
  94. package/dist/generated/instructions/setDecompressableState.d.ts +38 -0
  95. package/dist/generated/instructions/setDecompressableState.d.ts.map +1 -0
  96. package/dist/generated/instructions/setDecompressableState.js +74 -0
  97. package/dist/generated/instructions/setDecompressableState.js.map +1 -0
  98. package/dist/generated/instructions/setDecompressibleState.d.ts +38 -0
  99. package/dist/generated/instructions/setDecompressibleState.d.ts.map +1 -0
  100. package/dist/generated/instructions/setDecompressibleState.js +74 -0
  101. package/dist/generated/instructions/setDecompressibleState.js.map +1 -0
  102. package/dist/generated/instructions/setNonTransferableV2.d.ts +107 -0
  103. package/dist/generated/instructions/setNonTransferableV2.d.ts.map +1 -0
  104. package/dist/generated/instructions/setNonTransferableV2.js +217 -0
  105. package/dist/generated/instructions/setNonTransferableV2.js.map +1 -0
  106. package/dist/generated/instructions/setTreeDelegate.d.ts +49 -0
  107. package/dist/generated/instructions/setTreeDelegate.d.ts.map +1 -0
  108. package/dist/generated/instructions/setTreeDelegate.js +134 -0
  109. package/dist/generated/instructions/setTreeDelegate.js.map +1 -0
  110. package/dist/generated/instructions/thawAndRevokeV2.d.ts +93 -0
  111. package/dist/generated/instructions/thawAndRevokeV2.d.ts.map +1 -0
  112. package/dist/generated/instructions/thawAndRevokeV2.js +197 -0
  113. package/dist/generated/instructions/thawAndRevokeV2.js.map +1 -0
  114. package/dist/generated/instructions/thawV2.d.ts +105 -0
  115. package/dist/generated/instructions/thawV2.d.ts.map +1 -0
  116. package/dist/generated/instructions/thawV2.js +217 -0
  117. package/dist/generated/instructions/thawV2.js.map +1 -0
  118. package/dist/generated/instructions/transfer.d.ts +79 -0
  119. package/dist/generated/instructions/transfer.d.ts.map +1 -0
  120. package/dist/generated/instructions/transfer.js +187 -0
  121. package/dist/generated/instructions/transfer.js.map +1 -0
  122. package/dist/generated/instructions/transferV2.d.ts +110 -0
  123. package/dist/generated/instructions/transferV2.d.ts.map +1 -0
  124. package/dist/generated/instructions/transferV2.js +228 -0
  125. package/dist/generated/instructions/transferV2.js.map +1 -0
  126. package/dist/generated/instructions/unverifyCollection.d.ts +135 -0
  127. package/dist/generated/instructions/unverifyCollection.d.ts.map +1 -0
  128. package/dist/generated/instructions/unverifyCollection.js +300 -0
  129. package/dist/generated/instructions/unverifyCollection.js.map +1 -0
  130. package/dist/generated/instructions/unverifyCreator.d.ts +87 -0
  131. package/dist/generated/instructions/unverifyCreator.d.ts.map +1 -0
  132. package/dist/generated/instructions/unverifyCreator.js +201 -0
  133. package/dist/generated/instructions/unverifyCreator.js.map +1 -0
  134. package/dist/generated/instructions/unverifyCreatorV2.d.ts +91 -0
  135. package/dist/generated/instructions/unverifyCreatorV2.d.ts.map +1 -0
  136. package/dist/generated/instructions/unverifyCreatorV2.js +205 -0
  137. package/dist/generated/instructions/unverifyCreatorV2.js.map +1 -0
  138. package/dist/generated/instructions/updateAssetDataV2.d.ts +114 -0
  139. package/dist/generated/instructions/updateAssetDataV2.d.ts.map +1 -0
  140. package/dist/generated/instructions/updateAssetDataV2.js +222 -0
  141. package/dist/generated/instructions/updateAssetDataV2.js.map +1 -0
  142. package/dist/generated/instructions/updateMetadata.d.ts +112 -0
  143. package/dist/generated/instructions/updateMetadata.d.ts.map +1 -0
  144. package/dist/generated/instructions/updateMetadata.js +250 -0
  145. package/dist/generated/instructions/updateMetadata.js.map +1 -0
  146. package/dist/generated/instructions/updateMetadataV2.d.ts +109 -0
  147. package/dist/generated/instructions/updateMetadataV2.d.ts.map +1 -0
  148. package/dist/generated/instructions/updateMetadataV2.js +219 -0
  149. package/dist/generated/instructions/updateMetadataV2.js.map +1 -0
  150. package/dist/generated/instructions/verifyCollection.d.ts +135 -0
  151. package/dist/generated/instructions/verifyCollection.d.ts.map +1 -0
  152. package/dist/generated/instructions/verifyCollection.js +300 -0
  153. package/dist/generated/instructions/verifyCollection.js.map +1 -0
  154. package/dist/generated/instructions/verifyCreator.d.ts +87 -0
  155. package/dist/generated/instructions/verifyCreator.d.ts.map +1 -0
  156. package/dist/generated/instructions/verifyCreator.js +201 -0
  157. package/dist/generated/instructions/verifyCreator.js.map +1 -0
  158. package/dist/generated/instructions/verifyCreatorV2.d.ts +91 -0
  159. package/dist/generated/instructions/verifyCreatorV2.d.ts.map +1 -0
  160. package/dist/generated/instructions/verifyCreatorV2.js +205 -0
  161. package/dist/generated/instructions/verifyCreatorV2.js.map +1 -0
  162. package/dist/generated/pdas/assetId.d.ts +16 -0
  163. package/dist/generated/pdas/assetId.d.ts.map +1 -0
  164. package/dist/generated/pdas/assetId.js +18 -0
  165. package/dist/generated/pdas/assetId.js.map +1 -0
  166. package/dist/generated/pdas/bubblegumSigner.d.ts +10 -0
  167. package/dist/generated/pdas/bubblegumSigner.d.ts.map +1 -0
  168. package/dist/generated/pdas/bubblegumSigner.js +14 -0
  169. package/dist/generated/pdas/bubblegumSigner.js.map +1 -0
  170. package/dist/generated/pdas/index.d.ts +7 -0
  171. package/dist/generated/pdas/masterEdition.d.ts +14 -0
  172. package/dist/generated/pdas/masterEdition.d.ts.map +1 -0
  173. package/dist/generated/pdas/masterEdition.js +19 -0
  174. package/dist/generated/pdas/masterEdition.js.map +1 -0
  175. package/dist/generated/pdas/metadata.d.ts +14 -0
  176. package/dist/generated/pdas/metadata.d.ts.map +1 -0
  177. package/dist/generated/pdas/metadata.js +18 -0
  178. package/dist/generated/pdas/metadata.js.map +1 -0
  179. package/dist/generated/pdas/mintAuthority.d.ts +14 -0
  180. package/dist/generated/pdas/mintAuthority.d.ts.map +1 -0
  181. package/dist/generated/pdas/mintAuthority.js +14 -0
  182. package/dist/generated/pdas/mintAuthority.js.map +1 -0
  183. package/dist/generated/pdas/treeConfig.d.ts +14 -0
  184. package/dist/generated/pdas/treeConfig.d.ts.map +1 -0
  185. package/dist/generated/pdas/treeConfig.js +14 -0
  186. package/dist/generated/pdas/treeConfig.js.map +1 -0
  187. package/dist/generated/pdas/voucher.d.ts +16 -0
  188. package/dist/generated/pdas/voucher.d.ts.map +1 -0
  189. package/dist/generated/pdas/voucher.js +18 -0
  190. package/dist/generated/pdas/voucher.js.map +1 -0
  191. package/dist/generated/programs/bubblegum.d.ts +232 -0
  192. package/dist/generated/programs/bubblegum.d.ts.map +1 -0
  193. package/dist/generated/programs/bubblegum.js +844 -0
  194. package/dist/generated/programs/bubblegum.js.map +1 -0
  195. package/dist/generated/programs/index.d.ts +2 -0
  196. package/dist/generated/programs/mplTokenMetadata.d.ts +20 -0
  197. package/dist/generated/programs/mplTokenMetadata.d.ts.map +1 -0
  198. package/dist/generated/programs/mplTokenMetadata.js +17 -0
  199. package/dist/generated/programs/mplTokenMetadata.js.map +1 -0
  200. package/dist/generated/types/assetDataSchema.d.ts +15 -0
  201. package/dist/generated/types/assetDataSchema.d.ts.map +1 -0
  202. package/dist/generated/types/assetDataSchema.js +21 -0
  203. package/dist/generated/types/assetDataSchema.js.map +1 -0
  204. package/dist/generated/types/bubblegumEventType.d.ts +14 -0
  205. package/dist/generated/types/bubblegumEventType.d.ts.map +1 -0
  206. package/dist/generated/types/bubblegumEventType.js +20 -0
  207. package/dist/generated/types/bubblegumEventType.js.map +1 -0
  208. package/dist/generated/types/collection.d.ts +14 -0
  209. package/dist/generated/types/collection.d.ts.map +1 -0
  210. package/dist/generated/types/collection.js +15 -0
  211. package/dist/generated/types/collection.js.map +1 -0
  212. package/dist/generated/types/creator.d.ts +20 -0
  213. package/dist/generated/types/creator.d.ts.map +1 -0
  214. package/dist/generated/types/creator.js +23 -0
  215. package/dist/generated/types/creator.js.map +1 -0
  216. package/dist/generated/types/decompressibleState.d.ts +14 -0
  217. package/dist/generated/types/decompressibleState.d.ts.map +1 -0
  218. package/dist/generated/types/decompressibleState.js +20 -0
  219. package/dist/generated/types/decompressibleState.js.map +1 -0
  220. package/dist/generated/types/index.d.ts +15 -0
  221. package/dist/generated/types/instructionName.d.ts +47 -0
  222. package/dist/generated/types/instructionName.d.ts.map +1 -0
  223. package/dist/generated/types/instructionName.js +53 -0
  224. package/dist/generated/types/instructionName.js.map +1 -0
  225. package/dist/generated/types/leafSchema.d.ts +54 -0
  226. package/dist/generated/types/leafSchema.d.ts.map +1 -0
  227. package/dist/generated/types/leafSchema.js +61 -0
  228. package/dist/generated/types/leafSchema.js.map +1 -0
  229. package/dist/generated/types/metadataArgs.d.ts +62 -0
  230. package/dist/generated/types/metadataArgs.d.ts.map +1 -0
  231. package/dist/generated/types/metadataArgs.js +46 -0
  232. package/dist/generated/types/metadataArgs.js.map +1 -0
  233. package/dist/generated/types/metadataArgsV2.d.ts +51 -0
  234. package/dist/generated/types/metadataArgsV2.d.ts.map +1 -0
  235. package/dist/generated/types/metadataArgsV2.js +37 -0
  236. package/dist/generated/types/metadataArgsV2.js.map +1 -0
  237. package/dist/generated/types/tokenProgramVersion.d.ts +14 -0
  238. package/dist/generated/types/tokenProgramVersion.d.ts.map +1 -0
  239. package/dist/generated/types/tokenProgramVersion.js +20 -0
  240. package/dist/generated/types/tokenProgramVersion.js.map +1 -0
  241. package/dist/generated/types/tokenStandard.d.ts +16 -0
  242. package/dist/generated/types/tokenStandard.d.ts.map +1 -0
  243. package/dist/generated/types/tokenStandard.js +22 -0
  244. package/dist/generated/types/tokenStandard.js.map +1 -0
  245. package/dist/generated/types/updateArgs.d.ts +28 -0
  246. package/dist/generated/types/updateArgs.d.ts.map +1 -0
  247. package/dist/generated/types/updateArgs.js +32 -0
  248. package/dist/generated/types/updateArgs.js.map +1 -0
  249. package/dist/generated/types/useMethod.d.ts +15 -0
  250. package/dist/generated/types/useMethod.d.ts.map +1 -0
  251. package/dist/generated/types/useMethod.js +21 -0
  252. package/dist/generated/types/useMethod.js.map +1 -0
  253. package/dist/generated/types/uses.d.ts +20 -0
  254. package/dist/generated/types/uses.d.ts.map +1 -0
  255. package/dist/generated/types/uses.js +24 -0
  256. package/dist/generated/types/uses.js.map +1 -0
  257. package/dist/generated/types/version.d.ts +14 -0
  258. package/dist/generated/types/version.d.ts.map +1 -0
  259. package/dist/generated/types/version.js +20 -0
  260. package/dist/generated/types/version.js.map +1 -0
  261. package/dist/index.d.ts +64 -0
  262. package/dist/index.js +64 -0
  263. package/package.json +53 -5
  264. package/src/generated/accounts/index.ts +10 -0
  265. package/src/generated/accounts/treeConfig.ts +197 -0
  266. package/src/generated/accounts/voucher.ts +166 -0
  267. package/src/generated/errors/bubblegum.ts +309 -0
  268. package/src/generated/errors/index.ts +9 -0
  269. package/src/generated/index.ts +14 -0
  270. package/src/generated/instructions/burn.ts +454 -0
  271. package/src/generated/instructions/burnV2.ts +641 -0
  272. package/src/generated/instructions/cancelRedeem.ts +432 -0
  273. package/src/generated/instructions/closeTreeV2.ts +424 -0
  274. package/src/generated/instructions/collectV2.ts +184 -0
  275. package/src/generated/instructions/compress.ts +589 -0
  276. package/src/generated/instructions/createTree.ts +448 -0
  277. package/src/generated/instructions/createTreeV2.ts +459 -0
  278. package/src/generated/instructions/decompressV1.ts +646 -0
  279. package/src/generated/instructions/delegate.ts +492 -0
  280. package/src/generated/instructions/delegateAndFreezeV2.ts +568 -0
  281. package/src/generated/instructions/delegateV2.ts +562 -0
  282. package/src/generated/instructions/freezeV2.ts +566 -0
  283. package/src/generated/instructions/index.ts +44 -0
  284. package/src/generated/instructions/mintToCollectionV1.ts +732 -0
  285. package/src/generated/instructions/mintV1.ts +476 -0
  286. package/src/generated/instructions/mintV2.ts +649 -0
  287. package/src/generated/instructions/redeem.ts +480 -0
  288. package/src/generated/instructions/setAndVerifyCollection.ts +792 -0
  289. package/src/generated/instructions/setCollectionV2.ts +711 -0
  290. package/src/generated/instructions/setDecompressableState.ts +218 -0
  291. package/src/generated/instructions/setDecompressibleState.ts +218 -0
  292. package/src/generated/instructions/setNonTransferableV2.ts +575 -0
  293. package/src/generated/instructions/setTreeDelegate.ts +344 -0
  294. package/src/generated/instructions/thawAndRevokeV2.ts +526 -0
  295. package/src/generated/instructions/thawV2.ts +566 -0
  296. package/src/generated/instructions/transfer.ts +476 -0
  297. package/src/generated/instructions/transferV2.ts +591 -0
  298. package/src/generated/instructions/unverifyCollection.ts +781 -0
  299. package/src/generated/instructions/unverifyCreator.ts +515 -0
  300. package/src/generated/instructions/unverifyCreatorV2.ts +538 -0
  301. package/src/generated/instructions/updateAssetDataV2.ts +599 -0
  302. package/src/generated/instructions/updateMetadata.ts +665 -0
  303. package/src/generated/instructions/updateMetadataV2.ts +582 -0
  304. package/src/generated/instructions/verifyCollection.ts +779 -0
  305. package/src/generated/instructions/verifyCreator.ts +516 -0
  306. package/src/generated/instructions/verifyCreatorV2.ts +538 -0
  307. package/src/generated/pdas/assetId.ts +40 -0
  308. package/src/generated/pdas/bubblegumSigner.ts +23 -0
  309. package/src/generated/pdas/index.ts +15 -0
  310. package/src/generated/pdas/masterEdition.ts +38 -0
  311. package/src/generated/pdas/metadata.ts +37 -0
  312. package/src/generated/pdas/mintAuthority.ts +29 -0
  313. package/src/generated/pdas/treeConfig.ts +29 -0
  314. package/src/generated/pdas/voucher.ts +40 -0
  315. package/src/generated/programs/bubblegum.ts +1509 -0
  316. package/src/generated/programs/index.ts +10 -0
  317. package/src/generated/programs/mplTokenMetadata.ts +42 -0
  318. package/src/generated/types/assetDataSchema.ts +37 -0
  319. package/src/generated/types/bubblegumEventType.ts +39 -0
  320. package/src/generated/types/collection.ts +51 -0
  321. package/src/generated/types/creator.ts +58 -0
  322. package/src/generated/types/decompressibleState.ts +39 -0
  323. package/src/generated/types/index.ts +23 -0
  324. package/src/generated/types/instructionName.ts +69 -0
  325. package/src/generated/types/leafSchema.ts +166 -0
  326. package/src/generated/types/metadataArgs.ts +148 -0
  327. package/src/generated/types/metadataArgsV2.ts +126 -0
  328. package/src/generated/types/tokenProgramVersion.ts +39 -0
  329. package/src/generated/types/tokenStandard.ts +38 -0
  330. package/src/generated/types/updateArgs.ts +102 -0
  331. package/src/generated/types/useMethod.ts +34 -0
  332. package/src/generated/types/uses.ts +54 -0
  333. package/src/generated/types/version.ts +33 -0
  334. package/src/index.ts +8 -0
@@ -0,0 +1,1509 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import type {
10
+ Address,
11
+ ClientWithPayer,
12
+ ClientWithRpc,
13
+ ClientWithTransactionPlanning,
14
+ ClientWithTransactionSending,
15
+ GetAccountInfoApi,
16
+ GetMultipleAccountsApi,
17
+ Instruction,
18
+ InstructionWithData,
19
+ ReadonlyUint8Array,
20
+ } from "@solana/kit";
21
+ import type {
22
+ SelfFetchFunctions,
23
+ SelfPlanAndSendFunctions,
24
+ } from "@solana/program-client-core";
25
+ import type {
26
+ TreeConfig,
27
+ TreeConfigArgs,
28
+ Voucher,
29
+ VoucherArgs,
30
+ } from "../accounts/index.js";
31
+ import type {
32
+ BurnAsyncInput,
33
+ BurnV2AsyncInput,
34
+ CancelRedeemAsyncInput,
35
+ CloseTreeV2AsyncInput,
36
+ CollectV2Input,
37
+ CompressAsyncInput,
38
+ CreateTreeAsyncInput,
39
+ CreateTreeV2AsyncInput,
40
+ DecompressV1AsyncInput,
41
+ DelegateAndFreezeV2AsyncInput,
42
+ DelegateAsyncInput,
43
+ DelegateV2AsyncInput,
44
+ FreezeV2AsyncInput,
45
+ MintToCollectionV1AsyncInput,
46
+ MintV1AsyncInput,
47
+ MintV2AsyncInput,
48
+ ParsedBurnInstruction,
49
+ ParsedBurnV2Instruction,
50
+ ParsedCancelRedeemInstruction,
51
+ ParsedCloseTreeV2Instruction,
52
+ ParsedCollectV2Instruction,
53
+ ParsedCompressInstruction,
54
+ ParsedCreateTreeInstruction,
55
+ ParsedCreateTreeV2Instruction,
56
+ ParsedDecompressV1Instruction,
57
+ ParsedDelegateAndFreezeV2Instruction,
58
+ ParsedDelegateInstruction,
59
+ ParsedDelegateV2Instruction,
60
+ ParsedFreezeV2Instruction,
61
+ ParsedMintToCollectionV1Instruction,
62
+ ParsedMintV1Instruction,
63
+ ParsedMintV2Instruction,
64
+ ParsedRedeemInstruction,
65
+ ParsedSetAndVerifyCollectionInstruction,
66
+ ParsedSetCollectionV2Instruction,
67
+ ParsedSetDecompressableStateInstruction,
68
+ ParsedSetDecompressibleStateInstruction,
69
+ ParsedSetNonTransferableV2Instruction,
70
+ ParsedSetTreeDelegateInstruction,
71
+ ParsedThawAndRevokeV2Instruction,
72
+ ParsedThawV2Instruction,
73
+ ParsedTransferInstruction,
74
+ ParsedTransferV2Instruction,
75
+ ParsedUnverifyCollectionInstruction,
76
+ ParsedUnverifyCreatorInstruction,
77
+ ParsedUnverifyCreatorV2Instruction,
78
+ ParsedUpdateAssetDataV2Instruction,
79
+ ParsedUpdateMetadataInstruction,
80
+ ParsedUpdateMetadataV2Instruction,
81
+ ParsedVerifyCollectionInstruction,
82
+ ParsedVerifyCreatorInstruction,
83
+ ParsedVerifyCreatorV2Instruction,
84
+ RedeemAsyncInput,
85
+ SetAndVerifyCollectionAsyncInput,
86
+ SetCollectionV2AsyncInput,
87
+ SetDecompressableStateInput,
88
+ SetDecompressibleStateInput,
89
+ SetNonTransferableV2AsyncInput,
90
+ SetTreeDelegateAsyncInput,
91
+ ThawAndRevokeV2AsyncInput,
92
+ ThawV2AsyncInput,
93
+ TransferAsyncInput,
94
+ TransferV2AsyncInput,
95
+ UnverifyCollectionAsyncInput,
96
+ UnverifyCreatorAsyncInput,
97
+ UnverifyCreatorV2AsyncInput,
98
+ UpdateAssetDataV2AsyncInput,
99
+ UpdateMetadataAsyncInput,
100
+ UpdateMetadataV2AsyncInput,
101
+ VerifyCollectionAsyncInput,
102
+ VerifyCreatorAsyncInput,
103
+ VerifyCreatorV2AsyncInput,
104
+ } from "../instructions/index.js";
105
+ import {
106
+ assertIsInstructionWithAccounts,
107
+ containsBytes,
108
+ extendClient,
109
+ fixEncoderSize,
110
+ getBytesEncoder,
111
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
112
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
113
+ SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
114
+ SolanaError,
115
+ } from "@solana/kit";
116
+ import {
117
+ addSelfFetchFunctions,
118
+ addSelfPlanAndSendFunctions,
119
+ } from "@solana/program-client-core";
120
+ import { getTreeConfigCodec, getVoucherCodec } from "../accounts/index.js";
121
+ import {
122
+ getBurnInstructionAsync,
123
+ getBurnV2InstructionAsync,
124
+ getCancelRedeemInstructionAsync,
125
+ getCloseTreeV2InstructionAsync,
126
+ getCollectV2Instruction,
127
+ getCompressInstructionAsync,
128
+ getCreateTreeInstructionAsync,
129
+ getCreateTreeV2InstructionAsync,
130
+ getDecompressV1InstructionAsync,
131
+ getDelegateAndFreezeV2InstructionAsync,
132
+ getDelegateInstructionAsync,
133
+ getDelegateV2InstructionAsync,
134
+ getFreezeV2InstructionAsync,
135
+ getMintToCollectionV1InstructionAsync,
136
+ getMintV1InstructionAsync,
137
+ getMintV2InstructionAsync,
138
+ getRedeemInstructionAsync,
139
+ getSetAndVerifyCollectionInstructionAsync,
140
+ getSetCollectionV2InstructionAsync,
141
+ getSetDecompressableStateInstruction,
142
+ getSetDecompressibleStateInstruction,
143
+ getSetNonTransferableV2InstructionAsync,
144
+ getSetTreeDelegateInstructionAsync,
145
+ getThawAndRevokeV2InstructionAsync,
146
+ getThawV2InstructionAsync,
147
+ getTransferInstructionAsync,
148
+ getTransferV2InstructionAsync,
149
+ getUnverifyCollectionInstructionAsync,
150
+ getUnverifyCreatorInstructionAsync,
151
+ getUnverifyCreatorV2InstructionAsync,
152
+ getUpdateAssetDataV2InstructionAsync,
153
+ getUpdateMetadataInstructionAsync,
154
+ getUpdateMetadataV2InstructionAsync,
155
+ getVerifyCollectionInstructionAsync,
156
+ getVerifyCreatorInstructionAsync,
157
+ getVerifyCreatorV2InstructionAsync,
158
+ parseBurnInstruction,
159
+ parseBurnV2Instruction,
160
+ parseCancelRedeemInstruction,
161
+ parseCloseTreeV2Instruction,
162
+ parseCollectV2Instruction,
163
+ parseCompressInstruction,
164
+ parseCreateTreeInstruction,
165
+ parseCreateTreeV2Instruction,
166
+ parseDecompressV1Instruction,
167
+ parseDelegateAndFreezeV2Instruction,
168
+ parseDelegateInstruction,
169
+ parseDelegateV2Instruction,
170
+ parseFreezeV2Instruction,
171
+ parseMintToCollectionV1Instruction,
172
+ parseMintV1Instruction,
173
+ parseMintV2Instruction,
174
+ parseRedeemInstruction,
175
+ parseSetAndVerifyCollectionInstruction,
176
+ parseSetCollectionV2Instruction,
177
+ parseSetDecompressableStateInstruction,
178
+ parseSetDecompressibleStateInstruction,
179
+ parseSetNonTransferableV2Instruction,
180
+ parseSetTreeDelegateInstruction,
181
+ parseThawAndRevokeV2Instruction,
182
+ parseThawV2Instruction,
183
+ parseTransferInstruction,
184
+ parseTransferV2Instruction,
185
+ parseUnverifyCollectionInstruction,
186
+ parseUnverifyCreatorInstruction,
187
+ parseUnverifyCreatorV2Instruction,
188
+ parseUpdateAssetDataV2Instruction,
189
+ parseUpdateMetadataInstruction,
190
+ parseUpdateMetadataV2Instruction,
191
+ parseVerifyCollectionInstruction,
192
+ parseVerifyCreatorInstruction,
193
+ parseVerifyCreatorV2Instruction,
194
+ } from "../instructions/index.js";
195
+ import {
196
+ findAssetIdPda,
197
+ findBubblegumSignerPda,
198
+ findMintAuthorityPda,
199
+ findTreeConfigPda,
200
+ findVoucherPda,
201
+ } from "../pdas/index.js";
202
+
203
+ export const BUBBLEGUM_PROGRAM_ADDRESS =
204
+ "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY" as Address<"BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY">;
205
+
206
+ export enum BubblegumAccount {
207
+ TreeConfig = 0,
208
+ Voucher = 1,
209
+ }
210
+
211
+ export function identifyBubblegumAccount(
212
+ account: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
213
+ ): BubblegumAccount {
214
+ const data = "data" in account ? account.data : account;
215
+ if (
216
+ containsBytes(
217
+ data,
218
+ fixEncoderSize(getBytesEncoder(), 8).encode(
219
+ new Uint8Array([122, 245, 175, 248, 171, 34, 0, 207]),
220
+ ),
221
+ 0,
222
+ )
223
+ ) {
224
+ return BubblegumAccount.TreeConfig;
225
+ }
226
+ if (
227
+ containsBytes(
228
+ data,
229
+ fixEncoderSize(getBytesEncoder(), 8).encode(
230
+ new Uint8Array([191, 204, 149, 234, 213, 165, 13, 65]),
231
+ ),
232
+ 0,
233
+ )
234
+ ) {
235
+ return BubblegumAccount.Voucher;
236
+ }
237
+ throw new SolanaError(
238
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
239
+ { accountData: data, programName: "bubblegum" },
240
+ );
241
+ }
242
+
243
+ export enum BubblegumInstruction {
244
+ Burn = 0,
245
+ BurnV2 = 1,
246
+ CancelRedeem = 2,
247
+ CloseTreeV2 = 3,
248
+ CollectV2 = 4,
249
+ Compress = 5,
250
+ CreateTree = 6,
251
+ CreateTreeV2 = 7,
252
+ DecompressV1 = 8,
253
+ Delegate = 9,
254
+ DelegateAndFreezeV2 = 10,
255
+ DelegateV2 = 11,
256
+ FreezeV2 = 12,
257
+ MintToCollectionV1 = 13,
258
+ MintV1 = 14,
259
+ MintV2 = 15,
260
+ Redeem = 16,
261
+ SetAndVerifyCollection = 17,
262
+ SetCollectionV2 = 18,
263
+ SetDecompressableState = 19,
264
+ SetDecompressibleState = 20,
265
+ SetNonTransferableV2 = 21,
266
+ SetTreeDelegate = 22,
267
+ ThawAndRevokeV2 = 23,
268
+ ThawV2 = 24,
269
+ Transfer = 25,
270
+ TransferV2 = 26,
271
+ UnverifyCollection = 27,
272
+ UnverifyCreator = 28,
273
+ UnverifyCreatorV2 = 29,
274
+ UpdateAssetDataV2 = 30,
275
+ UpdateMetadata = 31,
276
+ UpdateMetadataV2 = 32,
277
+ VerifyCollection = 33,
278
+ VerifyCreator = 34,
279
+ VerifyCreatorV2 = 35,
280
+ }
281
+
282
+ export function identifyBubblegumInstruction(
283
+ instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array,
284
+ ): BubblegumInstruction {
285
+ const data = "data" in instruction ? instruction.data : instruction;
286
+ if (
287
+ containsBytes(
288
+ data,
289
+ fixEncoderSize(getBytesEncoder(), 8).encode(
290
+ new Uint8Array([116, 110, 29, 56, 107, 219, 42, 93]),
291
+ ),
292
+ 0,
293
+ )
294
+ ) {
295
+ return BubblegumInstruction.Burn;
296
+ }
297
+ if (
298
+ containsBytes(
299
+ data,
300
+ fixEncoderSize(getBytesEncoder(), 8).encode(
301
+ new Uint8Array([115, 210, 34, 240, 232, 143, 183, 16]),
302
+ ),
303
+ 0,
304
+ )
305
+ ) {
306
+ return BubblegumInstruction.BurnV2;
307
+ }
308
+ if (
309
+ containsBytes(
310
+ data,
311
+ fixEncoderSize(getBytesEncoder(), 8).encode(
312
+ new Uint8Array([111, 76, 232, 50, 39, 175, 48, 242]),
313
+ ),
314
+ 0,
315
+ )
316
+ ) {
317
+ return BubblegumInstruction.CancelRedeem;
318
+ }
319
+ if (
320
+ containsBytes(
321
+ data,
322
+ fixEncoderSize(getBytesEncoder(), 8).encode(
323
+ new Uint8Array([45, 172, 6, 94, 28, 90, 157, 70]),
324
+ ),
325
+ 0,
326
+ )
327
+ ) {
328
+ return BubblegumInstruction.CloseTreeV2;
329
+ }
330
+ if (
331
+ containsBytes(
332
+ data,
333
+ fixEncoderSize(getBytesEncoder(), 8).encode(
334
+ new Uint8Array([21, 11, 159, 47, 4, 195, 106, 56]),
335
+ ),
336
+ 0,
337
+ )
338
+ ) {
339
+ return BubblegumInstruction.CollectV2;
340
+ }
341
+ if (
342
+ containsBytes(
343
+ data,
344
+ fixEncoderSize(getBytesEncoder(), 8).encode(
345
+ new Uint8Array([82, 193, 176, 117, 176, 21, 115, 253]),
346
+ ),
347
+ 0,
348
+ )
349
+ ) {
350
+ return BubblegumInstruction.Compress;
351
+ }
352
+ if (
353
+ containsBytes(
354
+ data,
355
+ fixEncoderSize(getBytesEncoder(), 8).encode(
356
+ new Uint8Array([165, 83, 136, 142, 89, 202, 47, 220]),
357
+ ),
358
+ 0,
359
+ )
360
+ ) {
361
+ return BubblegumInstruction.CreateTree;
362
+ }
363
+ if (
364
+ containsBytes(
365
+ data,
366
+ fixEncoderSize(getBytesEncoder(), 8).encode(
367
+ new Uint8Array([55, 99, 95, 215, 142, 203, 227, 205]),
368
+ ),
369
+ 0,
370
+ )
371
+ ) {
372
+ return BubblegumInstruction.CreateTreeV2;
373
+ }
374
+ if (
375
+ containsBytes(
376
+ data,
377
+ fixEncoderSize(getBytesEncoder(), 8).encode(
378
+ new Uint8Array([54, 85, 76, 70, 228, 250, 164, 81]),
379
+ ),
380
+ 0,
381
+ )
382
+ ) {
383
+ return BubblegumInstruction.DecompressV1;
384
+ }
385
+ if (
386
+ containsBytes(
387
+ data,
388
+ fixEncoderSize(getBytesEncoder(), 8).encode(
389
+ new Uint8Array([90, 147, 75, 178, 85, 88, 4, 137]),
390
+ ),
391
+ 0,
392
+ )
393
+ ) {
394
+ return BubblegumInstruction.Delegate;
395
+ }
396
+ if (
397
+ containsBytes(
398
+ data,
399
+ fixEncoderSize(getBytesEncoder(), 8).encode(
400
+ new Uint8Array([17, 229, 35, 218, 190, 241, 250, 123]),
401
+ ),
402
+ 0,
403
+ )
404
+ ) {
405
+ return BubblegumInstruction.DelegateAndFreezeV2;
406
+ }
407
+ if (
408
+ containsBytes(
409
+ data,
410
+ fixEncoderSize(getBytesEncoder(), 8).encode(
411
+ new Uint8Array([95, 87, 125, 140, 181, 131, 128, 227]),
412
+ ),
413
+ 0,
414
+ )
415
+ ) {
416
+ return BubblegumInstruction.DelegateV2;
417
+ }
418
+ if (
419
+ containsBytes(
420
+ data,
421
+ fixEncoderSize(getBytesEncoder(), 8).encode(
422
+ new Uint8Array([200, 151, 244, 102, 16, 195, 255, 3]),
423
+ ),
424
+ 0,
425
+ )
426
+ ) {
427
+ return BubblegumInstruction.FreezeV2;
428
+ }
429
+ if (
430
+ containsBytes(
431
+ data,
432
+ fixEncoderSize(getBytesEncoder(), 8).encode(
433
+ new Uint8Array([153, 18, 178, 47, 197, 158, 86, 15]),
434
+ ),
435
+ 0,
436
+ )
437
+ ) {
438
+ return BubblegumInstruction.MintToCollectionV1;
439
+ }
440
+ if (
441
+ containsBytes(
442
+ data,
443
+ fixEncoderSize(getBytesEncoder(), 8).encode(
444
+ new Uint8Array([145, 98, 192, 118, 184, 147, 118, 104]),
445
+ ),
446
+ 0,
447
+ )
448
+ ) {
449
+ return BubblegumInstruction.MintV1;
450
+ }
451
+ if (
452
+ containsBytes(
453
+ data,
454
+ fixEncoderSize(getBytesEncoder(), 8).encode(
455
+ new Uint8Array([120, 121, 23, 146, 173, 110, 199, 205]),
456
+ ),
457
+ 0,
458
+ )
459
+ ) {
460
+ return BubblegumInstruction.MintV2;
461
+ }
462
+ if (
463
+ containsBytes(
464
+ data,
465
+ fixEncoderSize(getBytesEncoder(), 8).encode(
466
+ new Uint8Array([184, 12, 86, 149, 70, 196, 97, 225]),
467
+ ),
468
+ 0,
469
+ )
470
+ ) {
471
+ return BubblegumInstruction.Redeem;
472
+ }
473
+ if (
474
+ containsBytes(
475
+ data,
476
+ fixEncoderSize(getBytesEncoder(), 8).encode(
477
+ new Uint8Array([235, 242, 121, 216, 158, 234, 180, 234]),
478
+ ),
479
+ 0,
480
+ )
481
+ ) {
482
+ return BubblegumInstruction.SetAndVerifyCollection;
483
+ }
484
+ if (
485
+ containsBytes(
486
+ data,
487
+ fixEncoderSize(getBytesEncoder(), 8).encode(
488
+ new Uint8Array([229, 35, 61, 91, 15, 14, 99, 160]),
489
+ ),
490
+ 0,
491
+ )
492
+ ) {
493
+ return BubblegumInstruction.SetCollectionV2;
494
+ }
495
+ if (
496
+ containsBytes(
497
+ data,
498
+ fixEncoderSize(getBytesEncoder(), 8).encode(
499
+ new Uint8Array([18, 135, 238, 168, 246, 195, 61, 115]),
500
+ ),
501
+ 0,
502
+ )
503
+ ) {
504
+ return BubblegumInstruction.SetDecompressableState;
505
+ }
506
+ if (
507
+ containsBytes(
508
+ data,
509
+ fixEncoderSize(getBytesEncoder(), 8).encode(
510
+ new Uint8Array([82, 104, 152, 6, 149, 111, 100, 13]),
511
+ ),
512
+ 0,
513
+ )
514
+ ) {
515
+ return BubblegumInstruction.SetDecompressibleState;
516
+ }
517
+ if (
518
+ containsBytes(
519
+ data,
520
+ fixEncoderSize(getBytesEncoder(), 8).encode(
521
+ new Uint8Array([181, 141, 206, 58, 242, 199, 152, 168]),
522
+ ),
523
+ 0,
524
+ )
525
+ ) {
526
+ return BubblegumInstruction.SetNonTransferableV2;
527
+ }
528
+ if (
529
+ containsBytes(
530
+ data,
531
+ fixEncoderSize(getBytesEncoder(), 8).encode(
532
+ new Uint8Array([253, 118, 66, 37, 190, 49, 154, 102]),
533
+ ),
534
+ 0,
535
+ )
536
+ ) {
537
+ return BubblegumInstruction.SetTreeDelegate;
538
+ }
539
+ if (
540
+ containsBytes(
541
+ data,
542
+ fixEncoderSize(getBytesEncoder(), 8).encode(
543
+ new Uint8Array([86, 214, 190, 37, 167, 4, 28, 116]),
544
+ ),
545
+ 0,
546
+ )
547
+ ) {
548
+ return BubblegumInstruction.ThawAndRevokeV2;
549
+ }
550
+ if (
551
+ containsBytes(
552
+ data,
553
+ fixEncoderSize(getBytesEncoder(), 8).encode(
554
+ new Uint8Array([96, 133, 101, 93, 82, 220, 146, 191]),
555
+ ),
556
+ 0,
557
+ )
558
+ ) {
559
+ return BubblegumInstruction.ThawV2;
560
+ }
561
+ if (
562
+ containsBytes(
563
+ data,
564
+ fixEncoderSize(getBytesEncoder(), 8).encode(
565
+ new Uint8Array([163, 52, 200, 231, 140, 3, 69, 186]),
566
+ ),
567
+ 0,
568
+ )
569
+ ) {
570
+ return BubblegumInstruction.Transfer;
571
+ }
572
+ if (
573
+ containsBytes(
574
+ data,
575
+ fixEncoderSize(getBytesEncoder(), 8).encode(
576
+ new Uint8Array([119, 40, 6, 235, 234, 221, 248, 49]),
577
+ ),
578
+ 0,
579
+ )
580
+ ) {
581
+ return BubblegumInstruction.TransferV2;
582
+ }
583
+ if (
584
+ containsBytes(
585
+ data,
586
+ fixEncoderSize(getBytesEncoder(), 8).encode(
587
+ new Uint8Array([250, 251, 42, 106, 41, 137, 186, 168]),
588
+ ),
589
+ 0,
590
+ )
591
+ ) {
592
+ return BubblegumInstruction.UnverifyCollection;
593
+ }
594
+ if (
595
+ containsBytes(
596
+ data,
597
+ fixEncoderSize(getBytesEncoder(), 8).encode(
598
+ new Uint8Array([107, 178, 57, 39, 105, 115, 112, 152]),
599
+ ),
600
+ 0,
601
+ )
602
+ ) {
603
+ return BubblegumInstruction.UnverifyCreator;
604
+ }
605
+ if (
606
+ containsBytes(
607
+ data,
608
+ fixEncoderSize(getBytesEncoder(), 8).encode(
609
+ new Uint8Array([174, 112, 29, 142, 230, 100, 239, 7]),
610
+ ),
611
+ 0,
612
+ )
613
+ ) {
614
+ return BubblegumInstruction.UnverifyCreatorV2;
615
+ }
616
+ if (
617
+ containsBytes(
618
+ data,
619
+ fixEncoderSize(getBytesEncoder(), 8).encode(
620
+ new Uint8Array([59, 56, 111, 43, 95, 14, 11, 61]),
621
+ ),
622
+ 0,
623
+ )
624
+ ) {
625
+ return BubblegumInstruction.UpdateAssetDataV2;
626
+ }
627
+ if (
628
+ containsBytes(
629
+ data,
630
+ fixEncoderSize(getBytesEncoder(), 8).encode(
631
+ new Uint8Array([170, 182, 43, 239, 97, 78, 225, 186]),
632
+ ),
633
+ 0,
634
+ )
635
+ ) {
636
+ return BubblegumInstruction.UpdateMetadata;
637
+ }
638
+ if (
639
+ containsBytes(
640
+ data,
641
+ fixEncoderSize(getBytesEncoder(), 8).encode(
642
+ new Uint8Array([43, 103, 89, 42, 121, 242, 62, 72]),
643
+ ),
644
+ 0,
645
+ )
646
+ ) {
647
+ return BubblegumInstruction.UpdateMetadataV2;
648
+ }
649
+ if (
650
+ containsBytes(
651
+ data,
652
+ fixEncoderSize(getBytesEncoder(), 8).encode(
653
+ new Uint8Array([56, 113, 101, 253, 79, 55, 122, 169]),
654
+ ),
655
+ 0,
656
+ )
657
+ ) {
658
+ return BubblegumInstruction.VerifyCollection;
659
+ }
660
+ if (
661
+ containsBytes(
662
+ data,
663
+ fixEncoderSize(getBytesEncoder(), 8).encode(
664
+ new Uint8Array([52, 17, 96, 132, 71, 4, 85, 194]),
665
+ ),
666
+ 0,
667
+ )
668
+ ) {
669
+ return BubblegumInstruction.VerifyCreator;
670
+ }
671
+ if (
672
+ containsBytes(
673
+ data,
674
+ fixEncoderSize(getBytesEncoder(), 8).encode(
675
+ new Uint8Array([85, 138, 140, 42, 22, 241, 118, 102]),
676
+ ),
677
+ 0,
678
+ )
679
+ ) {
680
+ return BubblegumInstruction.VerifyCreatorV2;
681
+ }
682
+ throw new SolanaError(
683
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
684
+ { instructionData: data, programName: "bubblegum" },
685
+ );
686
+ }
687
+
688
+ export type ParsedBubblegumInstruction<
689
+ TProgram extends string = "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY",
690
+ > =
691
+ | ({
692
+ instructionType: BubblegumInstruction.Burn;
693
+ } & ParsedBurnInstruction<TProgram>)
694
+ | ({
695
+ instructionType: BubblegumInstruction.BurnV2;
696
+ } & ParsedBurnV2Instruction<TProgram>)
697
+ | ({
698
+ instructionType: BubblegumInstruction.CancelRedeem;
699
+ } & ParsedCancelRedeemInstruction<TProgram>)
700
+ | ({
701
+ instructionType: BubblegumInstruction.CloseTreeV2;
702
+ } & ParsedCloseTreeV2Instruction<TProgram>)
703
+ | ({
704
+ instructionType: BubblegumInstruction.CollectV2;
705
+ } & ParsedCollectV2Instruction<TProgram>)
706
+ | ({
707
+ instructionType: BubblegumInstruction.Compress;
708
+ } & ParsedCompressInstruction<TProgram>)
709
+ | ({
710
+ instructionType: BubblegumInstruction.CreateTree;
711
+ } & ParsedCreateTreeInstruction<TProgram>)
712
+ | ({
713
+ instructionType: BubblegumInstruction.CreateTreeV2;
714
+ } & ParsedCreateTreeV2Instruction<TProgram>)
715
+ | ({
716
+ instructionType: BubblegumInstruction.DecompressV1;
717
+ } & ParsedDecompressV1Instruction<TProgram>)
718
+ | ({
719
+ instructionType: BubblegumInstruction.Delegate;
720
+ } & ParsedDelegateInstruction<TProgram>)
721
+ | ({
722
+ instructionType: BubblegumInstruction.DelegateAndFreezeV2;
723
+ } & ParsedDelegateAndFreezeV2Instruction<TProgram>)
724
+ | ({
725
+ instructionType: BubblegumInstruction.DelegateV2;
726
+ } & ParsedDelegateV2Instruction<TProgram>)
727
+ | ({
728
+ instructionType: BubblegumInstruction.FreezeV2;
729
+ } & ParsedFreezeV2Instruction<TProgram>)
730
+ | ({
731
+ instructionType: BubblegumInstruction.MintToCollectionV1;
732
+ } & ParsedMintToCollectionV1Instruction<TProgram>)
733
+ | ({
734
+ instructionType: BubblegumInstruction.MintV1;
735
+ } & ParsedMintV1Instruction<TProgram>)
736
+ | ({
737
+ instructionType: BubblegumInstruction.MintV2;
738
+ } & ParsedMintV2Instruction<TProgram>)
739
+ | ({
740
+ instructionType: BubblegumInstruction.Redeem;
741
+ } & ParsedRedeemInstruction<TProgram>)
742
+ | ({
743
+ instructionType: BubblegumInstruction.SetAndVerifyCollection;
744
+ } & ParsedSetAndVerifyCollectionInstruction<TProgram>)
745
+ | ({
746
+ instructionType: BubblegumInstruction.SetCollectionV2;
747
+ } & ParsedSetCollectionV2Instruction<TProgram>)
748
+ | ({
749
+ instructionType: BubblegumInstruction.SetDecompressableState;
750
+ } & ParsedSetDecompressableStateInstruction<TProgram>)
751
+ | ({
752
+ instructionType: BubblegumInstruction.SetDecompressibleState;
753
+ } & ParsedSetDecompressibleStateInstruction<TProgram>)
754
+ | ({
755
+ instructionType: BubblegumInstruction.SetNonTransferableV2;
756
+ } & ParsedSetNonTransferableV2Instruction<TProgram>)
757
+ | ({
758
+ instructionType: BubblegumInstruction.SetTreeDelegate;
759
+ } & ParsedSetTreeDelegateInstruction<TProgram>)
760
+ | ({
761
+ instructionType: BubblegumInstruction.ThawAndRevokeV2;
762
+ } & ParsedThawAndRevokeV2Instruction<TProgram>)
763
+ | ({
764
+ instructionType: BubblegumInstruction.ThawV2;
765
+ } & ParsedThawV2Instruction<TProgram>)
766
+ | ({
767
+ instructionType: BubblegumInstruction.Transfer;
768
+ } & ParsedTransferInstruction<TProgram>)
769
+ | ({
770
+ instructionType: BubblegumInstruction.TransferV2;
771
+ } & ParsedTransferV2Instruction<TProgram>)
772
+ | ({
773
+ instructionType: BubblegumInstruction.UnverifyCollection;
774
+ } & ParsedUnverifyCollectionInstruction<TProgram>)
775
+ | ({
776
+ instructionType: BubblegumInstruction.UnverifyCreator;
777
+ } & ParsedUnverifyCreatorInstruction<TProgram>)
778
+ | ({
779
+ instructionType: BubblegumInstruction.UnverifyCreatorV2;
780
+ } & ParsedUnverifyCreatorV2Instruction<TProgram>)
781
+ | ({
782
+ instructionType: BubblegumInstruction.UpdateAssetDataV2;
783
+ } & ParsedUpdateAssetDataV2Instruction<TProgram>)
784
+ | ({
785
+ instructionType: BubblegumInstruction.UpdateMetadata;
786
+ } & ParsedUpdateMetadataInstruction<TProgram>)
787
+ | ({
788
+ instructionType: BubblegumInstruction.UpdateMetadataV2;
789
+ } & ParsedUpdateMetadataV2Instruction<TProgram>)
790
+ | ({
791
+ instructionType: BubblegumInstruction.VerifyCollection;
792
+ } & ParsedVerifyCollectionInstruction<TProgram>)
793
+ | ({
794
+ instructionType: BubblegumInstruction.VerifyCreator;
795
+ } & ParsedVerifyCreatorInstruction<TProgram>)
796
+ | ({
797
+ instructionType: BubblegumInstruction.VerifyCreatorV2;
798
+ } & ParsedVerifyCreatorV2Instruction<TProgram>);
799
+
800
+ export function parseBubblegumInstruction<TProgram extends string>(
801
+ instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,
802
+ ): ParsedBubblegumInstruction<TProgram> {
803
+ const instructionType = identifyBubblegumInstruction(instruction);
804
+ switch (instructionType) {
805
+ case BubblegumInstruction.Burn: {
806
+ assertIsInstructionWithAccounts(instruction);
807
+ return {
808
+ instructionType: BubblegumInstruction.Burn,
809
+ ...parseBurnInstruction(instruction),
810
+ };
811
+ }
812
+ case BubblegumInstruction.BurnV2: {
813
+ assertIsInstructionWithAccounts(instruction);
814
+ return {
815
+ instructionType: BubblegumInstruction.BurnV2,
816
+ ...parseBurnV2Instruction(instruction),
817
+ };
818
+ }
819
+ case BubblegumInstruction.CancelRedeem: {
820
+ assertIsInstructionWithAccounts(instruction);
821
+ return {
822
+ instructionType: BubblegumInstruction.CancelRedeem,
823
+ ...parseCancelRedeemInstruction(instruction),
824
+ };
825
+ }
826
+ case BubblegumInstruction.CloseTreeV2: {
827
+ assertIsInstructionWithAccounts(instruction);
828
+ return {
829
+ instructionType: BubblegumInstruction.CloseTreeV2,
830
+ ...parseCloseTreeV2Instruction(instruction),
831
+ };
832
+ }
833
+ case BubblegumInstruction.CollectV2: {
834
+ assertIsInstructionWithAccounts(instruction);
835
+ return {
836
+ instructionType: BubblegumInstruction.CollectV2,
837
+ ...parseCollectV2Instruction(instruction),
838
+ };
839
+ }
840
+ case BubblegumInstruction.Compress: {
841
+ assertIsInstructionWithAccounts(instruction);
842
+ return {
843
+ instructionType: BubblegumInstruction.Compress,
844
+ ...parseCompressInstruction(instruction),
845
+ };
846
+ }
847
+ case BubblegumInstruction.CreateTree: {
848
+ assertIsInstructionWithAccounts(instruction);
849
+ return {
850
+ instructionType: BubblegumInstruction.CreateTree,
851
+ ...parseCreateTreeInstruction(instruction),
852
+ };
853
+ }
854
+ case BubblegumInstruction.CreateTreeV2: {
855
+ assertIsInstructionWithAccounts(instruction);
856
+ return {
857
+ instructionType: BubblegumInstruction.CreateTreeV2,
858
+ ...parseCreateTreeV2Instruction(instruction),
859
+ };
860
+ }
861
+ case BubblegumInstruction.DecompressV1: {
862
+ assertIsInstructionWithAccounts(instruction);
863
+ return {
864
+ instructionType: BubblegumInstruction.DecompressV1,
865
+ ...parseDecompressV1Instruction(instruction),
866
+ };
867
+ }
868
+ case BubblegumInstruction.Delegate: {
869
+ assertIsInstructionWithAccounts(instruction);
870
+ return {
871
+ instructionType: BubblegumInstruction.Delegate,
872
+ ...parseDelegateInstruction(instruction),
873
+ };
874
+ }
875
+ case BubblegumInstruction.DelegateAndFreezeV2: {
876
+ assertIsInstructionWithAccounts(instruction);
877
+ return {
878
+ instructionType: BubblegumInstruction.DelegateAndFreezeV2,
879
+ ...parseDelegateAndFreezeV2Instruction(instruction),
880
+ };
881
+ }
882
+ case BubblegumInstruction.DelegateV2: {
883
+ assertIsInstructionWithAccounts(instruction);
884
+ return {
885
+ instructionType: BubblegumInstruction.DelegateV2,
886
+ ...parseDelegateV2Instruction(instruction),
887
+ };
888
+ }
889
+ case BubblegumInstruction.FreezeV2: {
890
+ assertIsInstructionWithAccounts(instruction);
891
+ return {
892
+ instructionType: BubblegumInstruction.FreezeV2,
893
+ ...parseFreezeV2Instruction(instruction),
894
+ };
895
+ }
896
+ case BubblegumInstruction.MintToCollectionV1: {
897
+ assertIsInstructionWithAccounts(instruction);
898
+ return {
899
+ instructionType: BubblegumInstruction.MintToCollectionV1,
900
+ ...parseMintToCollectionV1Instruction(instruction),
901
+ };
902
+ }
903
+ case BubblegumInstruction.MintV1: {
904
+ assertIsInstructionWithAccounts(instruction);
905
+ return {
906
+ instructionType: BubblegumInstruction.MintV1,
907
+ ...parseMintV1Instruction(instruction),
908
+ };
909
+ }
910
+ case BubblegumInstruction.MintV2: {
911
+ assertIsInstructionWithAccounts(instruction);
912
+ return {
913
+ instructionType: BubblegumInstruction.MintV2,
914
+ ...parseMintV2Instruction(instruction),
915
+ };
916
+ }
917
+ case BubblegumInstruction.Redeem: {
918
+ assertIsInstructionWithAccounts(instruction);
919
+ return {
920
+ instructionType: BubblegumInstruction.Redeem,
921
+ ...parseRedeemInstruction(instruction),
922
+ };
923
+ }
924
+ case BubblegumInstruction.SetAndVerifyCollection: {
925
+ assertIsInstructionWithAccounts(instruction);
926
+ return {
927
+ instructionType: BubblegumInstruction.SetAndVerifyCollection,
928
+ ...parseSetAndVerifyCollectionInstruction(instruction),
929
+ };
930
+ }
931
+ case BubblegumInstruction.SetCollectionV2: {
932
+ assertIsInstructionWithAccounts(instruction);
933
+ return {
934
+ instructionType: BubblegumInstruction.SetCollectionV2,
935
+ ...parseSetCollectionV2Instruction(instruction),
936
+ };
937
+ }
938
+ case BubblegumInstruction.SetDecompressableState: {
939
+ assertIsInstructionWithAccounts(instruction);
940
+ return {
941
+ instructionType: BubblegumInstruction.SetDecompressableState,
942
+ ...parseSetDecompressableStateInstruction(instruction),
943
+ };
944
+ }
945
+ case BubblegumInstruction.SetDecompressibleState: {
946
+ assertIsInstructionWithAccounts(instruction);
947
+ return {
948
+ instructionType: BubblegumInstruction.SetDecompressibleState,
949
+ ...parseSetDecompressibleStateInstruction(instruction),
950
+ };
951
+ }
952
+ case BubblegumInstruction.SetNonTransferableV2: {
953
+ assertIsInstructionWithAccounts(instruction);
954
+ return {
955
+ instructionType: BubblegumInstruction.SetNonTransferableV2,
956
+ ...parseSetNonTransferableV2Instruction(instruction),
957
+ };
958
+ }
959
+ case BubblegumInstruction.SetTreeDelegate: {
960
+ assertIsInstructionWithAccounts(instruction);
961
+ return {
962
+ instructionType: BubblegumInstruction.SetTreeDelegate,
963
+ ...parseSetTreeDelegateInstruction(instruction),
964
+ };
965
+ }
966
+ case BubblegumInstruction.ThawAndRevokeV2: {
967
+ assertIsInstructionWithAccounts(instruction);
968
+ return {
969
+ instructionType: BubblegumInstruction.ThawAndRevokeV2,
970
+ ...parseThawAndRevokeV2Instruction(instruction),
971
+ };
972
+ }
973
+ case BubblegumInstruction.ThawV2: {
974
+ assertIsInstructionWithAccounts(instruction);
975
+ return {
976
+ instructionType: BubblegumInstruction.ThawV2,
977
+ ...parseThawV2Instruction(instruction),
978
+ };
979
+ }
980
+ case BubblegumInstruction.Transfer: {
981
+ assertIsInstructionWithAccounts(instruction);
982
+ return {
983
+ instructionType: BubblegumInstruction.Transfer,
984
+ ...parseTransferInstruction(instruction),
985
+ };
986
+ }
987
+ case BubblegumInstruction.TransferV2: {
988
+ assertIsInstructionWithAccounts(instruction);
989
+ return {
990
+ instructionType: BubblegumInstruction.TransferV2,
991
+ ...parseTransferV2Instruction(instruction),
992
+ };
993
+ }
994
+ case BubblegumInstruction.UnverifyCollection: {
995
+ assertIsInstructionWithAccounts(instruction);
996
+ return {
997
+ instructionType: BubblegumInstruction.UnverifyCollection,
998
+ ...parseUnverifyCollectionInstruction(instruction),
999
+ };
1000
+ }
1001
+ case BubblegumInstruction.UnverifyCreator: {
1002
+ assertIsInstructionWithAccounts(instruction);
1003
+ return {
1004
+ instructionType: BubblegumInstruction.UnverifyCreator,
1005
+ ...parseUnverifyCreatorInstruction(instruction),
1006
+ };
1007
+ }
1008
+ case BubblegumInstruction.UnverifyCreatorV2: {
1009
+ assertIsInstructionWithAccounts(instruction);
1010
+ return {
1011
+ instructionType: BubblegumInstruction.UnverifyCreatorV2,
1012
+ ...parseUnverifyCreatorV2Instruction(instruction),
1013
+ };
1014
+ }
1015
+ case BubblegumInstruction.UpdateAssetDataV2: {
1016
+ assertIsInstructionWithAccounts(instruction);
1017
+ return {
1018
+ instructionType: BubblegumInstruction.UpdateAssetDataV2,
1019
+ ...parseUpdateAssetDataV2Instruction(instruction),
1020
+ };
1021
+ }
1022
+ case BubblegumInstruction.UpdateMetadata: {
1023
+ assertIsInstructionWithAccounts(instruction);
1024
+ return {
1025
+ instructionType: BubblegumInstruction.UpdateMetadata,
1026
+ ...parseUpdateMetadataInstruction(instruction),
1027
+ };
1028
+ }
1029
+ case BubblegumInstruction.UpdateMetadataV2: {
1030
+ assertIsInstructionWithAccounts(instruction);
1031
+ return {
1032
+ instructionType: BubblegumInstruction.UpdateMetadataV2,
1033
+ ...parseUpdateMetadataV2Instruction(instruction),
1034
+ };
1035
+ }
1036
+ case BubblegumInstruction.VerifyCollection: {
1037
+ assertIsInstructionWithAccounts(instruction);
1038
+ return {
1039
+ instructionType: BubblegumInstruction.VerifyCollection,
1040
+ ...parseVerifyCollectionInstruction(instruction),
1041
+ };
1042
+ }
1043
+ case BubblegumInstruction.VerifyCreator: {
1044
+ assertIsInstructionWithAccounts(instruction);
1045
+ return {
1046
+ instructionType: BubblegumInstruction.VerifyCreator,
1047
+ ...parseVerifyCreatorInstruction(instruction),
1048
+ };
1049
+ }
1050
+ case BubblegumInstruction.VerifyCreatorV2: {
1051
+ assertIsInstructionWithAccounts(instruction);
1052
+ return {
1053
+ instructionType: BubblegumInstruction.VerifyCreatorV2,
1054
+ ...parseVerifyCreatorV2Instruction(instruction),
1055
+ };
1056
+ }
1057
+ default:
1058
+ throw new SolanaError(
1059
+ SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
1060
+ {
1061
+ instructionType: instructionType as string,
1062
+ programName: "bubblegum",
1063
+ },
1064
+ );
1065
+ }
1066
+ }
1067
+
1068
+ export interface BubblegumPlugin {
1069
+ accounts: BubblegumPluginAccounts;
1070
+ instructions: BubblegumPluginInstructions;
1071
+ pdas: BubblegumPluginPdas;
1072
+ }
1073
+
1074
+ export interface BubblegumPluginAccounts {
1075
+ treeConfig: ReturnType<typeof getTreeConfigCodec> &
1076
+ SelfFetchFunctions<TreeConfigArgs, TreeConfig>;
1077
+ voucher: ReturnType<typeof getVoucherCodec> &
1078
+ SelfFetchFunctions<VoucherArgs, Voucher>;
1079
+ }
1080
+
1081
+ export interface BubblegumPluginInstructions {
1082
+ burn: (
1083
+ input: BurnAsyncInput,
1084
+ ) => ReturnType<typeof getBurnInstructionAsync> & SelfPlanAndSendFunctions;
1085
+ burnV2: (
1086
+ input: MakeOptional<BurnV2AsyncInput, "payer">,
1087
+ ) => ReturnType<typeof getBurnV2InstructionAsync> & SelfPlanAndSendFunctions;
1088
+ cancelRedeem: (
1089
+ input: CancelRedeemAsyncInput,
1090
+ ) => ReturnType<typeof getCancelRedeemInstructionAsync> &
1091
+ SelfPlanAndSendFunctions;
1092
+ closeTreeV2: (
1093
+ input: CloseTreeV2AsyncInput,
1094
+ ) => ReturnType<typeof getCloseTreeV2InstructionAsync> &
1095
+ SelfPlanAndSendFunctions;
1096
+ collectV2: (
1097
+ input: CollectV2Input,
1098
+ ) => ReturnType<typeof getCollectV2Instruction> & SelfPlanAndSendFunctions;
1099
+ compress: (
1100
+ input: MakeOptional<CompressAsyncInput, "payer">,
1101
+ ) => ReturnType<typeof getCompressInstructionAsync> &
1102
+ SelfPlanAndSendFunctions;
1103
+ createTree: (
1104
+ input: MakeOptional<CreateTreeAsyncInput, "payer">,
1105
+ ) => ReturnType<typeof getCreateTreeInstructionAsync> &
1106
+ SelfPlanAndSendFunctions;
1107
+ createTreeV2: (
1108
+ input: MakeOptional<CreateTreeV2AsyncInput, "payer">,
1109
+ ) => ReturnType<typeof getCreateTreeV2InstructionAsync> &
1110
+ SelfPlanAndSendFunctions;
1111
+ decompressV1: (
1112
+ input: DecompressV1AsyncInput,
1113
+ ) => ReturnType<typeof getDecompressV1InstructionAsync> &
1114
+ SelfPlanAndSendFunctions;
1115
+ delegate: (
1116
+ input: DelegateAsyncInput,
1117
+ ) => ReturnType<typeof getDelegateInstructionAsync> &
1118
+ SelfPlanAndSendFunctions;
1119
+ delegateAndFreezeV2: (
1120
+ input: MakeOptional<DelegateAndFreezeV2AsyncInput, "payer">,
1121
+ ) => ReturnType<typeof getDelegateAndFreezeV2InstructionAsync> &
1122
+ SelfPlanAndSendFunctions;
1123
+ delegateV2: (
1124
+ input: MakeOptional<DelegateV2AsyncInput, "payer">,
1125
+ ) => ReturnType<typeof getDelegateV2InstructionAsync> &
1126
+ SelfPlanAndSendFunctions;
1127
+ freezeV2: (
1128
+ input: MakeOptional<FreezeV2AsyncInput, "payer">,
1129
+ ) => ReturnType<typeof getFreezeV2InstructionAsync> &
1130
+ SelfPlanAndSendFunctions;
1131
+ mintToCollectionV1: (
1132
+ input: MakeOptional<MintToCollectionV1AsyncInput, "payer">,
1133
+ ) => ReturnType<typeof getMintToCollectionV1InstructionAsync> &
1134
+ SelfPlanAndSendFunctions;
1135
+ mintV1: (
1136
+ input: MakeOptional<MintV1AsyncInput, "payer">,
1137
+ ) => ReturnType<typeof getMintV1InstructionAsync> & SelfPlanAndSendFunctions;
1138
+ mintV2: (
1139
+ input: MakeOptional<MintV2AsyncInput, "payer">,
1140
+ ) => ReturnType<typeof getMintV2InstructionAsync> & SelfPlanAndSendFunctions;
1141
+ redeem: (
1142
+ input: RedeemAsyncInput,
1143
+ ) => ReturnType<typeof getRedeemInstructionAsync> & SelfPlanAndSendFunctions;
1144
+ setAndVerifyCollection: (
1145
+ input: MakeOptional<SetAndVerifyCollectionAsyncInput, "payer">,
1146
+ ) => ReturnType<typeof getSetAndVerifyCollectionInstructionAsync> &
1147
+ SelfPlanAndSendFunctions;
1148
+ setCollectionV2: (
1149
+ input: MakeOptional<SetCollectionV2AsyncInput, "payer">,
1150
+ ) => ReturnType<typeof getSetCollectionV2InstructionAsync> &
1151
+ SelfPlanAndSendFunctions;
1152
+ setDecompressableState: (
1153
+ input: SetDecompressableStateInput,
1154
+ ) => ReturnType<typeof getSetDecompressableStateInstruction> &
1155
+ SelfPlanAndSendFunctions;
1156
+ setDecompressibleState: (
1157
+ input: SetDecompressibleStateInput,
1158
+ ) => ReturnType<typeof getSetDecompressibleStateInstruction> &
1159
+ SelfPlanAndSendFunctions;
1160
+ setNonTransferableV2: (
1161
+ input: MakeOptional<SetNonTransferableV2AsyncInput, "payer">,
1162
+ ) => ReturnType<typeof getSetNonTransferableV2InstructionAsync> &
1163
+ SelfPlanAndSendFunctions;
1164
+ setTreeDelegate: (
1165
+ input: SetTreeDelegateAsyncInput,
1166
+ ) => ReturnType<typeof getSetTreeDelegateInstructionAsync> &
1167
+ SelfPlanAndSendFunctions;
1168
+ thawAndRevokeV2: (
1169
+ input: MakeOptional<ThawAndRevokeV2AsyncInput, "payer">,
1170
+ ) => ReturnType<typeof getThawAndRevokeV2InstructionAsync> &
1171
+ SelfPlanAndSendFunctions;
1172
+ thawV2: (
1173
+ input: MakeOptional<ThawV2AsyncInput, "payer">,
1174
+ ) => ReturnType<typeof getThawV2InstructionAsync> & SelfPlanAndSendFunctions;
1175
+ transfer: (
1176
+ input: TransferAsyncInput,
1177
+ ) => ReturnType<typeof getTransferInstructionAsync> &
1178
+ SelfPlanAndSendFunctions;
1179
+ transferV2: (
1180
+ input: MakeOptional<TransferV2AsyncInput, "payer">,
1181
+ ) => ReturnType<typeof getTransferV2InstructionAsync> &
1182
+ SelfPlanAndSendFunctions;
1183
+ unverifyCollection: (
1184
+ input: MakeOptional<UnverifyCollectionAsyncInput, "payer">,
1185
+ ) => ReturnType<typeof getUnverifyCollectionInstructionAsync> &
1186
+ SelfPlanAndSendFunctions;
1187
+ unverifyCreator: (
1188
+ input: MakeOptional<UnverifyCreatorAsyncInput, "payer">,
1189
+ ) => ReturnType<typeof getUnverifyCreatorInstructionAsync> &
1190
+ SelfPlanAndSendFunctions;
1191
+ unverifyCreatorV2: (
1192
+ input: MakeOptional<UnverifyCreatorV2AsyncInput, "payer">,
1193
+ ) => ReturnType<typeof getUnverifyCreatorV2InstructionAsync> &
1194
+ SelfPlanAndSendFunctions;
1195
+ updateAssetDataV2: (
1196
+ input: MakeOptional<UpdateAssetDataV2AsyncInput, "payer">,
1197
+ ) => ReturnType<typeof getUpdateAssetDataV2InstructionAsync> &
1198
+ SelfPlanAndSendFunctions;
1199
+ updateMetadata: (
1200
+ input: MakeOptional<UpdateMetadataAsyncInput, "payer">,
1201
+ ) => ReturnType<typeof getUpdateMetadataInstructionAsync> &
1202
+ SelfPlanAndSendFunctions;
1203
+ updateMetadataV2: (
1204
+ input: MakeOptional<UpdateMetadataV2AsyncInput, "payer">,
1205
+ ) => ReturnType<typeof getUpdateMetadataV2InstructionAsync> &
1206
+ SelfPlanAndSendFunctions;
1207
+ verifyCollection: (
1208
+ input: MakeOptional<VerifyCollectionAsyncInput, "payer">,
1209
+ ) => ReturnType<typeof getVerifyCollectionInstructionAsync> &
1210
+ SelfPlanAndSendFunctions;
1211
+ verifyCreator: (
1212
+ input: MakeOptional<VerifyCreatorAsyncInput, "payer">,
1213
+ ) => ReturnType<typeof getVerifyCreatorInstructionAsync> &
1214
+ SelfPlanAndSendFunctions;
1215
+ verifyCreatorV2: (
1216
+ input: MakeOptional<VerifyCreatorV2AsyncInput, "payer">,
1217
+ ) => ReturnType<typeof getVerifyCreatorV2InstructionAsync> &
1218
+ SelfPlanAndSendFunctions;
1219
+ }
1220
+
1221
+ export interface BubblegumPluginPdas {
1222
+ treeConfig: typeof findTreeConfigPda;
1223
+ voucher: typeof findVoucherPda;
1224
+ assetId: typeof findAssetIdPda;
1225
+ bubblegumSigner: typeof findBubblegumSignerPda;
1226
+ mintAuthority: typeof findMintAuthorityPda;
1227
+ }
1228
+
1229
+ export type BubblegumPluginRequirements = ClientWithRpc<
1230
+ GetAccountInfoApi & GetMultipleAccountsApi
1231
+ > &
1232
+ ClientWithPayer &
1233
+ ClientWithTransactionPlanning &
1234
+ ClientWithTransactionSending;
1235
+
1236
+ export function bubblegumProgram() {
1237
+ return <T extends BubblegumPluginRequirements>(
1238
+ client: T,
1239
+ ): Omit<T, "bubblegum"> & { bubblegum: BubblegumPlugin } => {
1240
+ return extendClient(client, {
1241
+ bubblegum: <BubblegumPlugin>{
1242
+ accounts: {
1243
+ treeConfig: addSelfFetchFunctions(client, getTreeConfigCodec()),
1244
+ voucher: addSelfFetchFunctions(client, getVoucherCodec()),
1245
+ },
1246
+ instructions: {
1247
+ burn: (input) =>
1248
+ addSelfPlanAndSendFunctions(client, getBurnInstructionAsync(input)),
1249
+ burnV2: (input) =>
1250
+ addSelfPlanAndSendFunctions(
1251
+ client,
1252
+ getBurnV2InstructionAsync({
1253
+ ...input,
1254
+ payer: input.payer ?? client.payer,
1255
+ }),
1256
+ ),
1257
+ cancelRedeem: (input) =>
1258
+ addSelfPlanAndSendFunctions(
1259
+ client,
1260
+ getCancelRedeemInstructionAsync(input),
1261
+ ),
1262
+ closeTreeV2: (input) =>
1263
+ addSelfPlanAndSendFunctions(
1264
+ client,
1265
+ getCloseTreeV2InstructionAsync(input),
1266
+ ),
1267
+ collectV2: (input) =>
1268
+ addSelfPlanAndSendFunctions(client, getCollectV2Instruction(input)),
1269
+ compress: (input) =>
1270
+ addSelfPlanAndSendFunctions(
1271
+ client,
1272
+ getCompressInstructionAsync({
1273
+ ...input,
1274
+ payer: input.payer ?? client.payer,
1275
+ }),
1276
+ ),
1277
+ createTree: (input) =>
1278
+ addSelfPlanAndSendFunctions(
1279
+ client,
1280
+ getCreateTreeInstructionAsync({
1281
+ ...input,
1282
+ payer: input.payer ?? client.payer,
1283
+ }),
1284
+ ),
1285
+ createTreeV2: (input) =>
1286
+ addSelfPlanAndSendFunctions(
1287
+ client,
1288
+ getCreateTreeV2InstructionAsync({
1289
+ ...input,
1290
+ payer: input.payer ?? client.payer,
1291
+ }),
1292
+ ),
1293
+ decompressV1: (input) =>
1294
+ addSelfPlanAndSendFunctions(
1295
+ client,
1296
+ getDecompressV1InstructionAsync(input),
1297
+ ),
1298
+ delegate: (input) =>
1299
+ addSelfPlanAndSendFunctions(
1300
+ client,
1301
+ getDelegateInstructionAsync(input),
1302
+ ),
1303
+ delegateAndFreezeV2: (input) =>
1304
+ addSelfPlanAndSendFunctions(
1305
+ client,
1306
+ getDelegateAndFreezeV2InstructionAsync({
1307
+ ...input,
1308
+ payer: input.payer ?? client.payer,
1309
+ }),
1310
+ ),
1311
+ delegateV2: (input) =>
1312
+ addSelfPlanAndSendFunctions(
1313
+ client,
1314
+ getDelegateV2InstructionAsync({
1315
+ ...input,
1316
+ payer: input.payer ?? client.payer,
1317
+ }),
1318
+ ),
1319
+ freezeV2: (input) =>
1320
+ addSelfPlanAndSendFunctions(
1321
+ client,
1322
+ getFreezeV2InstructionAsync({
1323
+ ...input,
1324
+ payer: input.payer ?? client.payer,
1325
+ }),
1326
+ ),
1327
+ mintToCollectionV1: (input) =>
1328
+ addSelfPlanAndSendFunctions(
1329
+ client,
1330
+ getMintToCollectionV1InstructionAsync({
1331
+ ...input,
1332
+ payer: input.payer ?? client.payer,
1333
+ }),
1334
+ ),
1335
+ mintV1: (input) =>
1336
+ addSelfPlanAndSendFunctions(
1337
+ client,
1338
+ getMintV1InstructionAsync({
1339
+ ...input,
1340
+ payer: input.payer ?? client.payer,
1341
+ }),
1342
+ ),
1343
+ mintV2: (input) =>
1344
+ addSelfPlanAndSendFunctions(
1345
+ client,
1346
+ getMintV2InstructionAsync({
1347
+ ...input,
1348
+ payer: input.payer ?? client.payer,
1349
+ }),
1350
+ ),
1351
+ redeem: (input) =>
1352
+ addSelfPlanAndSendFunctions(
1353
+ client,
1354
+ getRedeemInstructionAsync(input),
1355
+ ),
1356
+ setAndVerifyCollection: (input) =>
1357
+ addSelfPlanAndSendFunctions(
1358
+ client,
1359
+ getSetAndVerifyCollectionInstructionAsync({
1360
+ ...input,
1361
+ payer: input.payer ?? client.payer,
1362
+ }),
1363
+ ),
1364
+ setCollectionV2: (input) =>
1365
+ addSelfPlanAndSendFunctions(
1366
+ client,
1367
+ getSetCollectionV2InstructionAsync({
1368
+ ...input,
1369
+ payer: input.payer ?? client.payer,
1370
+ }),
1371
+ ),
1372
+ setDecompressableState: (input) =>
1373
+ addSelfPlanAndSendFunctions(
1374
+ client,
1375
+ getSetDecompressableStateInstruction(input),
1376
+ ),
1377
+ setDecompressibleState: (input) =>
1378
+ addSelfPlanAndSendFunctions(
1379
+ client,
1380
+ getSetDecompressibleStateInstruction(input),
1381
+ ),
1382
+ setNonTransferableV2: (input) =>
1383
+ addSelfPlanAndSendFunctions(
1384
+ client,
1385
+ getSetNonTransferableV2InstructionAsync({
1386
+ ...input,
1387
+ payer: input.payer ?? client.payer,
1388
+ }),
1389
+ ),
1390
+ setTreeDelegate: (input) =>
1391
+ addSelfPlanAndSendFunctions(
1392
+ client,
1393
+ getSetTreeDelegateInstructionAsync(input),
1394
+ ),
1395
+ thawAndRevokeV2: (input) =>
1396
+ addSelfPlanAndSendFunctions(
1397
+ client,
1398
+ getThawAndRevokeV2InstructionAsync({
1399
+ ...input,
1400
+ payer: input.payer ?? client.payer,
1401
+ }),
1402
+ ),
1403
+ thawV2: (input) =>
1404
+ addSelfPlanAndSendFunctions(
1405
+ client,
1406
+ getThawV2InstructionAsync({
1407
+ ...input,
1408
+ payer: input.payer ?? client.payer,
1409
+ }),
1410
+ ),
1411
+ transfer: (input) =>
1412
+ addSelfPlanAndSendFunctions(
1413
+ client,
1414
+ getTransferInstructionAsync(input),
1415
+ ),
1416
+ transferV2: (input) =>
1417
+ addSelfPlanAndSendFunctions(
1418
+ client,
1419
+ getTransferV2InstructionAsync({
1420
+ ...input,
1421
+ payer: input.payer ?? client.payer,
1422
+ }),
1423
+ ),
1424
+ unverifyCollection: (input) =>
1425
+ addSelfPlanAndSendFunctions(
1426
+ client,
1427
+ getUnverifyCollectionInstructionAsync({
1428
+ ...input,
1429
+ payer: input.payer ?? client.payer,
1430
+ }),
1431
+ ),
1432
+ unverifyCreator: (input) =>
1433
+ addSelfPlanAndSendFunctions(
1434
+ client,
1435
+ getUnverifyCreatorInstructionAsync({
1436
+ ...input,
1437
+ payer: input.payer ?? client.payer,
1438
+ }),
1439
+ ),
1440
+ unverifyCreatorV2: (input) =>
1441
+ addSelfPlanAndSendFunctions(
1442
+ client,
1443
+ getUnverifyCreatorV2InstructionAsync({
1444
+ ...input,
1445
+ payer: input.payer ?? client.payer,
1446
+ }),
1447
+ ),
1448
+ updateAssetDataV2: (input) =>
1449
+ addSelfPlanAndSendFunctions(
1450
+ client,
1451
+ getUpdateAssetDataV2InstructionAsync({
1452
+ ...input,
1453
+ payer: input.payer ?? client.payer,
1454
+ }),
1455
+ ),
1456
+ updateMetadata: (input) =>
1457
+ addSelfPlanAndSendFunctions(
1458
+ client,
1459
+ getUpdateMetadataInstructionAsync({
1460
+ ...input,
1461
+ payer: input.payer ?? client.payer,
1462
+ }),
1463
+ ),
1464
+ updateMetadataV2: (input) =>
1465
+ addSelfPlanAndSendFunctions(
1466
+ client,
1467
+ getUpdateMetadataV2InstructionAsync({
1468
+ ...input,
1469
+ payer: input.payer ?? client.payer,
1470
+ }),
1471
+ ),
1472
+ verifyCollection: (input) =>
1473
+ addSelfPlanAndSendFunctions(
1474
+ client,
1475
+ getVerifyCollectionInstructionAsync({
1476
+ ...input,
1477
+ payer: input.payer ?? client.payer,
1478
+ }),
1479
+ ),
1480
+ verifyCreator: (input) =>
1481
+ addSelfPlanAndSendFunctions(
1482
+ client,
1483
+ getVerifyCreatorInstructionAsync({
1484
+ ...input,
1485
+ payer: input.payer ?? client.payer,
1486
+ }),
1487
+ ),
1488
+ verifyCreatorV2: (input) =>
1489
+ addSelfPlanAndSendFunctions(
1490
+ client,
1491
+ getVerifyCreatorV2InstructionAsync({
1492
+ ...input,
1493
+ payer: input.payer ?? client.payer,
1494
+ }),
1495
+ ),
1496
+ },
1497
+ pdas: {
1498
+ treeConfig: findTreeConfigPda,
1499
+ voucher: findVoucherPda,
1500
+ assetId: findAssetIdPda,
1501
+ bubblegumSigner: findBubblegumSignerPda,
1502
+ mintAuthority: findMintAuthorityPda,
1503
+ },
1504
+ },
1505
+ });
1506
+ };
1507
+ }
1508
+
1509
+ type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;