@mycelium-ip/core-sdk 0.1.0-alpha.1

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 (203) hide show
  1. package/README.md +176 -0
  2. package/dist/accounts/entity/entity.d.ts +24 -0
  3. package/dist/accounts/entity/entity.js +24 -0
  4. package/dist/accounts/entity/entityTreasury.d.ts +22 -0
  5. package/dist/accounts/entity/entityTreasury.js +25 -0
  6. package/dist/accounts/entity/index.d.ts +2 -0
  7. package/dist/accounts/entity/index.js +2 -0
  8. package/dist/accounts/index.d.ts +3 -0
  9. package/dist/accounts/index.js +3 -0
  10. package/dist/accounts/ipcore/derivativeLink.d.ts +21 -0
  11. package/dist/accounts/ipcore/derivativeLink.js +22 -0
  12. package/dist/accounts/ipcore/index.d.ts +7 -0
  13. package/dist/accounts/ipcore/index.js +7 -0
  14. package/dist/accounts/ipcore/ipAsset.d.ts +25 -0
  15. package/dist/accounts/ipcore/ipAsset.js +26 -0
  16. package/dist/accounts/ipcore/ipRegistry.d.ts +21 -0
  17. package/dist/accounts/ipcore/ipRegistry.js +22 -0
  18. package/dist/accounts/ipcore/moduleConfig.d.ts +21 -0
  19. package/dist/accounts/ipcore/moduleConfig.js +22 -0
  20. package/dist/accounts/ipcore/provenanceClaim.d.ts +25 -0
  21. package/dist/accounts/ipcore/provenanceClaim.js +26 -0
  22. package/dist/accounts/ipcore/registryConfig.d.ts +21 -0
  23. package/dist/accounts/ipcore/registryConfig.js +22 -0
  24. package/dist/accounts/ipcore/registryConfigTreasury.d.ts +18 -0
  25. package/dist/accounts/ipcore/registryConfigTreasury.js +21 -0
  26. package/dist/accounts/metadata/entityMetadata.d.ts +23 -0
  27. package/dist/accounts/metadata/entityMetadata.js +24 -0
  28. package/dist/accounts/metadata/index.d.ts +3 -0
  29. package/dist/accounts/metadata/index.js +3 -0
  30. package/dist/accounts/metadata/ipMetadata.d.ts +23 -0
  31. package/dist/accounts/metadata/ipMetadata.js +24 -0
  32. package/dist/accounts/metadata/schemaRegistry.d.ts +21 -0
  33. package/dist/accounts/metadata/schemaRegistry.js +22 -0
  34. package/dist/constants/index.d.ts +4 -0
  35. package/dist/constants/index.js +4 -0
  36. package/dist/constants/programIds.d.ts +5 -0
  37. package/dist/constants/programIds.js +8 -0
  38. package/dist/constants/schema.d.ts +3 -0
  39. package/dist/constants/schema.js +3 -0
  40. package/dist/constants/seeds.d.ts +17 -0
  41. package/dist/constants/seeds.js +17 -0
  42. package/dist/constants/status.d.ts +24 -0
  43. package/dist/constants/status.js +33 -0
  44. package/dist/helper/index.d.ts +1 -0
  45. package/dist/helper/index.js +1 -0
  46. package/dist/helper/schema.d.ts +3 -0
  47. package/dist/helper/schema.js +28 -0
  48. package/dist/idl/entity.json +373 -0
  49. package/dist/idl/index.d.ts +4 -0
  50. package/dist/idl/index.js +4 -0
  51. package/dist/idl/ipcore.json +916 -0
  52. package/dist/idl/metadata.json +682 -0
  53. package/dist/index.d.ts +8 -0
  54. package/dist/index.js +9 -0
  55. package/dist/instructions/entity/assertControllerThreshold.d.ts +13 -0
  56. package/dist/instructions/entity/assertControllerThreshold.js +29 -0
  57. package/dist/instructions/entity/index.d.ts +5 -0
  58. package/dist/instructions/entity/index.js +5 -0
  59. package/dist/instructions/entity/initEntityCounter.d.ts +8 -0
  60. package/dist/instructions/entity/initEntityCounter.js +12 -0
  61. package/dist/instructions/entity/initEntityTreasury.d.ts +12 -0
  62. package/dist/instructions/entity/initEntityTreasury.js +20 -0
  63. package/dist/instructions/entity/registerEntity.d.ts +10 -0
  64. package/dist/instructions/entity/registerEntity.js +12 -0
  65. package/dist/instructions/entity/updateControllers.d.ts +15 -0
  66. package/dist/instructions/entity/updateControllers.js +29 -0
  67. package/dist/instructions/index.d.ts +3 -0
  68. package/dist/instructions/index.js +3 -0
  69. package/dist/instructions/ipcore/addDerivativeLink.d.ts +9 -0
  70. package/dist/instructions/ipcore/addDerivativeLink.js +10 -0
  71. package/dist/instructions/ipcore/addIpAsset.d.ts +7 -0
  72. package/dist/instructions/ipcore/addIpAsset.js +9 -0
  73. package/dist/instructions/ipcore/createDerivativeLink.d.ts +13 -0
  74. package/dist/instructions/ipcore/createDerivativeLink.js +22 -0
  75. package/dist/instructions/ipcore/createProvenanceClaim.d.ts +15 -0
  76. package/dist/instructions/ipcore/createProvenanceClaim.js +25 -0
  77. package/dist/instructions/ipcore/index.d.ts +11 -0
  78. package/dist/instructions/ipcore/index.js +11 -0
  79. package/dist/instructions/ipcore/initIpCounter.d.ts +8 -0
  80. package/dist/instructions/ipcore/initIpCounter.js +12 -0
  81. package/dist/instructions/ipcore/initIpRegistry.d.ts +8 -0
  82. package/dist/instructions/ipcore/initIpRegistry.js +20 -0
  83. package/dist/instructions/ipcore/initModuleConfig.d.ts +8 -0
  84. package/dist/instructions/ipcore/initModuleConfig.js +10 -0
  85. package/dist/instructions/ipcore/initRegistryConfig.d.ts +8 -0
  86. package/dist/instructions/ipcore/initRegistryConfig.js +9 -0
  87. package/dist/instructions/ipcore/initRegistryConfigTreasury.d.ts +8 -0
  88. package/dist/instructions/ipcore/initRegistryConfigTreasury.js +10 -0
  89. package/dist/instructions/ipcore/registerIpAsset.d.ts +14 -0
  90. package/dist/instructions/ipcore/registerIpAsset.js +21 -0
  91. package/dist/instructions/ipcore/resolveParent.d.ts +12 -0
  92. package/dist/instructions/ipcore/resolveParent.js +12 -0
  93. package/dist/instructions/ipcore/updateRegistryConfig.d.ts +9 -0
  94. package/dist/instructions/ipcore/updateRegistryConfig.js +9 -0
  95. package/dist/instructions/metadata/createEntityMetadata.d.ts +15 -0
  96. package/dist/instructions/metadata/createEntityMetadata.js +22 -0
  97. package/dist/instructions/metadata/createIpMetadata.d.ts +16 -0
  98. package/dist/instructions/metadata/createIpMetadata.js +23 -0
  99. package/dist/instructions/metadata/index.d.ts +7 -0
  100. package/dist/instructions/metadata/index.js +7 -0
  101. package/dist/instructions/metadata/lockEntityMetadata.d.ts +13 -0
  102. package/dist/instructions/metadata/lockEntityMetadata.js +19 -0
  103. package/dist/instructions/metadata/lockIpMetadata.d.ts +14 -0
  104. package/dist/instructions/metadata/lockIpMetadata.js +20 -0
  105. package/dist/instructions/metadata/registerSchema.d.ts +14 -0
  106. package/dist/instructions/metadata/registerSchema.js +18 -0
  107. package/dist/instructions/metadata/updateEntityMetadata.d.ts +16 -0
  108. package/dist/instructions/metadata/updateEntityMetadata.js +23 -0
  109. package/dist/instructions/metadata/updateIpMetadata.d.ts +17 -0
  110. package/dist/instructions/metadata/updateIpMetadata.js +24 -0
  111. package/dist/pda/entity.d.ts +5 -0
  112. package/dist/pda/entity.js +15 -0
  113. package/dist/pda/index.d.ts +4 -0
  114. package/dist/pda/index.js +4 -0
  115. package/dist/pda/ip.d.ts +9 -0
  116. package/dist/pda/ip.js +31 -0
  117. package/dist/pda/metadata.d.ts +3 -0
  118. package/dist/pda/metadata.js +19 -0
  119. package/dist/pda/schema.d.ts +2 -0
  120. package/dist/pda/schema.js +12 -0
  121. package/dist/programs/programIds.d.ts +18 -0
  122. package/dist/programs/programIds.js +16 -0
  123. package/dist/sdk/MyceliumSDK.d.ts +15 -0
  124. package/dist/sdk/MyceliumSDK.js +15 -0
  125. package/dist/sdk/MyceliumSDK.types.d.ts +3 -0
  126. package/dist/sdk/MyceliumSDK.types.js +1 -0
  127. package/dist/sdk/namespaces/admin.d.ts +23 -0
  128. package/dist/sdk/namespaces/admin.js +9 -0
  129. package/dist/sdk/namespaces/entity.d.ts +53 -0
  130. package/dist/sdk/namespaces/entity.js +21 -0
  131. package/dist/sdk/namespaces/ipcore.d.ts +111 -0
  132. package/dist/sdk/namespaces/ipcore.js +42 -0
  133. package/dist/sdk/namespaces/metadata.d.ts +86 -0
  134. package/dist/sdk/namespaces/metadata.js +27 -0
  135. package/dist/transactions/admin/adminTransaction.d.ts +18 -0
  136. package/dist/transactions/admin/adminTransaction.js +43 -0
  137. package/dist/transactions/admin/index.d.ts +1 -0
  138. package/dist/transactions/admin/index.js +1 -0
  139. package/dist/transactions/entity/assertControllerThreshold.d.ts +17 -0
  140. package/dist/transactions/entity/assertControllerThreshold.js +18 -0
  141. package/dist/transactions/entity/index.d.ts +5 -0
  142. package/dist/transactions/entity/index.js +5 -0
  143. package/dist/transactions/entity/initEntityCounter.d.ts +14 -0
  144. package/dist/transactions/entity/initEntityCounter.js +16 -0
  145. package/dist/transactions/entity/initEntityTreasury.d.ts +16 -0
  146. package/dist/transactions/entity/initEntityTreasury.js +18 -0
  147. package/dist/transactions/entity/registerEntity.d.ts +19 -0
  148. package/dist/transactions/entity/registerEntity.js +44 -0
  149. package/dist/transactions/entity/updateControllers.d.ts +19 -0
  150. package/dist/transactions/entity/updateControllers.js +20 -0
  151. package/dist/transactions/index.d.ts +4 -0
  152. package/dist/transactions/index.js +4 -0
  153. package/dist/transactions/ipcore/addDerivativeLink.d.ts +14 -0
  154. package/dist/transactions/ipcore/addDerivativeLink.js +15 -0
  155. package/dist/transactions/ipcore/addIpAsset.d.ts +15 -0
  156. package/dist/transactions/ipcore/addIpAsset.js +13 -0
  157. package/dist/transactions/ipcore/createDerivativeLink.d.ts +19 -0
  158. package/dist/transactions/ipcore/createDerivativeLink.js +18 -0
  159. package/dist/transactions/ipcore/createProvenanceClaim.d.ts +20 -0
  160. package/dist/transactions/ipcore/createProvenanceClaim.js +20 -0
  161. package/dist/transactions/ipcore/index.d.ts +12 -0
  162. package/dist/transactions/ipcore/index.js +12 -0
  163. package/dist/transactions/ipcore/initIpCounter.d.ts +14 -0
  164. package/dist/transactions/ipcore/initIpCounter.js +16 -0
  165. package/dist/transactions/ipcore/initIpRegistry.d.ts +10 -0
  166. package/dist/transactions/ipcore/initIpRegistry.js +17 -0
  167. package/dist/transactions/ipcore/initModuleConfig.d.ts +11 -0
  168. package/dist/transactions/ipcore/initModuleConfig.js +26 -0
  169. package/dist/transactions/ipcore/initializeRegistryConfig.d.ts +11 -0
  170. package/dist/transactions/ipcore/initializeRegistryConfig.js +18 -0
  171. package/dist/transactions/ipcore/initializeRegistryConfigTreasury.d.ts +10 -0
  172. package/dist/transactions/ipcore/initializeRegistryConfigTreasury.js +18 -0
  173. package/dist/transactions/ipcore/registerIpAsset.d.ts +16 -0
  174. package/dist/transactions/ipcore/registerIpAsset.js +64 -0
  175. package/dist/transactions/ipcore/resolveParent.d.ts +15 -0
  176. package/dist/transactions/ipcore/resolveParent.js +22 -0
  177. package/dist/transactions/ipcore/updateRegistryConfig.d.ts +11 -0
  178. package/dist/transactions/ipcore/updateRegistryConfig.js +19 -0
  179. package/dist/transactions/metadata/createEntityMetadata.d.ts +14 -0
  180. package/dist/transactions/metadata/createEntityMetadata.js +22 -0
  181. package/dist/transactions/metadata/createIpMetadata.d.ts +15 -0
  182. package/dist/transactions/metadata/createIpMetadata.js +23 -0
  183. package/dist/transactions/metadata/index.d.ts +7 -0
  184. package/dist/transactions/metadata/index.js +7 -0
  185. package/dist/transactions/metadata/lockEntityMetadata.d.ts +12 -0
  186. package/dist/transactions/metadata/lockEntityMetadata.js +20 -0
  187. package/dist/transactions/metadata/lockIpMetadata.d.ts +13 -0
  188. package/dist/transactions/metadata/lockIpMetadata.js +21 -0
  189. package/dist/transactions/metadata/registerSchema.d.ts +13 -0
  190. package/dist/transactions/metadata/registerSchema.js +21 -0
  191. package/dist/transactions/metadata/updateEntityMetadata.d.ts +13 -0
  192. package/dist/transactions/metadata/updateEntityMetadata.js +32 -0
  193. package/dist/transactions/metadata/updateIpMetadata.d.ts +17 -0
  194. package/dist/transactions/metadata/updateIpMetadata.js +24 -0
  195. package/dist/types/entity.d.ts +416 -0
  196. package/dist/types/entity.js +1 -0
  197. package/dist/types/index.d.ts +3 -0
  198. package/dist/types/index.js +3 -0
  199. package/dist/types/ipcore.d.ts +1008 -0
  200. package/dist/types/ipcore.js +1 -0
  201. package/dist/types/metadata.d.ts +714 -0
  202. package/dist/types/metadata.js +1 -0
  203. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # Mycelium Core SDK (Stateless Transaction Factory)
