Skip to content

Commit

Permalink
Merge pull request #1 from ethan-57blocks/main
Browse files Browse the repository at this point in the history
house keeping
  • Loading branch information
leslie555 authored Feb 29, 2024
2 parents 243b2fb + 317842d commit fb17497
Show file tree
Hide file tree
Showing 14 changed files with 472 additions and 74 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TEST_WALLET_A_ADDRESS = 0x0000000000000000000000000000000000000000
TEST_WALLET_B_ADDRESS = 0x0000000000000000000000000000000000000000
TEST_WALLET_C_ADDRESS = 0x0000000000000000000000000000000000000000
PRIVATE_KEYS = privateKey1,privateKey2,privateKey3
NFT_CONTRACT_ADDRESS = 0x0000000000000000000000000000000000000000
RPC_URL = https://rpc.ankr.com/eth_sepolia
LICENSE_MODULE = 0x0000000000000000000000000000000000000000
MINT_FEE_TOKEN = 0x0000000000000000000000000000000000000000
ROYALTY_POLICY = 0x0000000000000000000000000000000000000000
54 changes: 54 additions & 0 deletions config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import "dotenv/config";
import {
Hex,
createWalletClient,
http,
PrivateKeyAccount,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { StoryClient, StoryConfig } from "@story-protocol/core-sdk";

import { sepolia } from "viem/chains";

export const getStoryConfig = (account: PrivateKeyAccount) => ({
transport: http(RPC_URL),
account,
}) as StoryConfig;

export const TOKEN_CONTRACT_ADDRESS = "0x7ee32b8B515dEE0Ba2F25f612A04a731eEc24F49";
export const TEST_WALLET_A_ADDRESS = (process.env.TEST_WALLET_A_ADDRESS || "0x") as `0x${string}`;
export const TEST_WALLET_B_ADDRESS = (process.env.TEST_WALLET_B_ADDRESS || "0x") as `0x${string}`;
export const TEST_WALLET_C_ADDRESS = (process.env.TEST_WALLET_C_ADDRESS || "0x") as `0x${string}`;
export const NFT_CONTRACT_ADDRESS = (process.env.NFT_CONTRACT_ADDRESS || "0x") as `0x${string}`;
export const RPC_URL = process.env.RPC_URL || "";
export const LICENSE_MODULE = (process.env.LICENSE_MODULE || "") as `0x${string}`;
export const MINT_FEE_TOKEN = (process.env.MINT_FEE_TOKEN || "") as `0x${string}`;
export const ROYALTY_POLICY = (process.env.ROYALTY_POLICY || "") as `0x${string}`;

export const accountA = privateKeyToAccount((process.env.PRIVATE_KEYS?.split(',')[0] || '0x') as Hex);
export const accountB = privateKeyToAccount((process.env.PRIVATE_KEYS?.split(',')[1] || '0x') as Hex);
export const accountC = privateKeyToAccount((process.env.PRIVATE_KEYS?.split(',')[2] || '0x') as Hex);

const configA: StoryConfig = getStoryConfig(accountA);
const configB: StoryConfig = getStoryConfig(accountB);
const configC: StoryConfig = getStoryConfig(accountC);

export const storyClientA: StoryClient = StoryClient.newClient(configA);
export const storyClientB: StoryClient = StoryClient.newClient(configB);
export const storyClientC: StoryClient = StoryClient.newClient(configC);

export const walletClientA = createWalletClient({
transport: http(RPC_URL),
chain: sepolia,
account: accountA,
});
export const walletClientB = createWalletClient({
transport: http(RPC_URL),
chain: sepolia,
account: accountB,
});
export const walletClientC = createWalletClient({
transport: http(RPC_URL),
chain: sepolia,
account: accountC,
});
File renamed without changes.
21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,36 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test:flow1": "node -e 'require(\"./script/flow1.ts\").testFlow1()'",
"test:flow2": "node -e 'require(\"./script/flow2.ts\").testFlow3()'",
"test:flow3": "node -e 'require(\"./script/flow3.ts\").testFlow3()'",
"test:all": "npm-run-all test:flow1 test:flow2 test:flow3"
"test:flow1": "TEST_FLOWS=flow1 tsx test/e2e/e2e.ts",
"test:flow2": "TEST_FLOWS=flow2 tsx test/e2e/e2e.ts",
"test:flow3": "TEST_FLOWS=flow3 tsx test/e2e/e2e.ts",
"test:flow4": "TEST_FLOWS=flow4 tsx test/e2e/e2e.ts",
"test:flow5": "TEST_FLOWS=flow5 tsx test/e2e/e2e.ts",
"test:flow6": "TEST_FLOWS=flow6 tsx test/e2e/e2e.ts",
"test:all": "TEST_FLOWS=flow1,flow2,flow3,flow4,flow5,flow6 tsx test/e2e/e2e.ts"
},
"engines": {
"node": "20.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/storyprotocol/sdk-e2e-tests.git"
"url": "https://github.com/storyprotocol/sdk-e2e-tests.git"
},
"dependencies": {
"@story-protocol/core-sdk": "0.0.1-beta-rc.9",
"dotenv": "^16.4.5",
"tsx": "^4.7.1",
"viem": "^1.18.4"
},
"devDependencies": {
"@types/node": "^20.11.22",
"npm-run-all": "^4.1.5",
"typescript": "^5.2.2"
},
"author": "",
"license": "ISC",
"author": "storyprotocol engineering <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/storyprotocol/sdk-e2e-tests/issues"
},
Expand Down
Loading

0 comments on commit fb17497

Please sign in to comment.