Compatibility
This code is compatible with:
b98219687331fc6c8121d0c0243a49d2427ccd60
of chia-blockchain 2.2.1fc641b915d95ca00f33c268f820cee196c61ca65
of pool-reference
Breaking change
- When RPC API responds with
success: false
, itsPromise
now doesreject
. (Previously it doesresolve
) - 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 between2.1.4
and2.2.1
.get_all_mempool_items
Of FullNode RPC APIget_mempool_item_by_tx_id
Of FullNode RPC API
Changed
- Loosened a type of
agent
to call RPC APIs. RPC APIs can be invoked withagent
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>;
}
sp_source_data
was added toNewSignagePoint
As a result the following API responses were affectedinclude_signature_source_data
was added toDeclareProofOfSpace
As a result the following API responses were affectedfoliage_block_data
,foliage_transaction_block_data
andrc_block_unfinished
were added toRequestSignedValues
eligible_for_fast_forward
was added toBundleCoinSpend
CHIP_0002_P2_DELEGATED_CONDITIONS
was added toSigningMode
As a result the following API responses were affected- Wallet RPC API
get_notifications
- The types of request parameters were slightly changed
ids
are nowbytes32[]
(previouslystr[]
)start
are nowuint32
(previouslyint[]
)end
are nowuint32
(previouslyint[]
)
- The types of response parameters were slightly changed
id
are nowbytes32
(previouslystr
)message
are nowbytes
(previouslystr
)
- The types of request parameters were slightly changed
get_offer_summary
- The following properties were added to the response parameters
additions: str[]
removals: str[]
- The following properties were added to the response parameters
nft_get_info
- The following properties were removed from the response parameters
ignore_size_limit
- The following properties were removed from the response parameters
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 forRPCAgent
.
You can now configure and inject your ownrequire('https').Agent
intoRPCAgent
.
// 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
toNewSignagePoint