RPC: move deprecated methods into a dedicated file

This commit is contained in:
Slavomir 2021-06-30 14:17:04 +02:00
parent efad3e9472
commit 7b5326e463
2 changed files with 53 additions and 32 deletions

View File

@ -87,18 +87,6 @@ func (c *Client) GetSlot(ctx context.Context, commitment CommitmentType) (out Ge
return
}
// GetConfirmedBlock returns identity and transaction information about a confirmed block in the ledger.
// NOTE: DEPRECATED
func (c *Client) GetConfirmedBlock(ctx context.Context, slot uint64, encoding string) (out *GetConfirmedBlockResult, err error) {
if encoding == "" {
encoding = "json"
}
params := []interface{}{slot, encoding}
err = c.rpcClient.CallFor(&out, "getConfirmedBlock", params...)
return
}
// GetAccountInfo returns all information associated with the account of provided publicKey.
func (c *Client) GetAccountInfo(ctx context.Context, account solana.PublicKey) (out *GetAccountInfoResult, err error) {
obj := map[string]interface{}{
@ -128,26 +116,6 @@ func (c *Client) GetAccountDataIn(ctx context.Context, account solana.PublicKey,
return bin.NewDecoder(resp.Value.Data).Decode(inVar)
}
// GetConfirmedTransaction returns transaction details for a confirmed transaction.
// NOTE: DEPRECATED
func (c *Client) GetConfirmedTransaction(ctx context.Context, signature string) (out TransactionWithMeta, err error) {
params := []interface{}{signature, "json"}
err = c.rpcClient.CallFor(&out, "getConfirmedTransaction", params...)
return
}
// GetConfirmedSignaturesForAddress2 returns confirmed signatures for transactions involving an
// address backwards in time from the provided signature or most recent confirmed block.
// NOTE: DEPRECATED
func (c *Client) GetConfirmedSignaturesForAddress2(ctx context.Context, address solana.PublicKey, opts *GetConfirmedSignaturesForAddress2Opts) (out GetConfirmedSignaturesForAddress2Result, err error) {
params := []interface{}{address.String(), opts}
err = c.rpcClient.CallFor(&out, "getConfirmedSignaturesForAddress2", params...)
return
}
// GetProgramAccounts returns all accounts owned by the provided program publicKey.
func (c *Client) GetProgramAccounts(ctx context.Context, publicKey solana.PublicKey, opts *GetProgramAccountsOpts) (out GetProgramAccountsResult, err error) {
obj := map[string]interface{}{

53
rpc/deprecated.go Normal file
View File

@ -0,0 +1,53 @@
// Copyright 2020 dfuse Platform Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rpc
import (
"context"
"github.com/dfuse-io/solana-go"
)
// GetConfirmedBlock returns identity and transaction information about a confirmed block in the ledger.
// NOTE: DEPRECATED
func (c *Client) GetConfirmedBlock(ctx context.Context, slot uint64, encoding string) (out *GetConfirmedBlockResult, err error) {
if encoding == "" {
encoding = "json"
}
params := []interface{}{slot, encoding}
err = c.rpcClient.CallFor(&out, "getConfirmedBlock", params...)
return
}
// GetConfirmedTransaction returns transaction details for a confirmed transaction.
// NOTE: DEPRECATED
func (c *Client) GetConfirmedTransaction(ctx context.Context, signature string) (out TransactionWithMeta, err error) {
params := []interface{}{signature, "json"}
err = c.rpcClient.CallFor(&out, "getConfirmedTransaction", params...)
return
}
// GetConfirmedSignaturesForAddress2 returns confirmed signatures for transactions involving an
// address backwards in time from the provided signature or most recent confirmed block.
// NOTE: DEPRECATED
func (c *Client) GetConfirmedSignaturesForAddress2(ctx context.Context, address solana.PublicKey, opts *GetConfirmedSignaturesForAddress2Opts) (out GetConfirmedSignaturesForAddress2Result, err error) {
params := []interface{}{address.String(), opts}
err = c.rpcClient.CallFor(&out, "getConfirmedSignaturesForAddress2", params...)
return
}