2
+
3
+ This is the core, stateless SDK for building deterministic Solana transactions for the Mycelium protocol. It generates instructions and transactions offline. It does not create RPC connections, providers, wallets, or send anything.
4
+
5
+ - Stateless and offline-capable
6
+ - Chain-aware program ID resolution
7
+ - Thin SDK wrapper around existing transaction builders
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pnpm add @mycelium/core-sdk
13
+ ```
14
+
15
+ ## Quickstart
16
+
17
+ Initialize the SDK for a chain, then use namespaces to generate unsigned transactions.
18
+
19
+ ```ts
20
+ import { MyceliumSDK } from "@mycelium/core-sdk";
21
+
22
+ // 1) Initialize the SDK (no network, no wallet required)
23
+ const sdk = new MyceliumSDK({ chain: "devnet" });
24
+
25
+ // 2) Prepare your Anchor Programs elsewhere (not handled by core-sdk)
26
+ // These are placeholders — you should construct them in your app.
27
+ const entityProgram = /* Program<Entity> */ undefined as any;
28
+ const metadataProgram = /* Program<Metadata> */ undefined as any;
29
+ const ipcoreProgram = /* Program<Ipcore> */ undefined as any;
30
+
31
+ // Common inputs (replace with your keys)
32
+ const payer = /* PublicKey */ undefined as any;
33
+ const controllers = [
34
+ /* PublicKey[] */
35
+ ];
36
+ ```
37
+
38
+ ### Register an Entity
39
+
40
+ Creates an unsigned transaction with a registerEntity instruction and a createEntityMetadata instruction (metadata v1) when applicable.
41
+
42
+ ```ts
43
+ const { transaction } = await sdk.entity.generateRegisterTransaction({
44
+ program: entityProgram,
45
+ metadataProgram,
46
+ controllers,
47
+ threshold: 1,
48
+ metadataUri: "ipfs://...", // your URI
49
+ payer,
50
+ });
51
+ // transaction has NO fee payer, NO blockhash, and is UNSIGNED
52
+ ```
53
+
54
+ ### Register a Root IP Asset
55
+
56
+ Creates an unsigned transaction with a registerRootIp instruction and createIpMetadata v1.
57
+
58
+ ```ts
59
+ const { transaction: ipTx, ipAssetPda } =
60
+ await sdk.ipcore.generateRegisterIpAssetTransaction({
61
+ program: ipcoreProgram,
62
+ metadataProgram,
63
+ payer,
64
+ entityIndex: 0, // your entity index
65
+ registrationFee: 0.1, // in SOL (converted inside)
66
+ metadataUri: "ipfs://...", // your URI
67
+ controllers,
68
+ });
69
+ ```
70
+
71
+ ### Create Entity Metadata (v1)
72
+
73
+ ```ts
74
+ import { BN } from "@coral-xyz/anchor";
75
+ import { PublicKey } from "@solana/web3.js";
76
+
77
+ const entityPda = /* PublicKey */ undefined as any;
78
+ const schemaPda = /* PublicKey */ undefined as any;
79
+
80
+ const { transaction: createEntityMetaTx } =
81
+ await sdk.metadata.generateCreateEntityMetadataTransaction({
82
+ program: metadataProgram,
83
+ entityPda: entityPda as PublicKey,
84
+ schemaPda: schemaPda as PublicKey,
85
+ version: new BN(1),
86
+ metadataUri: "ipfs://...",
87
+ payer,
88
+ controllers,
89
+ });
90
+ ```
91
+
92
+ ### Create IP Metadata (v1)
93
+
94
+ ```ts
95
+ import { BN } from "@coral-xyz/anchor";
96
+ import { PublicKey } from "@solana/web3.js";
97
+
98
+ const ipAssetPda = /* PublicKey */ undefined as any;
99
+ const entityPda = /* PublicKey */ undefined as any;
100
+ const schemaPda = /* PublicKey */ undefined as any;
101
+
102
+ const { transaction: createIpMetaTx } =
103
+ await sdk.metadata.generateCreateIpMetadataTransaction({
104
+ program: metadataProgram,
105
+ ipAssetPda: ipAssetPda as PublicKey,
106
+ entityPda: entityPda as PublicKey,
107
+ schemaPda: schemaPda as PublicKey,
108
+ version: new BN(1),
109
+ metadataUri: "ipfs://...",
110
+ payer,
111
+ controllers,
112
+ });
113
+ ```
114
+
115
+ ### Update Entity Metadata
116
+
117
+ ```ts
118
+ import { BN } from "@coral-xyz/anchor";
119
+ import { PublicKey } from "@solana/web3.js";
120
+
121
+ const entityPda = /* PublicKey */ undefined as any;
122
+ const previousMetadataPda = /* PublicKey */ undefined as any;
123
+ const newMetadataPda = /* PublicKey */ undefined as any;
124
+ const schemaPda = /* PublicKey */ undefined as any;
125
+ const authority = /* PublicKey */ undefined as any;
126
+
127
+ const { transaction: updateEntityMetaTx } =
128
+ await sdk.metadata.generateUpdateEntityMetadataTransaction({
129
+ program: metadataProgram,
130
+ entityPda: entityPda as PublicKey,
131
+ previousMetadataPda: previousMetadataPda as PublicKey,
132
+ payer,
133
+ metadataUri: "ipfs://...",
134
+ controllers,
135
+ });
136
+ ```
137
+
138
+ ### Update IP Metadata
139
+
140
+ ```ts
141
+ import { BN } from "@coral-xyz/anchor";
142
+ import { PublicKey } from "@solana/web3.js";
143
+
144
+ const ipAssetPda = /* PublicKey */ undefined as any;
145
+ const entityPda = /* PublicKey */ undefined as any;
146
+ const previousMetadataPda = /* PublicKey */ undefined as any;
147
+ const newMetadataPda = /* PublicKey */ undefined as any;
148
+ const schemaPda = /* PublicKey */ undefined as any;
149
+ const authority = /* PublicKey */ undefined as any;
150
+
151
+ const { transaction: updateIpMetaTx } =
152
+ await sdk.metadata.generateUpdateIpMetadataTransaction({
153
+ program: metadataProgram,
154
+ ipAssetPda: ipAssetPda as PublicKey,
155
+ entityPda: entityPda as PublicKey,
156
+ previousMetadataPda: previousMetadataPda as PublicKey,
157
+ newMetadataPda: newMetadataPda as PublicKey,
158
+ schemaPda: schemaPda as PublicKey,
159
+ authority: authority as PublicKey,
160
+ payer,
161
+ version: new BN(2),
162
+ metadataUri: "ipfs://...",
163
+ controllers,
164
+ });
165
+ ```
166
+
167
+ ## Important Notes
168
+
169
+ - Returns unsigned transactions without fee payer or blockhash. Set those in your app before signing and sending.
170
+ - Core SDK does not create Connection, AnchorProvider, or Program. You must supply Program instances if your chosen transaction builder expects them.
171
+ - No on-chain data is fetched by the SDK itself. Some existing transaction builders may check account state via program.account.\*; construct those programs and providers externally if you use those helpers.
172
+
173
+ ## Next Steps
174
+
175
+ - Sign and send transactions using your own client or higher-level packages (e.g., client-sdk, react-sdk).
176
+ - See the full list of builders in sdk/namespaces and transactions/.
@@ -0,0 +1,24 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Entity } from "../../types/entity";
4
+ /**
5
+ * EntityAccount type definition
6
+ * Represents what is stored on-chain for an entity
7
+ */
8
+ export type EntityAccount = {
9
+ status: number;
10
+ controllerThreshold: number;
11
+ controllers: anchor.web3.PublicKey[];
12
+ creator: anchor.web3.PublicKey;
13
+ createdAt: anchor.BN;
14
+ updatedAt: anchor.BN;
15
+ bump: number;
16
+ };
17
+ /**
18
+ * Decode raw account buffer into a structured EntityAccount object
19
+ */
20
+ export declare function decodeEntityAccount(program: Program<Entity>, buffer: Buffer): EntityAccount;
21
+ /**
22
+ * Optional: check if a buffer matches the EntityAccount discriminator
23
+ */
24
+ export declare function isEntityAccountDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Decode raw account buffer into a structured EntityAccount object
3
+ */
4
+ export function decodeEntityAccount(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("EntityAccount", buffer);
6
+ return {
7
+ status: accountData.status,
8
+ controllerThreshold: accountData.controllerThreshold,
9
+ controllers: accountData.controllers,
10
+ creator: accountData.creator,
11
+ createdAt: accountData.createdAt,
12
+ updatedAt: accountData.updatedAt,
13
+ bump: accountData.bump,
14
+ };
15
+ }
16
+ /**
17
+ * Optional: check if a buffer matches the EntityAccount discriminator
18
+ */
19
+ export function isEntityAccountDiscriminator(buffer) {
20
+ const discriminator = buffer.subarray(0, 8);
21
+ return discriminator.every((byte, i) => byte === ENTITY_ACCOUNT_DISCRIMINATOR[i]);
22
+ }
23
+ // Example discriminator (anchor generates this)
24
+ const ENTITY_ACCOUNT_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,22 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Entity } from "../../types/entity";
4
+ /**
5
+ * EntityTreasury type definition
6
+ * Represents what is stored on-chain for an entity's treasury
7
+ */
8
+ export type EntityTreasury = {
9
+ entity: anchor.web3.PublicKey;
10
+ version: number;
11
+ balance: anchor.BN;
12
+ createdAt: anchor.BN;
13
+ bump: number;
14
+ };
15
+ /**
16
+ * Decode raw account buffer into a structured EntityTreasury object
17
+ */
18
+ export declare function decodeEntityTreasury(program: Program<Entity>, buffer: Buffer): EntityTreasury;
19
+ /**
20
+ * Optional: check if a buffer matches the EntityTreasury discriminator
21
+ */
22
+ export declare function isEntityTreasuryDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,25 @@
1
+ // src/accounts/entityTreasury.ts
2
+ import * as anchor from "@coral-xyz/anchor";
3
+ /**
4
+ * Decode raw account buffer into a structured EntityTreasury object
5
+ */
6
+ export function decodeEntityTreasury(program, buffer) {
7
+ var _a;
8
+ const accountData = program.coder.accounts.decode("EntityTreasury", buffer);
9
+ return {
10
+ entity: accountData.entity,
11
+ version: accountData.version,
12
+ balance: (_a = accountData.balance) !== null && _a !== void 0 ? _a : new anchor.BN(0),
13
+ createdAt: accountData.createdAt,
14
+ bump: accountData.bump,
15
+ };
16
+ }
17
+ /**
18
+ * Optional: check if a buffer matches the EntityTreasury discriminator
19
+ */
20
+ export function isEntityTreasuryDiscriminator(buffer) {
21
+ const discriminator = buffer.subarray(0, 8);
22
+ return discriminator.every((byte, i) => byte === ENTITY_TREASURY_DISCRIMINATOR[i]);
23
+ }
24
+ // Example discriminator (anchor generates this automatically in the IDL)
25
+ const ENTITY_TREASURY_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,2 @@
1
+ export * from "./entity";
2
+ export * from "./entityTreasury";
@@ -0,0 +1,2 @@
1
+ export * from "./entity";
2
+ export * from "./entityTreasury";
@@ -0,0 +1,3 @@
1
+ export * from "./entity";
2
+ export * from "./ipcore";
3
+ export * from "./metadata";
@@ -0,0 +1,3 @@
1
+ export * from "./entity";
2
+ export * from "./ipcore";
3
+ export * from "./metadata";
@@ -0,0 +1,21 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * DerivativeLink on-chain account type
6
+ */
7
+ export type DerivativeLink = {
8
+ parentIpId: anchor.BN;
9
+ childIpId: anchor.BN;
10
+ status: number;
11
+ createdAt: anchor.BN;
12
+ bump: number;
13
+ };
14
+ /**
15
+ * Decode raw buffer into structured DerivativeLink object
16
+ */
17
+ export declare function decodeDerivativeLink(program: Program<Ipcore>, buffer: Buffer): DerivativeLink;
18
+ /**
19
+ * Optional: check if buffer matches DerivativeLink discriminator
20
+ */
21
+ export declare function isDerivativeLinkDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Decode raw buffer into structured DerivativeLink object
3
+ */
4
+ export function decodeDerivativeLink(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("DerivativeLink", buffer);
6
+ return {
7
+ parentIpId: accountData.parentIpId,
8
+ childIpId: accountData.childIpId,
9
+ status: accountData.status,
10
+ createdAt: accountData.createdAt,
11
+ bump: accountData.bump,
12
+ };
13
+ }
14
+ /**
15
+ * Optional: check if buffer matches DerivativeLink discriminator
16
+ */
17
+ export function isDerivativeLinkDiscriminator(buffer) {
18
+ const discriminator = buffer.subarray(0, 8);
19
+ return discriminator.every((byte, i) => byte === DERIVATIVE_LINK_DISCRIMINATOR[i]);
20
+ }
21
+ // Anchor-generated discriminator (example; replace with actual)
22
+ const DERIVATIVE_LINK_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,7 @@
1
+ export * from "./derivativeLink";
2
+ export * from "./ipAsset";
3
+ export * from "./ipRegistry";
4
+ export * from "./moduleConfig";
5
+ export * from "./provenanceClaim";
6
+ export * from "./registryConfig";
7
+ export * from "./registryConfigTreasury";
@@ -0,0 +1,7 @@
1
+ export * from "./derivativeLink";
2
+ export * from "./ipAsset";
3
+ export * from "./ipRegistry";
4
+ export * from "./moduleConfig";
5
+ export * from "./provenanceClaim";
6
+ export * from "./registryConfig";
7
+ export * from "./registryConfigTreasury";
@@ -0,0 +1,25 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * IpAsset on-chain account type
6
+ */
7
+ export type IpAsset = {
8
+ entity: anchor.web3.PublicKey;
9
+ parent: anchor.web3.PublicKey | null;
10
+ category: number;
11
+ metadataUri: string;
12
+ provenance: string | null;
13
+ status: number;
14
+ createdAt: anchor.BN;
15
+ updatedAt: anchor.BN;
16
+ bump: number;
17
+ };
18
+ /**
19
+ * Decode raw buffer into structured IpAsset object
20
+ */
21
+ export declare function decodeIpAsset(program: Program<Ipcore>, buffer: Buffer): IpAsset;
22
+ /**
23
+ * Optional: check if buffer matches IpAsset discriminator
24
+ */
25
+ export declare function isIpAssetDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Decode raw buffer into structured IpAsset object
3
+ */
4
+ export function decodeIpAsset(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("IpAsset", buffer);
6
+ return {
7
+ entity: accountData.entity,
8
+ parent: accountData.parent,
9
+ category: accountData.category,
10
+ metadataUri: accountData.metadataUri,
11
+ provenance: accountData.provenance,
12
+ status: accountData.status,
13
+ createdAt: accountData.createdAt,
14
+ updatedAt: accountData.updatedAt,
15
+ bump: accountData.bump,
16
+ };
17
+ }
18
+ /**
19
+ * Optional: check if buffer matches IpAsset discriminator
20
+ */
21
+ export function isIpAssetDiscriminator(buffer) {
22
+ const discriminator = buffer.subarray(0, 8);
23
+ return discriminator.every((byte, i) => byte === IP_ASSET_DISCRIMINATOR[i]);
24
+ }
25
+ // Anchor-generated discriminator placeholder
26
+ const IP_ASSET_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,21 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * IPRegistry on-chain account type
6
+ */
7
+ export type IpRegistry = {
8
+ totalIps: anchor.BN;
9
+ ipAssets: anchor.web3.PublicKey[];
10
+ derivativeLinks: anchor.web3.PublicKey[];
11
+ createdAt: anchor.BN;
12
+ bump: number;
13
+ };
14
+ /**
15
+ * Decode raw buffer into structured IpRegistry object
16
+ */
17
+ export declare function decodeIpRegistry(program: Program<Ipcore>, buffer: Buffer): IpRegistry;
18
+ /**
19
+ * Optional: check if buffer matches IpRegistry discriminator
20
+ */
21
+ export declare function isIpRegistryDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Decode raw buffer into structured IpRegistry object
3
+ */
4
+ export function decodeIpRegistry(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("IpRegistry", buffer);
6
+ return {
7
+ totalIps: accountData.totalIps,
8
+ ipAssets: accountData.ipAssets,
9
+ derivativeLinks: accountData.derivativeLinks,
10
+ createdAt: accountData.createdAt,
11
+ bump: accountData.bump,
12
+ };
13
+ }
14
+ /**
15
+ * Optional: check if buffer matches IpRegistry discriminator
16
+ */
17
+ export function isIpRegistryDiscriminator(buffer) {
18
+ const discriminator = buffer.subarray(0, 8);
19
+ return discriminator.every((byte, i) => byte === IP_REGISTRY_DISCRIMINATOR[i]);
20
+ }
21
+ // Anchor-generated discriminator (for reference)
22
+ const IP_REGISTRY_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,21 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * ModuleConfig on-chain account type
6
+ */
7
+ export type ModuleConfig = {
8
+ ipAsset: anchor.web3.PublicKey;
9
+ allowedModules: anchor.web3.PublicKey[];
10
+ createdAt: anchor.BN;
11
+ updatedAt: anchor.BN;
12
+ bump: number;
13
+ };
14
+ /**
15
+ * Decode raw buffer into structured ModuleConfig object
16
+ */
17
+ export declare function decodeModuleConfig(program: Program<Ipcore>, buffer: Buffer): ModuleConfig;
18
+ /**
19
+ * Optional: check if buffer matches ModuleConfig discriminator
20
+ */
21
+ export declare function isModuleConfigDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Decode raw buffer into structured ModuleConfig object
3
+ */
4
+ export function decodeModuleConfig(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("ModuleConfig", buffer);
6
+ return {
7
+ ipAsset: accountData.ipAsset,
8
+ allowedModules: accountData.allowedModules,
9
+ createdAt: accountData.createdAt,
10
+ updatedAt: accountData.updatedAt,
11
+ bump: accountData.bump,
12
+ };
13
+ }
14
+ /**
15
+ * Optional: check if buffer matches ModuleConfig discriminator
16
+ */
17
+ export function isModuleConfigDiscriminator(buffer) {
18
+ const discriminator = buffer.subarray(0, 8);
19
+ return discriminator.every((byte, i) => byte === MODULE_CONFIG_DISCRIMINATOR[i]);
20
+ }
21
+ // Anchor-generated discriminator placeholder (replace with real one from IDL)
22
+ const MODULE_CONFIG_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,25 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * ProvenanceClaim on-chain account type
6
+ */
7
+ export type ProvenanceClaim = {
8
+ ipAsset: anchor.web3.PublicKey;
9
+ entity: anchor.web3.PublicKey;
10
+ creator: anchor.web3.PublicKey;
11
+ evidenceHash: Buffer;
12
+ uri: string;
13
+ status: number;
14
+ createdAt: anchor.BN;
15
+ updatedAt: anchor.BN;
16
+ bump: number;
17
+ };
18
+ /**
19
+ * Decode raw buffer into structured ProvenanceClaim object
20
+ */
21
+ export declare function decodeProvenanceClaim(program: Program<Ipcore>, buffer: Buffer): ProvenanceClaim;
22
+ /**
23
+ * Optional: check if buffer matches ProvenanceClaim discriminator
24
+ */
25
+ export declare function isProvenanceClaimDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Decode raw buffer into structured ProvenanceClaim object
3
+ */
4
+ export function decodeProvenanceClaim(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("ProvenanceClaim", buffer);
6
+ return {
7
+ ipAsset: accountData.ipAsset,
8
+ entity: accountData.entity,
9
+ creator: accountData.creator,
10
+ evidenceHash: accountData.evidenceHash,
11
+ uri: accountData.uri,
12
+ status: accountData.status,
13
+ createdAt: accountData.createdAt,
14
+ updatedAt: accountData.updatedAt,
15
+ bump: accountData.bump,
16
+ };
17
+ }
18
+ /**
19
+ * Optional: check if buffer matches ProvenanceClaim discriminator
20
+ */
21
+ export function isProvenanceClaimDiscriminator(buffer) {
22
+ const discriminator = buffer.subarray(0, 8);
23
+ return discriminator.every((byte, i) => byte === PROVENANCE_CLAIM_DISCRIMINATOR[i]);
24
+ }
25
+ // Anchor-generated discriminator placeholder
26
+ const PROVENANCE_CLAIM_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,21 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * RegistryConfig on-chain account type
6
+ */
7
+ export type RegistryConfig = {
8
+ authority: anchor.web3.PublicKey;
9
+ ipRegistrationFeeLamports: anchor.BN;
10
+ createdAt: anchor.BN;
11
+ updatedAt: anchor.BN;
12
+ bump: number;
13
+ };
14
+ /**
15
+ * Decode raw buffer into structured RegistryConfig object
16
+ */
17
+ export declare function decodeRegistryConfig(program: Program<Ipcore>, buffer: Buffer): RegistryConfig;
18
+ /**
19
+ * Optional: check if buffer matches RegistryConfig discriminator
20
+ */
21
+ export declare function isRegistryConfigDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Decode raw buffer into structured RegistryConfig object
3
+ */
4
+ export function decodeRegistryConfig(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("RegistryConfig", buffer);
6
+ return {
7
+ authority: accountData.authority,
8
+ ipRegistrationFeeLamports: accountData.ipRegistrationFeeLamports,
9
+ createdAt: accountData.createdAt,
10
+ updatedAt: accountData.updatedAt,
11
+ bump: accountData.bump,
12
+ };
13
+ }
14
+ /**
15
+ * Optional: check if buffer matches RegistryConfig discriminator
16
+ */
17
+ export function isRegistryConfigDiscriminator(buffer) {
18
+ const discriminator = buffer.subarray(0, 8);
19
+ return discriminator.every((byte, i) => byte === REGISTRY_CONFIG_DISCRIMINATOR[i]);
20
+ }
21
+ // Anchor-generated discriminator placeholder (replace with real one from IDL)
22
+ const REGISTRY_CONFIG_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,18 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Ipcore } from "../../types/ipcore";
4
+ /**
5
+ * RegistryConfigTreasury on-chain account type
6
+ */
7
+ export type RegistryConfigTreasury = {
8
+ authority: anchor.web3.PublicKey;
9
+ createdAt: anchor.BN;
10
+ };
11
+ /**
12
+ * Decode raw buffer into structured RegistryConfigTreasury object
13
+ */
14
+ export declare function decodeRegistryConfigTreasury(program: Program<Ipcore>, buffer: Buffer): RegistryConfigTreasury;
15
+ /**
16
+ * Optional: check if buffer matches RegistryConfigTreasury discriminator
17
+ */
18
+ export declare function isRegistryConfigTreasuryDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Decode raw buffer into structured RegistryConfigTreasury object
3
+ */
4
+ export function decodeRegistryConfigTreasury(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("RegistryConfigTreasury", buffer);
6
+ return {
7
+ authority: accountData.authority,
8
+ createdAt: accountData.createdAt,
9
+ };
10
+ }
11
+ /**
12
+ * Optional: check if buffer matches RegistryConfigTreasury discriminator
13
+ */
14
+ export function isRegistryConfigTreasuryDiscriminator(buffer) {
15
+ const discriminator = buffer.subarray(0, 8);
16
+ return discriminator.every((byte, i) => byte === REGISTRY_CONFIG_TREASURY_DISCRIMINATOR[i]);
17
+ }
18
+ // Anchor-generated discriminator placeholder (replace with actual IDL discriminator)
19
+ const REGISTRY_CONFIG_TREASURY_DISCRIMINATOR = [
20
+ 12, 34, 56, 78, 90, 123, 45, 67,
21
+ ];
@@ -0,0 +1,23 @@
1
+ import * as anchor from "@coral-xyz/anchor";
2
+ import { Program } from "@coral-xyz/anchor";
3
+ import { Metadata } from "../../types/metadata";
4
+ /**
5
+ * EntityMetadata on-chain account type
6
+ */
7
+ export type EntityMetadata = {
8
+ entity: anchor.web3.PublicKey;
9
+ schema: anchor.web3.PublicKey;
10
+ version: anchor.BN;
11
+ uri: string;
12
+ contentHash: Buffer;
13
+ createdAt: anchor.BN;
14
+ locked: boolean;
15
+ };
16
+ /**
17
+ * Decode raw buffer into structured EntityMetadata object
18
+ */
19
+ export declare function decodeEntityMetadata(program: Program<Metadata>, buffer: Buffer): EntityMetadata;
20
+ /**
21
+ * Optional: check if buffer matches EntityMetadata discriminator
22
+ */
23
+ export declare function isEntityMetadataDiscriminator(buffer: Buffer): boolean;