MCPcopy
hub / github.com/canopy-network/canopy / keystoreGetKey

Function keystoreGetKey

plugin/go/tutorial/rpc_test.go:219–233  ·  view source on GitHub ↗

keystoreGetKey gets the key info from the keystore using raw JSON

(rpcURL, address, password string)

Source from the content-addressed store, hash-verified

217
218// keystoreGetKey gets the key info from the keystore using raw JSON
219func keystoreGetKey(rpcURL, address, password string) (*keyGroup, error) {
220 reqJSON := fmt.Sprintf(`{"address":"%s","password":"%s"}`, address, password)
221
222 respBody, err := postRawJSON(rpcURL+"/v1/admin/keystore-get", reqJSON)
223 if err != nil {
224 return nil, err
225 }
226
227 var kg keyGroup
228 if err := json.Unmarshal(respBody, &kg); err != nil {
229 return nil, fmt.Errorf("failed to parse response: %v, body: %s", err, string(respBody))
230 }
231
232 return &kg, nil
233}
234
235// getHeight gets the current blockchain height using raw JSON
236func getHeight(rpcURL string) (uint64, error) {

Callers 1

TestPluginTransactionsFunction · 0.70

Calls 3

postRawJSONFunction · 0.70
UnmarshalMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected