• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bmresearch / Solnet / 10672350157

02 Sep 2024 07:46PM UTC coverage: 77.453% (+0.2%) from 77.239%
10672350157

push

github

BifrostTitan
Agave v2.0 Migration

Updated the RPC client and removed deprecated code from the SDK.
Cleaned up all the warnings across the solution and added a few sys-vars that were missing.
Generate Seed in Mnemonic class now uses System.Security.Cryptography instead of bouncy castle sdk

1111 of 1682 branches covered (66.05%)

Branch coverage included in aggregate %.

6 of 10 new or added lines in 6 files covered. (60.0%)

18 existing lines in 4 files now uncovered.

5117 of 6359 relevant lines covered (80.47%)

1328281.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Solnet.Extensions/TokenWalletRpcProxy.cs
1
using Solnet.Rpc;
2
using Solnet.Rpc.Core.Http;
3
using Solnet.Rpc.Messages;
4
using Solnet.Rpc.Models;
5
using Solnet.Rpc.Types;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Text;
10
using System.Threading.Tasks;
11

12
namespace Solnet.Extensions
13
{
14
    /// <summary>
15
    /// An internal RPC proxy that has everything required by TokenWallet.
16
    /// </summary>
17
    internal class TokenWalletRpcProxy : ITokenWalletRpcProxy
18
    {
19

20
        /// <summary>
21
        /// The RPC client to use.
22
        /// </summary>
23
        private IRpcClient _client;
24

25
        /// <summary>
26
        /// Constructs an instance of the TokenWalletRpcProxy.
27
        /// </summary>
28
        /// <param name="client"></param>
29
        internal TokenWalletRpcProxy(IRpcClient client)
×
30
        {
31
            _client = client ?? throw new ArgumentNullException(nameof(client));
×
32
        }
×
33

34
        /// <summary>
35
        /// Gets the balance <b>asynchronously</b> for a certain public key.
36
        /// <remarks>
37
        /// The <c>commitment</c> parameter is optional, the default value <see cref="Commitment.Finalized"/> is not sent.
38
        /// </remarks>
39
        /// </summary>
40
        /// <param name="pubKey">The public key.</param>
41
        /// <param name="commitment">The state commitment to consider when querying the ledger state.</param>
42
        /// <returns>A task which may return a request result holding the context and address balance.</returns>
43
        public async Task<RequestResult<ResponseValue<ulong>>> GetBalanceAsync(string pubKey, Commitment commitment = Commitment.Finalized)
44
        {
45
            return await _client.GetBalanceAsync(pubKey, commitment);
×
46
        }
×
47

48
        /// <summary>
49
        /// Gets a recent block hash.
50
        /// </summary>
51
        /// <param name="commitment">The state commitment to consider when querying the ledger state.</param>
52
        /// <returns>Returns a task that holds the asynchronous operation result and state.</returns>
53
        public async Task<RequestResult<ResponseValue<LatestBlockHash>>> GetLatestBlockHashAsync(Commitment commitment = Commitment.Finalized)
54
        {
NEW
55
            return await _client.GetLatestBlockHashAsync(commitment);
×
56
        }
×
57

58
        /// <summary>
59
        /// Gets all SPL Token accounts by token owner.
60
        /// </summary>
61
        /// <param name="ownerPubKey">Public key of account owner query, as base-58 encoded string.</param>
62
        /// <param name="tokenMintPubKey">Public key of the specific token Mint to limit accounts to, as base-58 encoded string.</param>
63
        /// <param name="tokenProgramId">Public key of the Token program ID that owns the accounts, as base-58 encoded string.</param>
64
        /// <param name="commitment">The state commitment to consider when querying the ledger state.</param>
65
        /// <returns>Returns a task that holds the asynchronous operation result and state.</returns>
66
        public async Task<RequestResult<ResponseValue<List<TokenAccount>>>> GetTokenAccountsByOwnerAsync(string ownerPubKey, string tokenMintPubKey = null, string tokenProgramId = null, Commitment commitment = Commitment.Finalized)
67
        {
68
            return await _client.GetTokenAccountsByOwnerAsync(ownerPubKey, tokenMintPubKey, tokenProgramId, commitment);
×
69
        }
×
70

71
        /// <summary>
72
        /// Sends a transaction.
73
        /// </summary>
74
        /// <param name="transaction">The signed transaction as byte array.</param>
75
        /// <param name="skipPreflight">If true skip the prflight transaction checks (default false).</param>
76
        /// <param name="commitment">The block commitment used to retrieve block hashes and verify success.</param>
77
        /// <returns>Returns an object that wraps the result along with possible errors with the request.</returns>
78
        public async Task<RequestResult<string>> SendTransactionAsync(byte[] transaction, bool skipPreflight = false, Commitment commitment = Commitment.Finalized)
79
        {
80
            return await _client.SendTransactionAsync(transaction, skipPreflight, commitment);
×
81
        }
×
82
    }
83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc