master
cyhhao 2 years ago
parent 5d7421b626
commit baae3a0710

@ -7,8 +7,10 @@ import Url from "url-parse"
import network from "../config/evm-network.js"
import abis from "../config/abis.js"
import { TxManager } from "./tx-manager.js"
import URLParse from "url-parse"
export type Git3Protocol = {
url: URLParse<string>
sender: string
senderAddress: string
hubAddress: string
@ -113,6 +115,7 @@ export async function parseGit3URI(
}
return {
url,
sender,
senderAddress,
hubAddress,

@ -88,6 +88,8 @@ const evmNetworks: Record<number, any> = {
],
txConst: {
blockTimeSec: 7,
rbfTimes: 5,
boardcastTimes: 15,
},
contracts: { factory: "0x96f7849C6D0EB09024e482Cc9c249096e3368a16" },
},

@ -71,6 +71,7 @@ wallet
}
wallets.forEach((file) => {
if (file.startsWith(".")) return
const content = readFileSync(`${keyPath}/${file}`).toString()
if (params.raw) {
@ -281,9 +282,7 @@ hub.command("add-member")
})
if (memberIsManager) {
let [isAdmin, isManager, isContributor] = await protocol.hub.memberRole(
protocol.wallet.address
)
let [isAdmin, isManager, _] = await protocol.hub.memberRole(protocol.wallet.address)
if (!isAdmin) {
let hubName = protocol.ns
? `${protocol.nsName}.${protocol.nsDomain}`
@ -294,7 +293,7 @@ hub.command("add-member")
return
}
;[isAdmin, isManager, isContributor] = await protocol.hub.memberRole(member)
;[isAdmin, isManager, _] = await protocol.hub.memberRole(member)
if (isManager) {
let hubName = protocol.ns
? `${protocol.nsName}.${protocol.nsDomain}`
@ -311,7 +310,7 @@ hub.command("add-member")
let receipt = await txManager.SendCall("addManager", [member])
console.log(explorerTxUrl(receipt.transactionHash, protocol.netConfig.explorers))
} else {
let [isAdmin, isManager, isContributor] = await protocol.hub.memberRole(
let [_, isManager, isContributor] = await protocol.hub.memberRole(
protocol.wallet.address
)
if (!isManager) {
@ -324,7 +323,7 @@ hub.command("add-member")
return
}
;[isAdmin, isManager, isContributor] = await protocol.hub.memberRole(member)
;[_, isManager, isContributor] = await protocol.hub.memberRole(member)
if (isContributor) {
let hubName = protocol.ns
? `${protocol.nsName}.${protocol.nsDomain}`
@ -355,9 +354,7 @@ hub.command("remove-member")
})
if (memberIsManager) {
let [isAdmin, isManager, isContributor] = await protocol.hub.memberRole(
protocol.wallet.address
)
let [isAdmin, isManager, _] = await protocol.hub.memberRole(protocol.wallet.address)
if (!isAdmin) {
let hubName = protocol.ns
? `${protocol.nsName}.${protocol.nsDomain}`
@ -367,8 +364,7 @@ hub.command("remove-member")
)
return
}
;[isAdmin, isManager, isContributor] = await protocol.hub.memberRole(member)
;[isAdmin, isManager, _] = await protocol.hub.memberRole(member)
if (!isManager) {
let hubName = protocol.ns
? `${protocol.nsName}.${protocol.nsDomain}`
@ -385,7 +381,7 @@ hub.command("remove-member")
let receipt = await txManager.SendCall("removeManager", [member])
console.log(explorerTxUrl(receipt.transactionHash, protocol.netConfig.explorers))
} else {
let [isAdmin, isManager, isContributor] = await protocol.hub.memberRole(
let [_, isManager, isContributor] = await protocol.hub.memberRole(
protocol.wallet.address
)
if (!isManager) {
@ -398,7 +394,7 @@ hub.command("remove-member")
return
}
;[isAdmin, isManager, isContributor] = await protocol.hub.memberRole(member)
;[_, isManager, isContributor] = await protocol.hub.memberRole(member)
if (!isContributor) {
let hubName = protocol.ns
? `${protocol.nsName}.${protocol.nsDomain}`
@ -467,7 +463,8 @@ repo.command("create")
let receipt = await txManager.SendCall("createRepo", [Buffer.from(protocol.repoName)])
console.log(explorerTxUrl(receipt.transactionHash, protocol.netConfig.explorers))
console.log(`repo ${protocol.repoName} created.`)
console.log(`Repo ${protocol.repoName} created.`)
console.log(`Now you can use the url of this repo: ${protocol.url.toString()}`)
})
repo.command("members")

Loading…
Cancel
Save