Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tx manifest to transactions. #609

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2090,6 +2090,9 @@ components:
$ref: "#/components/schemas/HexString"
receipt:
$ref: "#/components/schemas/TransactionReceipt"
manifest_instructions:
type: string
nullable: true
message:
type: object
description: |
Expand Down Expand Up @@ -2743,6 +2746,10 @@ components:
description: if set to `true`, all affected global entities by given transaction are returned.
type: boolean
default: false
manifest_instructions:
description: if set to `true`, manifest instructions for user transactions are returned.
type: boolean
default: false
balance_changes:
description: |
if set to `true`, returns the fungible and non-fungible balance changes.
Expand Down Expand Up @@ -2860,7 +2867,6 @@ components:
# /stream/* Request & Response Types
#

# TODO PP: update docs with examples.
StreamTransactionsRequest:
allOf:
- $ref: "#/components/schemas/AtLedgerStateMixin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ protected CommittedTransactionInfo() { }
/// <param name="errorMessage">errorMessage.</param>
/// <param name="rawHex">Hex-encoded binary blob..</param>
/// <param name="receipt">receipt.</param>
/// <param name="manifestInstructions">manifestInstructions.</param>
/// <param name="message">The optional transaction message. This type is defined in the Core API as &#x60;TransactionMessage&#x60;. See the Core API documentation for more details. .</param>
/// <param name="balanceChanges">balanceChanges.</param>
public CommittedTransactionInfo(long stateVersion = default(long), long epoch = default(long), long round = default(long), string roundTimestamp = default(string), TransactionStatus transactionStatus = default(TransactionStatus), string payloadHash = default(string), string intentHash = default(string), string feePaid = default(string), List<string> affectedGlobalEntities = default(List<string>), DateTime? confirmedAt = default(DateTime?), string errorMessage = default(string), string rawHex = default(string), TransactionReceipt receipt = default(TransactionReceipt), Object message = default(Object), TransactionBalanceChanges balanceChanges = default(TransactionBalanceChanges))
public CommittedTransactionInfo(long stateVersion = default(long), long epoch = default(long), long round = default(long), string roundTimestamp = default(string), TransactionStatus transactionStatus = default(TransactionStatus), string payloadHash = default(string), string intentHash = default(string), string feePaid = default(string), List<string> affectedGlobalEntities = default(List<string>), DateTime? confirmedAt = default(DateTime?), string errorMessage = default(string), string rawHex = default(string), TransactionReceipt receipt = default(TransactionReceipt), string manifestInstructions = default(string), Object message = default(Object), TransactionBalanceChanges balanceChanges = default(TransactionBalanceChanges))
{
this.StateVersion = stateVersion;
this.Epoch = epoch;
Expand All @@ -144,6 +145,7 @@ protected CommittedTransactionInfo() { }
this.ErrorMessage = errorMessage;
this.RawHex = rawHex;
this.Receipt = receipt;
this.ManifestInstructions = manifestInstructions;
this.Message = message;
this.BalanceChanges = balanceChanges;
}
Expand Down Expand Up @@ -224,6 +226,12 @@ protected CommittedTransactionInfo() { }
[DataMember(Name = "receipt", EmitDefaultValue = true)]
public TransactionReceipt Receipt { get; set; }

/// <summary>
/// Gets or Sets ManifestInstructions
/// </summary>
[DataMember(Name = "manifest_instructions", EmitDefaultValue = true)]
public string ManifestInstructions { get; set; }

