Skip to content

Commit

Permalink
fix: story config account type (#109)
Browse files Browse the repository at this point in the history
* feat: pull request template (#105)

* fix: story config account type (#108)

* fix: story config account type

* update pnpm-lock.yaml

* fix: story config tests

* update package version (#110)

---------

Co-authored-by: markzzw <[email protected]>
  • Loading branch information
jacob-tucker and zhangzewei authored Mar 22, 2024
1 parent 9dd9f90 commit 5500e31
Show file tree
Hide file tree
Showing 12 changed files with 1,413 additions and 1,364 deletions.
24 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Description
<!-- Add a description of the changes that this PR introduces -->
Example:
This pr adds user login function, includes:

- 1. add user login page.
- 2. ...

## Test Plan
<!-- The test plan section indicates detailed steps on how to verify and test code changes.
You can list the test cases or test steps that need to be performed.-->
Example:
- 1. Use different test accounts for login tests, including correct user names and passwords, and incorrect user names and passwords.
- 2. ...

## Related Issue
<!-- The related Issue section can indicate which issue or task the Pull Request is related with -->

Example: Issue #123

## Notes
<!-- The Important Matters section can alert others to special requirements or matters that need extra attention -->

- Example: Links and navigation need to be added to the front-end interface
4 changes: 2 additions & 2 deletions 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.10",
"version": "0.0.1-beta-rc.11",
"description": "Story Protocol Core SDK",
"main": "dist/story-protocol-core-sdk.cjs.js",
"module": "dist/story-protocol-core-sdk.esm.js",
Expand Down Expand Up @@ -32,7 +32,7 @@
"abitype": "^0.10.2",
"axios": "^1.5.1",
"dotenv": "^16.3.1",
"viem": "^2.7.0"
"viem": "^2.8.12"
},
"devDependencies": {
"@babel/core": "^7.23.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/core-sdk/src/types/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Account, Transport } from "viem";
import { Account, Transport, Address } from "viem";

/**
* Supported chains. For convenience, both name or chain ID are supported.
Expand All @@ -20,7 +20,7 @@ export type SupportedChainIds =
* @public
*/
export interface StoryConfig {
readonly account: Account;
readonly account: Account | Address;
readonly chainId?: SupportedChainIds;
readonly transport: Transport;
}
5 changes: 3 additions & 2 deletions packages/core-sdk/test/integration/iipAsset.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../src";
import { Hex, http } from "viem";
import { Address, Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import {
RegistrationModuleConfig,
Expand All @@ -21,7 +21,8 @@ describe("IP Asset Functions", () => {
account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.ipAsset.registrationModuleConfig = RegistrationModuleConfig;
client.ipAsset.ipAssetRegistryConfig = IPAssetRegistryConfig;
Expand Down
5 changes: 3 additions & 2 deletions packages/core-sdk/test/integration/ipAccount.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../src";
import { Hex, http } from "viem";
import { Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { IPAccountABI } from "./testABI.tenderly";

Expand All @@ -15,7 +15,8 @@ describe("Permission Functions", () => {
account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.ipAccount.ipAccountABI = IPAccountABI;
});
Expand Down
5 changes: 3 additions & 2 deletions packages/core-sdk/test/integration/license.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../src";
import { Hex, http } from "viem";
import { Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { IPAccountABI, LicenseRegistryConfig, LicensingModuleConfig } from "./testABI.tenderly";

Expand All @@ -15,7 +15,8 @@ describe("License Functions", () => {
account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.license.ipAccountABI = IPAccountABI;
client.license.licenseRegistryConfig = LicenseRegistryConfig;
Expand Down
5 changes: 3 additions & 2 deletions packages/core-sdk/test/integration/permission.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../src";
import { Hex, http } from "viem";
import { Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { IPAccountABI, AccessControllerConfig } from "./testABI.tenderly";

Expand All @@ -15,7 +15,8 @@ describe("Permission Functions", () => {
account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.permission.ipAccountABI = IPAccountABI;
client.permission.accessControllerConfig = AccessControllerConfig;
Expand Down
5 changes: 3 additions & 2 deletions packages/core-sdk/test/integration/policy.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../src";
import { Hex, http } from "viem";
import { Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import {
RegistrationModuleConfig,
Expand All @@ -24,7 +24,8 @@ describe.skip("Test Policy Functions", () => {
account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.policy.ipAccountABI = IPAccountABI;
client.policy.licensingModuleConfig = LicensingModuleConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../../src";
import { Hex, http } from "viem";
import { Hex, http, Account, Address } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import {
RegistrationModuleConfig,
Expand All @@ -21,7 +21,8 @@ describe("IP Asset Functions", () => {
account: privateKeyToAccount((process.env.SEPOLIA_WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.ipAsset.registrationModuleConfig = RegistrationModuleConfig;
client.ipAsset.ipAssetRegistryConfig = IPAssetRegistryConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../../src";
import { Hex, http } from "viem";
import { Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { IPAccountABI, LicenseRegistryConfig, LicensingModuleConfig } from "./testABI.sepolia";

Expand All @@ -15,7 +15,8 @@ describe("License Functions", () => {
account: privateKeyToAccount((process.env.SEPOLIA_WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.license.ipAccountABI = IPAccountABI;
client.license.licenseRegistryConfig = LicenseRegistryConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { StoryClient, StoryConfig } from "../../../src";
import { Hex, http } from "viem";
import { Hex, http, Account } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import {
IPAccountABI,
Expand All @@ -19,7 +19,8 @@ describe("Test Policy Functions", () => {
account: privateKeyToAccount((process.env.SEPOLIA_WALLET_PRIVATE_KEY || "0x") as Hex),
};

senderAddress = config.account.address;
const configAccount: Account = config.account as Account;
senderAddress = configAccount.address;
client = StoryClient.newClient(config);
client.policy.ipAccountABI = IPAccountABI;
client.policy.licensingModuleConfig = LicensingModuleConfig;
Expand Down
Loading

0 comments on commit 5500e31

Please sign in to comment.