feat(cli): initialize SuperAdmin natively and connect contract IDs po… - #799
Open
melvilmz wants to merge 6 commits into
Open
feat(cli): initialize SuperAdmin natively and connect contract IDs po…#799melvilmz wants to merge 6 commits into
melvilmz wants to merge 6 commits into
Conversation
|
@melvilmz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
@melvilmz please fix CI |
…rts to wrapperClient test
…ning test imports
…mands, and fix mock contract ids in sdk tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
This PR implements the deployment orchestrator features for initializing
SuperAdminnatively on-chain (#694) and connecting deployed contract IDs post-deployment (#693).Closes #694
Closes #693
🚀 Key Features & Changes
1. Native SuperAdmin Initialization (#694)
initializeSuperAdmin()incli/src/orchestrator/init-superadmin.tsto automatically construct and submit the contractinitialize()transaction using the deployer's keypair.verifySuperAdmin(),hasRole(),getAdmin()) via simulation query to guarantee the deployer holds theSuperAdmin/Adminrole post-initialization..bc-forge.jsonwith the deployer public key and initialized contract address.bc-forge init-superadminwith flags for--contract-id,--deployer,--secret-key,--name,--symbol,--decimals, and--no-verify.2. Post-Deployment Contract ID Connection (#693)
connectContractIds()/linkContracts()incli/src/orchestrator/connect-contracts.tsto connect deployed contract IDs to dependent contracts.set_admin_contractsetup invocations.linkedContracts,adminContractId,tokenContractId) to.bc-forge.json.bc-forge connect(aliasbc-forge link) with flags for--admin,--token,--vesting,--wrapper,--secret-key, and--file.3. Unified Deployment Orchestrator
runDeploymentOrchestrator()incli/src/orchestrator/orchestrator.tsto coordinate the full end-to-end lifecycle: initialize SuperAdmin -> connect contract IDs post-deployment -> verify all roles & links -> save deployment state.bc-forge orchestrate.4. TypeScript SDK Enhancements (
@bc-forge/sdk)bcForgeClientandMockBcForgeClient:getAdmin(): Promise<string>hasRole(role: Role, address: string): Promise<boolean>verifySuperAdmin(address: string): Promise<boolean>grantRole(role: Role, address: string, source: Keypair): Promise<TransactionResult>revokeRole(role: Role, address: string, source: Keypair): Promise<TransactionResult>setAdminContract(adminContractId: string, source: Keypair): Promise<TransactionResult>setDependentToken(tokenContractId: string, source: Keypair): Promise<TransactionResult>5. Config Schema Updates
cli/src/schema/bc-forge.schema.jsonandcli/src/utils/config-parser.tsto supportadminContractId,tokenContractId, andlinkedContractsunder contract deployment metadata.🧪 Test Coverage
Added comprehensive unit test suites covering both happy paths and expected error states:
cli/src/orchestrator/__tests__/init-superadmin.test.ts:cli/src/orchestrator/__tests__/connect-contracts.test.ts:cli/src/orchestrator/__tests__/orchestrator.test.ts:cli/src/utils/__tests__/config-parser.test.ts:sdk/src/client.test.ts:✅ Checklist
init-superadmin,connect,orchestrate) integrated and documentedRelated issues
Closes #694
Closes #693
Closes #692
Closes #691