Skip to content

Commit

Permalink
Added initial support for NFTs
Browse files Browse the repository at this point in the history
  • Loading branch information
krzlabrdx committed Oct 31, 2022
1 parent 8ce646d commit fbb350e
Show file tree
Hide file tree
Showing 18 changed files with 1,257 additions and 208 deletions.
1 change: 1 addition & 0 deletions .idea/.idea.babylon-gateway/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 53 additions & 26 deletions src/RadixDlt.NetworkGateway.GatewayApi/gateway-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,6 @@ components:
type: string
pattern: "^-?[0-9]+$"

#
# Mapping Enums
#

ResourceTypeMapping:
type: string
enum:
- fungible
- non_fungible

#
# Generic Types
#
Expand Down Expand Up @@ -642,42 +632,79 @@ components:
type: array
items:
$ref: "#/components/schemas/EntityMetadataItem"
EntityDetailsResponseDetailsType:
type: string
enum:
- fungible_resource
- non_fungible_resource
- account_component
EntityDetailsResponseDetails:
oneOf:
- $ref: "#/components/schemas/EntityDetailsResponseFungibleDetails"
- $ref: "#/components/schemas/EntityDetailsResponseNonFungibleDetails"
- $ref: "#/components/schemas/EntityDetailsResponseFungibleResourceDetails"
- $ref: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetails"
- $ref: "#/components/schemas/EntityDetailsResponseAccountComponentDetails"
discriminator:
propertyName: resource_type
propertyName: discriminator
mapping:
# Must match ResourceTypeMapping
fungible: "#/components/schemas/EntityDetailsResponseFungibleDetails"
non_fungible: "#/components/schemas/EntityDetailsResponseNonFungibleDetails"
EntityDetailsResponseFungibleDetails:
# Must match EntityDetailsResponseDetailsType
fungible_resource: "#/components/schemas/EntityDetailsResponseFungibleResourceDetails"
non_fungible_resource: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetails"
account_component: "#/components/schemas/EntityDetailsResponseAccountComponentDetails"
EntityDetailsResponseFungibleResourceDetails:
type: object
required:
- resource_type
- discriminator
- total_supply_attos
- total_minted_attos
- total_burnt_attos
properties:
resource_type:
$ref: "#/components/schemas/ResourceTypeMapping"
discriminator:
$ref: "#/components/schemas/EntityDetailsResponseDetailsType"
total_supply_attos:
$ref: "#/components/schemas/TokenAmountAttos"
total_minted_attos:
$ref: "#/components/schemas/TokenAmountAttos"
total_burnt_attos:
$ref: "#/components/schemas/TokenAmountAttos"
EntityDetailsResponseNonFungibleDetails:
EntityDetailsResponseNonFungibleResourceDetails:
type: object
required:
- resource_type
- tbd
- discriminator
- ids
properties:
resource_type:
$ref: "#/components/schemas/ResourceTypeMapping"
tbd:
discriminator:
$ref: "#/components/schemas/EntityDetailsResponseDetailsType"
ids:
$ref: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetailsIds"
EntityDetailsResponseNonFungibleResourceDetailsIds:
allOf:
- $ref: "#/components/schemas/ResultSetCursorMixin"
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: "#/components/schemas/EntityDetailsResponseNonFungibleResourceDetailsIdsItem"
EntityDetailsResponseNonFungibleResourceDetailsIdsItem:
type: object
required:
- id
properties:
id_hex:
type: string
immutable_data_hex:
type: string
mutable_data_hex:
type: string
EntityDetailsResponseAccountComponentDetails:
type: object
required:
- discriminator
properties:
discriminator:
$ref: "#/components/schemas/EntityDetailsResponseDetailsType"

