forked from Beans-BV/dotnet-stellar-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
stellar-dotnet-sdk/responses/sorobanrpc/GetEventsResponse.cs
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,27 @@ | ||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class GetEventsResponse | ||
{ | ||
public EventInfo[]? Events; | ||
public long? LatestLedger; | ||
|
||
public class EventInfo | ||
{ | ||
public string ContractId; | ||
|
||
public string Id; | ||
|
||
public bool InSuccessfulContractCall; | ||
|
||
public int Ledger; | ||
|
||
public string LedgerClosedAt; | ||
|
||
public string PagingToken; | ||
|
||
public string[] Topic; | ||
public string Type; | ||
|
||
public string Value; | ||
} | ||
} |
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,6 @@ | ||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class GetHealthResponse | ||
{ | ||
public string Status { get; set; } | ||
} |
12 changes: 12 additions & 0 deletions
12
stellar-dotnet-sdk/responses/sorobanrpc/GetLatestLedgerResponse.cs
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,12 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class GetLatestLedgerResponse | ||
{ | ||
public string Id; | ||
|
||
public int ProtocolVersion; | ||
|
||
public int Sequence; | ||
} |
22 changes: 22 additions & 0 deletions
22
stellar-dotnet-sdk/responses/sorobanrpc/GetLedgerEntriesResponse.cs
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,22 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class GetLedgerEntriesResponse | ||
{ | ||
public LedgerEntryResult?[] Entries; | ||
public long LatestLedger; | ||
|
||
public class LedgerEntryResult | ||
{ | ||
public string Key; | ||
|
||
[JsonProperty(PropertyName = "lastModifiedLedgerSeq")] | ||
public long LastModifiedLedger; | ||
|
||
[JsonProperty(PropertyName = "liveUntilLedgerSeq")] | ||
public long LiveUntilLedger; | ||
|
||
public string Xdr; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
stellar-dotnet-sdk/responses/sorobanrpc/GetNetworkResponse.cs
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,10 @@ | ||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class GetNetworkResponse | ||
{ | ||
public string FriendbotUrl { get; set; } | ||
|
||
public string Passphrase { get; set; } | ||
|
||
public int ProtocolVersion { get; set; } | ||
} |
70 changes: 70 additions & 0 deletions
70
stellar-dotnet-sdk/responses/sorobanrpc/GetTransactionResponse.cs
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,70 @@ | ||
using System; | ||
using stellar_dotnet_sdk.xdr; | ||
|
||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class GetTransactionResponse | ||
{ | ||
public enum GetTransactionStatus | ||
{ | ||
NOT_FOUND, | ||
SUCCESS, | ||
FAILED | ||
} | ||
|
||
public int ApplicationOrder; | ||
|
||
public long CreatedAt; | ||
|
||
public string? EnvelopeXdr; | ||
|
||
public bool FeeBump; | ||
|
||
public long LatestLedger; | ||
|
||
public long LatestLedgerCloseTime; | ||
|
||
public long Ledger; | ||
|
||
public long OldestLedger; | ||
|
||
public long OldestLedgerCloseTime; | ||
|
||
public string? ResultMetaXdr; | ||
|
||
public string? ResultXdr; | ||
public GetTransactionStatus Status; | ||
|
||
public SCVal? ResultValue | ||
{ | ||
get | ||
{ | ||
if (Status != GetTransactionStatus.SUCCESS || ResultMetaXdr == null) return null; | ||
|
||
var bytes = Convert.FromBase64String(ResultMetaXdr); | ||
var reader = new XdrDataInputStream(bytes); | ||
var meta = TransactionMeta.Decode(reader); | ||
return meta?.V3?.SorobanMeta?.ReturnValue == null ? null : SCVal.FromXdr(meta.V3.SorobanMeta.ReturnValue); | ||
} | ||
} | ||
|
||
public string? WasmId | ||
{ | ||
get | ||
{ | ||
if (ResultValue is SCBytes bytes) return Convert.ToBase64String(bytes.InnerValue); | ||
|
||
return null; | ||
} | ||
} | ||
|
||
public string? CreatedContractId | ||
{ | ||
get | ||
{ | ||
if (ResultValue is SCContractId contract) | ||
return contract.InnerValue; | ||
return null; | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
stellar-dotnet-sdk/responses/sorobanrpc/SendTransactionResponse.cs
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,21 @@ | ||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class SendTransactionResponse | ||
{ | ||
public enum SendTransactionStatus | ||
{ | ||
PENDING, | ||
DUPLICATE, | ||
TRY_AGAIN_LATER, | ||
ERROR | ||
} | ||
|
||
public string ErrorResultXdr; | ||
|
||
public string Hash; | ||
|
||
public long LatestLedger; | ||
|
||
public long LatestLedgerCloseTime; | ||
public SendTransactionStatus Status; | ||
} |
65 changes: 65 additions & 0 deletions
65
stellar-dotnet-sdk/responses/sorobanrpc/SimulateTransactionResponse.cs
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,65 @@ | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
|
||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class SimulateTransactionResponse | ||
{ | ||
public SimulateTransactionCost Cost; | ||
public string? Error; | ||
|
||
public string[]? Events; | ||
public long LatestLedger; | ||
|
||
public uint MinResourceFee; | ||
|
||
public RestorePreamble RestorePreambleInfo; | ||
|
||
// An array of the individual host function call results. | ||
// This will only contain a single element if present, because only a single | ||
// invokeHostFunctionOperation is supported per transaction. | ||
public SimulateInvokeHostFunctionResult[]? Results; | ||
|
||
public string? TransactionData; | ||
|
||
public SorobanTransactionData? SorobanTransactionData | ||
{ | ||
get | ||
{ | ||
if (TransactionData != null) return SorobanTransactionData.FromXdrBase64(TransactionData); | ||
|
||
return null; | ||
} | ||
} | ||
|
||
public SorobanAuthorizationEntry[]? SorobanAuthorization | ||
{ | ||
get | ||
{ | ||
if (Results is { Length: > 0 } && Results[0].Auth != null) | ||
return Results[0].Auth.Select(SorobanAuthorizationEntry.FromXdrBase64).ToArray(); | ||
return null; | ||
} | ||
} | ||
|
||
public class RestorePreamble | ||
{ | ||
public long MinResourceFee; | ||
public string TransactionData; | ||
} | ||
|
||
public class SimulateTransactionCost | ||
{ | ||
[JsonProperty(PropertyName = "cpuInsns")] | ||
public long CpuInstructions; | ||
|
||
[JsonProperty(PropertyName = "memBytes")] | ||
public long MemoryBytes; | ||
} | ||
|
||
public class SimulateInvokeHostFunctionResult | ||
{ | ||
public string[]? Auth; | ||
public string? Xdr; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
stellar-dotnet-sdk/responses/sorobanrpc/SorobanRpcResponse.cs
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,14 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace stellar_dotnet_sdk.responses.sorobanrpc; | ||
|
||
public class SorobanRpcResponse<T> : Response | ||
{ | ||
[JsonProperty(PropertyName = "jsonrpc")] | ||
public string JsonRpc { get; private set; } | ||
|
||
[JsonProperty(PropertyName = "id")] public string Id { get; private set; } | ||
|
||
[JsonProperty(PropertyName = "result")] | ||
public T Result { get; private set; } | ||
} |