repo
This module allows you to create and manage a MakeOS repository. It can be accessed from the global variable repo.

create

1
repo.create(txObject, [signingKey | payloadOnly | [signingKey, payloadOnly]])
Copied!
Send a transaction to create a repository.

Parameters

  1. 1.
    txObject - Object: The transaction object
    • name - String : The unique name of the repository.
    • value - String: (optional) The amount of coins to transfer to the new repository.
    • nonce - Number|String : The signing account’s next nonce.
    • fee - String: The network fee to be paid by the signing account.
    • timestamp - String: (optional) The Unix timestamp of the transaction.
    • config - Object: (optional) The repository configuration
    • sig - String : (optional) The transaction signature. If not provided, the transaction will be signed using the signingKey.
  2. 2.
    signingKey - String: (optional) The private key to use to sign the transaction.
  3. 3.
    payloadOnly - Boolean: (optional) When true, the transaction payload is returned instead of being sent to the network.

Returns

Object - The result object
  • hash - String: A 32 bytes transaction hash.
  • address - String: The full address of the repository.

Example

  • Create a transaction to create a repository named myrepo.
    • accounts[0] returns the address of a key at index 0 on the keystore.
    • You will be prompted to enter the passphrase.
JavaScript
Output
1
repo.create({
2
name: "myrepo",
3
fee: "0.1",
4
value: "15.5"
5
}, user.getKey(accounts[0]))
Copied!
1
{
2
"address": "r/myrepo",
3
"hash": "0x59e77af29938528284b69f8114a3ece38493e83725c3354ed840e2b8c86b39e3"
4
}
Copied!
  • Get the signed payload instead of creating and then sending the transaction.
JavaScript
Output
1
var payload = repo.create({
2
name: "myrepo",
3
fee: "0.1",
4
value: "15.5"
5
}, user.getKey(accounts[0]), true)
Copied!
1
{
2
"config": {},
3
"fee": "1",
4
"name": "myrepo",
5
"nonce": 1,
6
"senderPubKey": [121,172,241,123,81,102,72,134,112,163,3,245,128,196,144,219,42,147,70,184,226,63,26,28,135,151,128,139,16,82,174,4],
7
"sig": [184,29,52,29,244,75,118,183,214,245,205,15,170,131,69,60,15,110,172,211,11,122,96,199,175,70,5,79,127,189,23,199,13,87,77,37,8,219,206,101,109,82,123,150,202,101,78,142,22,202,46,1,165,25,229,31,112,102,58,184,121,20,221,3],
8
"timestamp": 1606173977,
9
"type": 6,
10
"value": "0"
11
}
Copied!

upsertOwner

1
repo.upsertOwner(txObject, [signingKey | payloadOnly | [signingKey, payloadOnly]])
Copied!
Create a proposal to add or update an owner of a repository.

Parameters

  1. 1.
    txObject - Object: The transaction object
    • id - String: A unique, numeric proposal ID. Must not exceed 16 characters.
    • name - String : The unique name of the repository.
    • value - String: (optional) The proposal deposit fee, if required.
    • addresses - Array<String>: A list of addresses to add as owners.
    • veto - Boolean: Grant veto right to owners.
    • nonce - Number|String : The signing account’s next nonce.
    • fee - String: The network fee to be paid by the signing account.
    • timestamp - String: (optional) The unix timestamp of the transaction.
    • sig - String : (optional) The transaction signature. If not provided, the transaction will be signed using the signingKey.
  2. 2.
    signingKey - String: (optional) The private key to use to sign the transaction.
  3. 3.
    payloadOnly - Boolean: (optional) When true, the transaction payload is returned instead of being sent to the network.

Returns

Object - The result object
  • hash - String: A 32 bytes transaction hash.

Example

  • Create a transaction that adds a new address as an owner with veto power.
1
repo.upsertOwner({
2
id: "1",
3
name:"myrepo",
4
veto: true,
5
addresses: ["os1858effdlfecl30hgq0dvpesygp2daf97malemz"],
6
fee: "1",
7
}, user.getKey(accounts[0]))
Copied!

vote

1
repo.vote(txObject, [signingKey | payloadOnly | [signingKey, payloadOnly]])
Copied!
Create a transaction that votes on a repository proposal.

