Skip to content

Commit

Permalink
Merge pull request #121 from storyprotocol/dev
Browse files Browse the repository at this point in the history
beta rc.12
  • Loading branch information
edisonz0718 authored Apr 8, 2024
2 parents 218963e + f9a184f commit ccd97fa
Show file tree
Hide file tree
Showing 52 changed files with 23,758 additions and 1,547 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "packages/core-sdk/protocol-contracts"]
path = packages/core-sdk/protocol-contracts
url = https://github.com/storyprotocol/protocol-core
url = https://github.com/storyprotocol/protocol-core-v1
branch = main
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
compile_contracts:
git submodule add -b main --force https://github.com/storyprotocol/protocol-core packages/core-sdk/protocol-contracts
git submodule add -b main --force https://github.com/storyprotocol/protocol-core-v1 packages/core-sdk/protocol-contracts
git submodule update --remote --merge
cd packages/core-sdk/protocol-contracts && yarn install
cd packages/core-sdk/protocol-contracts && git checkout tags/v1.0.0-rc.1 && yarn install

solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/IPAccountImpl.sol -o packages/core-sdk/src/abi/json/tmp/IPAccountImpl
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/AccessController.sol -o packages/core-sdk/src/abi/json/tmp/AccessController
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/RegistrationModule.sol -o packages/core-sdk/src/abi/json/tmp/RegistrationModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/access/AccessController.sol -o packages/core-sdk/src/abi/json/tmp/AccessController
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/dispute/DisputeModule.sol -o packages/core-sdk/src/abi/json/tmp/DisputeModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/LicensingModule.sol -o packages/core-sdk/src/abi/json/tmp/LicensingModule
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/royalty/policies/IpRoyaltyVault.sol -o packages/core-sdk/src/abi/json/tmp/Royalty
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/PILPolicyFrameworkManager.sol -o packages/core-sdk/src/abi/json/tmp/PILPolicyFrameworkManager
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/interfaces/registries/IIPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IIPAssetRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/registries/LicenseRegistry.sol -o packages/core-sdk/src/abi/json/tmp/LicenseRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/registries/IPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IPAssetRegistry
solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/lib/Errors.sol -o packages/core-sdk/src/abi/json/tmp/Errors
cp packages/core-sdk/src/abi/json/tmp/Errors/Errors.abi packages/core-sdk/src/abi/json/Errors.json

echo 'export default '"$$(jq '.' packages/core-sdk/src/abi/json/Errors.json)"' as const;' > packages/core-sdk/src/abi/json/Errors.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/IPAccountImpl/IPAccountImpl.abi)"' as const;' > packages/core-sdk/src/abi/json/IPAccountImpl.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/AccessController/AccessController.abi)"' as const;' > packages/core-sdk/src/abi/json/AccessController.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/RegistrationModule/RegistrationModule.abi)"' as const;' > packages/core-sdk/src/abi/json/RegistrationModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/DisputeModule/DisputeModule.abi)"' as const;' > packages/core-sdk/src/abi/json/DisputeModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicensingModule/LicensingModule.abi)"' as const;' > packages/core-sdk/src/abi/json/LicensingModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/Royalty/IpRoyaltyVault.abi)"' as const;' > packages/core-sdk/src/abi/json/IpRoyaltyVault.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/Royalty/IRoyaltyPolicyLAP.abi)"' as const;' > packages/core-sdk/src/abi/json/IRoyaltyPolicyLAP.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicenseRegistry/IRoyaltyModule.abi)"' as const;' > packages/core-sdk/src/abi/json/IRoyaltyModule.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/PILPolicyFrameworkManager/PILPolicyFrameworkManager.abi)"' as const;' > packages/core-sdk/src/abi/json/PILPolicyFrameworkManager.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/IIPAssetRegistry/IIPAssetRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/IIPAssetRegistry.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/IPAssetRegistry/IIPAssetRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/IIPAssetRegistry.abi.ts
echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicenseRegistry/LicenseRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts

