@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
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Decode raw buffer into structured EntityMetadata object
3
+ */
4
+ export function decodeEntityMetadata(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("EntityMetadata", buffer);
6
+ return {
7
+ entity: accountData.entity,
8
+ schema: accountData.schema,
9
+ version: accountData.version,
10
+ uri: accountData.uri,
11
+ contentHash: Buffer.from(accountData.contentHash),
12
+ createdAt: accountData.createdAt,
13
+ locked: accountData.locked,
14
+ };
15
+ }
16
+ /**
17
+ * Optional: check if buffer matches EntityMetadata discriminator
18
+ */
19
+ export function isEntityMetadataDiscriminator(buffer) {
20
+ const discriminator = buffer.subarray(0, 8);
21
+ return discriminator.every((byte, i) => byte === ENTITY_METADATA_DISCRIMINATOR[i]);
22
+ }
23
+ // Anchor-generated discriminator placeholder (replace with actual IDL discriminator)
24
+ const ENTITY_METADATA_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,3 @@
1
+ export * from "./entityMetadata";
2
+ export * from "./ipMetadata";
3
+ export * from "./schemaRegistry";
@@ -0,0 +1,3 @@
1
+ export * from "./entityMetadata";
2
+ export * from "./ipMetadata";
3
+ export * from "./schemaRegistry";
@@ -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
+ * IpMetadata on-chain account type
6
+ */
7
+ export type IpMetadata = {
8
+ ipAsset: 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 IpMetadata object
18
+ */
19
+ export declare function decodeIpMetadata(program: Program<Metadata>, buffer: Buffer): IpMetadata;
20
+ /**
21
+ * Optional: check if buffer matches IpMetadata discriminator
22
+ */
23
+ export declare function isIpMetadataDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Decode raw buffer into structured IpMetadata object
3
+ */
4
+ export function decodeIpMetadata(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("IpMetadata", buffer);
6
+ return {
7
+ ipAsset: accountData.ipAsset,
8
+ schema: accountData.schema,
9
+ version: accountData.version,
10
+ uri: accountData.uri,
11
+ contentHash: Buffer.from(accountData.contentHash),
12
+ createdAt: accountData.createdAt,
13
+ locked: accountData.locked,
14
+ };
15
+ }
16
+ /**
17
+ * Optional: check if buffer matches IpMetadata discriminator
18
+ */
19
+ export function isIpMetadataDiscriminator(buffer) {
20
+ const discriminator = buffer.subarray(0, 8);
21
+ return discriminator.every((byte, i) => byte === IP_METADATA_DISCRIMINATOR[i]);
22
+ }
23
+ // Anchor-generated discriminator placeholder (replace with actual IDL discriminator)
24
+ const IP_METADATA_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 { Metadata } from "../../types/metadata";
4
+ /**
5
+ * SchemaRegistry on-chain account type
6
+ */
7
+ export type SchemaRegistry = {
8
+ category: string;
9
+ schemaUri: string;
10
+ version: number;
11
+ creator: anchor.web3.PublicKey;
12
+ bump: number;
13
+ };
14
+ /**
15
+ * Decode raw buffer into structured SchemaRegistry object
16
+ */
17
+ export declare function decodeSchemaRegistry(program: Program<Metadata>, buffer: Buffer): SchemaRegistry;
18
+ /**
19
+ * Optional: check if buffer matches SchemaRegistry discriminator
20
+ */
21
+ export declare function isSchemaRegistryDiscriminator(buffer: Buffer): boolean;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Decode raw buffer into structured SchemaRegistry object
3
+ */
4
+ export function decodeSchemaRegistry(program, buffer) {
5
+ const accountData = program.coder.accounts.decode("SchemaRegistry", buffer);
6
+ return {
7
+ category: accountData.category,
8
+ schemaUri: accountData.schemaUri,
9
+ version: accountData.version,
10
+ creator: accountData.creator,
11
+ bump: accountData.bump,
12
+ };
13
+ }
14
+ /**
15
+ * Optional: check if buffer matches SchemaRegistry discriminator
16
+ */
17
+ export function isSchemaRegistryDiscriminator(buffer) {
18
+ const discriminator = buffer.subarray(0, 8);
19
+ return discriminator.every((byte, i) => byte === SCHEMA_REGISTRY_DISCRIMINATOR[i]);
20
+ }
21
+ // Anchor-generated discriminator placeholder (replace with actual IDL discriminator)
22
+ const SCHEMA_REGISTRY_DISCRIMINATOR = [12, 34, 56, 78, 90, 123, 45, 67];
@@ -0,0 +1,4 @@
1
+ export * from "./programIds";
2
+ export * from "./seeds";
3
+ export * from "./status";
4
+ export * from "./schema";
@@ -0,0 +1,4 @@
1
+ export * from "./programIds";
2
+ export * from "./seeds";
3
+ export * from "./status";
4
+ export * from "./schema";
@@ -0,0 +1,5 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ declare const ENTITY_PROGRAM_ID: PublicKey;
3
+ declare const IPCORE_PROGRAM_ID: PublicKey;
4
+ declare const METADATA_PROGRAM_ID: PublicKey;
5
+ export { ENTITY_PROGRAM_ID, IPCORE_PROGRAM_ID, METADATA_PROGRAM_ID };
@@ -0,0 +1,8 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import entityIdl from "../idl/entity.json";
3
+ import ipcoreIdl from "../idl/ipcore.json";
4
+ import metadataIdl from "../idl/metadata.json";
5
+ const ENTITY_PROGRAM_ID = new PublicKey(entityIdl.address);
6
+ const IPCORE_PROGRAM_ID = new PublicKey(ipcoreIdl.address);
7
+ const METADATA_PROGRAM_ID = new PublicKey(metadataIdl.address);
8
+ export { ENTITY_PROGRAM_ID, IPCORE_PROGRAM_ID, METADATA_PROGRAM_ID };
@@ -0,0 +1,3 @@
1
+ export declare const MAX_SCHEMA_ID_LEN = 32;
2
+ export declare const MAX_VERSION_LEN = 16;
3
+ export declare const MAX_SCHEMA_URI_LEN = 96;
@@ -0,0 +1,3 @@
1
+ export const MAX_SCHEMA_ID_LEN = 32;
2
+ export const MAX_VERSION_LEN = 16;
3
+ export const MAX_SCHEMA_URI_LEN = 96;
@@ -0,0 +1,17 @@
1
+ declare const SEEDS: {
2
+ readonly ENTITY: "entity";
3
+ readonly ENTITY_TREASURY: "entity_treasury";
4
+ readonly ENTITY_COUNTER: "entity_counter";
5
+ readonly IP_ASSET: "ip_asset";
6
+ readonly IP_COUNTER: "ip_counter";
7
+ readonly IP_REGISTRY: "ip_registry";
8
+ readonly DERIVATIVE_LINK: "derivative_link";
9
+ readonly PROVENANCE: "provenance";
10
+ readonly ENTITY_METADATA: "entity_metadata";
11
+ readonly IP_METADATA: "ip_metadata";
12
+ readonly SCHEMA: "schema";
13
+ readonly REGISTRY_CONFIG: "registry_config";
14
+ readonly REGISTRY_CONFIG_TREASURY: "registry_config_treasury";
15
+ readonly MODULE_CONFIG: "module_config";
16
+ };
17
+ export { SEEDS };
@@ -0,0 +1,17 @@
1
+ const SEEDS = {
2
+ ENTITY: "entity",
3
+ ENTITY_TREASURY: "entity_treasury",
4
+ ENTITY_COUNTER: "entity_counter",
5
+ IP_ASSET: "ip_asset",
6
+ IP_COUNTER: "ip_counter",
7
+ IP_REGISTRY: "ip_registry",
8
+ DERIVATIVE_LINK: "derivative_link",
9
+ PROVENANCE: "provenance",
10
+ ENTITY_METADATA: "entity_metadata",
11
+ IP_METADATA: "ip_metadata",
12
+ SCHEMA: "schema",
13
+ REGISTRY_CONFIG: "registry_config",
14
+ REGISTRY_CONFIG_TREASURY: "registry_config_treasury",
15
+ MODULE_CONFIG: "module_config",
16
+ };
17
+ export { SEEDS };
@@ -0,0 +1,24 @@
1
+ export declare const ENTITY_STATUS_ACTIVE = 1;
2
+ export declare const ENTITY_STATUS_FROZEN = 2;
3
+ export declare const IP_STATUS_ACTIVE = 1;
4
+ export declare const IP_STATUS_FROZEN = 2;
5
+ export declare const IP_STATE_DERIVATIVE_UNANCHORED = 1;
6
+ export declare const LINK_STATUS_ASSERTED = 1;
7
+ export declare const LINK_STATUS_RESOLVED = 2;
8
+ export declare const LINK_STATUS_DISPUTED = 3;
9
+ export declare enum EntityStatus {
10
+ ACTIVE = 1,
11
+ FROZEN = 2
12
+ }
13
+ export declare enum IpStatus {
14
+ ACTIVE = 1,
15
+ FROZEN = 2
16
+ }
17
+ export declare enum IpState {
18
+ DERIVATIVE_UNANCHORED = 1
19
+ }
20
+ export declare enum LinkStatus {
21
+ ASSERTED = 1,
22
+ RESOLVED = 2,
23
+ DISPUTED = 3
24
+ }
@@ -0,0 +1,33 @@
1
+ // src/constants/status.ts
2
+ // Entity statuses
3
+ export const ENTITY_STATUS_ACTIVE = 1;
4
+ export const ENTITY_STATUS_FROZEN = 2;
5
+ // IP asset statuses
6
+ export const IP_STATUS_ACTIVE = 1;
7
+ export const IP_STATUS_FROZEN = 2;
8
+ // IP state
9
+ export const IP_STATE_DERIVATIVE_UNANCHORED = 1;
10
+ // Derivative link statuses
11
+ export const LINK_STATUS_ASSERTED = 1;
12
+ export const LINK_STATUS_RESOLVED = 2;
13
+ export const LINK_STATUS_DISPUTED = 3;
14
+ export var EntityStatus;
15
+ (function (EntityStatus) {
16
+ EntityStatus[EntityStatus["ACTIVE"] = 1] = "ACTIVE";
17
+ EntityStatus[EntityStatus["FROZEN"] = 2] = "FROZEN";
18
+ })(EntityStatus || (EntityStatus = {}));
19
+ export var IpStatus;
20
+ (function (IpStatus) {
21
+ IpStatus[IpStatus["ACTIVE"] = 1] = "ACTIVE";
22
+ IpStatus[IpStatus["FROZEN"] = 2] = "FROZEN";
23
+ })(IpStatus || (IpStatus = {}));
24
+ export var IpState;
25
+ (function (IpState) {
26
+ IpState[IpState["DERIVATIVE_UNANCHORED"] = 1] = "DERIVATIVE_UNANCHORED";
27
+ })(IpState || (IpState = {}));
28
+ export var LinkStatus;
29
+ (function (LinkStatus) {
30
+ LinkStatus[LinkStatus["ASSERTED"] = 1] = "ASSERTED";
31
+ LinkStatus[LinkStatus["RESOLVED"] = 2] = "RESOLVED";
32
+ LinkStatus[LinkStatus["DISPUTED"] = 3] = "DISPUTED";
33
+ })(LinkStatus || (LinkStatus = {}));
@@ -0,0 +1 @@
1
+ export * from "./schema";
@@ -0,0 +1 @@
1
+ export * from "./schema";
@@ -0,0 +1,3 @@
1
+ export declare function encodePaddedAscii(input: string, maxLen: number): Uint8Array;
2
+ export declare function sha256(data: string): Uint8Array;
3
+ export declare function decodePaddedAscii(bytes: Uint8Array): string;
@@ -0,0 +1,28 @@
1
+ import { createHash } from "crypto";
2
+ export function encodePaddedAscii(input, maxLen) {
3
+ if (!/^[\x00-\x7F]*$/.test(input)) {
4
+ throw new Error("Non-ASCII characters are not allowed");
5
+ }
6
+ const encoder = new TextEncoder();
7
+ const bytes = encoder.encode(input);
8
+ if (bytes.length > maxLen) {
9
+ throw new Error(`Input too long. Max length is ${maxLen}`);
10
+ }
11
+ const padded = new Uint8Array(maxLen);
12
+ padded.set(bytes); // remaining bytes stay 0x00
13
+ return padded;
14
+ }
15
+ export function sha256(data) {
16
+ const hash = createHash("sha256").update(data).digest();
17
+ return new Uint8Array(hash);
18
+ }
19
+ export function decodePaddedAscii(bytes) {
20
+ // Remove trailing 0x00
21
+ let end = bytes.length;
22
+ while (end > 0 && bytes[end - 1] === 0) {
23
+ end--;
24
+ }
25
+ const trimmed = bytes.slice(0, end);
26
+ const decoder = new TextDecoder("utf-8");
27
+ return decoder.decode(trimmed);
28
+ }
@@ -0,0 +1,373 @@
1
+ {
2
+ "address": "8DpEe29Fw6gBHzEo3pKJL4YffJWgvq2N61ShXWhLjt1k",
3
+ "metadata": {
4
+ "name": "entity",
5
+ "version": "0.1.0",
6
+ "spec": "0.1.0",
7
+ "description": "Created with Anchor"
8
+ },
9
+ "instructions": [
10
+ {
11
+ "name": "activate_entity",
12
+ "discriminator": [179, 185, 27, 83, 195, 230, 123, 9],
13
+ "accounts": [
14
+ {
15
+ "name": "entity",
16
+ "writable": true
17
+ },
18
+ {
19
+ "name": "authority",
20
+ "signer": true
21
+ }
22
+ ],
23
+ "args": []
24
+ },
25
+ {
26
+ "name": "assert_controller_threshold",
27
+ "discriminator": [195, 68, 103, 16, 222, 131, 246, 134],
28
+ "accounts": [
29
+ {
30
+ "name": "entity"
31
+ }
32
+ ],
33
+ "args": []
34
+ },
35
+ {
36
+ "name": "freeze_entity",
37
+ "discriminator": [159, 136, 30, 2, 67, 167, 214, 147],
38
+ "accounts": [
39
+ {
40
+ "name": "entity",
41
+ "writable": true
42
+ },
43
+ {
44
+ "name": "authority",
45
+ "signer": true
46
+ }
47
+ ],
48
+ "args": []
49
+ },
50
+ {
51
+ "name": "init_entity_counter",
52
+ "discriminator": [192, 181, 149, 83, 121, 120, 190, 113],
53
+ "accounts": [
54
+ {
55
+ "name": "entity_counter",
56
+ "writable": true,
57
+ "pda": {
58
+ "seeds": [
59
+ {
60
+ "kind": "const",
61
+ "value": [
62
+ 101, 110, 116, 105, 116, 121, 95, 99, 111, 117, 110, 116, 101,
63
+ 114
64
+ ]
65
+ }
66
+ ]
67
+ }
68
+ },
69
+ {
70
+ "name": "payer",
71
+ "writable": true,
72
+ "signer": true
73
+ },
74
+ {
75
+ "name": "system_program",
76
+ "address": "11111111111111111111111111111111"
77
+ }
78
+ ],
79
+ "args": []
80
+ },
81
+ {
82
+ "name": "init_entity_treasury",
83
+ "discriminator": [66, 233, 24, 140, 15, 239, 108, 43],
84
+ "accounts": [
85
+ {
86
+ "name": "entity"
87
+ },
88
+ {
89
+ "name": "treasury",
90
+ "writable": true,
91
+ "pda": {
92
+ "seeds": [
93
+ {
94
+ "kind": "const",
95
+ "value": [
96
+ 101, 110, 116, 105, 116, 121, 95, 116, 114, 101, 97, 115, 117,
97
+ 114, 121
98
+ ]
99
+ },
100
+ {
101
+ "kind": "account",
102
+ "path": "entity"
103
+ }
104
+ ]
105
+ }
106
+ },
107
+ {
108
+ "name": "payer",
109
+ "writable": true,
110
+ "signer": true
111
+ },
112
+ {
113
+ "name": "system_program",
114
+ "address": "11111111111111111111111111111111"
115
+ }
116
+ ],
117
+ "args": []
118
+ },
119
+ {
120
+ "name": "register_entity",
121
+ "discriminator": [166, 52, 122, 244, 214, 116, 215, 255],
122
+ "accounts": [
123
+ {
124
+ "name": "entity_counter",
125
+ "writable": true,
126
+ "pda": {
127
+ "seeds": [
128
+ {
129
+ "kind": "const",
130
+ "value": [
131
+ 101, 110, 116, 105, 116, 121, 95, 99, 111, 117, 110, 116, 101,
132
+ 114
133
+ ]
134
+ }
135
+ ]
136
+ }
137
+ },
138
+ {
139
+ "name": "entity",
140
+ "writable": true,
141
+ "pda": {
142
+ "seeds": [
143
+ {
144
+ "kind": "const",
145
+ "value": [101, 110, 116, 105, 116, 121]
146
+ },
147
+ {
148
+ "kind": "account",
149
+ "path": "payer"
150
+ },
151
+ {
152
+ "kind": "account",
153
+ "path": "entity_counter.next_entity_index",
154
+ "account": "EntityCounter"
155
+ }
156
+ ]
157
+ }
158
+ },
159
+ {
160
+ "name": "payer",
161
+ "writable": true,
162
+ "signer": true
163
+ },
164
+ {
165
+ "name": "system_program",
166
+ "address": "11111111111111111111111111111111"
167
+ }
168
+ ],
169
+ "args": [
170
+ {
171
+ "name": "controllers",
172
+ "type": {
173
+ "vec": "pubkey"
174
+ }
175
+ },
176
+ {
177
+ "name": "threshold",
178
+ "type": "u8"
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ "name": "update_controllers",
184
+ "discriminator": [71, 2, 167, 69, 145, 109, 42, 139],
185
+ "accounts": [
186
+ {
187
+ "name": "entity",
188
+ "writable": true
189
+ }
190
+ ],
191
+ "args": [
192
+ {
193
+ "name": "new_controllers",
194
+ "type": {
195
+ "vec": "pubkey"
196
+ }
197
+ },
198
+ {
199
+ "name": "new_threshold",
200
+ "type": "u8"
201
+ }
202
+ ]
203
+ }
204
+ ],
205
+ "accounts": [
206
+ {
207
+ "name": "EntityAccount",
208
+ "discriminator": [46, 132, 149, 104, 229, 39, 46, 87]
209
+ },
210
+ {
211
+ "name": "EntityCounter",
212
+ "discriminator": [101, 1, 28, 203, 184, 98, 155, 3]
213
+ },
214
+ {
215
+ "name": "EntityTreasury",
216
+ "discriminator": [158, 97, 79, 97, 49, 235, 122, 123]
217
+ }
218
+ ],
219
+ "events": [
220
+ {
221
+ "name": "EntityRegistered",
222
+ "discriminator": [207, 100, 27, 194, 243, 88, 104, 198]
223
+ }
224
+ ],
225
+ "errors": [
226
+ {
227
+ "code": 6000,
228
+ "name": "UnauthorizedController",
229
+ "msg": "Signer is not a controller of this entity"
230
+ },
231
+ {
232
+ "code": 6001,
233
+ "name": "InvalidControllerThreshold",
234
+ "msg": "Invalid controller threshold"
235
+ },
236
+ {
237
+ "code": 6002,
238
+ "name": "EmptyControllerSet",
239
+ "msg": "Controller list cannot be empty"
240
+ },
241
+ {
242
+ "code": 6003,
243
+ "name": "DuplicateControllers",
244
+ "msg": "Duplicate controllers are not allowed"
245
+ },
246
+ {
247
+ "code": 6004,
248
+ "name": "EntityFrozen",
249
+ "msg": "Entity is frozen"
250
+ },
251
+ {
252
+ "code": 6005,
253
+ "name": "EntityActive",
254
+ "msg": "Entity is active"
255
+ },
256
+ {
257
+ "code": 6006,
258
+ "name": "NotEnoughControllerSigners",
259
+ "msg": "Not enough controller signers"
260
+ }
261
+ ],
262
+ "types": [
263
+ {
264
+ "name": "EntityAccount",
265
+ "type": {
266
+ "kind": "struct",
267
+ "fields": [
268
+ {
269
+ "name": "status",
270
+ "type": "u8"
271
+ },
272
+ {
273
+ "name": "controller_threshold",
274
+ "type": "u8"
275
+ },
276
+ {
277
+ "name": "controllers",
278
+ "type": {
279
+ "vec": "pubkey"
280
+ }
281
+ },
282
+ {
283
+ "name": "created_at",
284
+ "type": "i64"
285
+ },
286
+ {
287
+ "name": "creator",
288
+ "type": "pubkey"
289
+ },
290
+ {
291
+ "name": "updated_at",
292
+ "type": "i64"
293
+ },
294
+ {
295
+ "name": "entity_index",
296
+ "type": "u64"
297
+ }
298
+ ]
299
+ }
300
+ },
301
+ {
302
+ "name": "EntityCounter",
303
+ "type": {
304
+ "kind": "struct",
305
+ "fields": [
306
+ {
307
+ "name": "authority",
308
+ "type": "pubkey"
309
+ },
310
+ {
311
+ "name": "next_entity_index",
312
+ "type": "u64"
313
+ }
314
+ ]
315
+ }
316
+ },
317
+ {
318
+ "name": "EntityRegistered",
319
+ "type": {
320
+ "kind": "struct",
321
+ "fields": [
322
+ {
323
+ "name": "entity",
324
+ "type": "pubkey"
325
+ },
326
+ {
327
+ "name": "entity_index",
328
+ "type": "u64"
329
+ },
330
+ {
331
+ "name": "creator",
332
+ "type": "pubkey"
333
+ }
334
+ ]
335
+ }
336
+ },
337
+ {
338
+ "name": "EntityTreasury",
339
+ "type": {
340
+ "kind": "struct",
341
+ "fields": [
342
+ {
343
+ "name": "entity",
344
+ "docs": ["Entity this treasury belongs to"],
345
+ "type": "pubkey"
346
+ },
347
+ {
348
+ "name": "version",
349
+ "docs": ["Versioning for future upgrades"],
350
+ "type": "u8"
351
+ },
352
+ {
353
+ "name": "created_at",
354
+ "docs": ["Created timestamp"],
355
+ "type": "i64"
356
+ }
357
+ ]
358
+ }
359
+ }
360
+ ],
361
+ "constants": [
362
+ {
363
+ "name": "ENTITY_STATUS_ACTIVE",
364
+ "type": "u8",
365
+ "value": "1"
366
+ },
367
+ {
368
+ "name": "ENTITY_STATUS_FROZEN",
369
+ "type": "u8",
370
+ "value": "2"
371
+ }
372
+ ]
373
+ }