Table of Contents

Class DataLayerProxy

Namespace
chia.dotnet
Assembly
chia-dotnet.dll

Proxy that communicates with the Data Layer

public sealed class DataLayerProxy : ServiceProxy, IServiceProxy
Inheritance
DataLayerProxy
Implements
Inherited Members
Extension Methods

Remarks

ctor

Constructors

DataLayerProxy(IRpcClient, string)

Proxy that communicates with the Data Layer

public DataLayerProxy(IRpcClient rpcClient, string originService)

Parameters

rpcClient IRpcClient

IRpcClient instance to use for rpc communication

originService string

Origin

Remarks

ctor

Methods

AddMirror(string, ulong, IEnumerable<string>, ulong, CancellationToken)

Adds a mirror

public Task AddMirror(string id, ulong amount, IEnumerable<string> urls, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

id string

Mirror id

amount ulong

The Amount

urls IEnumerable<string>

List of mirror urls

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable Task

AddMissingFiles(string[], string, bool, CancellationToken)

Adds missing files

public Task AddMissingFiles(string[] ids, string foldername, bool overwrite = false, CancellationToken cancellationToken = default)

Parameters

ids string[]

List of file id's

foldername string

The folder name

overwrite bool

Indicator whether to overwrite files

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable Task

BatchUpdate(string, IDictionary<string, string>, bool, ulong, CancellationToken)

Applies a batch of updates.

public Task<string> BatchUpdate(string id, IDictionary<string, string> changeList, bool submitOnChain = true, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

id string

Id

changeList IDictionary<string, string>

Name value pairs of changes

submitOnChain bool

Indicates to submit the updates on the blockchain

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

Transaction id

CancelOffer(string, bool, ulong, CancellationToken)

Cancels an offer using a transaction

public Task CancelOffer(string tradeId, bool secure = false, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

tradeId string

The trade id of the offer

secure bool

This will create a transaction that includes coins that were offered

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable Task

CheckPlugins(CancellationToken)

Checks the status of plugins.

public Task<PluginStatus> CheckPlugins(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken
Proxy that communicates with the Data Layer

Returns

Task<PluginStatus>

PluginStatus

ClearPendingRoots(string, CancellationToken)

Clears pending roots.

public Task<Root> ClearPendingRoots(string storeId, CancellationToken cancellationToken = default)

Parameters

storeId string
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<Root>

Root

CreateDataStore(ulong, CancellationToken)

Creates a data store.

public Task<(string id, IEnumerable<TransactionRecord> txs)> CreateDataStore(ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<(string id, IEnumerable<TransactionRecord> txs)>

The tree id and list of transactions

DeleteKey(string, string, ulong, CancellationToken)

Deletes a data store.

public Task<string> DeleteKey(string key, string id, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

key string

Row key

id string

Row id

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

Transaction id

DeleteMirror(string, ulong, CancellationToken)

Deletes a mirror.

public Task DeleteMirror(string coinId, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

coinId string

Mirror coin id

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

GetAncestors(string, string, CancellationToken)

Gets the list of ancestors for a given id/hash pair.

public Task<IEnumerable<InternalNode>> GetAncestors(string id, string hash, CancellationToken cancellationToken = default)

Parameters

id string

Id

hash string

Hash

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<InternalNode>>

GetKVDiff(string, string, string, int, int, CancellationToken)

Get the keys and values for a given id/root_hash pair.

public Task<(KVDiff diff, int totalPages, int totalBytes)> GetKVDiff(string id, string hash1, string hash2, int page = 1, int maxPageSize = 41943040, CancellationToken cancellationToken = default)

Parameters

id string

Store id

hash1 string

First Hash

hash2 string

Second Hash

page int

The page to get

maxPageSize int

The max size of each page

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<(KVDiff diff, int totalPages, int totalBytes)>

The list of keys and paging information

GetKVDiff(string, string, string, CancellationToken)

Get kv diff between two root hashes.

public Task<KVDiff> GetKVDiff(string id, string hash1, string hash2, CancellationToken cancellationToken = default)

Parameters

id string

Id

hash1 string

First Hash

hash2 string

Second Hash

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<KVDiff>

KVDiff

GetKeys(string, string?, int, int, CancellationToken)

Gets the list of keys for a given id/hash pair.

public Task<(IEnumerable<string> keys, int totalPages, int totalBytes, string rootHash)> GetKeys(string id, string? rootHash, int page = 1, int maxPageSize = 41943040, CancellationToken cancellationToken = default)

Parameters

id string

Store id

rootHash string

Root Hash

page int

The page to get

maxPageSize int

The max size of each page

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<(IEnumerable<string> keys, int totalPages, int totalBytes, string rootHash)>

The list of keys and paging information

GetKeys(string, string?, CancellationToken)

Gets the list of keys for a given id/hash pair.

public Task<IEnumerable<string>> GetKeys(string id, string? rootHash, CancellationToken cancellationToken = default)

Parameters

id string

Store id

rootHash string

Root Hash

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<string>>

The list of keys

GetKeysValues(string, string?, int, int, CancellationToken)

Get the keys and values for a given id/root_hash pair.

public Task<(IEnumerable<TerminalNode> keys, int totalPages, int totalBytes, string rootHash)> GetKeysValues(string id, string? rootHash, int page = 1, int maxPageSize = 41943040, CancellationToken cancellationToken = default)

Parameters

id string

Store id

rootHash string

Root Hash

page int

The page to get

maxPageSize int

The max size of each page

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<(IEnumerable<TerminalNode> keys, int totalPages, int totalBytes, string rootHash)>

The list of keys and paging information

GetKeysValues(string, string, CancellationToken)

Get the keys and values for a given id/root_hash pair.

public Task<IEnumerable<TerminalNode>> GetKeysValues(string id, string rootHash, CancellationToken cancellationToken = default)

Parameters

id string

Id

rootHash string

Root Hash

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<TerminalNode>>

GetLocalRoot(string, CancellationToken)

Gets hash of latest tree root saved in our local datastore.

public Task<KVDiff> GetLocalRoot(string id, CancellationToken cancellationToken = default)

Parameters

id string

Id

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<KVDiff>

A hash

GetMirrors(string, CancellationToken)

Gets the mirrors for a given store id.

public Task<IEnumerable<Mirror>> GetMirrors(string id, CancellationToken cancellationToken = default)

Parameters

id string

Store Id

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<Mirror>>

A list of Mirror

GetOwnedStores(CancellationToken)

Gets the list of owned store ids.

public Task<IEnumerable<string>> GetOwnedStores(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<string>>

A list of Mirror

GetProof(string, IEnumerable<string>, CancellationToken)

Retrieves a proof.

public Task<DLProof> GetProof(string storeId, IEnumerable<string> keys, CancellationToken cancellationToken = default)

Parameters

storeId string
keys IEnumerable<string>
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<DLProof>

DLProof

GetRoot(string, CancellationToken)

Gets hash of latest tree root.

public Task<RootHash> GetRoot(string id, CancellationToken cancellationToken = default)

Parameters

id string
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<RootHash>

A Root

GetRootHistory(string, CancellationToken)

Get history of state hashes for a store.

public Task<IEnumerable<RootHistory>> GetRootHistory(string id, CancellationToken cancellationToken = default)

Parameters

id string
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<RootHistory>>

A list of RootHistory

GetRoots(IEnumerable<string>, CancellationToken)

Gets state hashes for a list of roots

public Task<IEnumerable<RootHash>> GetRoots(IEnumerable<string> ids, CancellationToken cancellationToken = default)

Parameters

ids IEnumerable<string>
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<RootHash>>

A list of RootHash

GetSyncStatus(string, CancellationToken)

Gets the sync status of a store.

public Task<DataLayerSyncStatus> GetSyncStatus(string id, CancellationToken cancellationToken = default)

Parameters

id string
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<DataLayerSyncStatus>

A list of DataLayerSyncStatus

GetValue(string, string, string?, CancellationToken)

Get the value for a given id/key pair.

public Task<string> GetValue(string id, string key, string? rootHash, CancellationToken cancellationToken = default)

Parameters

id string
key string
rootHash string
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

string

Insert(string, string, ulong, CancellationToken)

Adds a list of clvm objects as bytes to add to table.

public Task<string> Insert(string id, string value, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

id string
value string
fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

string

MakeOffer(IEnumerable<OfferStore>, IEnumerable<OfferStore>, ulong, CancellationToken)

Makes an offer.

public Task<DataLayerOffer> MakeOffer(IEnumerable<OfferStore> maker, IEnumerable<OfferStore> taker, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

maker IEnumerable<OfferStore>
taker IEnumerable<OfferStore>
fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<DataLayerOffer>

DataLayerOffer

RemoveSubscriptions(string, IEnumerable<string>, CancellationToken)

Removes subscriptions for the given id.

public Task RemoveSubscriptions(string id, IEnumerable<string> urls, CancellationToken cancellationToken = default)

Parameters

id string
urls IEnumerable<string>
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable Task

SubmitPendingRoot(string, ulong, CancellationToken)

Submits a pending root

public Task<string> SubmitPendingRoot(string storeId, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

storeId string

The store id

fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

A transaction id

Subscribe(string, IEnumerable<string>, CancellationToken)

Subscribe to singleton.

public Task Subscribe(string id, IEnumerable<string> urls, CancellationToken cancellationToken = default)

Parameters

id string
urls IEnumerable<string>
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable Task

Subscriptions(CancellationToken)

List current subscriptions.

public Task<IEnumerable<string>> Subscriptions(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<string>>

A list of string

TakeOffer(object, ulong, CancellationToken)

Takes an offer.

public Task<string> TakeOffer(object offer, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

offer object
fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

string

Unsubscribe(string, bool, CancellationToken)

Unsubscribe from singleton.

public Task Unsubscribe(string id, bool retain = false, CancellationToken cancellationToken = default)

Parameters

id string
retain bool
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable Task

VerifyOffer(DataLayerOffer, ulong, CancellationToken)

Verifies an offer.

public Task<(bool Valid, ulong Fee)> VerifyOffer(DataLayerOffer offer, ulong fee = 0, CancellationToken cancellationToken = default)

Parameters

offer DataLayerOffer
fee ulong

Fee (in units of mojos)

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<(bool Valid, ulong Fee)>

boolean valid flag and fee amount

VerifyProof(DLProof, CancellationToken)

Verifies a proof.

public Task<(bool CurrentRoot, ProofResultInclusions VerifiedClvmHashes)> VerifyProof(DLProof proof, CancellationToken cancellationToken = default)

Parameters

proof DLProof
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<(bool CurrentRoot, ProofResultInclusions VerifiedClvmHashes)>

Proof verification

WalletLogIn(uint, CancellationToken)

Sets a key to active.

public Task WalletLogIn(uint fingerprint, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

An awaitable task