rm -rf packages/core-sdk/src/abi/json/tmp
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@story-protocol/core-sdk",
"version": "0.0.1-beta-rc.11",
"version": "0.0.1-beta-rc.12",
"description": "Story Protocol Core SDK",
"main": "dist/story-protocol-core-sdk.cjs.js",
"module": "dist/story-protocol-core-sdk.esm.js",
Expand Down
70 changes: 37 additions & 33 deletions packages/core-sdk/src/abi/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,51 @@ import IPAccountImplABI from "./json/IPAccountImpl.abi";
import IPAssetRegistryABI from "./json/IIPAssetRegistry.abi";
import LicensingModuleABI from "./json/LicensingModule.abi";
import PILPolicyFrameworkManagerABI from "./json/PILPolicyFrameworkManager.abi";
import RegistrationModuleABI from "./json/RegistrationModule.abi";
import IRoyaltyPolicyLAPABI from "./json/IRoyaltyPolicyLAP.abi";
import IpRoyaltyVaultABI from "./json/IpRoyaltyVault.abi";
import IRoyaltyModuleABI from "./json/IRoyaltyModule.abi";
import ErrorsABI from "./json/Errors.abi";
import { sepolia } from "../utils/env";
import { contractAddress } from "../utils/env";
import { SupportedChainIds } from "../types/config";

export const IPAccountABI = [...IPAccountImplABI, ...ErrorsABI];

export const IPAssetRegistryConfig = {
export const getIPAssetRegistryConfig = (chain: SupportedChainIds) => ({
abi: IPAssetRegistryABI,
address: getAddress(sepolia.IPAssetRegistry),
};

export const AccessControllerConfig = {
address: getAddress(contractAddress[chain].IPAssetRegistry),
});
export const getAccessControllerConfig = (chain: SupportedChainIds) => ({
abi: [...AccessControllerABI, ...ErrorsABI],
address: getAddress(sepolia.AccessController),
};

export const DisputeModuleConfig = {
address: getAddress(contractAddress[chain].AccessController),
});
export const getDisputeModuleConfig = (chain: SupportedChainIds) => ({
abi: [...DisputeModuleABI, ...ErrorsABI],
address: getAddress(sepolia.DisputeModule),
};

export const LicenseRegistryConfig = {
address: getAddress(contractAddress[chain].DisputeModule),
});
export const getLicenseRegistryConfig = (chain: SupportedChainIds) => ({
abi: IERC1155ABI,
address: getAddress(sepolia.LicenseRegistry),
};

export const LicensingModuleConfig = {
address: getAddress(contractAddress[chain].LicenseRegistry),
});
export const getLicensingModuleConfig = (chain: SupportedChainIds) => ({
abi: [...LicensingModuleABI, ...ErrorsABI],
address: getAddress(sepolia.LicensingModule),
};

export const RegistrationModuleConfig = {
abi: [...RegistrationModuleABI, ...ErrorsABI],
address: getAddress(sepolia.RegistrationModule),
};
address: getAddress(contractAddress[chain].LicensingModule),
});

export const PILPolicyFrameworkManagerConfig = {
export const getPILPolicyFrameworkManagerConfig = (chain: SupportedChainIds) => ({
abi: [...PILPolicyFrameworkManagerABI, ...ErrorsABI],
address: getAddress(sepolia.PILPolicyFrameworkManager),
};

export const RoyaltyPolicyLAPConfig = {
address: getAddress(sepolia.RoyaltyPolicyLAP),
};
address: getAddress(contractAddress[chain].PILPolicyFrameworkManager),
});
export const getRoyaltyPolicyLAPConfig = (chain: SupportedChainIds) => ({
abi: [...IRoyaltyPolicyLAPABI, ...ErrorsABI],
address: getAddress(contractAddress[chain].RoyaltyPolicyLAP),
});

export const getRoyaltyVaultImplConfig = (chain: SupportedChainIds) => ({
abi: [...IpRoyaltyVaultABI, ...ErrorsABI],
address: getAddress(contractAddress[chain].IpRoyaltyVaultImpl),
});

export const getRoyaltyModuleConfig = (chain: SupportedChainIds) => ({
abi: [...IRoyaltyModuleABI, ...ErrorsABI],
address: getAddress(contractAddress[chain].RoyaltyModule),
});
Loading

0 comments on commit ccd97fa

Please sign in to comment.