@macalinao/clients-mpl-bubblegum 0.0.0 → 0.2.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 (313) hide show
  1. package/README.md +15 -1
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/generated/accounts/index.d.ts +10 -0
  4. package/dist/generated/accounts/index.d.ts.map +1 -0
  5. package/dist/generated/accounts/index.js +10 -0
  6. package/dist/generated/accounts/index.js.map +1 -0
  7. package/dist/generated/accounts/treeConfig.d.ts +44 -0
  8. package/dist/generated/accounts/treeConfig.d.ts.map +1 -0
  9. package/dist/generated/accounts/treeConfig.js +67 -0
  10. package/dist/generated/accounts/treeConfig.js.map +1 -0
  11. package/dist/generated/accounts/voucher.d.ts +36 -0
  12. package/dist/generated/accounts/voucher.d.ts.map +1 -0
  13. package/dist/generated/accounts/voucher.js +59 -0
  14. package/dist/generated/accounts/voucher.js.map +1 -0
  15. package/dist/generated/errors/bubblegum.d.ts +134 -0
  16. package/dist/generated/errors/bubblegum.d.ts.map +1 -0
  17. package/dist/generated/errors/bubblegum.js +195 -0
  18. package/dist/generated/errors/bubblegum.js.map +1 -0
  19. package/dist/generated/errors/index.d.ts +9 -0
  20. package/dist/generated/errors/index.d.ts.map +1 -0
  21. package/dist/generated/errors/index.js +9 -0
  22. package/dist/generated/errors/index.js.map +1 -0
  23. package/dist/generated/index.d.ts +13 -0
  24. package/dist/generated/index.d.ts.map +1 -0
  25. package/dist/generated/index.js +13 -0
  26. package/dist/generated/index.js.map +1 -0
  27. package/dist/generated/instructions/burn.d.ts +71 -0
  28. package/dist/generated/instructions/burn.d.ts.map +1 -0
  29. package/dist/generated/instructions/burn.js +106 -0
  30. package/dist/generated/instructions/burn.js.map +1 -0
  31. package/dist/generated/instructions/burnV2.d.ts +102 -0
  32. package/dist/generated/instructions/burnV2.d.ts.map +1 -0
  33. package/dist/generated/instructions/burnV2.js +144 -0
  34. package/dist/generated/instructions/burnV2.js.map +1 -0
  35. package/dist/generated/instructions/cancelRedeem.d.ts +59 -0
  36. package/dist/generated/instructions/cancelRedeem.d.ts.map +1 -0
  37. package/dist/generated/instructions/cancelRedeem.js +98 -0
  38. package/dist/generated/instructions/cancelRedeem.js.map +1 -0
  39. package/dist/generated/instructions/closeTreeV2.d.ts +65 -0
  40. package/dist/generated/instructions/closeTreeV2.d.ts.map +1 -0
  41. package/dist/generated/instructions/closeTreeV2.js +92 -0
  42. package/dist/generated/instructions/closeTreeV2.js.map +1 -0
  43. package/dist/generated/instructions/collectV2.d.ts +40 -0
  44. package/dist/generated/instructions/collectV2.d.ts.map +1 -0
  45. package/dist/generated/instructions/collectV2.js +69 -0
  46. package/dist/generated/instructions/collectV2.js.map +1 -0
  47. package/dist/generated/instructions/compress.d.ts +76 -0
  48. package/dist/generated/instructions/compress.d.ts.map +1 -0
  49. package/dist/generated/instructions/compress.js +124 -0
  50. package/dist/generated/instructions/compress.js.map +1 -0
  51. package/dist/generated/instructions/createTree.d.ts +65 -0
  52. package/dist/generated/instructions/createTree.d.ts.map +1 -0
  53. package/dist/generated/instructions/createTree.js +102 -0
  54. package/dist/generated/instructions/createTree.js.map +1 -0
  55. package/dist/generated/instructions/createTreeV2.d.ts +67 -0
  56. package/dist/generated/instructions/createTreeV2.d.ts.map +1 -0
  57. package/dist/generated/instructions/createTreeV2.js +108 -0
  58. package/dist/generated/instructions/createTreeV2.js.map +1 -0
  59. package/dist/generated/instructions/decompressV1.d.ts +78 -0
  60. package/dist/generated/instructions/decompressV1.d.ts.map +1 -0
  61. package/dist/generated/instructions/decompressV1.js +136 -0
  62. package/dist/generated/instructions/decompressV1.js.map +1 -0
  63. package/dist/generated/instructions/delegate.d.ts +74 -0
  64. package/dist/generated/instructions/delegate.d.ts.map +1 -0
  65. package/dist/generated/instructions/delegate.js +115 -0
  66. package/dist/generated/instructions/delegate.js.map +1 -0
  67. package/dist/generated/instructions/delegateAndFreezeV2.d.ts +90 -0
  68. package/dist/generated/instructions/delegateAndFreezeV2.d.ts.map +1 -0
  69. package/dist/generated/instructions/delegateAndFreezeV2.js +143 -0
  70. package/dist/generated/instructions/delegateAndFreezeV2.js.map +1 -0
  71. package/dist/generated/instructions/delegateV2.d.ts +90 -0
  72. package/dist/generated/instructions/delegateV2.d.ts.map +1 -0
  73. package/dist/generated/instructions/delegateV2.js +142 -0
  74. package/dist/generated/instructions/delegateV2.js.map +1 -0
  75. package/dist/generated/instructions/freezeV2.d.ts +94 -0
  76. package/dist/generated/instructions/freezeV2.d.ts.map +1 -0
  77. package/dist/generated/instructions/freezeV2.js +131 -0
  78. package/dist/generated/instructions/freezeV2.js.map +1 -0
  79. package/dist/generated/instructions/index.d.ts +44 -0
  80. package/dist/generated/instructions/index.d.ts.map +1 -0
  81. package/dist/generated/instructions/index.js +44 -0
  82. package/dist/generated/instructions/index.js.map +1 -0
  83. package/dist/generated/instructions/mintToCollectionV1.d.ts +95 -0
  84. package/dist/generated/instructions/mintToCollectionV1.d.ts.map +1 -0
  85. package/dist/generated/instructions/mintToCollectionV1.js +146 -0
  86. package/dist/generated/instructions/mintToCollectionV1.js.map +1 -0
  87. package/dist/generated/instructions/mintV1.d.ts +66 -0
  88. package/dist/generated/instructions/mintV1.d.ts.map +1 -0
  89. package/dist/generated/instructions/mintV1.js +105 -0
  90. package/dist/generated/instructions/mintV1.js.map +1 -0
  91. package/dist/generated/instructions/mintV2.d.ts +88 -0
  92. package/dist/generated/instructions/mintV2.d.ts.map +1 -0
  93. package/dist/generated/instructions/mintV2.js +143 -0
  94. package/dist/generated/instructions/mintV2.js.map +1 -0
  95. package/dist/generated/instructions/redeem.d.ts +74 -0
  96. package/dist/generated/instructions/redeem.d.ts.map +1 -0
  97. package/dist/generated/instructions/redeem.js +109 -0
  98. package/dist/generated/instructions/redeem.js.map +1 -0
  99. package/dist/generated/instructions/setAndVerifyCollection.d.ts +123 -0
  100. package/dist/generated/instructions/setAndVerifyCollection.d.ts.map +1 -0
  101. package/dist/generated/instructions/setAndVerifyCollection.js +158 -0
  102. package/dist/generated/instructions/setAndVerifyCollection.js.map +1 -0
  103. package/dist/generated/instructions/setCollectionV2.d.ts +116 -0
  104. package/dist/generated/instructions/setCollectionV2.d.ts.map +1 -0
  105. package/dist/generated/instructions/setCollectionV2.js +153 -0
  106. package/dist/generated/instructions/setCollectionV2.js.map +1 -0
  107. package/dist/generated/instructions/setDecompressableState.d.ts +45 -0
  108. package/dist/generated/instructions/setDecompressableState.d.ts.map +1 -0
  109. package/dist/generated/instructions/setDecompressableState.js +77 -0
  110. package/dist/generated/instructions/setDecompressableState.js.map +1 -0
  111. package/dist/generated/instructions/setDecompressibleState.d.ts +45 -0
  112. package/dist/generated/instructions/setDecompressibleState.d.ts.map +1 -0
  113. package/dist/generated/instructions/setDecompressibleState.js +77 -0
  114. package/dist/generated/instructions/setDecompressibleState.js.map +1 -0
  115. package/dist/generated/instructions/setNonTransferableV2.d.ts +96 -0
  116. package/dist/generated/instructions/setNonTransferableV2.d.ts.map +1 -0
  117. package/dist/generated/instructions/setNonTransferableV2.js +132 -0
  118. package/dist/generated/instructions/setNonTransferableV2.js.map +1 -0
  119. package/dist/generated/instructions/setTreeDelegate.d.ts +49 -0
  120. package/dist/generated/instructions/setTreeDelegate.d.ts.map +1 -0
  121. package/dist/generated/instructions/setTreeDelegate.js +84 -0
  122. package/dist/generated/instructions/setTreeDelegate.js.map +1 -0
  123. package/dist/generated/instructions/thawAndRevokeV2.d.ts +85 -0
  124. package/dist/generated/instructions/thawAndRevokeV2.d.ts.map +1 -0
  125. package/dist/generated/instructions/thawAndRevokeV2.js +131 -0
  126. package/dist/generated/instructions/thawAndRevokeV2.js.map +1 -0
  127. package/dist/generated/instructions/thawV2.d.ts +94 -0
  128. package/dist/generated/instructions/thawV2.d.ts.map +1 -0
  129. package/dist/generated/instructions/thawV2.js +131 -0
  130. package/dist/generated/instructions/thawV2.js.map +1 -0
  131. package/dist/generated/instructions/transfer.d.ts +74 -0
  132. package/dist/generated/instructions/transfer.d.ts.map +1 -0
  133. package/dist/generated/instructions/transfer.js +109 -0
  134. package/dist/generated/instructions/transfer.js.map +1 -0
  135. package/dist/generated/instructions/transferV2.d.ts +99 -0
  136. package/dist/generated/instructions/transferV2.d.ts.map +1 -0
  137. package/dist/generated/instructions/transferV2.js +134 -0
  138. package/dist/generated/instructions/transferV2.js.map +1 -0
  139. package/dist/generated/instructions/unverifyCollection.d.ts +120 -0
  140. package/dist/generated/instructions/unverifyCollection.d.ts.map +1 -0
  141. package/dist/generated/instructions/unverifyCollection.js +153 -0
  142. package/dist/generated/instructions/unverifyCollection.js.map +1 -0
  143. package/dist/generated/instructions/unverifyCreator.d.ts +81 -0
  144. package/dist/generated/instructions/unverifyCreator.d.ts.map +1 -0
  145. package/dist/generated/instructions/unverifyCreator.js +113 -0
  146. package/dist/generated/instructions/unverifyCreator.js.map +1 -0
  147. package/dist/generated/instructions/unverifyCreatorV2.d.ts +85 -0
  148. package/dist/generated/instructions/unverifyCreatorV2.d.ts.map +1 -0
  149. package/dist/generated/instructions/unverifyCreatorV2.js +125 -0
  150. package/dist/generated/instructions/unverifyCreatorV2.js.map +1 -0
  151. package/dist/generated/instructions/updateAssetDataV2.d.ts +101 -0
  152. package/dist/generated/instructions/updateAssetDataV2.d.ts.map +1 -0
  153. package/dist/generated/instructions/updateAssetDataV2.js +143 -0
  154. package/dist/generated/instructions/updateAssetDataV2.js.map +1 -0
  155. package/dist/generated/instructions/updateMetadata.d.ts +102 -0
  156. package/dist/generated/instructions/updateMetadata.d.ts.map +1 -0
  157. package/dist/generated/instructions/updateMetadata.js +142 -0
  158. package/dist/generated/instructions/updateMetadata.js.map +1 -0
  159. package/dist/generated/instructions/updateMetadataV2.d.ts +97 -0
  160. package/dist/generated/instructions/updateMetadataV2.d.ts.map +1 -0
  161. package/dist/generated/instructions/updateMetadataV2.js +130 -0
  162. package/dist/generated/instructions/updateMetadataV2.js.map +1 -0
  163. package/dist/generated/instructions/verifyCollection.d.ts +120 -0
  164. package/dist/generated/instructions/verifyCollection.d.ts.map +1 -0
  165. package/dist/generated/instructions/verifyCollection.js +153 -0
  166. package/dist/generated/instructions/verifyCollection.js.map +1 -0
  167. package/dist/generated/instructions/verifyCreator.d.ts +81 -0
  168. package/dist/generated/instructions/verifyCreator.d.ts.map +1 -0
  169. package/dist/generated/instructions/verifyCreator.js +115 -0
  170. package/dist/generated/instructions/verifyCreator.js.map +1 -0
  171. package/dist/generated/instructions/verifyCreatorV2.d.ts +85 -0
  172. package/dist/generated/instructions/verifyCreatorV2.d.ts.map +1 -0
  173. package/dist/generated/instructions/verifyCreatorV2.js +125 -0
  174. package/dist/generated/instructions/verifyCreatorV2.js.map +1 -0
  175. package/dist/generated/programs/bubblegum.d.ts +189 -0
  176. package/dist/generated/programs/bubblegum.d.ts.map +1 -0
  177. package/dist/generated/programs/bubblegum.js +566 -0
  178. package/dist/generated/programs/bubblegum.js.map +1 -0
  179. package/dist/generated/programs/index.d.ts +9 -0
  180. package/dist/generated/programs/index.d.ts.map +1 -0
  181. package/dist/generated/programs/index.js +9 -0
  182. package/dist/generated/programs/index.js.map +1 -0
  183. package/dist/generated/types/assetDataSchema.d.ts +18 -0
  184. package/dist/generated/types/assetDataSchema.d.ts.map +1 -0
  185. package/dist/generated/types/assetDataSchema.js +24 -0
  186. package/dist/generated/types/assetDataSchema.js.map +1 -0
  187. package/dist/generated/types/bubblegumEventType.d.ts +17 -0
  188. package/dist/generated/types/bubblegumEventType.d.ts.map +1 -0
  189. package/dist/generated/types/bubblegumEventType.js +23 -0
  190. package/dist/generated/types/bubblegumEventType.js.map +1 -0
  191. package/dist/generated/types/collection.d.ts +17 -0
  192. package/dist/generated/types/collection.d.ts.map +1 -0
  193. package/dist/generated/types/collection.js +24 -0
  194. package/dist/generated/types/collection.js.map +1 -0
  195. package/dist/generated/types/creator.d.ts +23 -0
  196. package/dist/generated/types/creator.d.ts.map +1 -0
  197. package/dist/generated/types/creator.js +26 -0
  198. package/dist/generated/types/creator.js.map +1 -0
  199. package/dist/generated/types/decompressibleState.d.ts +17 -0
  200. package/dist/generated/types/decompressibleState.d.ts.map +1 -0
  201. package/dist/generated/types/decompressibleState.js +23 -0
  202. package/dist/generated/types/decompressibleState.js.map +1 -0
  203. package/dist/generated/types/index.d.ts +23 -0
  204. package/dist/generated/types/index.d.ts.map +1 -0
  205. package/dist/generated/types/index.js +23 -0
  206. package/dist/generated/types/index.js.map +1 -0
  207. package/dist/generated/types/instructionName.d.ts +50 -0
  208. package/dist/generated/types/instructionName.d.ts.map +1 -0
  209. package/dist/generated/types/instructionName.js +56 -0
  210. package/dist/generated/types/instructionName.js.map +1 -0
  211. package/dist/generated/types/leafSchema.d.ts +57 -0
  212. package/dist/generated/types/leafSchema.d.ts.map +1 -0
  213. package/dist/generated/types/leafSchema.js +78 -0
  214. package/dist/generated/types/leafSchema.js.map +1 -0
  215. package/dist/generated/types/metadataArgs.d.ts +61 -0
  216. package/dist/generated/types/metadataArgs.d.ts.map +1 -0
  217. package/dist/generated/types/metadataArgs.js +45 -0
  218. package/dist/generated/types/metadataArgs.js.map +1 -0
  219. package/dist/generated/types/metadataArgsV2.d.ts +53 -0
  220. package/dist/generated/types/metadataArgsV2.d.ts.map +1 -0
  221. package/dist/generated/types/metadataArgsV2.js +39 -0
  222. package/dist/generated/types/metadataArgsV2.js.map +1 -0
  223. package/dist/generated/types/tokenProgramVersion.d.ts +17 -0
  224. package/dist/generated/types/tokenProgramVersion.d.ts.map +1 -0
  225. package/dist/generated/types/tokenProgramVersion.js +23 -0
  226. package/dist/generated/types/tokenProgramVersion.js.map +1 -0
  227. package/dist/generated/types/tokenStandard.d.ts +19 -0
  228. package/dist/generated/types/tokenStandard.d.ts.map +1 -0
  229. package/dist/generated/types/tokenStandard.js +25 -0
  230. package/dist/generated/types/tokenStandard.js.map +1 -0
  231. package/dist/generated/types/updateArgs.d.ts +31 -0
  232. package/dist/generated/types/updateArgs.d.ts.map +1 -0
  233. package/dist/generated/types/updateArgs.js +53 -0
  234. package/dist/generated/types/updateArgs.js.map +1 -0
  235. package/dist/generated/types/useMethod.d.ts +18 -0
  236. package/dist/generated/types/useMethod.d.ts.map +1 -0
  237. package/dist/generated/types/useMethod.js +24 -0
  238. package/dist/generated/types/useMethod.js.map +1 -0
  239. package/dist/generated/types/uses.d.ts +23 -0
  240. package/dist/generated/types/uses.d.ts.map +1 -0
  241. package/dist/generated/types/uses.js +27 -0
  242. package/dist/generated/types/uses.js.map +1 -0
  243. package/dist/generated/types/version.d.ts +17 -0
  244. package/dist/generated/types/version.d.ts.map +1 -0
  245. package/dist/generated/types/version.js +23 -0
  246. package/dist/generated/types/version.js.map +1 -0
  247. package/dist/index.d.ts +8 -0
  248. package/dist/index.d.ts.map +1 -0
  249. package/dist/index.js +8 -0
  250. package/dist/index.js.map +1 -0
  251. package/package.json +51 -5
  252. package/src/generated/accounts/index.ts +10 -0
  253. package/src/generated/accounts/treeConfig.ts +175 -0
  254. package/src/generated/accounts/voucher.ts +144 -0
  255. package/src/generated/errors/bubblegum.ts +309 -0
  256. package/src/generated/errors/index.ts +9 -0
  257. package/src/generated/index.ts +13 -0
  258. package/src/generated/instructions/burn.ts +310 -0
  259. package/src/generated/instructions/burnV2.ts +431 -0
  260. package/src/generated/instructions/cancelRedeem.ts +292 -0
  261. package/src/generated/instructions/closeTreeV2.ts +285 -0
  262. package/src/generated/instructions/collectV2.ts +184 -0
  263. package/src/generated/instructions/compress.ts +388 -0
  264. package/src/generated/instructions/createTree.ts +306 -0
  265. package/src/generated/instructions/createTreeV2.ts +316 -0
  266. package/src/generated/instructions/decompressV1.ts +404 -0
  267. package/src/generated/instructions/delegate.ts +334 -0
  268. package/src/generated/instructions/delegateAndFreezeV2.ts +397 -0
  269. package/src/generated/instructions/delegateV2.ts +391 -0
  270. package/src/generated/instructions/freezeV2.ts +392 -0
  271. package/src/generated/instructions/index.ts +44 -0
  272. package/src/generated/instructions/mintToCollectionV1.ts +457 -0
  273. package/src/generated/instructions/mintV1.ts +320 -0
  274. package/src/generated/instructions/mintV2.ts +435 -0
  275. package/src/generated/instructions/redeem.ts +328 -0
  276. package/src/generated/instructions/setAndVerifyCollection.ts +506 -0
  277. package/src/generated/instructions/setCollectionV2.ts +477 -0
  278. package/src/generated/instructions/setDecompressableState.ts +218 -0
  279. package/src/generated/instructions/setDecompressibleState.ts +218 -0
  280. package/src/generated/instructions/setNonTransferableV2.ts +400 -0
  281. package/src/generated/instructions/setTreeDelegate.ts +246 -0
  282. package/src/generated/instructions/thawAndRevokeV2.ts +370 -0
  283. package/src/generated/instructions/thawV2.ts +392 -0
  284. package/src/generated/instructions/transfer.ts +324 -0
  285. package/src/generated/instructions/transferV2.ts +408 -0
  286. package/src/generated/instructions/unverifyCollection.ts +496 -0
  287. package/src/generated/instructions/unverifyCreator.ts +354 -0
  288. package/src/generated/instructions/unverifyCreatorV2.ts +375 -0
  289. package/src/generated/instructions/updateAssetDataV2.ts +423 -0
  290. package/src/generated/instructions/updateMetadata.ts +449 -0
  291. package/src/generated/instructions/updateMetadataV2.ts +407 -0
  292. package/src/generated/instructions/verifyCollection.ts +494 -0
  293. package/src/generated/instructions/verifyCreator.ts +355 -0
  294. package/src/generated/instructions/verifyCreatorV2.ts +375 -0
  295. package/src/generated/programs/bubblegum.ts +1466 -0
  296. package/src/generated/programs/index.ts +9 -0
  297. package/src/generated/types/assetDataSchema.ts +37 -0
  298. package/src/generated/types/bubblegumEventType.ts +39 -0
  299. package/src/generated/types/collection.ts +51 -0
  300. package/src/generated/types/creator.ts +58 -0
  301. package/src/generated/types/decompressibleState.ts +39 -0
  302. package/src/generated/types/index.ts +23 -0
  303. package/src/generated/types/instructionName.ts +69 -0
  304. package/src/generated/types/leafSchema.ts +166 -0
  305. package/src/generated/types/metadataArgs.ts +148 -0
  306. package/src/generated/types/metadataArgsV2.ts +126 -0
  307. package/src/generated/types/tokenProgramVersion.ts +39 -0
  308. package/src/generated/types/tokenStandard.ts +38 -0
  309. package/src/generated/types/updateArgs.ts +102 -0
  310. package/src/generated/types/useMethod.ts +34 -0
  311. package/src/generated/types/uses.ts +54 -0
  312. package/src/generated/types/version.ts +33 -0
  313. package/src/index.ts +8 -0
@@ -0,0 +1,309 @@
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
+ SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,
12
+ SolanaError,
13
+ } from "@solana/kit";
14
+ import { isProgramError } from "@solana/kit";
15
+ import { BUBBLEGUM_PROGRAM_ADDRESS } from "../programs/index.js";
16
+
17
+ /** AssetOwnerMismatch: Asset Owner Does not match */
18
+ export const BUBBLEGUM_ERROR__ASSET_OWNER_MISMATCH = 0x17_70; // 6000
19
+ /** PublicKeyMismatch: PublicKeyMismatch */
20
+ export const BUBBLEGUM_ERROR__PUBLIC_KEY_MISMATCH = 0x17_71; // 6001
21
+ /** HashingMismatch: Hashing Mismatch Within Leaf Schema */
22
+ export const BUBBLEGUM_ERROR__HASHING_MISMATCH = 0x17_72; // 6002
23
+ /** UnsupportedSchemaVersion: Unsupported Schema Version */
24
+ export const BUBBLEGUM_ERROR__UNSUPPORTED_SCHEMA_VERSION = 0x17_73; // 6003
25
+ /** CreatorShareTotalMustBe100: Creator shares must sum to 100 */
26
+ export const BUBBLEGUM_ERROR__CREATOR_SHARE_TOTAL_MUST_BE100 = 0x17_74; // 6004
27
+ /** DuplicateCreatorAddress: No duplicate creator addresses in metadata */
28
+ export const BUBBLEGUM_ERROR__DUPLICATE_CREATOR_ADDRESS = 0x17_75; // 6005
29
+ /** CreatorDidNotVerify: Creator did not verify the metadata */
30
+ export const BUBBLEGUM_ERROR__CREATOR_DID_NOT_VERIFY = 0x17_76; // 6006
31
+ /** CreatorNotFound: Creator not found in creator Vec */
32
+ export const BUBBLEGUM_ERROR__CREATOR_NOT_FOUND = 0x17_77; // 6007
33
+ /** NoCreatorsPresent: No creators in creator Vec */
34
+ export const BUBBLEGUM_ERROR__NO_CREATORS_PRESENT = 0x17_78; // 6008
35
+ /** CreatorHashMismatch: User-provided creator Vec must result in same user-provided creator hash */
36
+ export const BUBBLEGUM_ERROR__CREATOR_HASH_MISMATCH = 0x17_79; // 6009
37
+ /** DataHashMismatch: User-provided metadata must result in same user-provided data hash */
38
+ export const BUBBLEGUM_ERROR__DATA_HASH_MISMATCH = 0x17_7a; // 6010
39
+ /** CreatorsTooLong: Creators list too long */
40
+ export const BUBBLEGUM_ERROR__CREATORS_TOO_LONG = 0x17_7b; // 6011
41
+ /** MetadataNameTooLong: Name in metadata is too long */
42
+ export const BUBBLEGUM_ERROR__METADATA_NAME_TOO_LONG = 0x17_7c; // 6012
43
+ /** MetadataSymbolTooLong: Symbol in metadata is too long */
44
+ export const BUBBLEGUM_ERROR__METADATA_SYMBOL_TOO_LONG = 0x17_7d; // 6013
45
+ /** MetadataUriTooLong: Uri in metadata is too long */
46
+ export const BUBBLEGUM_ERROR__METADATA_URI_TOO_LONG = 0x17_7e; // 6014
47
+ /** MetadataBasisPointsTooHigh: Basis points in metadata cannot exceed 10000 */
48
+ export const BUBBLEGUM_ERROR__METADATA_BASIS_POINTS_TOO_HIGH = 0x17_7f; // 6015
49
+ /** TreeAuthorityIncorrect: Tree creator or tree delegate must sign. */
50
+ export const BUBBLEGUM_ERROR__TREE_AUTHORITY_INCORRECT = 0x17_80; // 6016
51
+ /** InsufficientMintCapacity: Not enough unapproved mints left */
52
+ export const BUBBLEGUM_ERROR__INSUFFICIENT_MINT_CAPACITY = 0x17_81; // 6017
53
+ /** NumericalOverflowError: NumericalOverflowError */
54
+ export const BUBBLEGUM_ERROR__NUMERICAL_OVERFLOW_ERROR = 0x17_82; // 6018
55
+ /** IncorrectOwner: Incorrect account owner */
56
+ export const BUBBLEGUM_ERROR__INCORRECT_OWNER = 0x17_83; // 6019
57
+ /** CollectionCannotBeVerifiedInThisInstruction: Cannot Verify Collection in this Instruction */
58
+ export const BUBBLEGUM_ERROR__COLLECTION_CANNOT_BE_VERIFIED_IN_THIS_INSTRUCTION = 0x17_84; // 6020
59
+ /** CollectionNotFound: Collection Not Found on Metadata */
60
+ export const BUBBLEGUM_ERROR__COLLECTION_NOT_FOUND = 0x17_85; // 6021
61
+ /** AlreadyVerified: Collection item is already verified. */
62
+ export const BUBBLEGUM_ERROR__ALREADY_VERIFIED = 0x17_86; // 6022
63
+ /** AlreadyUnverified: Collection item is already unverified. */
64
+ export const BUBBLEGUM_ERROR__ALREADY_UNVERIFIED = 0x17_87; // 6023
65
+ /** UpdateAuthorityIncorrect: Incorrect leaf metadata update authority. */
66
+ export const BUBBLEGUM_ERROR__UPDATE_AUTHORITY_INCORRECT = 0x17_88; // 6024
67
+ /** LeafAuthorityMustSign: This transaction must be signed by either the leaf owner or leaf delegate */
68
+ export const BUBBLEGUM_ERROR__LEAF_AUTHORITY_MUST_SIGN = 0x17_89; // 6025
69
+ /** CollectionMustBeSized: Collection Not Compatable with Compression, Must be Sized */
70
+ export const BUBBLEGUM_ERROR__COLLECTION_MUST_BE_SIZED = 0x17_8a; // 6026
71
+ /** MetadataMintMismatch: Metadata mint does not match collection mint */
72
+ export const BUBBLEGUM_ERROR__METADATA_MINT_MISMATCH = 0x17_8b; // 6027
73
+ /** InvalidCollectionAuthority: Invalid collection authority */
74
+ export const BUBBLEGUM_ERROR__INVALID_COLLECTION_AUTHORITY = 0x17_8c; // 6028
75
+ /** InvalidDelegateRecord: Invalid delegate record pda derivation */
76
+ export const BUBBLEGUM_ERROR__INVALID_DELEGATE_RECORD = 0x17_8d; // 6029
77
+ /** CollectionMasterEditionAccountInvalid: Edition account doesnt match collection */
78
+ export const BUBBLEGUM_ERROR__COLLECTION_MASTER_EDITION_ACCOUNT_INVALID = 0x17_8e; // 6030
79
+ /** CollectionMustBeAUniqueMasterEdition: Collection Must Be a Unique Master Edition v2 */
80
+ export const BUBBLEGUM_ERROR__COLLECTION_MUST_BE_A_UNIQUE_MASTER_EDITION = 0x17_8f; // 6031
81
+ /** UnknownExternalError: Could not convert external error to BubblegumError */
82
+ export const BUBBLEGUM_ERROR__UNKNOWN_EXTERNAL_ERROR = 0x17_90; // 6032
83
+ /** DecompressionDisabled: Decompression is disabled for this tree. */
84
+ export const BUBBLEGUM_ERROR__DECOMPRESSION_DISABLED = 0x17_91; // 6033
85
+ /** MissingCollectionMintAccount: Missing collection mint account */
86
+ export const BUBBLEGUM_ERROR__MISSING_COLLECTION_MINT_ACCOUNT = 0x17_92; // 6034
87
+ /** MissingCollectionMetadataAccount: Missing collection metadata account */
88
+ export const BUBBLEGUM_ERROR__MISSING_COLLECTION_METADATA_ACCOUNT = 0x17_93; // 6035
89
+ /** CollectionMismatch: Collection mismatch */
90
+ export const BUBBLEGUM_ERROR__COLLECTION_MISMATCH = 0x17_94; // 6036
91
+ /** MetadataImmutable: Metadata not mutable */
92
+ export const BUBBLEGUM_ERROR__METADATA_IMMUTABLE = 0x17_95; // 6037
93
+ /** PrimarySaleCanOnlyBeFlippedToTrue: Can only update primary sale to true */
94
+ export const BUBBLEGUM_ERROR__PRIMARY_SALE_CAN_ONLY_BE_FLIPPED_TO_TRUE = 0x17_96; // 6038
95
+ /** CreatorDidNotUnverify: Creator did not unverify the metadata */
96
+ export const BUBBLEGUM_ERROR__CREATOR_DID_NOT_UNVERIFY = 0x17_97; // 6039
97
+ /** InvalidTokenStandard: Only NonFungible standard is supported */
98
+ export const BUBBLEGUM_ERROR__INVALID_TOKEN_STANDARD = 0x17_98; // 6040
99
+ /** InvalidCanopySize: Canopy size should be set bigger for this tree */
100
+ export const BUBBLEGUM_ERROR__INVALID_CANOPY_SIZE = 0x17_99; // 6041
101
+ /** InvalidLogWrapper: Invalid log wrapper program */
102
+ export const BUBBLEGUM_ERROR__INVALID_LOG_WRAPPER = 0x17_9a; // 6042
103
+ /** InvalidCompressionProgram: Invalid compression program */
104
+ export const BUBBLEGUM_ERROR__INVALID_COMPRESSION_PROGRAM = 0x17_9b; // 6043
105
+ /** LeafMustBeDelegated: Leaf must be delegated to someone other than the leaf owner */
106
+ export const BUBBLEGUM_ERROR__LEAF_MUST_BE_DELEGATED = 0x17_9c; // 6044
107
+ /** AssetIsFrozen: Asset is frozen */
108
+ export const BUBBLEGUM_ERROR__ASSET_IS_FROZEN = 0x17_9d; // 6045
109
+ /** AssetIsNonTransferable: Asset is non-transferable */
110
+ export const BUBBLEGUM_ERROR__ASSET_IS_NON_TRANSFERABLE = 0x17_9e; // 6046
111
+ /** InvalidAuthority: Invalid authority */
112
+ export const BUBBLEGUM_ERROR__INVALID_AUTHORITY = 0x17_9f; // 6047
113
+ /** CollectionIsFrozen: Collection is frozen */
114
+ export const BUBBLEGUM_ERROR__COLLECTION_IS_FROZEN = 0x17_a0; // 6048
115
+ /** CollectionMustHaveBubblegumPlugin: Core collections must have the Bubblegum V2 plugin on them */
116
+ export const BUBBLEGUM_ERROR__COLLECTION_MUST_HAVE_BUBBLEGUM_PLUGIN = 0x17_a1; // 6049
117
+ /** NotAvailable: Feature not currently available */
118
+ export const BUBBLEGUM_ERROR__NOT_AVAILABLE = 0x17_a2; // 6050
119
+ /** MissingCollectionAccount: Missing collection account */
120
+ export const BUBBLEGUM_ERROR__MISSING_COLLECTION_ACCOUNT = 0x17_a3; // 6051
121
+ /** AssetDataLengthTooLong: Asset data length too long */
122
+ export const BUBBLEGUM_ERROR__ASSET_DATA_LENGTH_TOO_LONG = 0x17_a4; // 6052
123
+ /** AlreadyInCollection: Item is already in the collection */
124
+ export const BUBBLEGUM_ERROR__ALREADY_IN_COLLECTION = 0x17_a5; // 6053
125
+ /** AlreadyNotInCollection: Item is already not in a collection */
126
+ export const BUBBLEGUM_ERROR__ALREADY_NOT_IN_COLLECTION = 0x17_a6; // 6054
127
+ /** MissingMplCoreCpiSignerAccount: Missing mpl-core CPI signer account */
128
+ export const BUBBLEGUM_ERROR__MISSING_MPL_CORE_CPI_SIGNER_ACCOUNT = 0x17_a7; // 6055
129
+ /** AssetIsNotFrozen: Asset is not frozen */
130
+ export const BUBBLEGUM_ERROR__ASSET_IS_NOT_FROZEN = 0x17_a8; // 6056
131
+
132
+ export type BubblegumError =
133
+ | typeof BUBBLEGUM_ERROR__ALREADY_IN_COLLECTION
134
+ | typeof BUBBLEGUM_ERROR__ALREADY_NOT_IN_COLLECTION
135
+ | typeof BUBBLEGUM_ERROR__ALREADY_UNVERIFIED
136
+ | typeof BUBBLEGUM_ERROR__ALREADY_VERIFIED
137
+ | typeof BUBBLEGUM_ERROR__ASSET_DATA_LENGTH_TOO_LONG
138
+ | typeof BUBBLEGUM_ERROR__ASSET_IS_FROZEN
139
+ | typeof BUBBLEGUM_ERROR__ASSET_IS_NON_TRANSFERABLE
140
+ | typeof BUBBLEGUM_ERROR__ASSET_IS_NOT_FROZEN
141
+ | typeof BUBBLEGUM_ERROR__ASSET_OWNER_MISMATCH
142
+ | typeof BUBBLEGUM_ERROR__COLLECTION_CANNOT_BE_VERIFIED_IN_THIS_INSTRUCTION
143
+ | typeof BUBBLEGUM_ERROR__COLLECTION_IS_FROZEN
144
+ | typeof BUBBLEGUM_ERROR__COLLECTION_MASTER_EDITION_ACCOUNT_INVALID
145
+ | typeof BUBBLEGUM_ERROR__COLLECTION_MISMATCH
146
+ | typeof BUBBLEGUM_ERROR__COLLECTION_MUST_BE_A_UNIQUE_MASTER_EDITION
147
+ | typeof BUBBLEGUM_ERROR__COLLECTION_MUST_BE_SIZED
148
+ | typeof BUBBLEGUM_ERROR__COLLECTION_MUST_HAVE_BUBBLEGUM_PLUGIN
149
+ | typeof BUBBLEGUM_ERROR__COLLECTION_NOT_FOUND
150
+ | typeof BUBBLEGUM_ERROR__CREATOR_DID_NOT_UNVERIFY
151
+ | typeof BUBBLEGUM_ERROR__CREATOR_DID_NOT_VERIFY
152
+ | typeof BUBBLEGUM_ERROR__CREATOR_HASH_MISMATCH
153
+ | typeof BUBBLEGUM_ERROR__CREATOR_NOT_FOUND
154
+ | typeof BUBBLEGUM_ERROR__CREATOR_SHARE_TOTAL_MUST_BE100
155
+ | typeof BUBBLEGUM_ERROR__CREATORS_TOO_LONG
156
+ | typeof BUBBLEGUM_ERROR__DATA_HASH_MISMATCH
157
+ | typeof BUBBLEGUM_ERROR__DECOMPRESSION_DISABLED
158
+ | typeof BUBBLEGUM_ERROR__DUPLICATE_CREATOR_ADDRESS
159
+ | typeof BUBBLEGUM_ERROR__HASHING_MISMATCH
160
+ | typeof BUBBLEGUM_ERROR__INCORRECT_OWNER
161
+ | typeof BUBBLEGUM_ERROR__INSUFFICIENT_MINT_CAPACITY
162
+ | typeof BUBBLEGUM_ERROR__INVALID_AUTHORITY
163
+ | typeof BUBBLEGUM_ERROR__INVALID_CANOPY_SIZE
164
+ | typeof BUBBLEGUM_ERROR__INVALID_COLLECTION_AUTHORITY
165
+ | typeof BUBBLEGUM_ERROR__INVALID_COMPRESSION_PROGRAM
166
+ | typeof BUBBLEGUM_ERROR__INVALID_DELEGATE_RECORD
167
+ | typeof BUBBLEGUM_ERROR__INVALID_LOG_WRAPPER
168
+ | typeof BUBBLEGUM_ERROR__INVALID_TOKEN_STANDARD
169
+ | typeof BUBBLEGUM_ERROR__LEAF_AUTHORITY_MUST_SIGN
170
+ | typeof BUBBLEGUM_ERROR__LEAF_MUST_BE_DELEGATED
171
+ | typeof BUBBLEGUM_ERROR__METADATA_BASIS_POINTS_TOO_HIGH
172
+ | typeof BUBBLEGUM_ERROR__METADATA_IMMUTABLE
173
+ | typeof BUBBLEGUM_ERROR__METADATA_MINT_MISMATCH
174
+ | typeof BUBBLEGUM_ERROR__METADATA_NAME_TOO_LONG
175
+ | typeof BUBBLEGUM_ERROR__METADATA_SYMBOL_TOO_LONG
176
+ | typeof BUBBLEGUM_ERROR__METADATA_URI_TOO_LONG
177
+ | typeof BUBBLEGUM_ERROR__MISSING_COLLECTION_ACCOUNT
178
+ | typeof BUBBLEGUM_ERROR__MISSING_COLLECTION_METADATA_ACCOUNT
179
+ | typeof BUBBLEGUM_ERROR__MISSING_COLLECTION_MINT_ACCOUNT
180
+ | typeof BUBBLEGUM_ERROR__MISSING_MPL_CORE_CPI_SIGNER_ACCOUNT
181
+ | typeof BUBBLEGUM_ERROR__NO_CREATORS_PRESENT
182
+ | typeof BUBBLEGUM_ERROR__NOT_AVAILABLE
183
+ | typeof BUBBLEGUM_ERROR__NUMERICAL_OVERFLOW_ERROR
184
+ | typeof BUBBLEGUM_ERROR__PRIMARY_SALE_CAN_ONLY_BE_FLIPPED_TO_TRUE
185
+ | typeof BUBBLEGUM_ERROR__PUBLIC_KEY_MISMATCH
186
+ | typeof BUBBLEGUM_ERROR__TREE_AUTHORITY_INCORRECT
187
+ | typeof BUBBLEGUM_ERROR__UNKNOWN_EXTERNAL_ERROR
188
+ | typeof BUBBLEGUM_ERROR__UNSUPPORTED_SCHEMA_VERSION
189
+ | typeof BUBBLEGUM_ERROR__UPDATE_AUTHORITY_INCORRECT;
190
+
191
+ let bubblegumErrorMessages: Record<BubblegumError, string> | undefined;
192
+ if (process.env.NODE_ENV !== "production") {
193
+ bubblegumErrorMessages = {
194
+ [BUBBLEGUM_ERROR__ALREADY_IN_COLLECTION]:
195
+ "Item is already in the collection",
196
+ [BUBBLEGUM_ERROR__ALREADY_NOT_IN_COLLECTION]:
197
+ "Item is already not in a collection",
198
+ [BUBBLEGUM_ERROR__ALREADY_UNVERIFIED]:
199
+ "Collection item is already unverified.",
200
+ [BUBBLEGUM_ERROR__ALREADY_VERIFIED]: "Collection item is already verified.",
201
+ [BUBBLEGUM_ERROR__ASSET_DATA_LENGTH_TOO_LONG]: "Asset data length too long",
202
+ [BUBBLEGUM_ERROR__ASSET_IS_FROZEN]: "Asset is frozen",
203
+ [BUBBLEGUM_ERROR__ASSET_IS_NON_TRANSFERABLE]: "Asset is non-transferable",
204
+ [BUBBLEGUM_ERROR__ASSET_IS_NOT_FROZEN]: "Asset is not frozen",
205
+ [BUBBLEGUM_ERROR__ASSET_OWNER_MISMATCH]: "Asset Owner Does not match",
206
+ [BUBBLEGUM_ERROR__COLLECTION_CANNOT_BE_VERIFIED_IN_THIS_INSTRUCTION]:
207
+ "Cannot Verify Collection in this Instruction",
208
+ [BUBBLEGUM_ERROR__COLLECTION_IS_FROZEN]: "Collection is frozen",
209
+ [BUBBLEGUM_ERROR__COLLECTION_MASTER_EDITION_ACCOUNT_INVALID]:
210
+ "Edition account doesnt match collection",
211
+ [BUBBLEGUM_ERROR__COLLECTION_MISMATCH]: "Collection mismatch",
212
+ [BUBBLEGUM_ERROR__COLLECTION_MUST_BE_A_UNIQUE_MASTER_EDITION]:
213
+ "Collection Must Be a Unique Master Edition v2",
214
+ [BUBBLEGUM_ERROR__COLLECTION_MUST_BE_SIZED]:
215
+ "Collection Not Compatable with Compression, Must be Sized",
216
+ [BUBBLEGUM_ERROR__COLLECTION_MUST_HAVE_BUBBLEGUM_PLUGIN]:
217
+ "Core collections must have the Bubblegum V2 plugin on them",
218
+ [BUBBLEGUM_ERROR__COLLECTION_NOT_FOUND]: "Collection Not Found on Metadata",
219
+ [BUBBLEGUM_ERROR__CREATOR_DID_NOT_UNVERIFY]:
220
+ "Creator did not unverify the metadata",
221
+ [BUBBLEGUM_ERROR__CREATOR_DID_NOT_VERIFY]:
222
+ "Creator did not verify the metadata",
223
+ [BUBBLEGUM_ERROR__CREATOR_HASH_MISMATCH]:
224
+ "User-provided creator Vec must result in same user-provided creator hash",
225
+ [BUBBLEGUM_ERROR__CREATOR_NOT_FOUND]: "Creator not found in creator Vec",
226
+ [BUBBLEGUM_ERROR__CREATOR_SHARE_TOTAL_MUST_BE100]:
227
+ "Creator shares must sum to 100",
228
+ [BUBBLEGUM_ERROR__CREATORS_TOO_LONG]: "Creators list too long",
229
+ [BUBBLEGUM_ERROR__DATA_HASH_MISMATCH]:
230
+ "User-provided metadata must result in same user-provided data hash",
231
+ [BUBBLEGUM_ERROR__DECOMPRESSION_DISABLED]:
232
+ "Decompression is disabled for this tree.",
233
+ [BUBBLEGUM_ERROR__DUPLICATE_CREATOR_ADDRESS]:
234
+ "No duplicate creator addresses in metadata",
235
+ [BUBBLEGUM_ERROR__HASHING_MISMATCH]: "Hashing Mismatch Within Leaf Schema",
236
+ [BUBBLEGUM_ERROR__INCORRECT_OWNER]: "Incorrect account owner",
237
+ [BUBBLEGUM_ERROR__INSUFFICIENT_MINT_CAPACITY]:
238
+ "Not enough unapproved mints left",
239
+ [BUBBLEGUM_ERROR__INVALID_AUTHORITY]: "Invalid authority",
240
+ [BUBBLEGUM_ERROR__INVALID_CANOPY_SIZE]:
241
+ "Canopy size should be set bigger for this tree",
242
+ [BUBBLEGUM_ERROR__INVALID_COLLECTION_AUTHORITY]:
243
+ "Invalid collection authority",
244
+ [BUBBLEGUM_ERROR__INVALID_COMPRESSION_PROGRAM]:
245
+ "Invalid compression program",
246
+ [BUBBLEGUM_ERROR__INVALID_DELEGATE_RECORD]:
247
+ "Invalid delegate record pda derivation",
248
+ [BUBBLEGUM_ERROR__INVALID_LOG_WRAPPER]: "Invalid log wrapper program",
249
+ [BUBBLEGUM_ERROR__INVALID_TOKEN_STANDARD]:
250
+ "Only NonFungible standard is supported",
251
+ [BUBBLEGUM_ERROR__LEAF_AUTHORITY_MUST_SIGN]:
252
+ "This transaction must be signed by either the leaf owner or leaf delegate",
253
+ [BUBBLEGUM_ERROR__LEAF_MUST_BE_DELEGATED]:
254
+ "Leaf must be delegated to someone other than the leaf owner",
255
+ [BUBBLEGUM_ERROR__METADATA_BASIS_POINTS_TOO_HIGH]:
256
+ "Basis points in metadata cannot exceed 10000",
257
+ [BUBBLEGUM_ERROR__METADATA_IMMUTABLE]: "Metadata not mutable",
258
+ [BUBBLEGUM_ERROR__METADATA_MINT_MISMATCH]:
259
+ "Metadata mint does not match collection mint",
260
+ [BUBBLEGUM_ERROR__METADATA_NAME_TOO_LONG]: "Name in metadata is too long",
261
+ [BUBBLEGUM_ERROR__METADATA_SYMBOL_TOO_LONG]:
262
+ "Symbol in metadata is too long",
263
+ [BUBBLEGUM_ERROR__METADATA_URI_TOO_LONG]: "Uri in metadata is too long",
264
+ [BUBBLEGUM_ERROR__MISSING_COLLECTION_ACCOUNT]: "Missing collection account",
265
+ [BUBBLEGUM_ERROR__MISSING_COLLECTION_METADATA_ACCOUNT]:
266
+ "Missing collection metadata account",
267
+ [BUBBLEGUM_ERROR__MISSING_COLLECTION_MINT_ACCOUNT]:
268
+ "Missing collection mint account",
269
+ [BUBBLEGUM_ERROR__MISSING_MPL_CORE_CPI_SIGNER_ACCOUNT]:
270
+ "Missing mpl-core CPI signer account",
271
+ [BUBBLEGUM_ERROR__NO_CREATORS_PRESENT]: "No creators in creator Vec",
272
+ [BUBBLEGUM_ERROR__NOT_AVAILABLE]: "Feature not currently available",
273
+ [BUBBLEGUM_ERROR__NUMERICAL_OVERFLOW_ERROR]: "NumericalOverflowError",
274
+ [BUBBLEGUM_ERROR__PRIMARY_SALE_CAN_ONLY_BE_FLIPPED_TO_TRUE]:
275
+ "Can only update primary sale to true",
276
+ [BUBBLEGUM_ERROR__PUBLIC_KEY_MISMATCH]: "PublicKeyMismatch",
277
+ [BUBBLEGUM_ERROR__TREE_AUTHORITY_INCORRECT]:
278
+ "Tree creator or tree delegate must sign.",
279
+ [BUBBLEGUM_ERROR__UNKNOWN_EXTERNAL_ERROR]:
280
+ "Could not convert external error to BubblegumError",
281
+ [BUBBLEGUM_ERROR__UNSUPPORTED_SCHEMA_VERSION]: "Unsupported Schema Version",
282
+ [BUBBLEGUM_ERROR__UPDATE_AUTHORITY_INCORRECT]:
283
+ "Incorrect leaf metadata update authority.",
284
+ };
285
+ }
286
+
287
+ export function getBubblegumErrorMessage(code: BubblegumError): string {
288
+ if (process.env.NODE_ENV !== "production") {
289
+ return bubblegumErrorMessages![code];
290
+ }
291
+
292
+ return "Error message not available in production bundles.";
293
+ }
294
+
295
+ export function isBubblegumError<TProgramErrorCode extends BubblegumError>(
296
+ error: unknown,
297
+ transactionMessage: {
298
+ instructions: Record<number, { programAddress: Address }>;
299
+ },
300
+ code?: TProgramErrorCode,
301
+ ): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &
302
+ Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {
303
+ return isProgramError<TProgramErrorCode>(
304
+ error,
305
+ transactionMessage,
306
+ BUBBLEGUM_PROGRAM_ADDRESS,
307
+ code,
308
+ );
309
+ }
@@ -0,0 +1,9 @@
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
+ export * from "./bubblegum.js";
@@ -0,0 +1,13 @@
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
+ export * from "./accounts/index.js";
10
+ export * from "./errors/index.js";
11
+ export * from "./instructions/index.js";
12
+ export * from "./programs/index.js";
13
+ export * from "./types/index.js";
@@ -0,0 +1,310 @@
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
+ AccountMeta,
11
+ Address,
12
+ FixedSizeCodec,
13
+ FixedSizeDecoder,
14
+ FixedSizeEncoder,
15
+ Instruction,
16
+ InstructionWithAccounts,
17
+ InstructionWithData,
18
+ ReadonlyAccount,
19
+ ReadonlyUint8Array,
20
+ WritableAccount,
21
+ } from "@solana/kit";
22
+ import type { ResolvedInstructionAccount } from "@solana/program-client-core";
23
+ import {
24
+ combineCodec,
25
+ fixDecoderSize,
26
+ fixEncoderSize,
27
+ getArrayDecoder,
28
+ getArrayEncoder,
29
+ getBytesDecoder,
30
+ getBytesEncoder,
31
+ getStructDecoder,
32
+ getStructEncoder,
33
+ getU8Decoder,
34
+ getU8Encoder,
35
+ getU32Decoder,
36
+ getU32Encoder,
37
+ getU64Decoder,
38
+ getU64Encoder,
39
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
40
+ SolanaError,
41
+ transformEncoder,
42
+ } from "@solana/kit";
43
+ import { getAccountMetaFactory } from "@solana/program-client-core";
44
+ import { BUBBLEGUM_PROGRAM_ADDRESS } from "../programs/index.js";
45
+
46
+ export const BURN_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
47
+ 116, 110, 29, 56, 107, 219, 42, 93,
48
+ ]);
49
+
50
+ export function getBurnDiscriminatorBytes(): ReadonlyUint8Array {
51
+ return fixEncoderSize(getBytesEncoder(), 8).encode(BURN_DISCRIMINATOR);
52
+ }
53
+
54
+ export type BurnInstruction<
55
+ TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,
56
+ TAccountTreeAuthority extends string | AccountMeta = string,
57
+ TAccountLeafOwner extends string | AccountMeta = string,
58
+ TAccountLeafDelegate extends string | AccountMeta = string,
59
+ TAccountMerkleTree extends string | AccountMeta = string,
60
+ TAccountLogWrapper extends string | AccountMeta = string,
61
+ TAccountCompressionProgram extends string | AccountMeta = string,
62
+ TAccountSystemProgram extends
63
+ | string
64
+ | AccountMeta = "11111111111111111111111111111111",
65
+ TRemainingAccounts extends readonly AccountMeta[] = [],
66
+ > = Instruction<TProgram> &
67
+ InstructionWithData<ReadonlyUint8Array> &
68
+ InstructionWithAccounts<
69
+ [
70
+ TAccountTreeAuthority extends string
71
+ ? ReadonlyAccount<TAccountTreeAuthority>
72
+ : TAccountTreeAuthority,
73
+ TAccountLeafOwner extends string
74
+ ? ReadonlyAccount<TAccountLeafOwner>
75
+ : TAccountLeafOwner,
76
+ TAccountLeafDelegate extends string
77
+ ? ReadonlyAccount<TAccountLeafDelegate>
78
+ : TAccountLeafDelegate,
79
+ TAccountMerkleTree extends string
80
+ ? WritableAccount<TAccountMerkleTree>
81
+ : TAccountMerkleTree,
82
+ TAccountLogWrapper extends string
83
+ ? ReadonlyAccount<TAccountLogWrapper>
84
+ : TAccountLogWrapper,
85
+ TAccountCompressionProgram extends string
86
+ ? ReadonlyAccount<TAccountCompressionProgram>
87
+ : TAccountCompressionProgram,
88
+ TAccountSystemProgram extends string
89
+ ? ReadonlyAccount<TAccountSystemProgram>
90
+ : TAccountSystemProgram,
91
+ ...TRemainingAccounts,
92
+ ]
93
+ >;
94
+
95
+ export interface BurnInstructionData {
96
+ discriminator: ReadonlyUint8Array;
97
+ root: number[];
98
+ dataHash: number[];
99
+ creatorHash: number[];
100
+ nonce: bigint;
101
+ index: number;
102
+ }
103
+
104
+ export interface BurnInstructionDataArgs {
105
+ root: number[];
106
+ dataHash: number[];
107
+ creatorHash: number[];
108
+ nonce: number | bigint;
109
+ index: number;
110
+ }
111
+
112
+ export function getBurnInstructionDataEncoder(): FixedSizeEncoder<BurnInstructionDataArgs> {
113
+ return transformEncoder(
114
+ getStructEncoder([
115
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
116
+ ["root", getArrayEncoder(getU8Encoder(), { size: 32 })],
117
+ ["dataHash", getArrayEncoder(getU8Encoder(), { size: 32 })],
118
+ ["creatorHash", getArrayEncoder(getU8Encoder(), { size: 32 })],
119
+ ["nonce", getU64Encoder()],
120
+ ["index", getU32Encoder()],
121
+ ]),
122
+ (value) => ({ ...value, discriminator: BURN_DISCRIMINATOR }),
123
+ );
124
+ }
125
+
126
+ export function getBurnInstructionDataDecoder(): FixedSizeDecoder<BurnInstructionData> {
127
+ return getStructDecoder([
128
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
129
+ ["root", getArrayDecoder(getU8Decoder(), { size: 32 })],
130
+ ["dataHash", getArrayDecoder(getU8Decoder(), { size: 32 })],
131
+ ["creatorHash", getArrayDecoder(getU8Decoder(), { size: 32 })],
132
+ ["nonce", getU64Decoder()],
133
+ ["index", getU32Decoder()],
134
+ ]);
135
+ }
136
+
137
+ export function getBurnInstructionDataCodec(): FixedSizeCodec<
138
+ BurnInstructionDataArgs,
139
+ BurnInstructionData
140
+ > {
141
+ return combineCodec(
142
+ getBurnInstructionDataEncoder(),
143
+ getBurnInstructionDataDecoder(),
144
+ );
145
+ }
146
+
147
+ export interface BurnInput<
148
+ TAccountTreeAuthority extends string = string,
149
+ TAccountLeafOwner extends string = string,
150
+ TAccountLeafDelegate extends string = string,
151
+ TAccountMerkleTree extends string = string,
152
+ TAccountLogWrapper extends string = string,
153
+ TAccountCompressionProgram extends string = string,
154
+ TAccountSystemProgram extends string = string,
155
+ > {
156
+ treeAuthority: Address<TAccountTreeAuthority>;
157
+ leafOwner: Address<TAccountLeafOwner>;
158
+ leafDelegate: Address<TAccountLeafDelegate>;
159
+ merkleTree: Address<TAccountMerkleTree>;
160
+ logWrapper: Address<TAccountLogWrapper>;
161
+ compressionProgram: Address<TAccountCompressionProgram>;
162
+ systemProgram?: Address<TAccountSystemProgram>;
163
+ root: BurnInstructionDataArgs["root"];
164
+ dataHash: BurnInstructionDataArgs["dataHash"];
165
+ creatorHash: BurnInstructionDataArgs["creatorHash"];
166
+ nonce: BurnInstructionDataArgs["nonce"];
167
+ index: BurnInstructionDataArgs["index"];
168
+ }
169
+
170
+ export function getBurnInstruction<
171
+ TAccountTreeAuthority extends string,
172
+ TAccountLeafOwner extends string,
173
+ TAccountLeafDelegate extends string,
174
+ TAccountMerkleTree extends string,
175
+ TAccountLogWrapper extends string,
176
+ TAccountCompressionProgram extends string,
177
+ TAccountSystemProgram extends string,
178
+ TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
179
+ >(
180
+ input: BurnInput<
181
+ TAccountTreeAuthority,
182
+ TAccountLeafOwner,
183
+ TAccountLeafDelegate,
184
+ TAccountMerkleTree,
185
+ TAccountLogWrapper,
186
+ TAccountCompressionProgram,
187
+ TAccountSystemProgram
188
+ >,
189
+ config?: { programAddress?: TProgramAddress },
190
+ ): BurnInstruction<
191
+ TProgramAddress,
192
+ TAccountTreeAuthority,
193
+ TAccountLeafOwner,
194
+ TAccountLeafDelegate,
195
+ TAccountMerkleTree,
196
+ TAccountLogWrapper,
197
+ TAccountCompressionProgram,
198
+ TAccountSystemProgram
199
+ > {
200
+ // Program address.
201
+ const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
202
+
203
+ // Original accounts.
204
+ const originalAccounts = {
205
+ treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },
206
+ leafOwner: { value: input.leafOwner ?? null, isWritable: false },
207
+ leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },
208
+ merkleTree: { value: input.merkleTree ?? null, isWritable: true },
209
+ logWrapper: { value: input.logWrapper ?? null, isWritable: false },
210
+ compressionProgram: {
211
+ value: input.compressionProgram ?? null,
212
+ isWritable: false,
213
+ },
214
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
215
+ };
216
+ const accounts = originalAccounts as Record<
217
+ keyof typeof originalAccounts,
218
+ ResolvedInstructionAccount
219
+ >;
220
+
221
+ // Original args.
222
+ const args = { ...input };
223
+
224
+ // Resolve default values.
225
+ if (!accounts.systemProgram.value) {
226
+ accounts.systemProgram.value =
227
+ "11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
228
+ }
229
+
230
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
231
+ return Object.freeze({
232
+ accounts: [
233
+ getAccountMeta("treeAuthority", accounts.treeAuthority),
234
+ getAccountMeta("leafOwner", accounts.leafOwner),
235
+ getAccountMeta("leafDelegate", accounts.leafDelegate),
236
+ getAccountMeta("merkleTree", accounts.merkleTree),
237
+ getAccountMeta("logWrapper", accounts.logWrapper),
238
+ getAccountMeta("compressionProgram", accounts.compressionProgram),
239
+ getAccountMeta("systemProgram", accounts.systemProgram),
240
+ ],
241
+ data: getBurnInstructionDataEncoder().encode(
242
+ args as BurnInstructionDataArgs,
243
+ ),
244
+ programAddress,
245
+ } as BurnInstruction<
246
+ TProgramAddress,
247
+ TAccountTreeAuthority,
248
+ TAccountLeafOwner,
249
+ TAccountLeafDelegate,
250
+ TAccountMerkleTree,
251
+ TAccountLogWrapper,
252
+ TAccountCompressionProgram,
253
+ TAccountSystemProgram
254
+ >);
255
+ }
256
+
257
+ export interface ParsedBurnInstruction<
258
+ TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,
259
+ TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
260
+ > {
261
+ programAddress: Address<TProgram>;
262
+ accounts: {
263
+ treeAuthority: TAccountMetas[0];
264
+ leafOwner: TAccountMetas[1];
265
+ leafDelegate: TAccountMetas[2];
266
+ merkleTree: TAccountMetas[3];
267
+ logWrapper: TAccountMetas[4];
268
+ compressionProgram: TAccountMetas[5];
269
+ systemProgram: TAccountMetas[6];
270
+ };
271
+ data: BurnInstructionData;
272
+ }
273
+
274
+ export function parseBurnInstruction<
275
+ TProgram extends string,
276
+ TAccountMetas extends readonly AccountMeta[],
277
+ >(
278
+ instruction: Instruction<TProgram> &
279
+ InstructionWithAccounts<TAccountMetas> &
280
+ InstructionWithData<ReadonlyUint8Array>,
281
+ ): ParsedBurnInstruction<TProgram, TAccountMetas> {
282
+ if (instruction.accounts.length < 7) {
283
+ throw new SolanaError(
284
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
285
+ {
286
+ actualAccountMetas: instruction.accounts.length,
287
+ expectedAccountMetas: 7,
288
+ },
289
+ );
290
+ }
291
+ let accountIndex = 0;
292
+ const getNextAccount = () => {
293
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
294
+ accountIndex += 1;
295
+ return accountMeta;
296
+ };
297
+ return {
298
+ programAddress: instruction.programAddress,
299
+ accounts: {
300
+ treeAuthority: getNextAccount(),
301
+ leafOwner: getNextAccount(),
302
+ leafDelegate: getNextAccount(),
303
+ merkleTree: getNextAccount(),
304
+ logWrapper: getNextAccount(),
305
+ compressionProgram: getNextAccount(),
306
+ systemProgram: getNextAccount(),
307
+ },
308
+ data: getBurnInstructionDataDecoder().decode(instruction.data),
309
+ };
310
+ }