Skip to content

Commit

Permalink
Add license abis (#53)
Browse files Browse the repository at this point in the history
* Add license abis

* Add permission set

* Fix test
  • Loading branch information
edisonz0718 authored Jan 31, 2024
1 parent d4ddd1e commit 73ba3b8
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 64 deletions.
44 changes: 22 additions & 22 deletions packages/core-sdk/src/abi/json/AccessController.abi.ts
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
export default [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "ipAccount_",
name: "ipAccount",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "signer_",
name: "signer",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "to_",
name: "to",
type: "address",
},
{
indexed: false,
internalType: "bytes4",
name: "func_",
name: "func",
type: "bytes4",
},
{
indexed: false,
internalType: "uint8",
name: "permission_",
name: "permission",
type: "uint8",
},
],
name: "setPermission",
outputs: [],
stateMutability: "nonpayable",
type: "function",
name: "PermissionSet",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "ipAccount",
name: "ipAccount_",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "signer",
name: "signer_",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "to",
name: "to_",
type: "address",
},
{
indexed: false,
internalType: "bytes4",
name: "func",
name: "func_",
type: "bytes4",
},
{
indexed: false,
internalType: "uint8",
name: "permission",
name: "permission_",
type: "uint8",
},
],
name: "PermissionSet",
type: "event",
name: "setPermission",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
29 changes: 0 additions & 29 deletions packages/core-sdk/src/abi/json/IIPAccountRegistry.abi.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
export default [
{
inputs: [
{
internalType: "uint256",
name: "chainId_",
type: "uint256",
},
{
internalType: "address",
name: "tokenContract_",
type: "address",
},
{
internalType: "uint256",
name: "tokenId_",
type: "uint256",
},
],
name: "ipAsset",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
anonymous: false,
inputs: [
Expand Down
115 changes: 115 additions & 0 deletions packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,78 @@
export default [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "creator",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "receiver",
type: "address",
},
{
indexed: true,
internalType: "uint256",
name: "licenseId",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256",
},
{
components: [
{
internalType: "uint256",
name: "policyId",
type: "uint256",
},
{
internalType: "address[]",
name: "licensorIpIds",
type: "address[]",
},
],
indexed: false,
internalType: "struct Licensing.License",
name: "licenseData",
type: "tuple",
},
],
name: "LicenseMinted",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "caller",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "ipId",
type: "address",
},
{
indexed: true,
internalType: "uint256",
name: "policyId",
type: "uint256",
},
],
name: "PolicyAddedToIpId",
type: "event",
},
{
inputs: [
{
Expand Down Expand Up @@ -158,4 +232,45 @@ export default [
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
components: [
{
internalType: "uint256",
name: "policyId",
type: "uint256",
},
{
internalType: "address[]",
name: "licensorIpIds",
type: "address[]",
},
],
internalType: "struct Licensing.License",
name: "licenseData",
type: "tuple",
},
{
internalType: "uint256",
name: "amount",
type: "uint256",
},
{
internalType: "address",
name: "receiver",
type: "address",
},
],
name: "mintLicense",
outputs: [
{
internalType: "uint256",
name: "licenseId",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "function",
},
] as const;
8 changes: 7 additions & 1 deletion packages/core-sdk/src/abi/sdkEntities.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
"addPolicyToIp",
"linkIpToParent",
"setPermission",
"PermissionSet",
"setTag",
"removeTag",
"registerModule",
"isRegistered",
"execute",
"isValidSigner",
"IPAccountRegistered",
"IPRegistered"
"IPRegistered",
"mintLicense",
"transfer",
"LicenseMinted",
"LicenseBurnt",
"PolicyAddedToIpId"
]
13 changes: 2 additions & 11 deletions packages/core-sdk/test/integration/permissionReadOnly.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { expect } from "chai";
import {
StoryClient,
StoryReadOnlyConfig,
ReadOnlyClient,
ListTransactionRequest,
ResourceType,
Transaction,
} from "../../src";
import { StoryClient, StoryReadOnlyConfig, ReadOnlyClient } from "../../src";
import { ListPermissionsRequest, Permission } from "../../src/types/resources/permission";

describe("Permission client integration tests", function () {
Expand Down Expand Up @@ -58,9 +51,7 @@ describe("Permission client integration tests", function () {
describe("Get Permission", async function () {
it("should return permission from request permission id", async function () {
const response = await client.permission.get({
permissionId:
(process.env.TEST_PERMISSION_ID as string) ||
"0x06cb17d43f16ad5cc3cd7757296fa87ce7ac741d-0x6c88f438cbfd9866dcd067ffe18b951f19b968da-0x0baa92f82d8992ff152047f29084079c263be7f7-0xa2b4192f",
permissionId: (process.env.TEST_PERMISSION_ID as string) || "0xb94a00bafe17e0x24",
});

expect(response).to.have.property("data");
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/test/integration/taggingReadOnly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe("Tagging Indexer Functions", () => {

it("should be able to get a tag by it's tag id", async () => {
const getTagRequest: GetTagRequest = {
id: "0xabcc2421f927c128b9f5a94b612f4541c8e624b6-testTag",
id: "0xeae93c26ec1b50xc4",
};
const response = await client.tagging.get(getTagRequest);

Expand Down

0 comments on commit 73ba3b8

Please sign in to comment.