Parameters

  1. 1.
    txObject - Object: The transaction object
    • id - String: The ID of the proposal.
    • name - String : The name of the repository.
    • vote - Number: The vote choice:
      • 0: No,
      • 1: Yes
      • 2: NoWithVeto
      • 3: Abstain
    • nonce - Number|String : The signing account’s next nonce.
    • fee - String: The network fee to be paid by the signing account.
    • timestamp - String: (optional) The Unix timestamp of the transaction.
    • sig - String : (optional) The transaction signature. If not provided, the transaction will be signed using the signingKey.
  2. 2.
    signingKey - String: (optional) The private key to use to sign the transaction.
  3. 3.
    payloadOnly - Boolean: (optional) When true, the transaction payload is returned instead of being sent to the network.

Returns

Object - The result object
  • hash - String: A 32 bytes transaction hash.

Example

  • Create a transaction that will vote Yes on a proposal with ID = 1.
1
repo.vote({
2
name: "myrepo",
3
id: "1",
4
vote: 1,
5
fee: "1"
6
}, user.getKey(accounts[0]))
Copied!

get

1
repo.get(name, queryopts)
Copied!
Create a transaction that votes on a repository proposal.

Parameters

  1. 1.
    name - String: The name of the repository.
  2. 2.
    queryopts - Object: The query options
    • height - Number|String: (Optional) The chain height to search for repository. Defaults to the latest block height.
    • noProps - Boolean : If true, proposals will not be returned.
      Returns
      Object - The result object
  3. 3.
    balance - String: The coin balance of the repository.
  4. 4.
    config - RepoConfig: The repository configuration.
  5. 5.
    contributors - {PushKey: [RepoContributor](#)}: The repository contributors.
  6. 6.
    owners - {Address: [RepoOwner](#)} - The owners of the repository.
  7. 7.
    proposals - {ID: [RepoProposal](#)} - The proposals created on the repository.
  8. 8.
    references - {Reference: [RepoReference](#)} - The git references of the repository.

Example

JavaScript
Origin
1
repo.get("myrepo")
Copied!
1
{
2
"balance": "0",
3
"config": {RepoConfig},
4
"contributors": {"pk1..": RepoContributor},
5
"owners": {"os1..": RepoOwner},
6
"proposals": {"1": RepoProposal},
7
"references": {"refs/heads/master": RepoReference}
8
}
Copied!

update

1
repo.update(txObject, [signingKey | payloadOnly | [signingKey, payloadOnly]])
Copied!
Create a proposal to update a repository.

Parameters

  1. 1.
    txObject - Object: The transaction object
    • id - String: A unique, numeric proposal ID. Must not exceed 16 characters.
    • name - String : The unique name of the repository.
    • value - String: (optional) The proposal deposit fee, if required.
    • config - Object: The config update to merge into the existing configuration.
    • nonce - Number|String : The signing account’s next nonce.
    • fee - String: The network fee to be paid by the signing account.
    • timestamp - String: (optional) The Unix timestamp of the transaction.
    • sig - String : (optional) The transaction signature. If not provided, the transaction will be signed using the signingKey.
  2. 2.
    signingKey - String: (optional) The private key to use to sign the transaction.
  3. 3.
    payloadOnly - Boolean: (optional) When true, the transaction payload is returned instead of being sent to the network.

Returns

Object - The result object
  • hash - String: A 32 bytes transaction hash.

Example

1
repo.update({
2
name: "myrepo",
3
id: "1",
4
fee: "1",
5
config: {
6
governance: { propQuorum: 35 }
7
}
8
}, user.getKey(accounts[0]))
Copied!

depositPropFee

1
repo.depositPropFee(txObject, [signingKey | payloadOnly | [signingKey, payloadOnly]])
Copied!
Creates a transaction that deposits the native coins to pay the proposal fee. Anyone can create this transaction. Depending on the repository's proposal fee configuration, the proposal fee may be returned after the proposal is finalized.

Parameters

  1. 1.
    txObject - Object: The transaction object
    • id - String: A target proposal ID that will receive the deposit.
    • name - String : The unique name of the repository.
    • value - String: The amount to deposit as proposal fee.
    • nonce - Number|String : The signing account’s next nonce.
    • fee - String: The network fee to be paid by the signing account.
    • timestamp - String: (optional) The unix timestamp of the transaction.
    • sig - String : (optional) The transaction signature. If not provided, the transaction will be signed using the signingKey.
  2. 2.
    signingKey - String: (optional) The private key to use to sign the transaction.
  3. 3.
    payloadOnly - Boolean: (optional) When true, the transaction payload is returned instead of being sent to the network.

Returns

Object - The result object
  • hash - String: A 32 bytes transaction hash.

Example

  • Create a transaction that will deposit 50 coins to a proposal with ID = 1.
1
repo.depositPropFee({
2
id: "1",
3
name: "myrepo",
4
fee: "1",
5
value: "50",
6
}, user.getKey(accounts[0],"marvel"))
Copied!

addContributor

1
repo.addContributor(txObject, [signingKey | payloadOnly | [signingKey, payloadOnly]])
Copied!
Creates a proposal that adds contributors to a repository.

Parameters

  1. 1.
    txObject - Object: The transaction object
    • id - String: A unique, numeric proposal ID. Must not exceed 16 characters.
    • name - String : The unique name of the repository.
    • value - String: (optional) The proposal deposit fee, if required.
    • keys - Array<String>: A list of push keys to add as contributors
    • policies - Array<[ContributorPolicy](#)>: A list of access policies to apply to the contributors.
      • feeMode - Number: The fee mode determines who pays the fees whenever a contributor performs a push operation. There are 3 fee mode options:
        • 0: Contributor pays for their fees.
        • 1: Repository pays for contributors fees.
        • 2: Repository pays a capped amount of contributors fees.
    • feeCap - Number: The maximum amount of fees payable by the repository if feeMode is 2.
    • namespace - String: Adds the push keys as namespace-level contributors. Note: The repository must own the namespace.
    • namespaceOnly - String: Adds the push keys only as namespace-level contributors. They will not be added as contributors to the repository itself. Note: The repository must own the namespace.
    • nonce - Number|String : The signing account’s next nonce.
    • fee - String: The network fee to be paid by the signing account.
    • timestamp - String: (optional) The unix timestamp of the transaction.
    • sig - String : (optional) The transaction signature. If not provided, the transaction will be signed using the signingKey.
  2. 2.
    signingKey - String: (optional) The private key to use to sign the transaction.
  3. 3.
    payloadOnly - Boolean: (optional) When true, the transaction payload is returned instead of being sent to the network.

Returns

Object - The result object
  • hash - String: A 32 bytes transaction hash.

Example

1
repo.addContributor({
2
id: "1",
3
name: "myrepo",
4
keys: ["pk1wfx7vp8qfyv98cctvamqwec5xjrj48tpkfwme7"],
5
fee: "1"
6
}, user.getKey(accounts[0]))
Copied!

track

1
repo.track(names, [height])
Copied!
Track one or more repositories. If a repository is added to the tracklist, only the repository's push updates will be synchronized and stored on the node. You can track as many repositories as you want.

Parameters

  1. 1.
    names - String: A comma separated list of repository names.
  2. 2.
    height - String|Number: (Optional) The block height to begin synchronization from.

Examples

  • Track a repo named my_repo.
1
repo.track('my_repo')
Copied!
  • Track repositories named my_repo and someones_repo
1
repo.track('my_repo,someones_repo')
Copied!

untrack

1
repo.untrack(names)
Copied!
Untrack one or more repositories.

Parameters

  1. 1.
    names - String: A comma-separated list of repository names.

Examples

  • Untrack a repo named my_repo.
1
repo.untrack('my_repo')
Copied!
  • Untrack repositories named my_repo and someones_repo.
1
repo.untrack('my_repo,someones_repo')
Copied!

tracked

1
repo.tracked()
Copied!
Get all tracked repositories.

Returns

Object - The result object
1
interface Result {
2
[repoName: String]: {updatedAt: String}
3
}
Copied!

Example

JavaScript
Output
1
repo.tracked()
Copied!
1
{
2
"my-repo": {
3
"updatedAt": "1005"
4
}
5
}
Copied!