/// <summary>
/// The optional transaction message. This type is defined in the Core API as &#x60;TransactionMessage&#x60;. See the Core API documentation for more details.
/// </summary>
Expand Down Expand Up @@ -258,6 +266,7 @@ public override string ToString()
sb.Append(" ErrorMessage: ").Append(ErrorMessage).Append("\n");
sb.Append(" RawHex: ").Append(RawHex).Append("\n");
sb.Append(" Receipt: ").Append(Receipt).Append("\n");
sb.Append(" ManifestInstructions: ").Append(ManifestInstructions).Append("\n");
sb.Append(" Message: ").Append(Message).Append("\n");
sb.Append(" BalanceChanges: ").Append(BalanceChanges).Append("\n");
sb.Append("}\n");
Expand Down Expand Up @@ -357,6 +366,11 @@ public bool Equals(CommittedTransactionInfo input)
(this.Receipt != null &&
this.Receipt.Equals(input.Receipt))
) &&
(
this.ManifestInstructions == input.ManifestInstructions ||
(this.ManifestInstructions != null &&
this.ManifestInstructions.Equals(input.ManifestInstructions))
) &&
(
this.Message == input.Message ||
(this.Message != null &&
Expand Down Expand Up @@ -418,6 +432,10 @@ public override int GetHashCode()
{
hashCode = (hashCode * 59) + this.Receipt.GetHashCode();
}
if (this.ManifestInstructions != null)
{
hashCode = (hashCode * 59) + this.ManifestInstructions.GetHashCode();
}
if (this.Message != null)
{
hashCode = (hashCode * 59) + this.Message.GetHashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected StateEntityDetailsRequest() { }
/// </summary>
/// <param name="atLedgerState">atLedgerState.</param>
/// <param name="optIns">optIns.</param>
/// <param name="addresses">addresses (required).</param>
/// <param name="addresses">limited to max 100 items. (required).</param>
/// <param name="aggregationLevel">aggregationLevel.</param>
public StateEntityDetailsRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), StateEntityDetailsOptIns optIns = default(StateEntityDetailsOptIns), List<string> addresses = default(List<string>), ResourceAggregationLevel? aggregationLevel = default(ResourceAggregationLevel?))
{
Expand Down Expand Up @@ -139,8 +139,9 @@ protected StateEntityDetailsRequest() { }
public StateEntityDetailsOptIns OptIns { get; set; }

/// <summary>
/// Gets or Sets Addresses
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "addresses", IsRequired = true, EmitDefaultValue = true)]
public List<string> Addresses { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected StateEntityDetailsRequestAllOf() { }
/// Initializes a new instance of the <see cref="StateEntityDetailsRequestAllOf" /> class.
/// </summary>
/// <param name="optIns">optIns.</param>
/// <param name="addresses">addresses (required).</param>
/// <param name="addresses">limited to max 100 items. (required).</param>
/// <param name="aggregationLevel">aggregationLevel.</param>
public StateEntityDetailsRequestAllOf(StateEntityDetailsOptIns optIns = default(StateEntityDetailsOptIns), List<string> addresses = default(List<string>), ResourceAggregationLevel? aggregationLevel = default(ResourceAggregationLevel?))
{
Expand All @@ -131,8 +131,9 @@ protected StateEntityDetailsRequestAllOf() { }
public StateEntityDetailsOptIns OptIns { get; set; }

/// <summary>
/// Gets or Sets Addresses
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "addresses", IsRequired = true, EmitDefaultValue = true)]
public List<string> Addresses { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected StateKeyValueStoreDataRequest() { }
/// </summary>
/// <param name="atLedgerState">atLedgerState.</param>
/// <param name="keyValueStoreAddress">Bech32m-encoded human readable version of the address. (required).</param>
/// <param name="keys">keys (required).</param>
/// <param name="keys">limited to max 100 items. (required).</param>
public StateKeyValueStoreDataRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), string keyValueStoreAddress = default(string), List<StateKeyValueStoreDataRequestKeyItem> keys = default(List<StateKeyValueStoreDataRequestKeyItem>))
{
// to ensure "keyValueStoreAddress" is required (not null)
Expand Down Expand Up @@ -137,8 +137,9 @@ protected StateKeyValueStoreDataRequest() { }
public string KeyValueStoreAddress { get; set; }

/// <summary>
/// Gets or Sets Keys
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "keys", IsRequired = true, EmitDefaultValue = true)]
public List<StateKeyValueStoreDataRequestKeyItem> Keys { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected StateKeyValueStoreDataRequestAllOf() { }
/// Initializes a new instance of the <see cref="StateKeyValueStoreDataRequestAllOf" /> class.
/// </summary>
/// <param name="keyValueStoreAddress">Bech32m-encoded human readable version of the address. (required).</param>
/// <param name="keys">keys (required).</param>
/// <param name="keys">limited to max 100 items. (required).</param>
public StateKeyValueStoreDataRequestAllOf(string keyValueStoreAddress = default(string), List<StateKeyValueStoreDataRequestKeyItem> keys = default(List<StateKeyValueStoreDataRequestKeyItem>))
{
// to ensure "keyValueStoreAddress" is required (not null)
Expand All @@ -129,8 +129,9 @@ protected StateKeyValueStoreDataRequestAllOf() { }
public string KeyValueStoreAddress { get; set; }

/// <summary>
/// Gets or Sets Keys
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "keys", IsRequired = true, EmitDefaultValue = true)]
public List<StateKeyValueStoreDataRequestKeyItem> Keys { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected StateNonFungibleDataRequest() { }
/// </summary>
/// <param name="atLedgerState">atLedgerState.</param>
/// <param name="resourceAddress">Bech32m-encoded human readable version of the address. (required).</param>
/// <param name="nonFungibleIds">nonFungibleIds (required).</param>
/// <param name="nonFungibleIds">limited to max 100 items. (required).</param>
public StateNonFungibleDataRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), string resourceAddress = default(string), List<string> nonFungibleIds = default(List<string>))
{
// to ensure "resourceAddress" is required (not null)
Expand Down Expand Up @@ -137,8 +137,9 @@ protected StateNonFungibleDataRequest() { }
public string ResourceAddress { get; set; }

/// <summary>
/// Gets or Sets NonFungibleIds
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "non_fungible_ids", IsRequired = true, EmitDefaultValue = true)]
public List<string> NonFungibleIds { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected StateNonFungibleLocationRequest() { }
/// </summary>
/// <param name="atLedgerState">atLedgerState.</param>
/// <param name="resourceAddress">Bech32m-encoded human readable version of the address. (required).</param>
/// <param name="nonFungibleIds">nonFungibleIds (required).</param>
/// <param name="nonFungibleIds">limited to max 100 items. (required).</param>
public StateNonFungibleLocationRequest(LedgerStateSelector atLedgerState = default(LedgerStateSelector), string resourceAddress = default(string), List<string> nonFungibleIds = default(List<string>))
{
// to ensure "resourceAddress" is required (not null)
Expand Down Expand Up @@ -137,8 +137,9 @@ protected StateNonFungibleLocationRequest() { }
public string ResourceAddress { get; set; }

/// <summary>
/// Gets or Sets NonFungibleIds
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "non_fungible_ids", IsRequired = true, EmitDefaultValue = true)]
public List<string> NonFungibleIds { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected StateNonFungibleLocationRequestAllOf() { }
/// Initializes a new instance of the <see cref="StateNonFungibleLocationRequestAllOf" /> class.
/// </summary>
/// <param name="resourceAddress">Bech32m-encoded human readable version of the address. (required).</param>
/// <param name="nonFungibleIds">nonFungibleIds (required).</param>
/// <param name="nonFungibleIds">limited to max 100 items. (required).</param>
public StateNonFungibleLocationRequestAllOf(string resourceAddress = default(string), List<string> nonFungibleIds = default(List<string>))
{
// to ensure "resourceAddress" is required (not null)
Expand All @@ -129,8 +129,9 @@ protected StateNonFungibleLocationRequestAllOf() { }
public string ResourceAddress { get; set; }

/// <summary>
/// Gets or Sets NonFungibleIds
/// limited to max 100 items.
/// </summary>
/// <value>limited to max 100 items.</value>
[DataMember(Name = "non_fungible_ids", IsRequired = true, EmitDefaultValue = true)]
public List<string> NonFungibleIds { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ public partial class TransactionDetailsOptIns : IEquatable<TransactionDetailsOpt
/// <param name="receiptEvents">if set to &#x60;true&#x60;, events inside receipt object is returned. (default to false).</param>
/// <param name="receiptOutput">(true by default) if set to &#x60;true&#x60;, transaction receipt output is returned. (default to true).</param>
/// <param name="affectedGlobalEntities">if set to &#x60;true&#x60;, all affected global entities by given transaction are returned. (default to false).</param>
/// <param name="manifestInstructions">if set to &#x60;true&#x60;, manifest instructions for user transactions are returned. (default to false).</param>
/// <param name="balanceChanges">if set to &#x60;true&#x60;, returns the fungible and non-fungible balance changes. **Warning!** This opt-in might be missing for recently committed transactions, in that case a &#x60;null&#x60; value will be returned. Retry the request until non-null value is returned. (default to false).</param>
public TransactionDetailsOptIns(bool rawHex = false, bool receiptStateChanges = false, bool receiptFeeSummary = false, bool receiptFeeSource = false, bool receiptFeeDestination = false, bool receiptCostingParameters = false, bool receiptEvents = false, bool receiptOutput = true, bool affectedGlobalEntities = false, bool balanceChanges = false)
public TransactionDetailsOptIns(bool rawHex = false, bool receiptStateChanges = false, bool receiptFeeSummary = false, bool receiptFeeSource = false, bool receiptFeeDestination = false, bool receiptCostingParameters = false, bool receiptEvents = false, bool receiptOutput = true, bool affectedGlobalEntities = false, bool manifestInstructions = false, bool balanceChanges = false)
{
this.RawHex = rawHex;
this.ReceiptStateChanges = receiptStateChanges;
Expand All @@ -119,6 +120,7 @@ public TransactionDetailsOptIns(bool rawHex = false, bool receiptStateChanges =
this.ReceiptEvents = receiptEvents;
this.ReceiptOutput = receiptOutput;
this.AffectedGlobalEntities = affectedGlobalEntities;
this.ManifestInstructions = manifestInstructions;
this.BalanceChanges = balanceChanges;
}

Expand Down Expand Up @@ -185,6 +187,13 @@ public TransactionDetailsOptIns(bool rawHex = false, bool receiptStateChanges =
[DataMember(Name = "affected_global_entities", EmitDefaultValue = true)]
public bool AffectedGlobalEntities { get; set; }

/// <summary>
/// if set to &#x60;true&#x60;, manifest instructions for user transactions are returned.
/// </summary>
/// <value>if set to &#x60;true&#x60;, manifest instructions for user transactions are returned.</value>
[DataMember(Name = "manifest_instructions", EmitDefaultValue = true)]
public bool ManifestInstructions { get; set; }

/// <summary>
/// if set to &#x60;true&#x60;, returns the fungible and non-fungible balance changes. **Warning!** This opt-in might be missing for recently committed transactions, in that case a &#x60;null&#x60; value will be returned. Retry the request until non-null value is returned.
/// </summary>
Expand All @@ -209,6 +218,7 @@ public override string ToString()
sb.Append(" ReceiptEvents: ").Append(ReceiptEvents).Append("\n");
sb.Append(" ReceiptOutput: ").Append(ReceiptOutput).Append("\n");
sb.Append(" AffectedGlobalEntities: ").Append(AffectedGlobalEntities).Append("\n");
sb.Append(" ManifestInstructions: ").Append(ManifestInstructions).Append("\n");
sb.Append(" BalanceChanges: ").Append(BalanceChanges).Append("\n");
sb.Append("}\n");
return sb.ToString();
Expand Down Expand Up @@ -281,6 +291,10 @@ public bool Equals(TransactionDetailsOptIns input)
this.AffectedGlobalEntities == input.AffectedGlobalEntities ||
this.AffectedGlobalEntities.Equals(input.AffectedGlobalEntities)
) &&
(
this.ManifestInstructions == input.ManifestInstructions ||
this.ManifestInstructions.Equals(input.ManifestInstructions)
) &&
(
this.BalanceChanges == input.BalanceChanges ||
this.BalanceChanges.Equals(input.BalanceChanges)
Expand All @@ -305,6 +319,7 @@ public override int GetHashCode()
hashCode = (hashCode * 59) + this.ReceiptEvents.GetHashCode();
hashCode = (hashCode * 59) + this.ReceiptOutput.GetHashCode();
hashCode = (hashCode * 59) + this.AffectedGlobalEntities.GetHashCode();
hashCode = (hashCode * 59) + this.ManifestInstructions.GetHashCode();
hashCode = (hashCode * 59) + this.BalanceChanges.GetHashCode();
return hashCode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ public static GatewayModel.CommittedTransactionInfo ToGatewayModel(
string? intentHash = null;
string? rawHex = null;
JRaw? message = null;
string? manifestInstructions = null;

if (lt is UserLedgerTransaction ult)
{
payloadHash = ult.PayloadHash;
intentHash = ult.IntentHash;
rawHex = optIns.RawHex ? ult.RawPayload.ToHex() : null;
message = ult.Message != null ? new JRaw(ult.Message) : null;
manifestInstructions = optIns.ManifestInstructions ? ult.ManifestInstructions : null;
}

var receipt = new GatewayModel.TransactionReceipt
Expand Down Expand Up @@ -156,7 +158,8 @@ public static GatewayModel.CommittedTransactionInfo ToGatewayModel(
rawHex: rawHex,
receipt: receipt,
message: message,
balanceChanges: optIns.BalanceChanges ? transactionBalanceChanges : null
balanceChanges: optIns.BalanceChanges ? transactionBalanceChanges : null,
manifestInstructions: manifestInstructions
);
}

Expand Down
Loading