@mycelium-ip/react 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +952 -0
  2. package/dist/hooks/derivative/useCreateDerivativeLink.d.ts +30 -0
  3. package/dist/hooks/derivative/useCreateDerivativeLink.d.ts.map +1 -0
  4. package/dist/hooks/derivative/useCreateDerivativeLink.js +45 -0
  5. package/dist/hooks/derivative/useUpdateDerivativeLicense.d.ts +30 -0
  6. package/dist/hooks/derivative/useUpdateDerivativeLicense.d.ts.map +1 -0
  7. package/dist/hooks/derivative/useUpdateDerivativeLicense.js +44 -0
  8. package/dist/hooks/entity/useCreateEntity.d.ts +28 -0
  9. package/dist/hooks/entity/useCreateEntity.d.ts.map +1 -0
  10. package/dist/hooks/entity/useCreateEntity.js +42 -0
  11. package/dist/hooks/entity/useUpdateEntityControllers.d.ts +28 -0
  12. package/dist/hooks/entity/useUpdateEntityControllers.d.ts.map +1 -0
  13. package/dist/hooks/entity/useUpdateEntityControllers.js +42 -0
  14. package/dist/hooks/grant/useCreateLicenseGrant.d.ts +29 -0
  15. package/dist/hooks/grant/useCreateLicenseGrant.d.ts.map +1 -0
  16. package/dist/hooks/grant/useCreateLicenseGrant.js +43 -0
  17. package/dist/hooks/grant/useRevokeLicenseGrant.d.ts +28 -0
  18. package/dist/hooks/grant/useRevokeLicenseGrant.d.ts.map +1 -0
  19. package/dist/hooks/grant/useRevokeLicenseGrant.js +42 -0
  20. package/dist/hooks/internal/useMyceliumClient.d.ts +15 -0
  21. package/dist/hooks/internal/useMyceliumClient.d.ts.map +1 -0
  22. package/dist/hooks/internal/useMyceliumClient.js +18 -0
  23. package/dist/hooks/internal/useMyceliumConnection.d.ts +14 -0
  24. package/dist/hooks/internal/useMyceliumConnection.d.ts.map +1 -0
  25. package/dist/hooks/internal/useMyceliumConnection.js +17 -0
  26. package/dist/hooks/internal/useMyceliumContext.d.ts +14 -0
  27. package/dist/hooks/internal/useMyceliumContext.d.ts.map +1 -0
  28. package/dist/hooks/internal/useMyceliumContext.js +22 -0
  29. package/dist/hooks/internal/useMyceliumWallet.d.ts +14 -0
  30. package/dist/hooks/internal/useMyceliumWallet.d.ts.map +1 -0
  31. package/dist/hooks/internal/useMyceliumWallet.js +17 -0
  32. package/dist/hooks/ip/useCreateIp.d.ts +29 -0
  33. package/dist/hooks/ip/useCreateIp.d.ts.map +1 -0
  34. package/dist/hooks/ip/useCreateIp.js +43 -0
  35. package/dist/hooks/ip/useTransferIp.d.ts +28 -0
  36. package/dist/hooks/ip/useTransferIp.d.ts.map +1 -0
  37. package/dist/hooks/ip/useTransferIp.js +42 -0
  38. package/dist/hooks/license/useCreateLicense.d.ts +28 -0
  39. package/dist/hooks/license/useCreateLicense.d.ts.map +1 -0
  40. package/dist/hooks/license/useCreateLicense.js +42 -0
  41. package/dist/hooks/license/useRevokeLicense.d.ts +27 -0
  42. package/dist/hooks/license/useRevokeLicense.d.ts.map +1 -0
  43. package/dist/hooks/license/useRevokeLicense.js +41 -0
  44. package/dist/hooks/license/useUpdateLicense.d.ts +28 -0
  45. package/dist/hooks/license/useUpdateLicense.d.ts.map +1 -0
  46. package/dist/hooks/license/useUpdateLicense.js +42 -0
  47. package/dist/hooks/metadata/useCreateEntityMetadata.d.ts +30 -0
  48. package/dist/hooks/metadata/useCreateEntityMetadata.d.ts.map +1 -0
  49. package/dist/hooks/metadata/useCreateEntityMetadata.js +45 -0
  50. package/dist/hooks/metadata/useCreateIpMetadata.d.ts +31 -0
  51. package/dist/hooks/metadata/useCreateIpMetadata.d.ts.map +1 -0
  52. package/dist/hooks/metadata/useCreateIpMetadata.js +46 -0
  53. package/dist/hooks/metadata/useCreateMetadataSchema.d.ts +29 -0
  54. package/dist/hooks/metadata/useCreateMetadataSchema.d.ts.map +1 -0
  55. package/dist/hooks/metadata/useCreateMetadataSchema.js +43 -0
  56. package/dist/hooks/queries/queryKeys.d.ts +45 -0
  57. package/dist/hooks/queries/queryKeys.d.ts.map +1 -0
  58. package/dist/hooks/queries/queryKeys.js +44 -0
  59. package/dist/index.d.ts +24 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +33 -0
  62. package/dist/provider/MyceliumIpProvider.d.ts +56 -0
  63. package/dist/provider/MyceliumIpProvider.d.ts.map +1 -0
  64. package/dist/provider/MyceliumIpProvider.js +76 -0
  65. package/dist/provider/context.d.ts +22 -0
  66. package/dist/provider/context.d.ts.map +1 -0
  67. package/dist/provider/context.js +6 -0
  68. package/dist/types/index.d.ts +2 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/dist/types/index.js +1 -0
  71. package/dist/types/wallet.d.ts +54 -0
  72. package/dist/types/wallet.d.ts.map +1 -0
  73. package/dist/types/wallet.js +1 -0
  74. package/dist/utils/transaction.d.ts +40 -0
  75. package/dist/utils/transaction.d.ts.map +1 -0
  76. package/dist/utils/transaction.js +82 -0
  77. package/package.json +59 -0
@@ -0,0 +1,30 @@
1
+ import type { CreateDerivativeLinkParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to create a derivative link between IPs.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function CreateDerivativeButton({ parentIp, childIp, childOwner, grant, license }: Props) {
9
+ * const { mutate, isPending } = useCreateDerivativeLink();
10
+ *
11
+ * const handleCreate = () => {
12
+ * mutate({
13
+ * parentIp,
14
+ * childIp,
15
+ * childOwnerEntity: childOwner,
16
+ * licenseGrant: grant,
17
+ * license,
18
+ * });
19
+ * };
20
+ *
21
+ * return (
22
+ * <button onClick={handleCreate} disabled={isPending}>
23
+ * Create Derivative Link
24
+ * </button>
25
+ * );
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function useCreateDerivativeLink(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, CreateDerivativeLinkParams, unknown>;
30
+ //# sourceMappingURL=useCreateDerivativeLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateDerivativeLink.d.ts","sourceRoot":"","sources":["../../../src/hooks/derivative/useCreateDerivativeLink.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,qHActC"}
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { executeTransaction, } from "../../utils/transaction";
4
+ import { useMyceliumContext } from "../internal/useMyceliumContext";
5
+ import { queryKeys } from "../queries/queryKeys";
6
+ /**
7
+ * Hook to create a derivative link between IPs.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function CreateDerivativeButton({ parentIp, childIp, childOwner, grant, license }: Props) {
12
+ * const { mutate, isPending } = useCreateDerivativeLink();
13
+ *
14
+ * const handleCreate = () => {
15
+ * mutate({
16
+ * parentIp,
17
+ * childIp,
18
+ * childOwnerEntity: childOwner,
19
+ * licenseGrant: grant,
20
+ * license,
21
+ * });
22
+ * };
23
+ *
24
+ * return (
25
+ * <button onClick={handleCreate} disabled={isPending}>
26
+ * Create Derivative Link
27
+ * </button>
28
+ * );
29
+ * }
30
+ * ```
31
+ */
32
+ export function useCreateDerivativeLink() {
33
+ const { client, connection, wallet, confirmation } = useMyceliumContext();
34
+ const queryClient = useQueryClient();
35
+ return useMutation({
36
+ mutationFn: async (params) => {
37
+ const instruction = await client.ipCore.derivative.createIx(params);
38
+ return executeTransaction(connection, wallet, instruction, confirmation);
39
+ },
40
+ onSuccess: () => {
41
+ queryClient.invalidateQueries({ queryKey: queryKeys.derivatives() });
42
+ queryClient.invalidateQueries({ queryKey: queryKeys.ips() });
43
+ },
44
+ });
45
+ }
@@ -0,0 +1,30 @@
1
+ import type { UpdateDerivativeLicenseParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to update the license on a derivative link.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function UpdateDerivativeLicenseButton({ parentIp, childIp, childOwner, newGrant, newLicense }: Props) {
9
+ * const { mutate, isPending } = useUpdateDerivativeLicense();
10
+ *
11
+ * const handleUpdate = () => {
12
+ * mutate({
13
+ * parentIp,
14
+ * childIp,
15
+ * childOwnerEntity: childOwner,
16
+ * newLicenseGrant: newGrant,
17
+ * newLicense: newLicense,
18
+ * });
19
+ * };
20
+ *
21
+ * return (
22
+ * <button onClick={handleUpdate} disabled={isPending}>
23
+ * Update License
24
+ * </button>
25
+ * );
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function useUpdateDerivativeLicense(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, UpdateDerivativeLicenseParams, unknown>;
30
+ //# sourceMappingURL=useUpdateDerivativeLicense.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateDerivativeLicense.d.ts","sourceRoot":"","sources":["../../../src/hooks/derivative/useUpdateDerivativeLicense.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,wHAczC"}
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { executeTransaction, } from "../../utils/transaction";
4
+ import { useMyceliumContext } from "../internal/useMyceliumContext";
5
+ import { queryKeys } from "../queries/queryKeys";
6
+ /**
7
+ * Hook to update the license on a derivative link.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function UpdateDerivativeLicenseButton({ parentIp, childIp, childOwner, newGrant, newLicense }: Props) {
12
+ * const { mutate, isPending } = useUpdateDerivativeLicense();
13
+ *
14
+ * const handleUpdate = () => {
15
+ * mutate({
16
+ * parentIp,
17
+ * childIp,
18
+ * childOwnerEntity: childOwner,
19
+ * newLicenseGrant: newGrant,
20
+ * newLicense: newLicense,
21
+ * });
22
+ * };
23
+ *
24
+ * return (
25
+ * <button onClick={handleUpdate} disabled={isPending}>
26
+ * Update License
27
+ * </button>
28
+ * );
29
+ * }
30
+ * ```
31
+ */
32
+ export function useUpdateDerivativeLicense() {
33
+ const { client, connection, wallet, confirmation } = useMyceliumContext();
34
+ const queryClient = useQueryClient();
35
+ return useMutation({
36
+ mutationFn: async (params) => {
37
+ const instruction = await client.ipCore.derivative.updateLicenseIx(params);
38
+ return executeTransaction(connection, wallet, instruction, confirmation);
39
+ },
40
+ onSuccess: () => {
41
+ queryClient.invalidateQueries({ queryKey: queryKeys.derivatives() });
42
+ },
43
+ });
44
+ }
@@ -0,0 +1,28 @@
1
+ import type { CreateEntityParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to create a new entity.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function CreateEntityButton() {
9
+ * const { mutate, isPending, error } = useCreateEntity();
10
+ *
11
+ * const handleCreate = () => {
12
+ * mutate({
13
+ * handle: "my-entity",
14
+ * additionalControllers: [],
15
+ * signatureThreshold: 1,
16
+ * });
17
+ * };
18
+ *
19
+ * return (
20
+ * <button onClick={handleCreate} disabled={isPending}>
21
+ * {isPending ? "Creating..." : "Create Entity"}
22
+ * </button>
23
+ * );
24
+ * }
25
+ * ```
26
+ */
27
+ export declare function useCreateEntity(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, CreateEntityParams, unknown>;
28
+ //# sourceMappingURL=useCreateEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateEntity.d.ts","sourceRoot":"","sources":["../../../src/hooks/entity/useCreateEntity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,6GAa9B"}
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { executeTransaction, } from "../../utils/transaction";
4
+ import { useMyceliumContext } from "../internal/useMyceliumContext";
5
+ import { queryKeys } from "../queries/queryKeys";
6
+ /**
7
+ * Hook to create a new entity.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function CreateEntityButton() {
12
+ * const { mutate, isPending, error } = useCreateEntity();
13
+ *
14
+ * const handleCreate = () => {
15
+ * mutate({
16
+ * handle: "my-entity",
17
+ * additionalControllers: [],
18
+ * signatureThreshold: 1,
19
+ * });
20
+ * };
21
+ *
22
+ * return (
23
+ * <button onClick={handleCreate} disabled={isPending}>
24
+ * {isPending ? "Creating..." : "Create Entity"}
25
+ * </button>
26
+ * );
27
+ * }
28
+ * ```
29
+ */
30
+ export function useCreateEntity() {
31
+ const { client, connection, wallet, confirmation } = useMyceliumContext();
32
+ const queryClient = useQueryClient();
33
+ return useMutation({
34
+ mutationFn: async (params) => {
35
+ const instruction = await client.ipCore.entity.createIx(params);
36
+ return executeTransaction(connection, wallet, instruction, confirmation);
37
+ },
38
+ onSuccess: () => {
39
+ queryClient.invalidateQueries({ queryKey: queryKeys.entities() });
40
+ },
41
+ });
42
+ }
@@ -0,0 +1,28 @@
1
+ import type { UpdateEntityControllersParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to update entity controllers.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function UpdateControllersButton({ entityPubkey }: { entityPubkey: PublicKey }) {
9
+ * const { mutate, isPending } = useUpdateEntityControllers();
10
+ *
11
+ * const handleUpdate = () => {
12
+ * mutate({
13
+ * entity: entityPubkey,
14
+ * newControllers: [controller1, controller2],
15
+ * newThreshold: 2,
16
+ * });
17
+ * };
18
+ *
19
+ * return (
20
+ * <button onClick={handleUpdate} disabled={isPending}>
21
+ * Update Controllers
22
+ * </button>
23
+ * );
24
+ * }
25
+ * ```
26
+ */
27
+ export declare function useUpdateEntityControllers(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, UpdateEntityControllersParams, unknown>;
28
+ //# sourceMappingURL=useUpdateEntityControllers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUpdateEntityControllers.d.ts","sourceRoot":"","sources":["../../../src/hooks/entity/useUpdateEntityControllers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,0BAA0B,wHAczC"}
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { executeTransaction, } from "../../utils/transaction";
4
+ import { useMyceliumContext } from "../internal/useMyceliumContext";
5
+ import { queryKeys } from "../queries/queryKeys";
6
+ /**
7
+ * Hook to update entity controllers.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function UpdateControllersButton({ entityPubkey }: { entityPubkey: PublicKey }) {
12
+ * const { mutate, isPending } = useUpdateEntityControllers();
13
+ *
14
+ * const handleUpdate = () => {
15
+ * mutate({
16
+ * entity: entityPubkey,
17
+ * newControllers: [controller1, controller2],
18
+ * newThreshold: 2,
19
+ * });
20
+ * };
21
+ *
22
+ * return (
23
+ * <button onClick={handleUpdate} disabled={isPending}>
24
+ * Update Controllers
25
+ * </button>
26
+ * );
27
+ * }
28
+ * ```
29
+ */
30
+ export function useUpdateEntityControllers() {
31
+ const { client, connection, wallet, confirmation } = useMyceliumContext();
32
+ const queryClient = useQueryClient();
33
+ return useMutation({
34
+ mutationFn: async (params) => {
35
+ const instruction = await client.ipCore.entity.updateControllersIx(params);
36
+ return executeTransaction(connection, wallet, instruction, confirmation);
37
+ },
38
+ onSuccess: () => {
39
+ queryClient.invalidateQueries({ queryKey: queryKeys.entities() });
40
+ },
41
+ });
42
+ }
@@ -0,0 +1,29 @@
1
+ import type { CreateLicenseGrantParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to create a license grant for an entity.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function CreateGrantButton({ originIp, authorityEntity, granteeEntity }: Props) {
9
+ * const { mutate, isPending } = useCreateLicenseGrant();
10
+ *
11
+ * const handleCreate = () => {
12
+ * mutate({
13
+ * originIp,
14
+ * authorityEntity,
15
+ * granteeEntity,
16
+ * expiration: BigInt(Date.now() + 365 * 24 * 60 * 60 * 1000), // 1 year
17
+ * });
18
+ * };
19
+ *
20
+ * return (
21
+ * <button onClick={handleCreate} disabled={isPending}>
22
+ * Create Grant
23
+ * </button>
24
+ * );
25
+ * }
26
+ * ```
27
+ */
28
+ export declare function useCreateLicenseGrant(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, CreateLicenseGrantParams, unknown>;
29
+ //# sourceMappingURL=useCreateLicenseGrant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateLicenseGrant.d.ts","sourceRoot":"","sources":["../../../src/hooks/grant/useCreateLicenseGrant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,mHAapC"}
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { executeTransaction, } from "../../utils/transaction";
4
+ import { useMyceliumContext } from "../internal/useMyceliumContext";
5
+ import { queryKeys } from "../queries/queryKeys";
6
+ /**
7
+ * Hook to create a license grant for an entity.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function CreateGrantButton({ originIp, authorityEntity, granteeEntity }: Props) {
12
+ * const { mutate, isPending } = useCreateLicenseGrant();
13
+ *
14
+ * const handleCreate = () => {
15
+ * mutate({
16
+ * originIp,
17
+ * authorityEntity,
18
+ * granteeEntity,
19
+ * expiration: BigInt(Date.now() + 365 * 24 * 60 * 60 * 1000), // 1 year
20
+ * });
21
+ * };
22
+ *
23
+ * return (
24
+ * <button onClick={handleCreate} disabled={isPending}>
25
+ * Create Grant
26
+ * </button>
27
+ * );
28
+ * }
29
+ * ```
30
+ */
31
+ export function useCreateLicenseGrant() {
32
+ const { client, connection, wallet, confirmation } = useMyceliumContext();
33
+ const queryClient = useQueryClient();
34
+ return useMutation({
35
+ mutationFn: async (params) => {
36
+ const instruction = await client.license.grant.createIx(params);
37
+ return executeTransaction(connection, wallet, instruction, confirmation);
38
+ },
39
+ onSuccess: () => {
40
+ queryClient.invalidateQueries({ queryKey: queryKeys.grants() });
41
+ },
42
+ });
43
+ }
@@ -0,0 +1,28 @@
1
+ import type { RevokeLicenseGrantParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to revoke a license grant.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function RevokeGrantButton({ originIp, authorityEntity, granteeEntity }: Props) {
9
+ * const { mutate, isPending } = useRevokeLicenseGrant();
10
+ *
11
+ * const handleRevoke = () => {
12
+ * mutate({
13
+ * originIp,
14
+ * authorityEntity,
15
+ * granteeEntity,
16
+ * });
17
+ * };
18
+ *
19
+ * return (
20
+ * <button onClick={handleRevoke} disabled={isPending}>
21
+ * Revoke Grant
22
+ * </button>
23
+ * );
24
+ * }
25
+ * ```
26
+ */
27
+ export declare function useRevokeLicenseGrant(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, RevokeLicenseGrantParams, unknown>;
28
+ //# sourceMappingURL=useRevokeLicenseGrant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRevokeLicenseGrant.d.ts","sourceRoot":"","sources":["../../../src/hooks/grant/useRevokeLicenseGrant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,mHAapC"}
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
3
+ import { executeTransaction, } from "../../utils/transaction";
4
+ import { useMyceliumContext } from "../internal/useMyceliumContext";
5
+ import { queryKeys } from "../queries/queryKeys";
6
+ /**
7
+ * Hook to revoke a license grant.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * function RevokeGrantButton({ originIp, authorityEntity, granteeEntity }: Props) {
12
+ * const { mutate, isPending } = useRevokeLicenseGrant();
13
+ *
14
+ * const handleRevoke = () => {
15
+ * mutate({
16
+ * originIp,
17
+ * authorityEntity,
18
+ * granteeEntity,
19
+ * });
20
+ * };
21
+ *
22
+ * return (
23
+ * <button onClick={handleRevoke} disabled={isPending}>
24
+ * Revoke Grant
25
+ * </button>
26
+ * );
27
+ * }
28
+ * ```
29
+ */
30
+ export function useRevokeLicenseGrant() {
31
+ const { client, connection, wallet, confirmation } = useMyceliumContext();
32
+ const queryClient = useQueryClient();
33
+ return useMutation({
34
+ mutationFn: async (params) => {
35
+ const instruction = await client.license.grant.revokeIx(params);
36
+ return executeTransaction(connection, wallet, instruction, confirmation);
37
+ },
38
+ onSuccess: () => {
39
+ queryClient.invalidateQueries({ queryKey: queryKeys.grants() });
40
+ },
41
+ });
42
+ }
@@ -0,0 +1,15 @@
1
+ import type { MyceliumClient } from "@mycelium-ip/core-sdk";
2
+ /**
3
+ * Returns the MyceliumClient instance from context.
4
+ *
5
+ * @throws Error if used outside of MyceliumIpProvider
6
+ * @throws Error if wallet is not connected
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const client = useMyceliumClient();
11
+ * const ix = await client.ipCore.entity.createIx({ ... });
12
+ * ```
13
+ */
14
+ export declare function useMyceliumClient(): MyceliumClient;
15
+ //# sourceMappingURL=useMyceliumClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMyceliumClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/internal/useMyceliumClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAGlD"}
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { useMyceliumContext } from "./useMyceliumContext";
3
+ /**
4
+ * Returns the MyceliumClient instance from context.
5
+ *
6
+ * @throws Error if used outside of MyceliumIpProvider
7
+ * @throws Error if wallet is not connected
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const client = useMyceliumClient();
12
+ * const ix = await client.ipCore.entity.createIx({ ... });
13
+ * ```
14
+ */
15
+ export function useMyceliumClient() {
16
+ const { client } = useMyceliumContext();
17
+ return client;
18
+ }
@@ -0,0 +1,14 @@
1
+ import type { Connection } from "@solana/web3.js";
2
+ /**
3
+ * Returns the Solana Connection from context.
4
+ *
5
+ * @throws Error if used outside of MyceliumIpProvider
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const connection = useMyceliumConnection();
10
+ * const blockhash = await connection.getLatestBlockhash();
11
+ * ```
12
+ */
13
+ export declare function useMyceliumConnection(): Connection;
14
+ //# sourceMappingURL=useMyceliumConnection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMyceliumConnection.d.ts","sourceRoot":"","sources":["../../../src/hooks/internal/useMyceliumConnection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,IAAI,UAAU,CAGlD"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useMyceliumContext } from "./useMyceliumContext";
3
+ /**
4
+ * Returns the Solana Connection from context.
5
+ *
6
+ * @throws Error if used outside of MyceliumIpProvider
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const connection = useMyceliumConnection();
11
+ * const blockhash = await connection.getLatestBlockhash();
12
+ * ```
13
+ */
14
+ export function useMyceliumConnection() {
15
+ const { connection } = useMyceliumContext();
16
+ return connection;
17
+ }
@@ -0,0 +1,14 @@
1
+ import { type MyceliumContextValue } from "../../provider/context";
2
+ /**
3
+ * Returns the full Mycelium context value.
4
+ *
5
+ * @throws Error if used outside of MyceliumIpProvider
6
+ * @throws Error if wallet is not connected (no publicKey)
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const { connection, wallet, client, confirmation } = useMyceliumContext();
11
+ * ```
12
+ */
13
+ export declare function useMyceliumContext(): MyceliumContextValue;
14
+ //# sourceMappingURL=useMyceliumContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMyceliumContext.d.ts","sourceRoot":"","sources":["../../../src/hooks/internal/useMyceliumContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI,oBAAoB,CAWzD"}
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { useContext } from "react";
3
+ import { MyceliumContext, } from "../../provider/context";
4
+ /**
5
+ * Returns the full Mycelium context value.
6
+ *
7
+ * @throws Error if used outside of MyceliumIpProvider
8
+ * @throws Error if wallet is not connected (no publicKey)
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const { connection, wallet, client, confirmation } = useMyceliumContext();
13
+ * ```
14
+ */
15
+ export function useMyceliumContext() {
16
+ const context = useContext(MyceliumContext);
17
+ if (context === null) {
18
+ throw new Error("useMyceliumContext must be used within a MyceliumIpProvider. " +
19
+ "Make sure your component is wrapped with <MyceliumIpProvider>.");
20
+ }
21
+ return context;
22
+ }
@@ -0,0 +1,14 @@
1
+ import type { MyceliumWallet } from "../../types/wallet";
2
+ /**
3
+ * Returns the MyceliumWallet from context.
4
+ *
5
+ * @throws Error if used outside of MyceliumIpProvider
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const wallet = useMyceliumWallet();
10
+ * const pubkey = wallet.publicKey;
11
+ * ```
12
+ */
13
+ export declare function useMyceliumWallet(): MyceliumWallet;
14
+ //# sourceMappingURL=useMyceliumWallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMyceliumWallet.d.ts","sourceRoot":"","sources":["../../../src/hooks/internal/useMyceliumWallet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAGlD"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useMyceliumContext } from "./useMyceliumContext";
3
+ /**
4
+ * Returns the MyceliumWallet from context.
5
+ *
6
+ * @throws Error if used outside of MyceliumIpProvider
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const wallet = useMyceliumWallet();
11
+ * const pubkey = wallet.publicKey;
12
+ * ```
13
+ */
14
+ export function useMyceliumWallet() {
15
+ const { wallet } = useMyceliumContext();
16
+ return wallet;
17
+ }
@@ -0,0 +1,29 @@
1
+ import type { CreateIpParams } from "@mycelium-ip/core-sdk";
2
+ import { type TransactionResult } from "../../utils/transaction";
3
+ /**
4
+ * Hook to create a new IP (Intellectual Property) asset.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function CreateIpButton({ entityPubkey }: { entityPubkey: PublicKey }) {
9
+ * const { mutate, isPending } = useCreateIp();
10
+ *
11
+ * const handleCreate = () => {
12
+ * mutate({
13
+ * registrantEntity: entityPubkey,
14
+ * content: new TextEncoder().encode("ip-content-hash"),
15
+ * treasuryTokenAccount: treasuryAccount,
16
+ * payerTokenAccount: payerAccount,
17
+ * });
18
+ * };
19
+ *
20
+ * return (
21
+ * <button onClick={handleCreate} disabled={isPending}>
22
+ * Create IP
23
+ * </button>
24
+ * );
25
+ * }
26
+ * ```
27
+ */
28
+ export declare function useCreateIp(): import("@tanstack/react-query").UseMutationResult<TransactionResult, Error, CreateIpParams, unknown>;
29
+ //# sourceMappingURL=useCreateIp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCreateIp.d.ts","sourceRoot":"","sources":["../../../src/hooks/ip/useCreateIp.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,yGAa1B"}