@towns-protocol/generated 0.0.386 → 0.0.388
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/.contracts-hash +1 -1
- package/package.json +6 -3
- package/scripts/build-contract-types.sh +42 -0
- package/scripts/prepare.js +3 -3
package/dev/.contracts-hash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0d9de6103ee5af4a92a15177b478b7175f955b50:
|
|
1
|
+
0d9de6103ee5af4a92a15177b478b7175f955b50:f939332b550842988507b6c0bc2087844acc1043
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@towns-protocol/generated",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.388",
|
|
4
4
|
"packageManager": "yarn@3.8.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "node ./scripts/prepare.js",
|
|
8
|
+
"build-types": "bash scripts/build-contract-types.sh",
|
|
8
9
|
"make-config": "node ./scripts/make-config.js"
|
|
9
10
|
},
|
|
10
11
|
"dependencies": {
|
|
@@ -13,7 +14,9 @@
|
|
|
13
14
|
"ethers": "^5.8.0"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"@towns-protocol/contracts": "^0.0.
|
|
17
|
+
"@towns-protocol/contracts": "^0.0.388",
|
|
18
|
+
"@typechain/ethers-v5": "^11.1.2",
|
|
19
|
+
"typechain": "^8.3.2"
|
|
17
20
|
},
|
|
18
21
|
"files": [
|
|
19
22
|
"config/**/*",
|
|
@@ -32,5 +35,5 @@
|
|
|
32
35
|
"publishConfig": {
|
|
33
36
|
"access": "public"
|
|
34
37
|
},
|
|
35
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "0fb562a106aae5d780b2d45bce3babd5ff2c693b"
|
|
36
39
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -ueo pipefail
|
|
3
|
+
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"
|
|
4
|
+
cd ..
|
|
5
|
+
|
|
6
|
+
# Contracts package is a sibling directory
|
|
7
|
+
CONTRACTS_DIR="../contracts"
|
|
8
|
+
ABI_DIR="./dev/abis"
|
|
9
|
+
TYPINGS_DIR="./dev/typings"
|
|
10
|
+
|
|
11
|
+
# Run forge build in contracts directory (needs foundry.toml)
|
|
12
|
+
(cd "$CONTRACTS_DIR" && forge build)
|
|
13
|
+
|
|
14
|
+
CONTRACT_INTERFACES="(IDiamond|IDiamondCut|IArchitect|Architect|ILegacyArchitect|MockLegacyArchitect|IProxyManager|IPausable|IEntitlementsManager|EntitlementsManager|IChannel|Channels|IRoles|Roles|IMulticall|IRuleEntitlement|IRuleEntitlementV2|IWalletLink|WalletLink|INodeRegistry|NodeRegistry|IOperatorRegistry|OperatorRegistry|IStreamRegistry|StreamRegistry|OwnableFacet|TokenPausableFacet|UserEntitlement|SpaceOwner|MockERC721A|MembershipFacet|IMembershipMetadata|Member|IBanning|IPricingModules|ICrossChainEntitlement|MockEntitlementGated|PrepayFacet|IERC721AQueryable|IEntitlementDataQueryable|PlatformRequirementsFacet|IERC721A|INodeOperator|ISpaceDelegation|IEntitlementChecker|IERC5267|ICreateSpace|IDropFacet|DropFacet|ITownsPoints|ITipping|IReview|ITreasury|ISwapRouter|ISwapFacet|IAppRegistry|IAppAccount|ISimpleApp|ITownsApp|Towns|RewardsDistributionV2|MainnetDelegation|GuardianFacet|SubscriptionModuleFacet|IAppInstaller|IAppFactory)"
|
|
15
|
+
|
|
16
|
+
# Clean typings to avoid stale factories/interfaces lingering between runs
|
|
17
|
+
rm -rf "$TYPINGS_DIR"
|
|
18
|
+
yarn typechain --target=ethers-v5 "$CONTRACTS_DIR/out/**/?${CONTRACT_INTERFACES}.json" --out-dir "$TYPINGS_DIR"
|
|
19
|
+
|
|
20
|
+
# Clean abis to avoid stale abi files lingering between runs
|
|
21
|
+
rm -rf "$ABI_DIR"
|
|
22
|
+
mkdir -p "$ABI_DIR"
|
|
23
|
+
cp -a $CONTRACTS_DIR/out/{Diamond,DiamondCutFacet,Architect,MockLegacyArchitect,ProxyManager,IPausable,EntitlementsManager,Channels,Roles,IMulticall,OwnableFacet,WalletLink,MockWalletLink,NodeRegistry,OperatorRegistry,StreamRegistry,TokenPausableFacet,IRuleEntitlement,UserEntitlement,SpaceOwner,MockERC721A,MembershipFacet,IMembershipMetadata,Member,MockRiverRegistry,IBanning,IPricingModules,ICrossChainEntitlement,MockCrossChainEntitlement,MockEntitlementGated,PrepayFacet,IERC721AQueryable,IEntitlementDataQueryable,PlatformRequirementsFacet,IERC721A,INodeOperator,ISpaceDelegation,IEntitlementChecker,IEntitlementGated,IERC5267,ICreateSpace,DropFacet,ITownsPoints,ITipping,IReview,ITreasury,ISwapRouter,ISwapFacet,IAppRegistry,IAppAccount,ISimpleApp,ITownsApp,Towns,RewardsDistributionV2,MainnetDelegation,GuardianFacet,SubscriptionModuleFacet,IAppInstaller,IAppFactory}.sol/*.abi.json "$ABI_DIR"
|
|
24
|
+
|
|
25
|
+
# Copy the json abis to TS files for type inference
|
|
26
|
+
for file in $ABI_DIR/*.abi.json; do
|
|
27
|
+
filename=$(basename "$file" .json)
|
|
28
|
+
echo "export default $(cat $file) as const" > $ABI_DIR/$filename.ts
|
|
29
|
+
done
|
|
30
|
+
|
|
31
|
+
# Generate contract hash for this artifact build
|
|
32
|
+
echo "Generating contract hash..."
|
|
33
|
+
SRC_HASH=$(git rev-parse HEAD:$CONTRACTS_DIR/src 2>/dev/null || echo "")
|
|
34
|
+
BUILD_SCRIPT_HASH=$(git rev-parse HEAD:./scripts/build-contract-types.sh 2>/dev/null || echo "")
|
|
35
|
+
|
|
36
|
+
if [ -n "$SRC_HASH" ] && [ -n "$BUILD_SCRIPT_HASH" ]; then
|
|
37
|
+
CONTRACTS_HASH="$SRC_HASH:$BUILD_SCRIPT_HASH"
|
|
38
|
+
echo "$CONTRACTS_HASH" > "./dev/.contracts-hash"
|
|
39
|
+
echo "Contract hash: $CONTRACTS_HASH"
|
|
40
|
+
else
|
|
41
|
+
echo "Warning: Failed to generate contract hash (not in git repo or src not found)"
|
|
42
|
+
fi
|
package/scripts/prepare.js
CHANGED
|
@@ -49,7 +49,7 @@ function getContractsHash() {
|
|
|
49
49
|
}).trim();
|
|
50
50
|
|
|
51
51
|
const buildScriptHash = execSync('git rev-parse HEAD:./scripts/build-contract-types.sh', {
|
|
52
|
-
cwd:
|
|
52
|
+
cwd: packageRoot,
|
|
53
53
|
encoding: 'utf8',
|
|
54
54
|
stdio: 'pipe'
|
|
55
55
|
}).trim();
|
|
@@ -167,7 +167,7 @@ function generateArtifacts() {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
const buildScript = resolve(
|
|
170
|
+
const buildScript = resolve(packageRoot, 'scripts/build-contract-types.sh');
|
|
171
171
|
|
|
172
172
|
if (!existsSync(buildScript)) {
|
|
173
173
|
throw new Error(`Build script not found at ${buildScript}`);
|
|
@@ -180,7 +180,7 @@ function generateArtifacts() {
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
execSync(`bash ${buildScript}`, {
|
|
183
|
-
cwd:
|
|
183
|
+
cwd: packageRoot,
|
|
184
184
|
stdio: 'inherit',
|
|
185
185
|
env: envWithFoundry
|
|
186
186
|
});
|