Skip to content

Commit

Permalink
Update contract address and hide story net (#150)
Browse files Browse the repository at this point in the history
* Modify annotation to show detail

* Update contract address and add env config about apiKey

* Hide story net

* Bump version to 1.0.0-rc.6

* Fix tests about hiding story net
  • Loading branch information
bonnie57 authored Apr 25, 2024
1 parent a027ca0 commit fd92005
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 121 deletions.
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": "1.0.0-rc.5",
"version": "1.0.0-rc.6",
"description": "Story Protocol Core SDK",
"main": "dist/story-protocol-core-sdk.cjs.js",
"module": "dist/story-protocol-core-sdk.esm.js",
Expand Down
96 changes: 48 additions & 48 deletions packages/core-sdk/src/abi/generated.ts

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions packages/core-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { LicenseClient } from "./resources/license";
import { DisputeClient } from "./resources/dispute";
import { IPAccountClient } from "./resources/ipAccount";
import { chainStringToViemChain } from "./utils/utils";
import { StoryAPIClient } from "./clients/storyAPI";
import { RoyaltyClient } from "./resources/royalty";
import { SimpleWalletClient } from "./abi/generated";

Expand All @@ -27,7 +26,6 @@ export class StoryClient {
private readonly config: StoryConfig & { chainId: SupportedChainIds };
private readonly rpcClient: PublicClient;
private readonly wallet: SimpleWalletClient;
private readonly storyClient: StoryAPIClient;
private _ipAsset: IPAssetClient | null = null;
private _permission: PermissionClient | null = null;
private _license: LicenseClient | null = null;
Expand All @@ -54,7 +52,6 @@ export class StoryClient {
};

this.rpcClient = createPublicClient(clientConfig);
this.storyClient = new StoryAPIClient();

if (this.config.wallet) {
this.wallet = this.config.wallet;
Expand Down
4 changes: 2 additions & 2 deletions packages/core-sdk/src/resources/dispute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class DisputeClient {

/**
* Cancels an ongoing dispute
* @param request The request object containing details to cancel the dispute.
* @param request - The request object containing details to cancel the dispute.
* @param request.disputeId The ID of the dispute to be cancelled.
* @param request.calldata Optional additional data used in the cancellation process.
* @returns A Promise that resolves to a CancelDisputeResponse containing the transaction hash.
Expand Down Expand Up @@ -90,7 +90,7 @@ export class DisputeClient {

/**
* Resolves a dispute after it has been judged
* @param request The request object containing details to resolve the dispute.
* @param request - The request object containing details to resolve the dispute.
* @param request.disputeId The ID of the dispute to be resolved.
* @param request.data The data to resolve the dispute.
* @returns A Promise that resolves to a ResolveDisputeResponse.
Expand Down
4 changes: 2 additions & 2 deletions packages/core-sdk/src/resources/ipAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class IPAccountClient {
}

/** Executes a transaction from the IP Account.
* @param request The request object containing necessary data to execute IP Account a transaction.
* @param request - The request object containing necessary data to execute IP Account a transaction.
* @param request.to The recipient of the transaction.
* @param request.value The amount of Ether to send.
* @param request.data The data to send along with the transaction.
Expand Down Expand Up @@ -50,7 +50,7 @@ export class IPAccountClient {
}

/** Executes a transaction from the IP Account.
* @param request The request object containing necessary data to execute IP Account a transaction.
* @param request - The request object containing necessary data to execute IP Account a transaction.
* @param request.to The recipient of the transaction.
* @param request.value The amount of Ether to send.
* @param request.data The data to send along with the transaction.
Expand Down
10 changes: 5 additions & 5 deletions packages/core-sdk/src/resources/license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class LicenseClient {
}
/**
* Convenient function to register a PIL non commercial social remix license to the registry
* @param request [Optional] The request object that contains all data needed to register a PIL non commercial social remix license.
* @param request - [Optional] The request object that contains all data needed to register a PIL non commercial social remix license.
* @param request.txOptions [Optional] The transaction options.
* @returns A Promise that resolves to an object containing the optional transaction hash and optional license terms Id.
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
Expand Down Expand Up @@ -93,7 +93,7 @@ export class LicenseClient {
}
/**
* Convenient function to register a PIL commercial use license to the registry.
* @param request The request object that contains all data needed to register a PIL commercial use license.
* @param request - The request object that contains all data needed to register a PIL commercial use license.
* @param request.mintingFee The fee to be paid when minting a license.
* @param request.currency The ERC20 token to be used to pay the minting fee and the token must be registered in story protocol.
* @param request.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
Expand Down Expand Up @@ -142,7 +142,7 @@ export class LicenseClient {
}
/**
* Convenient function to register a PIL commercial Remix license to the registry.
* @param request The request object that contains all data needed to register license.
* @param request - The request object that contains all data needed to register license.
* @param request.mintingFee The fee to be paid when minting a license.
* @param request.commercialRevShare Percentage of revenue that must be shared with the licensor.
* @param request.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
Expand Down Expand Up @@ -193,7 +193,7 @@ export class LicenseClient {

/**
* Attaches license terms to an IP.
* @param request The request object that contains all data needed to attach license terms.
* @param request - The request object that contains all data needed to attach license terms.
* @param request.ipId The address of the IP to which the license terms are attached.
* @param request.licenseTemplate The address of the license template.
* @param request.licenseTermsId The ID of the license terms.
Expand Down Expand Up @@ -251,7 +251,7 @@ export class LicenseClient {
* The minting fee is paid in the minting fee token specified in the license terms or configured by the IP owner.
* IP owners can configure the minting fee of their IPs or
* configure the minting fee module to determine the minting fee.
* @param request The request object that contains all data needed to mint license tokens.
* @param request - The request object that contains all data needed to mint license tokens.
* @param request.licensorIpId The licensor IP ID.
* @param request.licenseTemplate The address of the license template.
* @param request.licenseTermsId The ID of the license terms within the license template.
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/src/resources/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class PermissionClient {
* address(0) => wildcard
* bytes4(0) => wildcard
* Specific permission overrides wildcard permission.
* @param request The request object containing necessary data to set permissions.
* @param request - The request object containing necessary data to set permissions.
* @param request.ipAsset The address of the IP account that grants the permission for `signer`
* @param request.signer The address that can call `to` on behalf of the `ipAccount`
* @param request.to The address that can be called by the `signer` (currently only modules can be `to`)
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/src/resources/royalty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class RoyaltyClient {

/**
* Allows ancestors to claim the royalty tokens and any accrued revenue tokens
* @param request - The request object that contains all data needed to collect royalty tokens.
* @param request - The request object that contains all data needed to collect royalty tokens.
* @param request.parentIpId The ip id of the ancestor to whom the royalty tokens belong to.
* @param request.royaltyVaultIpId The id of the royalty vault.
* @param request.txOptions [Optional] The transaction options.
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SimpleWalletClient } from "../abi/generated";
*
* @public
*/
export type SupportedChainIds = "11155111" | "sepolia" | "1513" | "storyTestnet";
export type SupportedChainIds = "11155111" | "sepolia";

/**
* Configuration for the SDK Client.
Expand Down
29 changes: 0 additions & 29 deletions packages/core-sdk/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
parseAbiParameters,
Chain,
ContractEventName,
defineChain,
} from "viem";
import { sepolia } from "viem/chains";

Expand Down Expand Up @@ -149,40 +148,12 @@ export function chainStringToViemChain(chainId: SupportedChainIds): Chain {
case "11155111":
case "sepolia":
return sepolia;
case "1513":
case "storyTestnet":
return storyTestnet;
default:
throw new Error(`chainId ${chainId as string} not supported`);
}
}

export const storyTestnet = defineChain({
id: 15_13,
name: "story-network",
nativeCurrency: { name: "Ether", symbol: "SEP", decimals: 18 },
rpcUrls: {
default: {
http: ["https://story-network.rpc.caldera.xyz/http"],
webSocket: ["wss://story-network.rpc.caldera.xyz/ws"],
},
},
blockExplorers: {
default: { name: "Explorer", url: "https://story-network.explorer.caldera.xyz" },
},
//TODO: wait for Ze confirm with config information
contracts: {
multicall3: {
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
blockCreated: 5882,
},
},
testnet: true,
});

export const chain: { [key in SupportedChainIds]: string } = {
sepolia: "11155111",
storyTestnet: "1513",
11155111: "11155111",
1513: "1513",
};
6 changes: 4 additions & 2 deletions packages/core-sdk/test/integration/dispute.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { expect } from "chai";

import chai from "chai";
import { StoryClient } from "../../src";
import {
CancelDisputeRequest,
RaiseDisputeRequest,
ResolveDisputeRequest,
} from "../../src/types/resources/dispute";
import { MockERC721, getStoryClientInSepolia, getTokenId } from "./util";
import chaiAsPromised from "chai-as-promised";
chai.use(chaiAsPromised);
const expect = chai.expect;

describe.skip("Dispute Functions", () => {
let client: StoryClient;
Expand Down
4 changes: 2 additions & 2 deletions packages/core-sdk/test/integration/license.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ describe.skip("License Functions in storyTestnet", () => {
let tokenId: string;
before(async function () {
const baseConfig = {
chain: chainStringToViemChain("storyTestnet"),
transport: http(process.env.STORY_TEST_NET_RPC_PROVIDER_URL),
chain: chainStringToViemChain("sepolia"),
transport: http(process.env.SEPOLIA_RPC_PROVIDER_URL),
} as const;
const publicClient = createPublicClient(baseConfig);
const walletClient = createWalletClient({
Expand Down
2 changes: 1 addition & 1 deletion packages/core-sdk/test/integration/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getTokenId = async (): Promise<string | undefined> => {
}
};

export const MockERC20 = "0x857308523a01B430cB112400976B9FC4A6429D55";
export const MockERC20 = "0xB132A6B7AE652c974EE1557A3521D53d18F6739f";
export const MockERC721 = "0x7ee32b8B515dEE0Ba2F25f612A04a731eEc24F49";

export const getStoryClientInSepolia = (): StoryClient => {
Expand Down
9 changes: 0 additions & 9 deletions packages/core-sdk/test/unit/utils/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
dictToQueryParams,
typedDataArrayToBytesArray,
chainStringToViemChain,
storyTestnet,
waitTx,
} from "../../../src/utils/utils";
import { createMock } from "../testUtils";
Expand Down Expand Up @@ -269,14 +268,6 @@ describe("Test chainStringToViemChain", () => {
const chain = chainStringToViemChain("sepolia");
expect(chain).to.equal(sepolia);
});
it("should return story testnet if id is 1513", () => {
const chain = chainStringToViemChain("1513");
expect(chain).to.equal(storyTestnet);
});
it("should return story test network if id is storyTestnet", () => {
const chain = chainStringToViemChain("storyTestnet");
expect(chain).to.equal(storyTestnet);
});
});

describe("Test waitTx", () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/wagmi-generater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
"typescript": "^5.4.2",
"viem": "^2.8.6",
"wagmi": "^2.5.7"
},
"dependencies": {
"dotenv": "^16.3.1"
}
}
}
29 changes: 16 additions & 13 deletions packages/wagmi-generater/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -1,82 +1,84 @@
import {defineConfig} from '@wagmi/cli'
import {blockExplorer, react} from '@wagmi/cli/plugins'
import {blockExplorer} from '@wagmi/cli/plugins'
import {sdk} from './sdk'
import type {Evaluate} from "@wagmi/cli/src/types";
import type {ContractConfig} from "@wagmi/cli/src/config";
import {resolveProxyContracts} from "./resolveProxyContracts";
const storyTestnetId = 1513;
const sepoliaChainId = 11155111;
import 'dotenv/config';

export default defineConfig(async () => {
const contracts: Evaluate<Omit<ContractConfig, 'abi'>>[] = [
{
name: "AccessController", address: {
[sepoliaChainId]: "0xFbD5BE3815b71564Dc51C3C8301c47770fC9a61c",
[sepoliaChainId]: "0xF9936a224b3Deb6f9A4645ccAfa66f7ECe83CF0A",
// [storyTestnetId]: "0x7e253Df9b0fC872746877Fa362b2cAf32712d770",
}
},
{
name: "DisputeModule", address: {
[sepoliaChainId]: "0xd0194dD93968DE60dBe10610fb6Ce2C86a51A78e",
[sepoliaChainId]: "0xEB7B1dd43B81A7be1fA427515a2b173B454A9832",
// [storyTestnetId]: "0x6d54456Ae5DCbDC0C9E2713cC8E650fE4f445c7C",
}
},
{
name: "IPAccountImpl", address: {
[sepoliaChainId]: "0x71898BD128039BC5bb8D2451Cfc43A55F64fb9c6",
[sepoliaChainId]: "0x36a5f0D61f6Bab3C6Dde211E5a6762Cb18a8060d",
// [storyTestnetId]: "0x38cAfD16502B1d61c6399A18d6Fa1Ea8CEca3678",
}
},
{
name: "IPAssetRegistry", address: {
[sepoliaChainId]: "0x84c177633adCD26157732e18dd9E145E442E6aCb",
[sepoliaChainId]: "0xd43fE0d865cb5C26b1351d3eAf2E3064BE3276F6",
// [storyTestnetId]: "0x862de97662a1231FFc14038eC1BE93aB129D2169",
}
},
{
name: "IpRoyaltyVaultImpl", address: {
[sepoliaChainId]: "0xDdAa6A42399F8eA503048ACb93A5fAe6e6b39598",
[sepoliaChainId]: "0xD6c2AfB61085f1359d47159f2271BDD0EeBf19C2",
// [storyTestnetId]: "0x8Be22cc2D13ADF496a417D9C616dA4a253c68Af8",
}
},
{
name: "LicenseRegistry", address: {
[sepoliaChainId]: "0xbbcb7b0Bd15b1CfcA0A923791e526A6E90774D40",
[sepoliaChainId]: "0x4f4b1bf7135C7ff1462826CCA81B048Ed19562ed",
// [storyTestnetId]: "0x0c3D467537FAd845a78728CEdc3D9447338c5422",
}
},
{
name: "LicenseToken", address: {
[sepoliaChainId]: "0xCe9862F0a6f39631A2A790237086bd48635e3e42",
[sepoliaChainId]: "0x1333c78A821c9a576209B01a16dDCEF881cAb6f2",
// [storyTestnetId]: "0xD40b7bCA204f96a346021e31c9ad54FF495226e7",
}
},
{
name: "LicensingModule", address: {
[sepoliaChainId]: "0xf6C72a97E6ef70A9AB0F96c6E4baB93b868DC992",
[sepoliaChainId]: "0xe89b0EaA8a0949738efA80bB531a165FB3456CBe",
// [storyTestnetId]: "0xEeDDE5529122b621105798860F235c28FD3aBA40",
}
},
{
name: "PILicenseTemplate", address: {
[sepoliaChainId]: "0xFD474b0938303613AAa377BE375c3A571cAA04fb",
[sepoliaChainId]: "0x260B6CB6284c89dbE660c0004233f7bB99B5edE7",
// [storyTestnetId]: "0xd0Be223ae9719bBD93447ecf5289319CCf8cA227",
}
},
{
name: "ModuleRegistry", address: {
[sepoliaChainId]: "0x59b37bb4D6913eFE32f40D09b5290ff5509E6738",
[sepoliaChainId]: "0x2E0a668289D5C4Da6a2264aC8DF03cd600c7aAB8",
// [storyTestnetId]: "0xf2965E3B6251905Dd1E8671077760D07b0408cf2",
}
},
{
name: "RoyaltyModule", address: {
[sepoliaChainId]: "0xE50BB9D71b4d5c587d36849460F57df5bc939dab",
[sepoliaChainId]: "0xFAE961dd2b87CD5818dbCDc2591e6AB0b50E96b0",
// [storyTestnetId]: "0x551AD8CD7893003cE00500aC2aCF1E327763D9f6",
}
},
{
name: "RoyaltyPolicyLAP", address: {
[sepoliaChainId]: "0xf4f93F779BAe88898BA0Fc6ddb6FAA05632ee13c",
[sepoliaChainId]: "0xAAbaf349C7a2A84564F9CC4Ac130B3f19A718E86",
// [storyTestnetId]: "0x2EcdB5bD12a037dCb9De0Ab7957f35FEeF758eA6",
}
},
Expand All @@ -94,6 +96,7 @@ export default defineConfig(async () => {
chainId: sepoliaChainId,
}),
contracts: contracts,
apiKey: process.env.API_KEY
}),
sdk({
permissionLessSDK: true,
Expand Down
4 changes: 4 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fd92005

Please sign in to comment.