Skip to content

Commit 82056e2

Browse files
committed
Merge branch 'feat/migrate-lit-contracts-repo' into feature/jss-105-refactor-auth-services-from-elysia-to-express
2 parents bf71d65 + dd2e6f4 commit 82056e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+492392
-4
lines changed

.changeset/tidy-masks-run.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@lit-protocol/contracts': patch
3+
---
4+
5+
This is the first monorepo release and should behave exactly like v0.5.1. If anything breaks, roll back to v0.5.1.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,5 @@ alice-auth-manager-data
9696
.plans
9797
.e2e
9898
alice-auth-manager-data
99+
!/packages/contracts/dist/
100+
!/packages/contracts/dist/dev

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ git commit -m "chore: release v0.0.1"
9898
bunx changeset publish
9999
```
100100

101+
## Keeping the contract address and ABIs in sync with the latest changes
102+
103+
This command must be run manually and is NOT part of the build process, as it requires a GitHub API key.
104+
105+
```
106+
DEV_BRANCH=develop GH_API_KEY=github_pat_xxx bun run sync:contracts
107+
```
108+
101109
---
102110

103111
# Legacy Documentation for V7 and Earlier

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.1",
44
"license": "MIT",
55
"scripts": {
6+
"sync:contracts": "nx run contracts:sync",
67
"reset": "rimraf dist pnpm-lock.yaml node_modules tmp yarn-error.log yarn.lock package-lock.json learn-debug.log .nx lit-auth-storage pkp-tokens lit-auth-local ./e2e/dist ./e2e/node_modules",
78
"build": "nx run-many --parallel=false --target=build --all --exclude=wrapped-keys,wrapped-keys-lit-actions",
89
"gen:local-network-context": "dotenvx run --env-file=.env -- node --conditions=import --import tsx packages/networks/src/networks/vNaga/shared/scripts/generate-abi-signatures.ts",
@@ -20,7 +21,6 @@
2021
"@babel/preset-env": "^7.28.3",
2122
"@babel/preset-typescript": "^7.27.1",
2223
"@dotenvx/dotenvx": "^1.6.4",
23-
"@lit-protocol/contracts": "0.5.1",
2424
"@lit-protocol/nacl": "7.1.1",
2525
"@lit-protocol/uint8arrays": "7.1.1",
2626
"@metamask/eth-sig-util": "5.0.2",

packages/constants/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"type": "module",
1616
"dependencies": {
1717
"@openagenda/verror": "^3.1.4",
18-
"zod": "3.24.3"
18+
"tslib": "^2.8.1",
19+
"zod": "3.24.3",
20+
"@lit-protocol/contracts": "workspace:*"
1921
},
2022
"publishConfig": {
2123
"access": "public",

packages/contracts/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Configurations
2+
3+
All configs are in the `./src/config` directory
4+
5+
```bash
6+
.
7+
├── env.ts // 👈 to modify env vars
8+
├── methods.ts // 👈 to add new ABI methods to extract
9+
└── networks.ts // 👈 to add or modify a network
10+
```
11+
12+
# Syncing Contract Addresses and ABIs
13+
14+
```shell
15+
tsx ./src/sync.ts
16+
```
17+
18+
or from monorepo root
19+
20+
```shell
21+
nx run contracts:start
22+
```

packages/contracts/dist/build.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export declare const env: Readonly<{
2+
GH_API_KEY: string;
3+
DEV_BRANCH: string;
4+
}>;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export declare const METHODS_TO_EXTRACT: readonly ["PKPPermissions.getPermittedActions", "PKPPermissions.getPermittedAddresses", "PKPPermissions.isPermittedAction", "PKPPermissions.isPermittedAddress", "PKPPermissions.getPermittedAuthMethods", "PKPPermissions.getPermittedAuthMethodScopes", "PKPPermissions.addPermittedAction", "PKPPermissions.addPermittedAddress", "PKPPermissions.addPermittedAuthMethodScope", "PKPPermissions.addPermittedAuthMethod", "PKPPermissions.removePermittedAction", "PKPPermissions.removePermittedAddress", "PKPPermissions.removePermittedAuthMethod", "PKPPermissions.removePermittedAuthMethodScope", "PKPPermissions.getTokenIdsForAuthMethod", "PKPNFT.tokenOfOwnerByIndex", "PKPNFT.mintCost", "PKPNFT.safeTransferFrom", "PKPNFT.mintNext", "PKPNFT.claimAndMint", "PKPHelper.claimAndMintNextAndAddAuthMethodsWithTypes", "PKPHelper.mintNextAndAddAuthMethods", "Staking.getActiveUnkickedValidatorStructsAndCounts", "PriceFeed.getNodesForRequest", "PubkeyRouter.deriveEthAddressFromPubkey", "PubkeyRouter.ethAddressToPkpId", "PubkeyRouter.getPubkey", "PubkeyRouter.getEthAddress", "Ledger.deposit", "Ledger.depositForUser", "Ledger.balance", "Ledger.stableBalance", "Ledger.requestWithdraw", "Ledger.latestWithdrawRequest", "Ledger.userWithdrawDelay", "Ledger.withdraw", "PaymentDelegation.getPayersAndRestrictions", "PaymentDelegation.getUsers", "PaymentDelegation.getRestriction", "PaymentDelegation.getPayers", "PaymentDelegation.delegatePayments", "PaymentDelegation.undelegatePayments", "PaymentDelegation.delegatePaymentsBatch", "PaymentDelegation.undelegatePaymentsBatch", "PaymentDelegation.setRestriction"];
2+
export type ContractName = 'PKPPermissions' | 'PKPNFT' | 'PKPHelper' | 'Staking' | 'PubkeyRouter';
3+
export type ExtractMethodName<T extends string> = T extends `${ContractName}.${infer Method}` ? Method : never;
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/**
2+
* Network Configuration
3+
* Contains all network-related constants and configurations
4+
*/
5+
export declare const GITHUB_API_BASE = "https://api.github.com/repos";
6+
export declare const USERNAME = "LIT-Protocol";
7+
export declare const NETWORKS_REPO = "networks";
8+
export declare const LIT_ASSETS_REPO = "lit-assets";
9+
export declare const PROD_PATH_BY_NETWORK: {
10+
readonly datil: "datil-prod";
11+
readonly 'datil-dev': "datil-dev";
12+
readonly 'datil-test': "datil-test";
13+
readonly 'naga-dev': "naga-dev";
14+
readonly 'naga-test': "naga-test";
15+
readonly 'naga-staging': "naga-staging";
16+
};
17+
export declare const DEV_PATH_BY_NETWORK: {
18+
readonly develop: "develop";
19+
};
20+
export type ProdNetworkName = keyof typeof PROD_PATH_BY_NETWORK;
21+
export type DevNetworkName = keyof typeof DEV_PATH_BY_NETWORK;
22+
export type NetworkName = ProdNetworkName | DevNetworkName;
23+
export type NetworkPath = (typeof PROD_PATH_BY_NETWORK)[ProdNetworkName] | (typeof DEV_PATH_BY_NETWORK)[DevNetworkName];
24+
/**
25+
* Network path configuration for GitHub API requests
26+
*
27+
* Production:
28+
* - Uses network-specific subdirectories (e.g., "datil-prod/abis" for datil network)
29+
* - Special case: "datil" network uses "datil-prod" directory
30+
*
31+
* Development:
32+
* - Uses a flat structure without network subdirectories
33+
* - All files are in the same directory (e.g., "rust/lit-core/blockchain/abis")
34+
*/
35+
export declare const NETWORK_PATHS: {
36+
readonly prod: {
37+
/**
38+
* Maps network names to their directory names
39+
* Example: "datil" -> "datil-prod", "datil-dev" -> "datil-dev"
40+
*/
41+
readonly networkToPath: {
42+
readonly datil: "datil-prod";
43+
readonly 'datil-dev': "datil-dev";
44+
readonly 'datil-test': "datil-test";
45+
readonly 'naga-dev': "naga-dev";
46+
readonly 'naga-test': "naga-test";
47+
readonly 'naga-staging': "naga-staging";
48+
};
49+
/**
50+
* Constructs the full path for production networks
51+
* Format: <network-directory>/<content-path>
52+
* Example: "datil-prod/abis"
53+
*/
54+
readonly getContentPath: (network: ProdNetworkName, contentPath: string) => string;
55+
};
56+
readonly dev: {
57+
/**
58+
* Maps network names to their directory names
59+
* Example: "develop" -> "develop"
60+
*/
61+
readonly networkToPath: {
62+
readonly develop: "develop";
63+
};
64+
/**
65+
* Constructs the full path for development
66+
* Uses the content path directly without network subdirectory
67+
* Example: "rust/lit-core/blockchain/abis"
68+
*/
69+
readonly getContentPath: (network: DevNetworkName, contentPath: string) => string;
70+
};
71+
};
72+
export declare const NETWORKS: {
73+
readonly prod: {
74+
readonly networks: ProdNetworkName[];
75+
readonly deployedContracts: {
76+
readonly 'datil-dev': "https://raw.githubusercontent.com/LIT-Protocol/networks/main/datil-dev/deployed-lit-node-contracts-temp.json";
77+
readonly 'datil-test': "https://raw.githubusercontent.com/LIT-Protocol/networks/main/datil-test/deployed-lit-node-contracts-temp.json";
78+
readonly datil: "https://raw.githubusercontent.com/LIT-Protocol/networks/main/datil-prod/deployed-lit-node-contracts-temp.json";
79+
readonly 'naga-dev': "https://raw.githubusercontent.com/LIT-Protocol/networks/main/naga-dev/deployed-lit-node-contracts-temp.json";
80+
readonly 'naga-staging': "https://raw.githubusercontent.com/LIT-Protocol/networks/main/naga-staging/deployed-lit-node-contracts-temp.json";
81+
readonly 'naga-test': "https://raw.githubusercontent.com/LIT-Protocol/networks/main/naga-test/deployed-lit-node-contracts-temp.json";
82+
};
83+
};
84+
readonly dev: {
85+
readonly networks: DevNetworkName[];
86+
readonly deployedContracts: {
87+
readonly develop: "https://raw.githubusercontent.com/LIT-Protocol/networks/main/naga-dev/deployed-lit-node-contracts-temp.json";
88+
readonly 'datil-clone': "https://raw.githubusercontent.com/LIT-Protocol/networks/main/datil-clone/deployed-lit-node-contracts-temp.json";
89+
};
90+
};
91+
};
92+
export declare const CONTRACT_NAME_MAP: {
93+
readonly litTokenContractAddress: "LITToken";
94+
readonly pkpNftContractAddress: "PKPNFT";
95+
readonly pkpHelperContractAddress: "PKPHelper";
96+
readonly pkpPermissionsContractAddress: "PKPPermissions";
97+
readonly pkpNftMetadataContractAddress: "PKPNFTMetadata";
98+
readonly pubkeyRouterContractAddress: "PubkeyRouter";
99+
readonly rateLimitNftContractAddress: "RateLimitNFT";
100+
readonly stakingBalancesContractAddress: "StakingBalances";
101+
readonly stakingContractAddress: "Staking";
102+
readonly multisenderContractAddress: "Multisender";
103+
readonly allowlistContractAddress: "Allowlist";
104+
readonly paymentDelegationContractAddress: "PaymentDelegation";
105+
readonly priceFeedContractAddress: "PriceFeed";
106+
readonly cloneNetContractAddress: "CloneNet";
107+
readonly ledgerContractAddress: "Ledger";
108+
};
109+
export declare const ENV_CONFIG: {
110+
readonly prod: {
111+
readonly repoName: "networks";
112+
readonly path: "abis";
113+
readonly fileExtensionToRemove: ".abi";
114+
readonly abiSourceInJson: readonly [];
115+
};
116+
readonly dev: {
117+
readonly repoName: "lit-assets";
118+
readonly path: "rust/lit-core/lit-blockchain/abis";
119+
readonly fileExtensionToRemove: ".json";
120+
readonly abiSourceInJson: readonly ["abi"];
121+
};
122+
};

0 commit comments

Comments
 (0)