feat: add support for getGenesisHash RPC (#19732)

This commit is contained in:
Justin Starry
2021-09-09 13:34:43 -04:00
committed by GitHub
parent df5befdaca
commit 0b64bf5585
2 changed files with 23 additions and 0 deletions

View File

@@ -2963,6 +2963,18 @@ export class Connection {
return res.result;
}
/**
* Fetch the genesis hash
*/
async getGenesisHash(): Promise<string> {
const unsafeRes = await this._rpcRequest('getGenesisHash', []);
const res = create(unsafeRes, jsonRpcResult(string()));
if ('error' in res) {
throw new Error('failed to get genesis hash: ' + res.error.message);
}
return res.result;
}
/**
* Fetch a processed block from the cluster.
*/