Skip to content

@gala-chain/apiAPI


API > OraclePriceCrossRateAssertionDto

Class: OraclePriceCrossRateAssertionDto

Contents

Description

The base DTO (Data Transfer Object) class. Provides common properties and methods for signing, uniqueness, validation, and serialization. All other DTOs in the SDK extend from this base class. To implement custom a custom DTO, create a new class that extends ChainCallDTO, and use the class-validator npm package to decorate the properties of the new class.

Remarks

Additional details for specific properties of this class are generated via the class-validator-jsonschema npm module and can either be viewed in the source code or in the OpenAPI documentation served alongside GalaChain's API endpoints.

Extends

Constructors

new OraclePriceCrossRateAssertionDto()

new OraclePriceCrossRateAssertionDto(): OraclePriceCrossRateAssertionDto

Inherited from

ChainCallDTO.constructor

Properties

baseTokenCrossRate

baseTokenCrossRate: OraclePriceAssertionDto

Source

chain-api/src/types/oracle.ts:242


crossRate

crossRate: BigNumber

Source

chain-api/src/types/oracle.ts:277


crossRateToken

crossRateToken?: TokenInstanceKey

Source

chain-api/src/types/oracle.ts:261


externalCrossRateToken

externalCrossRateToken?: ExternalToken

Source

chain-api/src/types/oracle.ts:271


identity

identity: string

Source

chain-api/src/types/oracle.ts:235


oracle

oracle: string

Source

chain-api/src/types/oracle.ts:229


prefix

prefix?: string

Inherited from

ChainCallDTO.prefix

Source

chain-api/src/types/dtos.ts:160


quoteTokenCrossRate

quoteTokenCrossRate: OraclePriceAssertionDto

Source

chain-api/src/types/oracle.ts:250


signature

signature?: string

Inherited from

ChainCallDTO.signature

Source

chain-api/src/types/dtos.ts:151


signerAddress

signerAddress?: string

Inherited from

ChainCallDTO.signerAddress

Source

chain-api/src/types/dtos.ts:167


signerPublicKey

signerPublicKey?: string

Inherited from

ChainCallDTO.signerPublicKey

Source

chain-api/src/types/dtos.ts:174


signing

signing?: SigningScheme

Inherited from

ChainCallDTO.signing

Source

chain-api/src/types/dtos.ts:184


trace

trace?: TraceContext

Inherited from

ChainCallDTO.trace

Source

chain-api/src/types/dtos.ts:126


uniqueKey

uniqueKey?: string

Inherited from

ChainCallDTO.uniqueKey

Source

chain-api/src/types/dtos.ts:141


ENCODING

static readonly ENCODING: "base64" = "base64"

Inherited from

ChainCallDTO.ENCODING

Source

chain-api/src/types/dtos.ts:127

Methods

calculateCrossRate()

calculateCrossRate(): BigNumber

Returns

Description

Calculate the cross-rate using the instantiated instance's base and quote token exchange rates.

Requires valid cross-rate token keys: For our purposes we expect the base exchange rate and the quote exchange rate to use a common quote token to faciliate the cross-rate calculation.

Remarks

The quote token exchange rate is inverted to yield a cross-rate exchange of "$n of quote token per 1 base token."

Example

Quote GALA in TON using hypothetical exchange rates:

GALA is quoted in USD at $0.025 USD per GALA (quoteTokenCrossRate).

TON is quoted in USD at $5.50 USD per TON. (baseTokenCrossRate).

The GALA cross-rate is inverted, yielding 40 GALA per 1 USD.

Multiply USD/TON x GALA/USD to yield a cross-rate of 220 GALA per 1 TON.

Source

chain-api/src/types/oracle.ts:351


isSignatureValid()

isSignatureValid(publicKey): boolean

Parameters

publicKey: string

Inherited from

ChainCallDTO.isSignatureValid

Source

chain-api/src/types/dtos.ts:258


serialize()

serialize(): string

Returns

string

Inherited from

ChainCallDTO.serialize

Description

Serialze this object to string in a determinsitic fashion. See Hyperledger Fabric's documentation on JSON Determinism for more details.

Source

chain-api/src/types/dtos.ts:208


sign()

sign(privateKey, useDer): void

Parameters

privateKey: string

useDer: boolean= false

Inherited from

ChainCallDTO.sign

Source

chain-api/src/types/dtos.ts:236


signed()

signed(privateKey, useDer): OraclePriceCrossRateAssertionDto

Creates a signed copy of current object.

Parameters

privateKey: string

useDer: boolean= false

Inherited from

ChainCallDTO.signed

Source

chain-api/src/types/dtos.ts:252


validate()

validate(): Promise\<ValidationError[]>

Inherited from

ChainCallDTO.validate

Source

chain-api/src/types/dtos.ts:186


validateCrossRate()

validateCrossRate(): void

Source

chain-api/src/types/oracle.ts:365


validateCrossRateTokenKeys()

validateCrossRateTokenKeys(): void

Source

chain-api/src/types/oracle.ts:280


validateOrReject()

validateOrReject(): Promise\<void>

Inherited from

ChainCallDTO.validateOrReject

Source

chain-api/src/types/dtos.ts:190


deserialize()

static deserialize\<T>(constructor, object): T

Type parameters

T

Parameters

constructor: ClassConstructor\<Inferred\<T, ChainCallDTO>>

ClassConstructor that extends ChainCallDTO

object: string | Record\<string, unknown> | Record\<string, unknown>[]

serialized string or plain object to be instantiated via the provided ClassConstructor

Returns

An instantiated class created with the provided ClassConstructor

Inherited from

ChainCallDTO.deserialize

Description

Instantiate a class instance from a serialized object using the provided ClassConstructor.

Source

chain-api/src/types/dtos.ts:229