Skip to content

v14.0.0

Latest
Compare
Choose a tag to compare
@ChiaMineJP ChiaMineJP released this 10 Mar 18:10
0b196aa

Compatibility

This code is compatible with:

Breaking change

  • When RPC API responds with success: false, its Promise now does reject. (Previously it does resolve)
  • At chia-blockchain@2.2.1, in chia/consensus/cost_calculator.py,
    NPCResult.cost was removed.
    As a result, the RPC APIs below might be incompatible between 2.1.4 and 2.2.1.
    • get_all_mempool_items Of FullNode RPC API
    • get_mempool_item_by_tx_id Of FullNode RPC API

Changed

  • Loosened a type of agent to call RPC APIs. RPC APIs can be invoked with agent which just implements
    sendMessage method depicted as below.
export interface APIAgent {
  sendMessage<M extends unknown>(
          destination: string,
          command: string,
          data?: Record<string, unknown>,
  ): Promise<M>;
}

Added

  • Added connectivity options for RPCAgent.
    • keepAlive (default: true)
    • keepAliveMsecs (default: 1000)
    • maxSockets (default: Infinity)
    • timeout (default: undefined)
// Usage
const {RPCAgent} = require("chia-agent");
const {get_plots} = require("chia-agent/api/rpc");

const agent = new RPCAgent({
  service: "harvester",
  keepAlive: true,
  keepAliveMsecs: 3000,
  maxSockets: 1, // Avoid to set `1` if your requests may be sent in parallel.
  timeout: 5000,
});
const res = await get_plots(agent);
  • Added httpsAgent, httpAgent option for RPCAgent.
    You can now configure and inject your own require('https').Agent into RPCAgent.
// Usage
const {Agent: HttpsAgent} = require("https"); // or const {Agent: HttpAgent} = require('http');
const {RPCAgent} = require("chia-agent");
const {get_plots} = require("chia-agent/api/rpc");

const httpsAgent = new HttpsAgent({
  host: "localhost",
  port: 8560,
  ca: ...,
  cert: ...,
  key: ...,
  rejectUnauthorized: false,
});
const agent = new RPCAgent({httpsAgent: httpsAgent}); // `new RPCAgent({httpAgent: httpAgent});` is also allowed.
const res = await get_plots(agent);

Fixed

  • Fixed an issue where some of the RPC Pool APIs did not handle request parameters correctly.
  • Added missing attribute peak_height to NewSignagePoint