Merge pull request #1 from git3protocol/joinInternalCreate

Join internal create
master
hhh_QC 2 years ago committed by GitHub
commit 95dc311e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -295,8 +295,8 @@ hub
program
.command("removeManager")
hub
.command("remove-member")
.argument("<manager address>", "manager address")
.option("-u, --uri <uri>", "hub_name.NS or hub_address:chain_id")
.description("remove a manager/contributor from hub")
@ -361,6 +361,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) {
@ -370,9 +371,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`
@ -389,7 +396,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))

Loading…
Cancel
Save