EntityOverviewRequest:
type: object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
/* Copyright 2021 Radix Publishing Ltd incorporated in Jersey (Channel Islands).
*
* Licensed under the Radix License, Version 1.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
*
* radixfoundation.org/licenses/LICENSE-v1
*
* The Licensor hereby grants permission for the Canonical version of the Work to be
* published, distributed and used under or by reference to the Licensor’s trademark
* Radix ® and use of any unregistered trade names, logos or get-up.
*
* The Licensor provides the Work (and each Contributor provides its Contributions) on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
* including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
*
* Whilst the Work is capable of being deployed, used and adopted (instantiated) to create
* a distributed ledger it is your responsibility to test and validate the code, together
* with all logic and performance of that code under all foreseeable scenarios.
*
* The Licensor does not make or purport to make and hereby excludes liability for all
* and any representation, warranty or undertaking in any form whatsoever, whether express
* or implied, to any entity or person, including any representation, warranty or
* undertaking, as to the functionality security use, value or other characteristics of
* any distributed ledger nor in respect the functioning or value of any tokens which may
* be created stored or transferred using the Work. The Licensor does not warrant that the
* Work or any use of the Work complies with any law or regulation in any territory where
* it may be implemented or used or that it will be appropriate for any specific purpose.
*
* Neither the licensor nor any current or former employees, officers, directors, partners,
* trustees, representatives, agents, advisors, contractors, or volunteers of the Licensor
* shall be liable for any direct or indirect, special, incidental, consequential or other
* losses of any kind, in tort, contract or otherwise (including but not limited to loss
* of revenue, income or profits, or loss of use or data, or loss of reputation, or loss
* of any economic or other opportunity of whatsoever nature or howsoever arising), arising
* out of or in connection with (without limitation of any use, misuse, of any ledger system
* or use made or its functionality or any performance or operation of any code or protocol
* caused by bugs or programming or logic errors or otherwise);
*
* A. any offer, purchase, holding, use, sale, exchange or transmission of any
* cryptographic keys, tokens or assets created, exchanged, stored or arising from any
* interaction with the Work;
*
* B. any failure in a transmission or loss of any token or assets keys or other digital
* artefacts due to errors in transmission;
*
* C. bugs, hacks, logic errors or faults in the Work or any communication;
*
* D. system software or apparatus including but not limited to losses caused by errors
* in holding or transmitting tokens by any third-party;
*
* E. breaches or failure of security including hacker attacks, loss or disclosure of
* password, loss of private key, unauthorised use or misuse of such passwords or keys;
*
* F. any losses including loss of anticipated savings or other benefits resulting from
* use of the Work or any changes to the Work (however implemented).
*
* You are solely responsible for; testing, validating and evaluation of all operation
* logic, functionality, security and appropriateness of using the Work for any commercial
* or non-commercial purpose and for any reproduction or redistribution by You of the
* Work. You assume all risks associated with Your use of the Work and the exercise of
* permissions under this License.
*/

/*
* Radix Babylon Gateway API
*
* See https://docs.radixdlt.com/main/apis/introduction.html
*
* The version of the OpenAPI document: 2.0.0
* Generated by: https://github.com/openapitools/openapi-generator.git
*/


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using FileParameter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.FileParameter;
using OpenAPIDateConverter = RadixDlt.NetworkGateway.GatewayApiSdk.Client.OpenAPIDateConverter;

namespace RadixDlt.NetworkGateway.GatewayApiSdk.Model
{
/// <summary>
/// EntityDetailsResponseAccountComponentDetails
/// </summary>
[DataContract(Name = "EntityDetailsResponseAccountComponentDetails")]
public partial class EntityDetailsResponseAccountComponentDetails : IEquatable<EntityDetailsResponseAccountComponentDetails>, IValidatableObject
{

/// <summary>
/// Gets or Sets Discriminator
/// </summary>
[DataMember(Name = "discriminator", IsRequired = true, EmitDefaultValue = true)]
public EntityDetailsResponseDetailsType Discriminator { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="EntityDetailsResponseAccountComponentDetails" /> class.
/// </summary>
[JsonConstructorAttribute]
protected EntityDetailsResponseAccountComponentDetails() { }
/// <summary>
/// Initializes a new instance of the <see cref="EntityDetailsResponseAccountComponentDetails" /> class.
/// </summary>
/// <param name="discriminator">discriminator (required).</param>
public EntityDetailsResponseAccountComponentDetails(EntityDetailsResponseDetailsType discriminator = default(EntityDetailsResponseDetailsType))
{
this.Discriminator = discriminator;
}

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class EntityDetailsResponseAccountComponentDetails {\n");
sb.Append(" Discriminator: ").Append(Discriminator).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as EntityDetailsResponseAccountComponentDetails);
}

/// <summary>
/// Returns true if EntityDetailsResponseAccountComponentDetails instances are equal
/// </summary>
/// <param name="input">Instance of EntityDetailsResponseAccountComponentDetails to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(EntityDetailsResponseAccountComponentDetails input)
{
if (input == null)
{
return false;
}
return
(
this.Discriminator == input.Discriminator ||
this.Discriminator.Equals(input.Discriminator)
);
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
hashCode = (hashCode * 59) + this.Discriminator.GetHashCode();
return hashCode;
}
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
{
yield break;
}
}

}
Loading

0 comments on commit fbb350e

Please sign in to comment.