@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.
- package/README.md +176 -0
- package/dist/accounts/entity/entity.d.ts +24 -0
- package/dist/accounts/entity/entity.js +24 -0
- package/dist/accounts/entity/entityTreasury.d.ts +22 -0
- package/dist/accounts/entity/entityTreasury.js +25 -0
- package/dist/accounts/entity/index.d.ts +2 -0
- package/dist/accounts/entity/index.js +2 -0
- package/dist/accounts/index.d.ts +3 -0
- package/dist/accounts/index.js +3 -0
- package/dist/accounts/ipcore/derivativeLink.d.ts +21 -0
- package/dist/accounts/ipcore/derivativeLink.js +22 -0
- package/dist/accounts/ipcore/index.d.ts +7 -0
- package/dist/accounts/ipcore/index.js +7 -0
- package/dist/accounts/ipcore/ipAsset.d.ts +25 -0
- package/dist/accounts/ipcore/ipAsset.js +26 -0
- package/dist/accounts/ipcore/ipRegistry.d.ts +21 -0
- package/dist/accounts/ipcore/ipRegistry.js +22 -0
- package/dist/accounts/ipcore/moduleConfig.d.ts +21 -0
- package/dist/accounts/ipcore/moduleConfig.js +22 -0
- package/dist/accounts/ipcore/provenanceClaim.d.ts +25 -0
- package/dist/accounts/ipcore/provenanceClaim.js +26 -0
- package/dist/accounts/ipcore/registryConfig.d.ts +21 -0
- package/dist/accounts/ipcore/registryConfig.js +22 -0
- package/dist/accounts/ipcore/registryConfigTreasury.d.ts +18 -0
- package/dist/accounts/ipcore/registryConfigTreasury.js +21 -0
- package/dist/accounts/metadata/entityMetadata.d.ts +23 -0
- package/dist/accounts/metadata/entityMetadata.js +24 -0
- package/dist/accounts/metadata/index.d.ts +3 -0
- package/dist/accounts/metadata/index.js +3 -0
- package/dist/accounts/metadata/ipMetadata.d.ts +23 -0
- package/dist/accounts/metadata/ipMetadata.js +24 -0
- package/dist/accounts/metadata/schemaRegistry.d.ts +21 -0
- package/dist/accounts/metadata/schemaRegistry.js +22 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +4 -0
- package/dist/constants/programIds.d.ts +5 -0
- package/dist/constants/programIds.js +8 -0
- package/dist/constants/schema.d.ts +3 -0
- package/dist/constants/schema.js +3 -0
- package/dist/constants/seeds.d.ts +17 -0
- package/dist/constants/seeds.js +17 -0
- package/dist/constants/status.d.ts +24 -0
- package/dist/constants/status.js +33 -0
- package/dist/helper/index.d.ts +1 -0
- package/dist/helper/index.js +1 -0
- package/dist/helper/schema.d.ts +3 -0
- package/dist/helper/schema.js +28 -0
- package/dist/idl/entity.json +373 -0
- package/dist/idl/index.d.ts +4 -0
- package/dist/idl/index.js +4 -0
- package/dist/idl/ipcore.json +916 -0
- package/dist/idl/metadata.json +682 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/instructions/entity/assertControllerThreshold.d.ts +13 -0
- package/dist/instructions/entity/assertControllerThreshold.js +29 -0
- package/dist/instructions/entity/index.d.ts +5 -0
- package/dist/instructions/entity/index.js +5 -0
- package/dist/instructions/entity/initEntityCounter.d.ts +8 -0
- package/dist/instructions/entity/initEntityCounter.js +12 -0
- package/dist/instructions/entity/initEntityTreasury.d.ts +12 -0
- package/dist/instructions/entity/initEntityTreasury.js +20 -0
- package/dist/instructions/entity/registerEntity.d.ts +10 -0
- package/dist/instructions/entity/registerEntity.js +12 -0
- package/dist/instructions/entity/updateControllers.d.ts +15 -0
- package/dist/instructions/entity/updateControllers.js +29 -0
- package/dist/instructions/index.d.ts +3 -0
- package/dist/instructions/index.js +3 -0
- package/dist/instructions/ipcore/addDerivativeLink.d.ts +9 -0
- package/dist/instructions/ipcore/addDerivativeLink.js +10 -0
- package/dist/instructions/ipcore/addIpAsset.d.ts +7 -0
- package/dist/instructions/ipcore/addIpAsset.js +9 -0
- package/dist/instructions/ipcore/createDerivativeLink.d.ts +13 -0
- package/dist/instructions/ipcore/createDerivativeLink.js +22 -0
- package/dist/instructions/ipcore/createProvenanceClaim.d.ts +15 -0
- package/dist/instructions/ipcore/createProvenanceClaim.js +25 -0
- package/dist/instructions/ipcore/index.d.ts +11 -0
- package/dist/instructions/ipcore/index.js +11 -0
- package/dist/instructions/ipcore/initIpCounter.d.ts +8 -0
- package/dist/instructions/ipcore/initIpCounter.js +12 -0
- package/dist/instructions/ipcore/initIpRegistry.d.ts +8 -0
- package/dist/instructions/ipcore/initIpRegistry.js +20 -0
- package/dist/instructions/ipcore/initModuleConfig.d.ts +8 -0
- package/dist/instructions/ipcore/initModuleConfig.js +10 -0
- package/dist/instructions/ipcore/initRegistryConfig.d.ts +8 -0
- package/dist/instructions/ipcore/initRegistryConfig.js +9 -0
- package/dist/instructions/ipcore/initRegistryConfigTreasury.d.ts +8 -0
- package/dist/instructions/ipcore/initRegistryConfigTreasury.js +10 -0
- package/dist/instructions/ipcore/registerIpAsset.d.ts +14 -0
- package/dist/instructions/ipcore/registerIpAsset.js +21 -0
- package/dist/instructions/ipcore/resolveParent.d.ts +12 -0
- package/dist/instructions/ipcore/resolveParent.js +12 -0
- package/dist/instructions/ipcore/updateRegistryConfig.d.ts +9 -0
- package/dist/instructions/ipcore/updateRegistryConfig.js +9 -0
- package/dist/instructions/metadata/createEntityMetadata.d.ts +15 -0
- package/dist/instructions/metadata/createEntityMetadata.js +22 -0
- package/dist/instructions/metadata/createIpMetadata.d.ts +16 -0
- package/dist/instructions/metadata/createIpMetadata.js +23 -0
- package/dist/instructions/metadata/index.d.ts +7 -0
- package/dist/instructions/metadata/index.js +7 -0
- package/dist/instructions/metadata/lockEntityMetadata.d.ts +13 -0
- package/dist/instructions/metadata/lockEntityMetadata.js +19 -0
- package/dist/instructions/metadata/lockIpMetadata.d.ts +14 -0
- package/dist/instructions/metadata/lockIpMetadata.js +20 -0
- package/dist/instructions/metadata/registerSchema.d.ts +14 -0
- package/dist/instructions/metadata/registerSchema.js +18 -0
- package/dist/instructions/metadata/updateEntityMetadata.d.ts +16 -0
- package/dist/instructions/metadata/updateEntityMetadata.js +23 -0
- package/dist/instructions/metadata/updateIpMetadata.d.ts +17 -0
- package/dist/instructions/metadata/updateIpMetadata.js +24 -0
- package/dist/pda/entity.d.ts +5 -0
- package/dist/pda/entity.js +15 -0
- package/dist/pda/index.d.ts +4 -0
- package/dist/pda/index.js +4 -0
- package/dist/pda/ip.d.ts +9 -0
- package/dist/pda/ip.js +31 -0
- package/dist/pda/metadata.d.ts +3 -0
- package/dist/pda/metadata.js +19 -0
- package/dist/pda/schema.d.ts +2 -0
- package/dist/pda/schema.js +12 -0
- package/dist/programs/programIds.d.ts +18 -0
- package/dist/programs/programIds.js +16 -0
- package/dist/sdk/MyceliumSDK.d.ts +15 -0
- package/dist/sdk/MyceliumSDK.js +15 -0
- package/dist/sdk/MyceliumSDK.types.d.ts +3 -0
- package/dist/sdk/MyceliumSDK.types.js +1 -0
- package/dist/sdk/namespaces/admin.d.ts +23 -0
- package/dist/sdk/namespaces/admin.js +9 -0
- package/dist/sdk/namespaces/entity.d.ts +53 -0
- package/dist/sdk/namespaces/entity.js +21 -0
- package/dist/sdk/namespaces/ipcore.d.ts +111 -0
- package/dist/sdk/namespaces/ipcore.js +42 -0
- package/dist/sdk/namespaces/metadata.d.ts +86 -0
- package/dist/sdk/namespaces/metadata.js +27 -0
- package/dist/transactions/admin/adminTransaction.d.ts +18 -0
- package/dist/transactions/admin/adminTransaction.js +43 -0
- package/dist/transactions/admin/index.d.ts +1 -0
- package/dist/transactions/admin/index.js +1 -0
- package/dist/transactions/entity/assertControllerThreshold.d.ts +17 -0
- package/dist/transactions/entity/assertControllerThreshold.js +18 -0
- package/dist/transactions/entity/index.d.ts +5 -0
- package/dist/transactions/entity/index.js +5 -0
- package/dist/transactions/entity/initEntityCounter.d.ts +14 -0
- package/dist/transactions/entity/initEntityCounter.js +16 -0
- package/dist/transactions/entity/initEntityTreasury.d.ts +16 -0
- package/dist/transactions/entity/initEntityTreasury.js +18 -0
- package/dist/transactions/entity/registerEntity.d.ts +19 -0
- package/dist/transactions/entity/registerEntity.js +44 -0
- package/dist/transactions/entity/updateControllers.d.ts +19 -0
- package/dist/transactions/entity/updateControllers.js +20 -0
- package/dist/transactions/index.d.ts +4 -0
- package/dist/transactions/index.js +4 -0
- package/dist/transactions/ipcore/addDerivativeLink.d.ts +14 -0
- package/dist/transactions/ipcore/addDerivativeLink.js +15 -0
- package/dist/transactions/ipcore/addIpAsset.d.ts +15 -0
- package/dist/transactions/ipcore/addIpAsset.js +13 -0
- package/dist/transactions/ipcore/createDerivativeLink.d.ts +19 -0
- package/dist/transactions/ipcore/createDerivativeLink.js +18 -0
- package/dist/transactions/ipcore/createProvenanceClaim.d.ts +20 -0
- package/dist/transactions/ipcore/createProvenanceClaim.js +20 -0
- package/dist/transactions/ipcore/index.d.ts +12 -0
- package/dist/transactions/ipcore/index.js +12 -0
- package/dist/transactions/ipcore/initIpCounter.d.ts +14 -0
- package/dist/transactions/ipcore/initIpCounter.js +16 -0
- package/dist/transactions/ipcore/initIpRegistry.d.ts +10 -0
- package/dist/transactions/ipcore/initIpRegistry.js +17 -0
- package/dist/transactions/ipcore/initModuleConfig.d.ts +11 -0
- package/dist/transactions/ipcore/initModuleConfig.js +26 -0
- package/dist/transactions/ipcore/initializeRegistryConfig.d.ts +11 -0
- package/dist/transactions/ipcore/initializeRegistryConfig.js +18 -0
- package/dist/transactions/ipcore/initializeRegistryConfigTreasury.d.ts +10 -0
- package/dist/transactions/ipcore/initializeRegistryConfigTreasury.js +18 -0
- package/dist/transactions/ipcore/registerIpAsset.d.ts +16 -0
- package/dist/transactions/ipcore/registerIpAsset.js +64 -0
- package/dist/transactions/ipcore/resolveParent.d.ts +15 -0
- package/dist/transactions/ipcore/resolveParent.js +22 -0
- package/dist/transactions/ipcore/updateRegistryConfig.d.ts +11 -0
- package/dist/transactions/ipcore/updateRegistryConfig.js +19 -0
- package/dist/transactions/metadata/createEntityMetadata.d.ts +14 -0
- package/dist/transactions/metadata/createEntityMetadata.js +22 -0
- package/dist/transactions/metadata/createIpMetadata.d.ts +15 -0
- package/dist/transactions/metadata/createIpMetadata.js +23 -0
- package/dist/transactions/metadata/index.d.ts +7 -0
- package/dist/transactions/metadata/index.js +7 -0
- package/dist/transactions/metadata/lockEntityMetadata.d.ts +12 -0
- package/dist/transactions/metadata/lockEntityMetadata.js +20 -0
- package/dist/transactions/metadata/lockIpMetadata.d.ts +13 -0
- package/dist/transactions/metadata/lockIpMetadata.js +21 -0
- package/dist/transactions/metadata/registerSchema.d.ts +13 -0
- package/dist/transactions/metadata/registerSchema.js +21 -0
- package/dist/transactions/metadata/updateEntityMetadata.d.ts +13 -0
- package/dist/transactions/metadata/updateEntityMetadata.js +32 -0
- package/dist/transactions/metadata/updateIpMetadata.d.ts +17 -0
- package/dist/transactions/metadata/updateIpMetadata.js +24 -0
- package/dist/types/entity.d.ts +416 -0
- package/dist/types/entity.js +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/ipcore.d.ts +1008 -0
- package/dist/types/ipcore.js +1 -0
- package/dist/types/metadata.d.ts +714 -0
- package/dist/types/metadata.js +1 -0
- 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,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,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,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,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
|
+
}
|