MCPcopy Create free account
hub / github.com/chain/Core / configAPI

Function configAPI

sdk/node/src/api/config.js:96–145  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

94 * @module ConfigApi
95 */
96const configAPI = (client) => {
97 return {
98 /**
99 * Reset specified Chain Core.
100 *
101 * @param {Boolean} everything - If `true`, all objects including access tokens and
102 * MockHSM keys will be deleted. If `false`, then access tokens
103 * and MockHSM keys will be preserved.
104 * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
105 * @returns {Promise} Promise resolved on success.
106 */
107 reset: (everything = false, cb) => shared.tryCallback(
108 client.request('/reset', {everything: everything}),
109 cb
110 ),
111
112 /**
113 * Configure specified Chain Core.
114 *
115 * @param {Object} opts - options for configuring Chain Core.
116 * @param {Boolean} opts.isGenerator - Whether the local core will be a block generator
117 * for the blockchain; i.e., you are starting a new blockchain on
118 * the local core. `false` if you are connecting to a
119 * pre-existing blockchain.
120 * @param {String} opts.generatorUrl - A URL for the block generator. Required if
121 * `isGenerator` is false.
122 * @param {String} opts.generatorAccessToken - An access token provided by administrators
123 * of the block generator. Required if `isGenerator` is false.
124 * @param {String} opts.blockchainId - The unique ID of the generator's blockchain.
125 * Required if `isGenerator` is false.
126 * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
127 * @returns {Promise} Promise resolved on success.
128 */
129 configure: (opts = {}, cb) => shared.tryCallback(
130 client.request('/configure', opts),
131 cb
132 ),
133
134 /**
135 * Get info on specified Chain Core.
136 *
137 * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired.
138 * @returns {Promise<CoreInfo>} Requested info of specified Chain Core.
139 */
140 info: (cb) => shared.tryCallback(
141 client.request('/info'),
142 cb
143 ),
144 }
145}
146
147module.exports = configAPI

Callers 1

constructorMethod · 0.85

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected