Skip to content

Commit

Permalink
feat: add addkey
Browse files Browse the repository at this point in the history
  • Loading branch information
gridcat committed Jul 7, 2021
1 parent 8834777 commit 51f95ae
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/RPC/Developer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AuditSnapshot, AuditSnapshotAccurals, AuditSnapshotDetailed } from '../contracts/auditSnapshot';
import { Contract } from '../contracts/transaction';
import { RPCBase } from '../RPCBase';
import { CPID } from '../types';
import { CPID, TX } from '../types';

export class Developer extends RPCBase {
public async auditSnapshotAccrual(cpid: CPID, detailed: false): Promise<AuditSnapshot>;
Expand Down Expand Up @@ -29,4 +30,38 @@ export class Developer extends RPCBase {
public async auditSnapshotAccruals(mismatchedOnly?: boolean): Promise<AuditSnapshotAccurals> {
return this.call('auditsnapshotaccruals', mismatchedOnly);
}

/**
* Send a transaction that contains an administrative contract.
* @description
* Before invoking this command, import the master key used to sign and verify
* transactions that contain administrative contracts. The label is optional:
* importprivkey <private_key_hex> master
* Send some coins to the master key address if necessary:
* sendtoaddress <address> <amount>
* To whitelist a project:
* addkey add project projectname url
* To de-whitelist a project:
* addkey delete project projectname 1
* Key examples:
* addkey add project milkyway@home http://milkyway.cs.rpi.edu/milkyway/@
* addkey delete project milkyway@home 1
* GRC will only memorize the *last* value it finds for a key in the highest block.
* @todo: check return values as I am guessing here
*
* @param {('add' | 'delete')} action
* @param {string} keyType
* @param {string} keyName
* @param {(string | number | boolean)} keyValue
* @returns {Promise<{ contract: Contract, txid: TX }>}
* @memberof Developer
*/
public async addKey(
action: 'add' | 'delete',
keyType: string,
keyName: string,
keyValue: string | number | boolean,
): Promise<{ contract: Contract, txid: TX }> {
return this.call('addkey', action, keyType, keyName, keyValue);
}
}

0 comments on commit 51f95ae

Please sign in to comment.