rpc: revert deprecated subscriptions API changes

Revert deprecated subscriptions-related method signature changed in
673a495527, 8e84bb51d5
and d7c1f3eac7.
This commit is contained in:
Anna Shaleva 2022-10-26 13:22:12 +03:00
parent f5441f6085
commit 4fc11c2924

View file

@ -636,15 +636,14 @@ func (c *WSClient) performUnsubscription(id string) error {
} }
// SubscribeForNewBlocks adds subscription for new block events to this instance // SubscribeForNewBlocks adds subscription for new block events to this instance
// of the client. It can be filtered by primary consensus node index and/or block // of the client. It can be filtered by primary consensus node index, nil value doesn't
// index allowing to receive blocks since/till the specified index only, nil value // add any filters.
// is treated as missing filter.
// //
// Deprecated: please, use ReceiveBlocks. This method will be removed in future versions. // Deprecated: please, use ReceiveBlocks. This method will be removed in future versions.
func (c *WSClient) SubscribeForNewBlocks(primary *int, sinceIndex, tillIndex *uint32) (string, error) { func (c *WSClient) SubscribeForNewBlocks(primary *int) (string, error) {
var flt *neorpc.BlockFilter var flt *neorpc.BlockFilter
if primary != nil || sinceIndex != nil || tillIndex != nil { if primary != nil {
flt = &neorpc.BlockFilter{Primary: primary, Since: sinceIndex, Till: tillIndex} flt = &neorpc.BlockFilter{Primary: primary}
} }
params := []interface{}{"block_added"} params := []interface{}{"block_added"}
if flt != nil { if flt != nil {
@ -775,14 +774,13 @@ func (c *WSClient) ReceiveExecutionNotifications(flt *neorpc.NotificationFilter,
// SubscribeForTransactionExecutions adds subscription for application execution // SubscribeForTransactionExecutions adds subscription for application execution
// results generated during transaction execution to this instance of the client. It can // results generated during transaction execution to this instance of the client. It can
// be filtered by state (HALT/FAULT) to check for successful or failing // be filtered by state (HALT/FAULT) to check for successful or failing
// transactions; it can also be filtered by script container hash. // transactions, nil value means no filtering.
// nil value means no filtering.
// //
// Deprecated: please, use ReceiveExecutions. This method will be removed in future versions. // Deprecated: please, use ReceiveExecutions. This method will be removed in future versions.
func (c *WSClient) SubscribeForTransactionExecutions(vmState *string, container *util.Uint256) (string, error) { func (c *WSClient) SubscribeForTransactionExecutions(state *string) (string, error) {
var flt *neorpc.ExecutionFilter var flt *neorpc.ExecutionFilter
if vmState != nil || container != nil { if state != nil {
flt = &neorpc.ExecutionFilter{State: vmState, Container: container} flt = &neorpc.ExecutionFilter{State: state}
} }
params := []interface{}{"transaction_executed"} params := []interface{}{"transaction_executed"}
if flt != nil { if flt != nil {