Skip to content

Commit

Permalink
Added contract address to Smart Contract query
Browse files Browse the repository at this point in the history
  • Loading branch information
schwartz-concordium committed Sep 1, 2023
1 parent 2171a83 commit 09d7102
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ public IQueryable<SmartContract> GetSmartContracts(
}
}

/// <summary>
/// Adds additional field to the returned GraphQL type <see cref="SmartContract"/>
/// </summary>
[ExtendObjectType(typeof(SmartContract))]
public sealed class SmartContractExtensions
{
public ContractAddress GetContractAddress([Parent] SmartContract smartContract) =>
new(smartContract.ContractAddressIndex, smartContract.ContractAddressSubIndex);

/// <summary>
/// Adds additional field to the returned GraphQL type <see cref="SmartContract"/> which returns
/// aggregated amount from events on contract.
/// Returns aggregated amount from events on contract.
/// </summary>
public double GetAmount([Parent] SmartContract smartContract)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,7 @@ type SmartContract {
source: ImportSource!
createdAt: DateTime!
smartContractEvents: [SmartContractEvent!]!
contractAddress: ContractAddress!
amount: Float!
}

Expand Down

0 comments on commit 09d7102

Please sign in to comment.