-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use environment to find home * is_running * dep updates * dep updates and lint * add data layer, AddMissingFiles, BatchUpdate * CreateDataStore * GetBlockSpends * get_fee_estimate * comment * new properties * PushTransactions * GetCoinRecordsByNames * GetSpendableCoins * NFTInfo fix (#76) * NFTInfo fix * Adding Id parameter and fix Infos for GetOfferSummary --------- Co-authored-by: Enache Dragos <[email protected]> * remove RLWallet add DL * update from main (#89) * Bump YamlDotNet from 11.2.1 to 12.3.1 in /src/chia-dotnet (#65) Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 11.2.1 to 12.3.1. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](aaubry/YamlDotNet@v11.2.1...v12.3.1) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump Newtonsoft.Json from 13.0.1 to 13.0.2 in /src/chia-dotnet (#60) Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2. - [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases) - [Commits](JamesNK/Newtonsoft.Json@13.0.1...13.0.2) --- updated-dependencies: - dependency-name: Newtonsoft.Json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update README.md (#77) * Bump YamlDotNet from 12.3.1 to 13.1.1 in /src/chia-dotnet (#79) Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 12.3.1 to 13.1.1. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](aaubry/YamlDotNet@v12.3.1...v13.1.1) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * remove rate limited wallet types and methods (#81) * Update dependabot.yml (#82) * Update codeql-analysis.yml to v2 * Update README.md (#84) * Ignore jetbrains .idea folder https://rider-support.jetbrains.com/hc/en-us/articles/207097529-What-is-the-idea-folder- (#85) Co-authored-by: kev <kev@darkhorse> * added initial get-block-spends (#83) * added initial get-block-spends * Recommended PR changes --------- Co-authored-by: kev <kev@darkhorse> Co-authored-by: Don Kackman <[email protected]> * Dto (#86) * up through Mirror * first pass done * Remove blockspend.cs and use existing model CoinSpend (#87) Co-authored-by: kev <kev@darkhorse> * Key management (#88) * get_key * get_keys * set_label * delete_label --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: KevinOnFrontEnd <[email protected]> Co-authored-by: kev <kev@darkhorse> * remove duplicated GetBlockSpends * add new includePending * missing param --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Blackcode <[email protected]> Co-authored-by: Enache Dragos <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: KevinOnFrontEnd <[email protected]> Co-authored-by: kev <kev@darkhorse>
- Loading branch information
1 parent
56e1dd4
commit 9c5ba0d
Showing
16 changed files
with
354 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace chia.dotnet.tests | ||
{ | ||
[TestClass] | ||
[TestCategory("Integration")] | ||
public class DataLayerProxyTest | ||
{ | ||
private static DataLayerProxy _theDataLayer; | ||
|
||
[ClassInitialize] | ||
public static async Task Initialize(TestContext context) | ||
{ | ||
using var cts = new CancellationTokenSource(2000); | ||
var rpcClient = Factory.CreateWebsocketClient(); | ||
await rpcClient.Connect(cts.Token); | ||
|
||
var daemon = new DaemonProxy(rpcClient, "unit_tests"); | ||
await daemon.RegisterService(cts.Token); | ||
|
||
_theDataLayer = new DataLayerProxy(rpcClient, "unit_tests"); | ||
} | ||
|
||
[ClassCleanup()] | ||
public static void ClassCleanup() | ||
{ | ||
_theDataLayer.RpcClient?.Dispose(); | ||
} | ||
|
||
[TestMethod()] | ||
[TestCategory("CAUTION")] | ||
public async Task CreateDataStore() | ||
{ | ||
using var cts = new CancellationTokenSource(150000); | ||
|
||
var result = await _theDataLayer.CreateDataStore(5, cts.Token); | ||
|
||
Assert.IsNotNull(result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Dynamic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace chia.dotnet | ||
{ | ||
/// <summary> | ||
/// Proxy that communicates with the Data Layer | ||
/// </summary> | ||
public sealed class DataLayerProxy : ServiceProxy | ||
{ | ||
/// <summary> | ||
/// ctor | ||
/// </summary> | ||
/// <param name="rpcClient"><see cref="IRpcClient"/> instance to use for rpc communication</param> | ||
/// <param name="originService"><see cref="Message.Origin"/></param> | ||
public DataLayerProxy(IRpcClient rpcClient, string originService) | ||
: base(rpcClient, ServiceNames.DataLayer, originService) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Adds missing files | ||
/// </summary> | ||
/// <param name="ids">List of file id's</param> | ||
/// <param name="foldername">The folder name</param> | ||
/// <param name="overwrite">Indicator whetehr to overwrite files</param> | ||
/// <param name="cancellationToken">A token to allow the call to be cancelled</param> | ||
/// <returns>An awaitable Task</returns> | ||
public async Task AddMissingFiles(string[] ids, string foldername, bool overwrite = false, CancellationToken cancellationToken = default) | ||
{ | ||
if (string.IsNullOrEmpty(foldername)) | ||
{ | ||
throw new ArgumentNullException(nameof(foldername)); | ||
} | ||
dynamic data = new ExpandoObject(); | ||
data.ids = ids; | ||
data.foldername = foldername; | ||
data.overwrite = overwrite; | ||
|
||
await SendMessage("get_peer_counts", "data", cancellationToken).ConfigureAwait(false); | ||
} | ||
|
||
/// <summary> | ||
/// Applies a batch of updates. | ||
/// </summary> | ||
/// <param name="id">Id</param> | ||
/// <param name="changeList">Name value pairs of changes</param> | ||
/// <param name="cancellationToken">A token to allow the call to be cancelled</param> | ||
/// <returns>Transaction id</returns> | ||
public async Task<string> BatchUpdate(string id, IDictionary<string, string> changeList, CancellationToken cancellationToken = default) | ||
{ | ||
if (string.IsNullOrEmpty(id)) | ||
{ | ||
throw new ArgumentNullException(nameof(id)); | ||
} | ||
|
||
dynamic data = new ExpandoObject(); | ||
data.id = id; | ||
data.changelist = changeList; | ||
|
||
var response = await SendMessage("batch_update", data, cancellationToken).ConfigureAwait(false); | ||
|
||
return response.tx_id; | ||
} | ||
|
||
/// <summary> | ||
/// Creates a data store. | ||
/// </summary> | ||
/// <param name="fee">Fee amount (in units of mojos)</param> | ||
/// <param name="cancellationToken">A token to allow the call to be cancelled</param> | ||
/// <returns>The tree id and list of transactions</returns> | ||
public async Task<(string id, IEnumerable<TransactionRecord> txs)> CreateDataStore(ulong fee, CancellationToken cancellationToken = default) | ||
{ | ||
dynamic data = new ExpandoObject(); | ||
data.fee = fee; | ||
|
||
var response = await SendMessage("create_data_store", data, cancellationToken).ConfigureAwait(false); | ||
|
||
return ( | ||
response.id, | ||
response.txs | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.