From 5090cfaedacd848209b60054b45b45103bc4fd42 Mon Sep 17 00:00:00 2001 From: cyl19970726 <15258378443@163.com> Date: Wed, 1 Mar 2023 11:46:54 +0800 Subject: [PATCH 1/2] update hub.remove-member --- src/git3/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/git3/index.ts b/src/git3/index.ts index 225d0b9..4d25459 100644 --- a/src/git3/index.ts +++ b/src/git3/index.ts @@ -310,8 +310,8 @@ hub -program - .command("removeManager") +hub + .command("remove-member") .argument("", "manager address") .option("-u, --uri ", "hub_name.NS or hub_address:chain_id") .description("remove a manager/contributor from hub") From 45f660e5c0413647357412ae08164eb13a6bb7ed Mon Sep 17 00:00:00 2001 From: cyl19970726 <15258378443@163.com> Date: Wed, 1 Mar 2023 11:57:56 +0800 Subject: [PATCH 2/2] Add the code to automatically join the permissionless hub in the process of creating repo --- src/git3/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/git3/index.ts b/src/git3/index.ts index 4d25459..8b42e2d 100644 --- a/src/git3/index.ts +++ b/src/git3/index.ts @@ -376,6 +376,7 @@ repo .description("create a new repo") .action(async (uri) => { const protocol = await parseGit3URI(uri, { ignoreProtocolHeader: true }) + const txManager = new TxManager(protocol.hub, protocol.chainId, protocol.netConfig.txConst) let isMember = await protocol.hub.membership(protocol.wallet.address) if (!isMember) { @@ -385,9 +386,15 @@ repo console.error(`you are not a member of this hub: ${hubName}`) let isPermissionless = await protocol.hub.permissionless() if (isPermissionless) { + console.error( - `this hub is permissionless, you can join it with: git3 join ${hubName}` + `this hub is permissionless, you are joining this hub ${hubName}` ) + + let rec = await txManager.SendCall("permissionlessJoin",[]) + + console.log(explorerTxUrl(rec.transactionHash, protocol.netConfig.explorers)) + console.log(`already joined hub: ${hubName}`) } else { console.error( `this hub is not permissionless, you can ask the hub owner to add you as a member` @@ -404,7 +411,6 @@ repo } console.log(`creating repo ${protocol.repoName} on ${protocol.netConfig.name}...`) - const txManager = new TxManager(protocol.hub, protocol.chainId, protocol.netConfig.txConst) let receipt = await txManager.SendCall("createRepo", [Buffer.from(protocol.repoName)]) console.log(explorerTxUrl(receipt.transactionHash, protocol.netConfig.explorers))