diff --git a/src/vendors/nexus.ts b/src/vendors/nexus.ts index e2ebd82df8..8e67c5735b 100644 --- a/src/vendors/nexus.ts +++ b/src/vendors/nexus.ts @@ -30,7 +30,7 @@ export interface ExtendedRuntimeTransaction extends NexusRuntimeTransaction { export function getNexusAPIs(url: string | 'https://nexus.oasis.io/v1/') { const explorerConfig = new Configuration({ basePath: url, - ...throwAPIErrors, + fetchApi: throwAPIErrors.fetchApi, }) const api = new NexusApi(explorerConfig) diff --git a/src/vendors/nexus/.openapi-generator/FILES b/src/vendors/nexus/.openapi-generator/FILES index ee68eb3ded..0924162615 100644 --- a/src/vendors/nexus/.openapi-generator/FILES +++ b/src/vendors/nexus/.openapi-generator/FILES @@ -1,10 +1,9 @@ -.openapi-generator-ignore apis/DefaultApi.ts apis/index.ts index.ts models/Account.ts models/AccountList.ts -models/AccountListAllOf.ts +models/AccountListAllOfAccounts.ts models/AccountStats.ts models/ActiveAccounts.ts models/ActiveAccountsList.ts @@ -14,60 +13,60 @@ models/Allowance.ts models/BareTokenHolder.ts models/Block.ts models/BlockList.ts -models/BlockListAllOf.ts +models/BlockListAllOfBlocks.ts models/ConsensusEvent.ts models/ConsensusEventList.ts -models/ConsensusEventListAllOf.ts +models/ConsensusEventListAllOfEvents.ts models/ConsensusEventType.ts models/ConsensusTxMethod.ts models/DebondingDelegation.ts models/DebondingDelegationList.ts -models/DebondingDelegationListAllOf.ts +models/DebondingDelegationListAllOfDebondingDelegations.ts models/Delegation.ts models/DelegationList.ts -models/DelegationListAllOf.ts +models/DelegationListAllOfDelegations.ts models/Entity.ts models/EntityList.ts -models/EntityListAllOf.ts +models/EntityListAllOfEntities.ts models/Epoch.ts models/EpochList.ts -models/EpochListAllOf.ts +models/EpochListAllOfEpochs.ts models/Escrow.ts models/EvmAbiParam.ts models/EvmEventToken.ts models/EvmNft.ts models/EvmNftList.ts -models/EvmNftListAllOf.ts +models/EvmNftListAllOfEvmNfts.ts models/EvmToken.ts models/EvmTokenList.ts -models/EvmTokenListAllOf.ts +models/EvmTokenListAllOfEvmTokens.ts models/EvmTokenType.ts -models/InlineResponse400.ts +models/GetStatus400Response.ts models/Layer.ts models/List.ts models/Node.ts models/NodeList.ts -models/NodeListAllOf.ts +models/NodeListAllOfNodes.ts models/Proposal.ts models/ProposalList.ts -models/ProposalListAllOf.ts +models/ProposalListAllOfProposals.ts models/ProposalState.ts models/ProposalTarget.ts models/ProposalVote.ts models/ProposalVotes.ts -models/ProposalVotesAllOf.ts +models/ProposalVotesAllOfVotes.ts models/RoothashMessage.ts models/RoothashMessageList.ts -models/RoothashMessageListAllOf.ts +models/RoothashMessageListAllOfRoothashMessages.ts models/RoothashMessageType.ts models/Runtime.ts models/RuntimeAccount.ts models/RuntimeBlock.ts models/RuntimeBlockList.ts -models/RuntimeBlockListAllOf.ts +models/RuntimeBlockListAllOfBlocks.ts models/RuntimeEvent.ts models/RuntimeEventList.ts -models/RuntimeEventListAllOf.ts +models/RuntimeEventListAllOfEvents.ts models/RuntimeEventType.ts models/RuntimeEvmBalance.ts models/RuntimeEvmContract.ts @@ -77,13 +76,13 @@ models/RuntimeStatus.ts models/RuntimeTransaction.ts models/RuntimeTransactionEncryptionEnvelope.ts models/RuntimeTransactionList.ts -models/RuntimeTransactionListAllOf.ts +models/RuntimeTransactionListAllOfTransactions.ts models/Status.ts models/TokenHolderList.ts -models/TokenHolderListAllOf.ts +models/TokenHolderListAllOfHolders.ts models/Transaction.ts models/TransactionList.ts -models/TransactionListAllOf.ts +models/TransactionListAllOfTransactions.ts models/TxError.ts models/TxVolume.ts models/TxVolumeList.ts @@ -91,10 +90,10 @@ models/Validator.ts models/ValidatorAggStats.ts models/ValidatorCommissionBound.ts models/ValidatorHistory.ts -models/ValidatorHistoryAllOf.ts +models/ValidatorHistoryAllOfHistory.ts models/ValidatorHistoryPoint.ts models/ValidatorList.ts -models/ValidatorListAllOf.ts +models/ValidatorListAllOfValidators.ts models/ValidatorMedia.ts models/ValidatorsResponse.ts models/VerificationLevel.ts diff --git a/src/vendors/nexus/.openapi-generator/VERSION b/src/vendors/nexus/.openapi-generator/VERSION index acf69b48b8..758bb9c821 100644 --- a/src/vendors/nexus/.openapi-generator/VERSION +++ b/src/vendors/nexus/.openapi-generator/VERSION @@ -1 +1 @@ -5.1.0 \ No newline at end of file +7.10.0 diff --git a/src/vendors/nexus/apis/DefaultApi.ts b/src/vendors/nexus/apis/DefaultApi.ts index 9ca668b489..aa3bc0fa06 100644 --- a/src/vendors/nexus/apis/DefaultApi.ts +++ b/src/vendors/nexus/apis/DefaultApi.ts @@ -14,134 +14,136 @@ import * as runtime from '../runtime'; +import type { + Account, + AccountList, + ActiveAccountsList, + Block, + BlockList, + ConsensusEventList, + ConsensusEventType, + ConsensusTxMethod, + DebondingDelegationList, + DelegationList, + Entity, + EntityList, + Epoch, + EpochList, + EvmNft, + EvmNftList, + EvmToken, + EvmTokenList, + GetStatus400Response, + Layer, + Node, + NodeList, + Proposal, + ProposalList, + ProposalState, + ProposalVotes, + RoothashMessageList, + RoothashMessageType, + Runtime, + RuntimeAccount, + RuntimeBlockList, + RuntimeEventList, + RuntimeEventType, + RuntimeStatus, + RuntimeTransactionList, + Status, + TokenHolderList, + Transaction, + TransactionList, + TxVolumeList, + ValidatorHistory, + ValidatorList, +} from '../models/index'; import { - Account, AccountFromJSON, AccountToJSON, - AccountList, AccountListFromJSON, AccountListToJSON, - ActiveAccountsList, ActiveAccountsListFromJSON, ActiveAccountsListToJSON, - Block, BlockFromJSON, BlockToJSON, - BlockList, BlockListFromJSON, BlockListToJSON, - ConsensusEventList, ConsensusEventListFromJSON, ConsensusEventListToJSON, - ConsensusEventType, ConsensusEventTypeFromJSON, ConsensusEventTypeToJSON, - ConsensusTxMethod, ConsensusTxMethodFromJSON, ConsensusTxMethodToJSON, - DebondingDelegationList, DebondingDelegationListFromJSON, DebondingDelegationListToJSON, - DelegationList, DelegationListFromJSON, DelegationListToJSON, - Entity, EntityFromJSON, EntityToJSON, - EntityList, EntityListFromJSON, EntityListToJSON, - Epoch, EpochFromJSON, EpochToJSON, - EpochList, EpochListFromJSON, EpochListToJSON, - EvmNft, EvmNftFromJSON, EvmNftToJSON, - EvmNftList, EvmNftListFromJSON, EvmNftListToJSON, - EvmToken, EvmTokenFromJSON, EvmTokenToJSON, - EvmTokenList, EvmTokenListFromJSON, EvmTokenListToJSON, - InlineResponse400, - InlineResponse400FromJSON, - InlineResponse400ToJSON, - Layer, + GetStatus400ResponseFromJSON, + GetStatus400ResponseToJSON, LayerFromJSON, LayerToJSON, - Node, NodeFromJSON, NodeToJSON, - NodeList, NodeListFromJSON, NodeListToJSON, - Proposal, ProposalFromJSON, ProposalToJSON, - ProposalList, ProposalListFromJSON, ProposalListToJSON, - ProposalState, ProposalStateFromJSON, ProposalStateToJSON, - ProposalVotes, ProposalVotesFromJSON, ProposalVotesToJSON, - RoothashMessageList, RoothashMessageListFromJSON, RoothashMessageListToJSON, - RoothashMessageType, RoothashMessageTypeFromJSON, RoothashMessageTypeToJSON, - Runtime, RuntimeFromJSON, RuntimeToJSON, - RuntimeAccount, RuntimeAccountFromJSON, RuntimeAccountToJSON, - RuntimeBlockList, RuntimeBlockListFromJSON, RuntimeBlockListToJSON, - RuntimeEventList, RuntimeEventListFromJSON, RuntimeEventListToJSON, - RuntimeEventType, RuntimeEventTypeFromJSON, RuntimeEventTypeToJSON, - RuntimeStatus, RuntimeStatusFromJSON, RuntimeStatusToJSON, - RuntimeTransactionList, RuntimeTransactionListFromJSON, RuntimeTransactionListToJSON, - Status, StatusFromJSON, StatusToJSON, - TokenHolderList, TokenHolderListFromJSON, TokenHolderListToJSON, - Transaction, TransactionFromJSON, TransactionToJSON, - TransactionList, TransactionListFromJSON, TransactionListToJSON, - TxVolumeList, TxVolumeListFromJSON, TxVolumeListToJSON, - ValidatorHistory, ValidatorHistoryFromJSON, ValidatorHistoryToJSON, - ValidatorList, ValidatorListFromJSON, ValidatorListToJSON, -} from '../models'; +} from '../models/index'; export interface ConsensusAccountsAddressDebondingDelegationsGetRequest { address: string; @@ -400,29 +402,32 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns an account\'s debonding delegations. */ - async consensusAccountsAddressDebondingDelegationsGetRaw(requestParameters: ConsensusAccountsAddressDebondingDelegationsGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusAccountsAddressDebondingDelegationsGet.'); + async consensusAccountsAddressDebondingDelegationsGetRaw(requestParameters: ConsensusAccountsAddressDebondingDelegationsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusAccountsAddressDebondingDelegationsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/accounts/{address}/debonding_delegations`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/accounts/{address}/debonding_delegations`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DebondingDelegationListFromJSON(jsonValue)); } @@ -430,37 +435,40 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns an account\'s debonding delegations. */ - async consensusAccountsAddressDebondingDelegationsGet(requestParameters: ConsensusAccountsAddressDebondingDelegationsGetRequest): Promise { - const response = await this.consensusAccountsAddressDebondingDelegationsGetRaw(requestParameters); + async consensusAccountsAddressDebondingDelegationsGet(requestParameters: ConsensusAccountsAddressDebondingDelegationsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusAccountsAddressDebondingDelegationsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of debonding delegations to an account. */ - async consensusAccountsAddressDebondingDelegationsToGetRaw(requestParameters: ConsensusAccountsAddressDebondingDelegationsToGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusAccountsAddressDebondingDelegationsToGet.'); + async consensusAccountsAddressDebondingDelegationsToGetRaw(requestParameters: ConsensusAccountsAddressDebondingDelegationsToGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusAccountsAddressDebondingDelegationsToGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/accounts/{address}/debonding_delegations_to`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/accounts/{address}/debonding_delegations_to`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DebondingDelegationListFromJSON(jsonValue)); } @@ -468,37 +476,40 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of debonding delegations to an account. */ - async consensusAccountsAddressDebondingDelegationsToGet(requestParameters: ConsensusAccountsAddressDebondingDelegationsToGetRequest): Promise { - const response = await this.consensusAccountsAddressDebondingDelegationsToGetRaw(requestParameters); + async consensusAccountsAddressDebondingDelegationsToGet(requestParameters: ConsensusAccountsAddressDebondingDelegationsToGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusAccountsAddressDebondingDelegationsToGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns an account\'s delegations. */ - async consensusAccountsAddressDelegationsGetRaw(requestParameters: ConsensusAccountsAddressDelegationsGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusAccountsAddressDelegationsGet.'); + async consensusAccountsAddressDelegationsGetRaw(requestParameters: ConsensusAccountsAddressDelegationsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusAccountsAddressDelegationsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/accounts/{address}/delegations`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/accounts/{address}/delegations`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DelegationListFromJSON(jsonValue)); } @@ -506,37 +517,40 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns an account\'s delegations. */ - async consensusAccountsAddressDelegationsGet(requestParameters: ConsensusAccountsAddressDelegationsGetRequest): Promise { - const response = await this.consensusAccountsAddressDelegationsGetRaw(requestParameters); + async consensusAccountsAddressDelegationsGet(requestParameters: ConsensusAccountsAddressDelegationsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusAccountsAddressDelegationsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of delegations to an account. */ - async consensusAccountsAddressDelegationsToGetRaw(requestParameters: ConsensusAccountsAddressDelegationsToGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusAccountsAddressDelegationsToGet.'); + async consensusAccountsAddressDelegationsToGetRaw(requestParameters: ConsensusAccountsAddressDelegationsToGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusAccountsAddressDelegationsToGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/accounts/{address}/delegations_to`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/accounts/{address}/delegations_to`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DelegationListFromJSON(jsonValue)); } @@ -544,17 +558,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of delegations to an account. */ - async consensusAccountsAddressDelegationsToGet(requestParameters: ConsensusAccountsAddressDelegationsToGetRequest): Promise { - const response = await this.consensusAccountsAddressDelegationsToGetRaw(requestParameters); + async consensusAccountsAddressDelegationsToGet(requestParameters: ConsensusAccountsAddressDelegationsToGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusAccountsAddressDelegationsToGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a consensus layer account. */ - async consensusAccountsAddressGetRaw(requestParameters: ConsensusAccountsAddressGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusAccountsAddressGet.'); + async consensusAccountsAddressGetRaw(requestParameters: ConsensusAccountsAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusAccountsAddressGet().' + ); } const queryParameters: any = {}; @@ -562,11 +579,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/accounts/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/accounts/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => AccountFromJSON(jsonValue)); } @@ -574,23 +591,23 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a consensus layer account. */ - async consensusAccountsAddressGet(requestParameters: ConsensusAccountsAddressGetRequest): Promise { - const response = await this.consensusAccountsAddressGetRaw(requestParameters); + async consensusAccountsAddressGet(requestParameters: ConsensusAccountsAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusAccountsAddressGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of consensus layer accounts. Note that for performance reasons, the info returned by this endpoint may be slightly stale (<2 minutes). For the most up-to-date account state, query the single-account endpoint. */ - async consensusAccountsGetRaw(requestParameters: ConsensusAccountsGetRequest): Promise> { + async consensusAccountsGetRaw(requestParameters: ConsensusAccountsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -600,7 +617,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => AccountListFromJSON(jsonValue)); } @@ -608,43 +625,43 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of consensus layer accounts. Note that for performance reasons, the info returned by this endpoint may be slightly stale (<2 minutes). For the most up-to-date account state, query the single-account endpoint. */ - async consensusAccountsGet(requestParameters: ConsensusAccountsGetRequest): Promise { - const response = await this.consensusAccountsGetRaw(requestParameters); + async consensusAccountsGet(requestParameters: ConsensusAccountsGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusAccountsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of consensus blocks, sorted from most to least recent. */ - async consensusBlocksGetRaw(requestParameters: ConsensusBlocksGetRequest): Promise> { + async consensusBlocksGetRaw(requestParameters: ConsensusBlocksGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.from !== undefined) { - queryParameters['from'] = requestParameters.from; + if (requestParameters['from'] != null) { + queryParameters['from'] = requestParameters['from']; } - if (requestParameters.to !== undefined) { - queryParameters['to'] = requestParameters.to; + if (requestParameters['to'] != null) { + queryParameters['to'] = requestParameters['to']; } - if (requestParameters.after !== undefined) { - queryParameters['after'] = (requestParameters.after as any).toISOString(); + if (requestParameters['after'] != null) { + queryParameters['after'] = (requestParameters['after'] as any).toISOString(); } - if (requestParameters.before !== undefined) { - queryParameters['before'] = (requestParameters.before as any).toISOString(); + if (requestParameters['before'] != null) { + queryParameters['before'] = (requestParameters['before'] as any).toISOString(); } - if (requestParameters.hash !== undefined) { - queryParameters['hash'] = requestParameters.hash; + if (requestParameters['hash'] != null) { + queryParameters['hash'] = requestParameters['hash']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -654,7 +671,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BlockListFromJSON(jsonValue)); } @@ -662,17 +679,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of consensus blocks, sorted from most to least recent. */ - async consensusBlocksGet(requestParameters: ConsensusBlocksGetRequest): Promise { - const response = await this.consensusBlocksGetRaw(requestParameters); + async consensusBlocksGet(requestParameters: ConsensusBlocksGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusBlocksGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a consensus block. */ - async consensusBlocksHeightGetRaw(requestParameters: ConsensusBlocksHeightGetRequest): Promise> { - if (requestParameters.height === null || requestParameters.height === undefined) { - throw new runtime.RequiredError('height','Required parameter requestParameters.height was null or undefined when calling consensusBlocksHeightGet.'); + async consensusBlocksHeightGetRaw(requestParameters: ConsensusBlocksHeightGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['height'] == null) { + throw new runtime.RequiredError( + 'height', + 'Required parameter "height" was null or undefined when calling consensusBlocksHeightGet().' + ); } const queryParameters: any = {}; @@ -680,11 +700,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/blocks/{height}`.replace(`{${"height"}}`, encodeURIComponent(String(requestParameters.height))), + path: `/consensus/blocks/{height}`.replace(`{${"height"}}`, encodeURIComponent(String(requestParameters['height']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BlockFromJSON(jsonValue)); } @@ -692,17 +712,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a consensus block. */ - async consensusBlocksHeightGet(requestParameters: ConsensusBlocksHeightGetRequest): Promise { - const response = await this.consensusBlocksHeightGetRaw(requestParameters); + async consensusBlocksHeightGet(requestParameters: ConsensusBlocksHeightGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusBlocksHeightGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns an entity registered at the consensus layer. */ - async consensusEntitiesAddressGetRaw(requestParameters: ConsensusEntitiesAddressGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusEntitiesAddressGet.'); + async consensusEntitiesAddressGetRaw(requestParameters: ConsensusEntitiesAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusEntitiesAddressGet().' + ); } const queryParameters: any = {}; @@ -710,11 +733,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/entities/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/entities/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EntityFromJSON(jsonValue)); } @@ -722,37 +745,40 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns an entity registered at the consensus layer. */ - async consensusEntitiesAddressGet(requestParameters: ConsensusEntitiesAddressGetRequest): Promise { - const response = await this.consensusEntitiesAddressGetRaw(requestParameters); + async consensusEntitiesAddressGet(requestParameters: ConsensusEntitiesAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEntitiesAddressGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of nodes registered at the consensus layer. */ - async consensusEntitiesAddressNodesGetRaw(requestParameters: ConsensusEntitiesAddressNodesGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusEntitiesAddressNodesGet.'); + async consensusEntitiesAddressNodesGetRaw(requestParameters: ConsensusEntitiesAddressNodesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusEntitiesAddressNodesGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/entities/{address}/nodes`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/entities/{address}/nodes`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NodeListFromJSON(jsonValue)); } @@ -760,21 +786,27 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of nodes registered at the consensus layer. */ - async consensusEntitiesAddressNodesGet(requestParameters: ConsensusEntitiesAddressNodesGetRequest): Promise { - const response = await this.consensusEntitiesAddressNodesGetRaw(requestParameters); + async consensusEntitiesAddressNodesGet(requestParameters: ConsensusEntitiesAddressNodesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEntitiesAddressNodesGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a node registered at the consensus layer. */ - async consensusEntitiesAddressNodesNodeIdGetRaw(requestParameters: ConsensusEntitiesAddressNodesNodeIdGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusEntitiesAddressNodesNodeIdGet.'); + async consensusEntitiesAddressNodesNodeIdGetRaw(requestParameters: ConsensusEntitiesAddressNodesNodeIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusEntitiesAddressNodesNodeIdGet().' + ); } - if (requestParameters.nodeId === null || requestParameters.nodeId === undefined) { - throw new runtime.RequiredError('nodeId','Required parameter requestParameters.nodeId was null or undefined when calling consensusEntitiesAddressNodesNodeIdGet.'); + if (requestParameters['nodeId'] == null) { + throw new runtime.RequiredError( + 'nodeId', + 'Required parameter "nodeId" was null or undefined when calling consensusEntitiesAddressNodesNodeIdGet().' + ); } const queryParameters: any = {}; @@ -782,11 +814,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/entities/{address}/nodes/{node_id}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))).replace(`{${"node_id"}}`, encodeURIComponent(String(requestParameters.nodeId))), + path: `/consensus/entities/{address}/nodes/{node_id}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))).replace(`{${"node_id"}}`, encodeURIComponent(String(requestParameters['nodeId']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => NodeFromJSON(jsonValue)); } @@ -794,23 +826,23 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a node registered at the consensus layer. */ - async consensusEntitiesAddressNodesNodeIdGet(requestParameters: ConsensusEntitiesAddressNodesNodeIdGetRequest): Promise { - const response = await this.consensusEntitiesAddressNodesNodeIdGetRaw(requestParameters); + async consensusEntitiesAddressNodesNodeIdGet(requestParameters: ConsensusEntitiesAddressNodesNodeIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEntitiesAddressNodesNodeIdGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of entities registered at the consensus layer. */ - async consensusEntitiesGetRaw(requestParameters: ConsensusEntitiesGetRequest): Promise> { + async consensusEntitiesGetRaw(requestParameters: ConsensusEntitiesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -820,7 +852,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EntityListFromJSON(jsonValue)); } @@ -828,17 +860,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of entities registered at the consensus layer. */ - async consensusEntitiesGet(requestParameters: ConsensusEntitiesGetRequest): Promise { - const response = await this.consensusEntitiesGetRaw(requestParameters); + async consensusEntitiesGet(requestParameters: ConsensusEntitiesGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEntitiesGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a consensus epoch. */ - async consensusEpochsEpochGetRaw(requestParameters: ConsensusEpochsEpochGetRequest): Promise> { - if (requestParameters.epoch === null || requestParameters.epoch === undefined) { - throw new runtime.RequiredError('epoch','Required parameter requestParameters.epoch was null or undefined when calling consensusEpochsEpochGet.'); + async consensusEpochsEpochGetRaw(requestParameters: ConsensusEpochsEpochGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['epoch'] == null) { + throw new runtime.RequiredError( + 'epoch', + 'Required parameter "epoch" was null or undefined when calling consensusEpochsEpochGet().' + ); } const queryParameters: any = {}; @@ -846,11 +881,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/epochs/{epoch}`.replace(`{${"epoch"}}`, encodeURIComponent(String(requestParameters.epoch))), + path: `/consensus/epochs/{epoch}`.replace(`{${"epoch"}}`, encodeURIComponent(String(requestParameters['epoch']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EpochFromJSON(jsonValue)); } @@ -858,23 +893,23 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a consensus epoch. */ - async consensusEpochsEpochGet(requestParameters: ConsensusEpochsEpochGetRequest): Promise { - const response = await this.consensusEpochsEpochGetRaw(requestParameters); + async consensusEpochsEpochGet(requestParameters: ConsensusEpochsEpochGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEpochsEpochGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of consensus epochs. */ - async consensusEpochsGetRaw(requestParameters: ConsensusEpochsGetRequest): Promise> { + async consensusEpochsGetRaw(requestParameters: ConsensusEpochsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -884,7 +919,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EpochListFromJSON(jsonValue)); } @@ -892,43 +927,43 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of consensus epochs. */ - async consensusEpochsGet(requestParameters: ConsensusEpochsGetRequest): Promise { - const response = await this.consensusEpochsGetRaw(requestParameters); + async consensusEpochsGet(requestParameters: ConsensusEpochsGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEpochsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of consensus events. */ - async consensusEventsGetRaw(requestParameters: ConsensusEventsGetRequest): Promise> { + async consensusEventsGetRaw(requestParameters: ConsensusEventsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.block !== undefined) { - queryParameters['block'] = requestParameters.block; + if (requestParameters['block'] != null) { + queryParameters['block'] = requestParameters['block']; } - if (requestParameters.txIndex !== undefined) { - queryParameters['tx_index'] = requestParameters.txIndex; + if (requestParameters['txIndex'] != null) { + queryParameters['tx_index'] = requestParameters['txIndex']; } - if (requestParameters.txHash !== undefined) { - queryParameters['tx_hash'] = requestParameters.txHash; + if (requestParameters['txHash'] != null) { + queryParameters['tx_hash'] = requestParameters['txHash']; } - if (requestParameters.rel !== undefined) { - queryParameters['rel'] = requestParameters.rel; + if (requestParameters['rel'] != null) { + queryParameters['rel'] = requestParameters['rel']; } - if (requestParameters.type !== undefined) { - queryParameters['type'] = requestParameters.type; + if (requestParameters['type'] != null) { + queryParameters['type'] = requestParameters['type']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -938,7 +973,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ConsensusEventListFromJSON(jsonValue)); } @@ -946,31 +981,31 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of consensus events. */ - async consensusEventsGet(requestParameters: ConsensusEventsGetRequest): Promise { - const response = await this.consensusEventsGetRaw(requestParameters); + async consensusEventsGet(requestParameters: ConsensusEventsGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusEventsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of governance proposals. */ - async consensusProposalsGetRaw(requestParameters: ConsensusProposalsGetRequest): Promise> { + async consensusProposalsGetRaw(requestParameters: ConsensusProposalsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.submitter !== undefined) { - queryParameters['submitter'] = requestParameters.submitter; + if (requestParameters['submitter'] != null) { + queryParameters['submitter'] = requestParameters['submitter']; } - if (requestParameters.state !== undefined) { - queryParameters['state'] = requestParameters.state; + if (requestParameters['state'] != null) { + queryParameters['state'] = requestParameters['state']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -980,7 +1015,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ProposalListFromJSON(jsonValue)); } @@ -988,17 +1023,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of governance proposals. */ - async consensusProposalsGet(requestParameters: ConsensusProposalsGetRequest): Promise { - const response = await this.consensusProposalsGetRaw(requestParameters); + async consensusProposalsGet(requestParameters: ConsensusProposalsGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusProposalsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a governance proposal. */ - async consensusProposalsProposalIdGetRaw(requestParameters: ConsensusProposalsProposalIdGetRequest): Promise> { - if (requestParameters.proposalId === null || requestParameters.proposalId === undefined) { - throw new runtime.RequiredError('proposalId','Required parameter requestParameters.proposalId was null or undefined when calling consensusProposalsProposalIdGet.'); + async consensusProposalsProposalIdGetRaw(requestParameters: ConsensusProposalsProposalIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['proposalId'] == null) { + throw new runtime.RequiredError( + 'proposalId', + 'Required parameter "proposalId" was null or undefined when calling consensusProposalsProposalIdGet().' + ); } const queryParameters: any = {}; @@ -1006,11 +1044,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/proposals/{proposal_id}`.replace(`{${"proposal_id"}}`, encodeURIComponent(String(requestParameters.proposalId))), + path: `/consensus/proposals/{proposal_id}`.replace(`{${"proposal_id"}}`, encodeURIComponent(String(requestParameters['proposalId']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ProposalFromJSON(jsonValue)); } @@ -1018,37 +1056,40 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a governance proposal. */ - async consensusProposalsProposalIdGet(requestParameters: ConsensusProposalsProposalIdGetRequest): Promise { - const response = await this.consensusProposalsProposalIdGetRaw(requestParameters); + async consensusProposalsProposalIdGet(requestParameters: ConsensusProposalsProposalIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusProposalsProposalIdGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of votes for a governance proposal. */ - async consensusProposalsProposalIdVotesGetRaw(requestParameters: ConsensusProposalsProposalIdVotesGetRequest): Promise> { - if (requestParameters.proposalId === null || requestParameters.proposalId === undefined) { - throw new runtime.RequiredError('proposalId','Required parameter requestParameters.proposalId was null or undefined when calling consensusProposalsProposalIdVotesGet.'); + async consensusProposalsProposalIdVotesGetRaw(requestParameters: ConsensusProposalsProposalIdVotesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['proposalId'] == null) { + throw new runtime.RequiredError( + 'proposalId', + 'Required parameter "proposalId" was null or undefined when calling consensusProposalsProposalIdVotesGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/proposals/{proposal_id}/votes`.replace(`{${"proposal_id"}}`, encodeURIComponent(String(requestParameters.proposalId))), + path: `/consensus/proposals/{proposal_id}/votes`.replace(`{${"proposal_id"}}`, encodeURIComponent(String(requestParameters['proposalId']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ProposalVotesFromJSON(jsonValue)); } @@ -1056,42 +1097,45 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of votes for a governance proposal. */ - async consensusProposalsProposalIdVotesGet(requestParameters: ConsensusProposalsProposalIdVotesGetRequest): Promise { - const response = await this.consensusProposalsProposalIdVotesGetRaw(requestParameters); + async consensusProposalsProposalIdVotesGet(requestParameters: ConsensusProposalsProposalIdVotesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusProposalsProposalIdVotesGetRaw(requestParameters, initOverrides); return await response.value(); } /** */ - async consensusRoothashMessagesGetRaw(requestParameters: ConsensusRoothashMessagesGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling consensusRoothashMessagesGet.'); + async consensusRoothashMessagesGetRaw(requestParameters: ConsensusRoothashMessagesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling consensusRoothashMessagesGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.runtime !== undefined) { - queryParameters['runtime'] = requestParameters.runtime; + if (requestParameters['runtime'] != null) { + queryParameters['runtime'] = requestParameters['runtime']; } - if (requestParameters.round !== undefined) { - queryParameters['round'] = requestParameters.round; + if (requestParameters['round'] != null) { + queryParameters['round'] = requestParameters['round']; } - if (requestParameters.type !== undefined) { - queryParameters['type'] = requestParameters.type; + if (requestParameters['type'] != null) { + queryParameters['type'] = requestParameters['type']; } - if (requestParameters.rel !== undefined) { - queryParameters['rel'] = requestParameters.rel; + if (requestParameters['rel'] != null) { + queryParameters['rel'] = requestParameters['rel']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -1101,54 +1145,54 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RoothashMessageListFromJSON(jsonValue)); } /** */ - async consensusRoothashMessagesGet(requestParameters: ConsensusRoothashMessagesGetRequest): Promise { - const response = await this.consensusRoothashMessagesGetRaw(requestParameters); + async consensusRoothashMessagesGet(requestParameters: ConsensusRoothashMessagesGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusRoothashMessagesGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of consensus transactions. */ - async consensusTransactionsGetRaw(requestParameters: ConsensusTransactionsGetRequest): Promise> { + async consensusTransactionsGetRaw(requestParameters: ConsensusTransactionsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.block !== undefined) { - queryParameters['block'] = requestParameters.block; + if (requestParameters['block'] != null) { + queryParameters['block'] = requestParameters['block']; } - if (requestParameters.method !== undefined) { - queryParameters['method'] = requestParameters.method; + if (requestParameters['method'] != null) { + queryParameters['method'] = requestParameters['method']; } - if (requestParameters.sender !== undefined) { - queryParameters['sender'] = requestParameters.sender; + if (requestParameters['sender'] != null) { + queryParameters['sender'] = requestParameters['sender']; } - if (requestParameters.rel !== undefined) { - queryParameters['rel'] = requestParameters.rel; + if (requestParameters['rel'] != null) { + queryParameters['rel'] = requestParameters['rel']; } - if (requestParameters.after !== undefined) { - queryParameters['after'] = (requestParameters.after as any).toISOString(); + if (requestParameters['after'] != null) { + queryParameters['after'] = (requestParameters['after'] as any).toISOString(); } - if (requestParameters.before !== undefined) { - queryParameters['before'] = (requestParameters.before as any).toISOString(); + if (requestParameters['before'] != null) { + queryParameters['before'] = (requestParameters['before'] as any).toISOString(); } const headerParameters: runtime.HTTPHeaders = {}; @@ -1158,7 +1202,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TransactionListFromJSON(jsonValue)); } @@ -1166,17 +1210,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of consensus transactions. */ - async consensusTransactionsGet(requestParameters: ConsensusTransactionsGetRequest): Promise { - const response = await this.consensusTransactionsGetRaw(requestParameters); + async consensusTransactionsGet(requestParameters: ConsensusTransactionsGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusTransactionsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a consensus transaction. */ - async consensusTransactionsTxHashGetRaw(requestParameters: ConsensusTransactionsTxHashGetRequest): Promise> { - if (requestParameters.txHash === null || requestParameters.txHash === undefined) { - throw new runtime.RequiredError('txHash','Required parameter requestParameters.txHash was null or undefined when calling consensusTransactionsTxHashGet.'); + async consensusTransactionsTxHashGetRaw(requestParameters: ConsensusTransactionsTxHashGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['txHash'] == null) { + throw new runtime.RequiredError( + 'txHash', + 'Required parameter "txHash" was null or undefined when calling consensusTransactionsTxHashGet().' + ); } const queryParameters: any = {}; @@ -1184,11 +1231,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/transactions/{tx_hash}`.replace(`{${"tx_hash"}}`, encodeURIComponent(String(requestParameters.txHash))), + path: `/consensus/transactions/{tx_hash}`.replace(`{${"tx_hash"}}`, encodeURIComponent(String(requestParameters['txHash']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TransactionFromJSON(jsonValue)); } @@ -1196,17 +1243,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a consensus transaction. */ - async consensusTransactionsTxHashGet(requestParameters: ConsensusTransactionsTxHashGetRequest): Promise { - const response = await this.consensusTransactionsTxHashGetRaw(requestParameters); + async consensusTransactionsTxHashGet(requestParameters: ConsensusTransactionsTxHashGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusTransactionsTxHashGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a validator registered at the consensus layer. */ - async consensusValidatorsAddressGetRaw(requestParameters: ConsensusValidatorsAddressGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusValidatorsAddressGet.'); + async consensusValidatorsAddressGetRaw(requestParameters: ConsensusValidatorsAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusValidatorsAddressGet().' + ); } const queryParameters: any = {}; @@ -1214,11 +1264,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/validators/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/validators/{address}`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ValidatorListFromJSON(jsonValue)); } @@ -1226,45 +1276,48 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a validator registered at the consensus layer. */ - async consensusValidatorsAddressGet(requestParameters: ConsensusValidatorsAddressGetRequest): Promise { - const response = await this.consensusValidatorsAddressGetRaw(requestParameters); + async consensusValidatorsAddressGet(requestParameters: ConsensusValidatorsAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusValidatorsAddressGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns historical information for a single validator. */ - async consensusValidatorsAddressHistoryGetRaw(requestParameters: ConsensusValidatorsAddressHistoryGetRequest): Promise> { - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling consensusValidatorsAddressHistoryGet.'); + async consensusValidatorsAddressHistoryGetRaw(requestParameters: ConsensusValidatorsAddressHistoryGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling consensusValidatorsAddressHistoryGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.from !== undefined) { - queryParameters['from'] = requestParameters.from; + if (requestParameters['from'] != null) { + queryParameters['from'] = requestParameters['from']; } - if (requestParameters.to !== undefined) { - queryParameters['to'] = requestParameters.to; + if (requestParameters['to'] != null) { + queryParameters['to'] = requestParameters['to']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/consensus/validators/{address}/history`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/consensus/validators/{address}/history`.replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ValidatorHistoryFromJSON(jsonValue)); } @@ -1272,27 +1325,27 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns historical information for a single validator. */ - async consensusValidatorsAddressHistoryGet(requestParameters: ConsensusValidatorsAddressHistoryGetRequest): Promise { - const response = await this.consensusValidatorsAddressHistoryGetRaw(requestParameters); + async consensusValidatorsAddressHistoryGet(requestParameters: ConsensusValidatorsAddressHistoryGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusValidatorsAddressHistoryGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of validators registered at the consensus layer (the list includes all registered entities, even those without a currently active validator node). */ - async consensusValidatorsGetRaw(requestParameters: ConsensusValidatorsGetRequest): Promise> { + async consensusValidatorsGetRaw(requestParameters: ConsensusValidatorsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.name !== undefined) { - queryParameters['name'] = requestParameters.name; + if (requestParameters['name'] != null) { + queryParameters['name'] = requestParameters['name']; } const headerParameters: runtime.HTTPHeaders = {}; @@ -1302,7 +1355,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ValidatorListFromJSON(jsonValue)); } @@ -1310,15 +1363,15 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of validators registered at the consensus layer (the list includes all registered entities, even those without a currently active validator node). */ - async consensusValidatorsGet(requestParameters: ConsensusValidatorsGetRequest): Promise { - const response = await this.consensusValidatorsGetRaw(requestParameters); + async consensusValidatorsGet(requestParameters: ConsensusValidatorsGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.consensusValidatorsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns the status of indexing. */ - async getStatusRaw(): Promise> { + async getStatusRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; @@ -1328,7 +1381,7 @@ export class DefaultApi extends runtime.BaseAPI { method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StatusFromJSON(jsonValue)); } @@ -1336,41 +1389,44 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns the status of indexing. */ - async getStatus(): Promise { - const response = await this.getStatusRaw(); + async getStatus(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getStatusRaw(initOverrides); return await response.value(); } /** * Returns a (sliding) timeline of the recorded daily unique active accounts for either consensus or one of the paratimes. */ - async layerStatsActiveAccountsGetRaw(requestParameters: LayerStatsActiveAccountsGetRequest): Promise> { - if (requestParameters.layer === null || requestParameters.layer === undefined) { - throw new runtime.RequiredError('layer','Required parameter requestParameters.layer was null or undefined when calling layerStatsActiveAccountsGet.'); + async layerStatsActiveAccountsGetRaw(requestParameters: LayerStatsActiveAccountsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['layer'] == null) { + throw new runtime.RequiredError( + 'layer', + 'Required parameter "layer" was null or undefined when calling layerStatsActiveAccountsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.windowStepSeconds !== undefined) { - queryParameters['window_step_seconds'] = requestParameters.windowStepSeconds; + if (requestParameters['windowStepSeconds'] != null) { + queryParameters['window_step_seconds'] = requestParameters['windowStepSeconds']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{layer}/stats/active_accounts`.replace(`{${"layer"}}`, encodeURIComponent(String(requestParameters.layer))), + path: `/{layer}/stats/active_accounts`.replace(`{${"layer"}}`, encodeURIComponent(String(requestParameters['layer']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ActiveAccountsListFromJSON(jsonValue)); } @@ -1378,45 +1434,48 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a (sliding) timeline of the recorded daily unique active accounts for either consensus or one of the paratimes. */ - async layerStatsActiveAccountsGet(requestParameters: LayerStatsActiveAccountsGetRequest): Promise { - const response = await this.layerStatsActiveAccountsGetRaw(requestParameters); + async layerStatsActiveAccountsGet(requestParameters: LayerStatsActiveAccountsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.layerStatsActiveAccountsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a timeline of the transaction volume at the chosen granularity, for either consensus or one of the paratimes. */ - async layerStatsTxVolumeGetRaw(requestParameters: LayerStatsTxVolumeGetRequest): Promise> { - if (requestParameters.layer === null || requestParameters.layer === undefined) { - throw new runtime.RequiredError('layer','Required parameter requestParameters.layer was null or undefined when calling layerStatsTxVolumeGet.'); + async layerStatsTxVolumeGetRaw(requestParameters: LayerStatsTxVolumeGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['layer'] == null) { + throw new runtime.RequiredError( + 'layer', + 'Required parameter "layer" was null or undefined when calling layerStatsTxVolumeGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.windowSizeSeconds !== undefined) { - queryParameters['window_size_seconds'] = requestParameters.windowSizeSeconds; + if (requestParameters['windowSizeSeconds'] != null) { + queryParameters['window_size_seconds'] = requestParameters['windowSizeSeconds']; } - if (requestParameters.windowStepSeconds !== undefined) { - queryParameters['window_step_seconds'] = requestParameters.windowStepSeconds; + if (requestParameters['windowStepSeconds'] != null) { + queryParameters['window_step_seconds'] = requestParameters['windowStepSeconds']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{layer}/stats/tx_volume`.replace(`{${"layer"}}`, encodeURIComponent(String(requestParameters.layer))), + path: `/{layer}/stats/tx_volume`.replace(`{${"layer"}}`, encodeURIComponent(String(requestParameters['layer']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TxVolumeListFromJSON(jsonValue)); } @@ -1424,21 +1483,27 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a timeline of the transaction volume at the chosen granularity, for either consensus or one of the paratimes. */ - async layerStatsTxVolumeGet(requestParameters: LayerStatsTxVolumeGetRequest): Promise { - const response = await this.layerStatsTxVolumeGetRaw(requestParameters); + async layerStatsTxVolumeGet(requestParameters: LayerStatsTxVolumeGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.layerStatsTxVolumeGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a runtime account. */ - async runtimeAccountsAddressGetRaw(requestParameters: RuntimeAccountsAddressGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeAccountsAddressGet.'); + async runtimeAccountsAddressGetRaw(requestParameters: RuntimeAccountsAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeAccountsAddressGet().' + ); } - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling runtimeAccountsAddressGet.'); + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling runtimeAccountsAddressGet().' + ); } const queryParameters: any = {}; @@ -1446,11 +1511,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/accounts/{address}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/{runtime}/accounts/{address}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RuntimeAccountFromJSON(jsonValue)); } @@ -1458,45 +1523,51 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a runtime account. */ - async runtimeAccountsAddressGet(requestParameters: RuntimeAccountsAddressGetRequest): Promise { - const response = await this.runtimeAccountsAddressGetRaw(requestParameters); + async runtimeAccountsAddressGet(requestParameters: RuntimeAccountsAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeAccountsAddressGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns the list of non-fungible token (NFT) instances owned by an account. */ - async runtimeAccountsAddressNftsGetRaw(requestParameters: RuntimeAccountsAddressNftsGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeAccountsAddressNftsGet.'); + async runtimeAccountsAddressNftsGetRaw(requestParameters: RuntimeAccountsAddressNftsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeAccountsAddressNftsGet().' + ); } - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling runtimeAccountsAddressNftsGet.'); + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling runtimeAccountsAddressNftsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.tokenAddress !== undefined) { - queryParameters['token_address'] = requestParameters.tokenAddress; + if (requestParameters['tokenAddress'] != null) { + queryParameters['token_address'] = requestParameters['tokenAddress']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/accounts/{address}/nfts`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/{runtime}/accounts/{address}/nfts`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EvmNftListFromJSON(jsonValue)); } @@ -1504,57 +1575,60 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns the list of non-fungible token (NFT) instances owned by an account. */ - async runtimeAccountsAddressNftsGet(requestParameters: RuntimeAccountsAddressNftsGetRequest): Promise { - const response = await this.runtimeAccountsAddressNftsGetRaw(requestParameters); + async runtimeAccountsAddressNftsGet(requestParameters: RuntimeAccountsAddressNftsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeAccountsAddressNftsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of Runtime blocks. */ - async runtimeBlocksGetRaw(requestParameters: RuntimeBlocksGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeBlocksGet.'); + async runtimeBlocksGetRaw(requestParameters: RuntimeBlocksGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeBlocksGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.from !== undefined) { - queryParameters['from'] = requestParameters.from; + if (requestParameters['from'] != null) { + queryParameters['from'] = requestParameters['from']; } - if (requestParameters.to !== undefined) { - queryParameters['to'] = requestParameters.to; + if (requestParameters['to'] != null) { + queryParameters['to'] = requestParameters['to']; } - if (requestParameters.after !== undefined) { - queryParameters['after'] = (requestParameters.after as any).toISOString(); + if (requestParameters['after'] != null) { + queryParameters['after'] = (requestParameters['after'] as any).toISOString(); } - if (requestParameters.before !== undefined) { - queryParameters['before'] = (requestParameters.before as any).toISOString(); + if (requestParameters['before'] != null) { + queryParameters['before'] = (requestParameters['before'] as any).toISOString(); } - if (requestParameters.hash !== undefined) { - queryParameters['hash'] = requestParameters.hash; + if (requestParameters['hash'] != null) { + queryParameters['hash'] = requestParameters['hash']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/blocks`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))), + path: `/{runtime}/blocks`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RuntimeBlockListFromJSON(jsonValue)); } @@ -1562,69 +1636,72 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of Runtime blocks. */ - async runtimeBlocksGet(requestParameters: RuntimeBlocksGetRequest): Promise { - const response = await this.runtimeBlocksGetRaw(requestParameters); + async runtimeBlocksGet(requestParameters: RuntimeBlocksGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeBlocksGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of runtime events. */ - async runtimeEventsGetRaw(requestParameters: RuntimeEventsGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeEventsGet.'); + async runtimeEventsGetRaw(requestParameters: RuntimeEventsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeEventsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.block !== undefined) { - queryParameters['block'] = requestParameters.block; + if (requestParameters['block'] != null) { + queryParameters['block'] = requestParameters['block']; } - if (requestParameters.txIndex !== undefined) { - queryParameters['tx_index'] = requestParameters.txIndex; + if (requestParameters['txIndex'] != null) { + queryParameters['tx_index'] = requestParameters['txIndex']; } - if (requestParameters.txHash !== undefined) { - queryParameters['tx_hash'] = requestParameters.txHash; + if (requestParameters['txHash'] != null) { + queryParameters['tx_hash'] = requestParameters['txHash']; } - if (requestParameters.type !== undefined) { - queryParameters['type'] = requestParameters.type; + if (requestParameters['type'] != null) { + queryParameters['type'] = requestParameters['type']; } - if (requestParameters.rel !== undefined) { - queryParameters['rel'] = requestParameters.rel; + if (requestParameters['rel'] != null) { + queryParameters['rel'] = requestParameters['rel']; } - if (requestParameters.evmLogSignature !== undefined) { - queryParameters['evm_log_signature'] = requestParameters.evmLogSignature; + if (requestParameters['evmLogSignature'] != null) { + queryParameters['evm_log_signature'] = requestParameters['evmLogSignature']; } - if (requestParameters.contractAddress !== undefined) { - queryParameters['contract_address'] = requestParameters.contractAddress; + if (requestParameters['contractAddress'] != null) { + queryParameters['contract_address'] = requestParameters['contractAddress']; } - if (requestParameters.nftId !== undefined) { - queryParameters['nft_id'] = requestParameters.nftId; + if (requestParameters['nftId'] != null) { + queryParameters['nft_id'] = requestParameters['nftId']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/events`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))), + path: `/{runtime}/events`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RuntimeEventListFromJSON(jsonValue)); } @@ -1632,21 +1709,27 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of runtime events. */ - async runtimeEventsGet(requestParameters: RuntimeEventsGetRequest): Promise { - const response = await this.runtimeEventsGetRaw(requestParameters); + async runtimeEventsGet(requestParameters: RuntimeEventsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeEventsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns info on an EVM (ERC-20, ...) token on the runtime. */ - async runtimeEvmTokensAddressGetRaw(requestParameters: RuntimeEvmTokensAddressGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeEvmTokensAddressGet.'); + async runtimeEvmTokensAddressGetRaw(requestParameters: RuntimeEvmTokensAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeEvmTokensAddressGet().' + ); } - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling runtimeEvmTokensAddressGet.'); + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling runtimeEvmTokensAddressGet().' + ); } const queryParameters: any = {}; @@ -1654,11 +1737,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/evm_tokens/{address}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/{runtime}/evm_tokens/{address}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EvmTokenFromJSON(jsonValue)); } @@ -1666,41 +1749,47 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns info on an EVM (ERC-20, ...) token on the runtime. */ - async runtimeEvmTokensAddressGet(requestParameters: RuntimeEvmTokensAddressGetRequest): Promise { - const response = await this.runtimeEvmTokensAddressGetRaw(requestParameters); + async runtimeEvmTokensAddressGet(requestParameters: RuntimeEvmTokensAddressGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeEvmTokensAddressGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns the list of holders of an EVM (ERC-20, ...) token. This endpoint does not verify that `address` is actually an EVM token; if it is not, it will simply return an empty list. */ - async runtimeEvmTokensAddressHoldersGetRaw(requestParameters: RuntimeEvmTokensAddressHoldersGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeEvmTokensAddressHoldersGet.'); + async runtimeEvmTokensAddressHoldersGetRaw(requestParameters: RuntimeEvmTokensAddressHoldersGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeEvmTokensAddressHoldersGet().' + ); } - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling runtimeEvmTokensAddressHoldersGet.'); + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling runtimeEvmTokensAddressHoldersGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/evm_tokens/{address}/holders`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/{runtime}/evm_tokens/{address}/holders`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => TokenHolderListFromJSON(jsonValue)); } @@ -1708,41 +1797,47 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns the list of holders of an EVM (ERC-20, ...) token. This endpoint does not verify that `address` is actually an EVM token; if it is not, it will simply return an empty list. */ - async runtimeEvmTokensAddressHoldersGet(requestParameters: RuntimeEvmTokensAddressHoldersGetRequest): Promise { - const response = await this.runtimeEvmTokensAddressHoldersGetRaw(requestParameters); + async runtimeEvmTokensAddressHoldersGet(requestParameters: RuntimeEvmTokensAddressHoldersGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeEvmTokensAddressHoldersGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns the list of non-fungible token (NFT) instances of an EVM (ERC-721, ...) token. This endpoint does not verify that `address` is actually an EVM token; if it is not, it will simply return an empty list. */ - async runtimeEvmTokensAddressNftsGetRaw(requestParameters: RuntimeEvmTokensAddressNftsGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeEvmTokensAddressNftsGet.'); + async runtimeEvmTokensAddressNftsGetRaw(requestParameters: RuntimeEvmTokensAddressNftsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeEvmTokensAddressNftsGet().' + ); } - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling runtimeEvmTokensAddressNftsGet.'); + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling runtimeEvmTokensAddressNftsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/evm_tokens/{address}/nfts`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))), + path: `/{runtime}/evm_tokens/{address}/nfts`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EvmNftListFromJSON(jsonValue)); } @@ -1750,25 +1845,34 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns the list of non-fungible token (NFT) instances of an EVM (ERC-721, ...) token. This endpoint does not verify that `address` is actually an EVM token; if it is not, it will simply return an empty list. */ - async runtimeEvmTokensAddressNftsGet(requestParameters: RuntimeEvmTokensAddressNftsGetRequest): Promise { - const response = await this.runtimeEvmTokensAddressNftsGetRaw(requestParameters); + async runtimeEvmTokensAddressNftsGet(requestParameters: RuntimeEvmTokensAddressNftsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeEvmTokensAddressNftsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns the non-fungible token (NFT) instance of an EVM (ERC-721, ...) token. */ - async runtimeEvmTokensAddressNftsIdGetRaw(requestParameters: RuntimeEvmTokensAddressNftsIdGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeEvmTokensAddressNftsIdGet.'); + async runtimeEvmTokensAddressNftsIdGetRaw(requestParameters: RuntimeEvmTokensAddressNftsIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeEvmTokensAddressNftsIdGet().' + ); } - if (requestParameters.address === null || requestParameters.address === undefined) { - throw new runtime.RequiredError('address','Required parameter requestParameters.address was null or undefined when calling runtimeEvmTokensAddressNftsIdGet.'); + if (requestParameters['address'] == null) { + throw new runtime.RequiredError( + 'address', + 'Required parameter "address" was null or undefined when calling runtimeEvmTokensAddressNftsIdGet().' + ); } - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling runtimeEvmTokensAddressNftsIdGet.'); + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling runtimeEvmTokensAddressNftsIdGet().' + ); } const queryParameters: any = {}; @@ -1776,11 +1880,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/evm_tokens/{address}/nfts/{id}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters.address))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + path: `/{runtime}/evm_tokens/{address}/nfts/{id}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"address"}}`, encodeURIComponent(String(requestParameters['address']))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EvmNftFromJSON(jsonValue)); } @@ -1788,41 +1892,44 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns the non-fungible token (NFT) instance of an EVM (ERC-721, ...) token. */ - async runtimeEvmTokensAddressNftsIdGet(requestParameters: RuntimeEvmTokensAddressNftsIdGetRequest): Promise { - const response = await this.runtimeEvmTokensAddressNftsIdGetRaw(requestParameters); + async runtimeEvmTokensAddressNftsIdGet(requestParameters: RuntimeEvmTokensAddressNftsIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeEvmTokensAddressNftsIdGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of EVM (ERC-20, ...) tokens on the runtime. */ - async runtimeEvmTokensGetRaw(requestParameters: RuntimeEvmTokensGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeEvmTokensGet.'); + async runtimeEvmTokensGetRaw(requestParameters: RuntimeEvmTokensGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeEvmTokensGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.name !== undefined) { - queryParameters['name'] = requestParameters.name; + if (requestParameters['name'] != null) { + queryParameters['name'] = requestParameters['name']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/evm_tokens`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))), + path: `/{runtime}/evm_tokens`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EvmTokenListFromJSON(jsonValue)); } @@ -1830,17 +1937,20 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of EVM (ERC-20, ...) tokens on the runtime. */ - async runtimeEvmTokensGet(requestParameters: RuntimeEvmTokensGetRequest): Promise { - const response = await this.runtimeEvmTokensGetRaw(requestParameters); + async runtimeEvmTokensGet(requestParameters: RuntimeEvmTokensGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeEvmTokensGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns the runtime status. */ - async runtimeStatusGetRaw(requestParameters: RuntimeStatusGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeStatusGet.'); + async runtimeStatusGetRaw(requestParameters: RuntimeStatusGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeStatusGet().' + ); } const queryParameters: any = {}; @@ -1848,11 +1958,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/status`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))), + path: `/{runtime}/status`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RuntimeStatusFromJSON(jsonValue)); } @@ -1860,53 +1970,56 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns the runtime status. */ - async runtimeStatusGet(requestParameters: RuntimeStatusGetRequest): Promise { - const response = await this.runtimeStatusGetRaw(requestParameters); + async runtimeStatusGet(requestParameters: RuntimeStatusGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeStatusGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns a list of Runtime transactions. */ - async runtimeTransactionsGetRaw(requestParameters: RuntimeTransactionsGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeTransactionsGet.'); + async runtimeTransactionsGetRaw(requestParameters: RuntimeTransactionsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeTransactionsGet().' + ); } const queryParameters: any = {}; - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; + if (requestParameters['limit'] != null) { + queryParameters['limit'] = requestParameters['limit']; } - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; + if (requestParameters['offset'] != null) { + queryParameters['offset'] = requestParameters['offset']; } - if (requestParameters.block !== undefined) { - queryParameters['block'] = requestParameters.block; + if (requestParameters['block'] != null) { + queryParameters['block'] = requestParameters['block']; } - if (requestParameters.after !== undefined) { - queryParameters['after'] = (requestParameters.after as any).toISOString(); + if (requestParameters['after'] != null) { + queryParameters['after'] = (requestParameters['after'] as any).toISOString(); } - if (requestParameters.before !== undefined) { - queryParameters['before'] = (requestParameters.before as any).toISOString(); + if (requestParameters['before'] != null) { + queryParameters['before'] = (requestParameters['before'] as any).toISOString(); } - if (requestParameters.rel !== undefined) { - queryParameters['rel'] = requestParameters.rel; + if (requestParameters['rel'] != null) { + queryParameters['rel'] = requestParameters['rel']; } const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/transactions`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))), + path: `/{runtime}/transactions`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RuntimeTransactionListFromJSON(jsonValue)); } @@ -1914,21 +2027,27 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns a list of Runtime transactions. */ - async runtimeTransactionsGet(requestParameters: RuntimeTransactionsGetRequest): Promise { - const response = await this.runtimeTransactionsGetRaw(requestParameters); + async runtimeTransactionsGet(requestParameters: RuntimeTransactionsGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeTransactionsGetRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns runtime transactions with the given transaction hash. */ - async runtimeTransactionsTxHashGetRaw(requestParameters: RuntimeTransactionsTxHashGetRequest): Promise> { - if (requestParameters.runtime === null || requestParameters.runtime === undefined) { - throw new runtime.RequiredError('runtime','Required parameter requestParameters.runtime was null or undefined when calling runtimeTransactionsTxHashGet.'); + async runtimeTransactionsTxHashGetRaw(requestParameters: RuntimeTransactionsTxHashGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['runtime'] == null) { + throw new runtime.RequiredError( + 'runtime', + 'Required parameter "runtime" was null or undefined when calling runtimeTransactionsTxHashGet().' + ); } - if (requestParameters.txHash === null || requestParameters.txHash === undefined) { - throw new runtime.RequiredError('txHash','Required parameter requestParameters.txHash was null or undefined when calling runtimeTransactionsTxHashGet.'); + if (requestParameters['txHash'] == null) { + throw new runtime.RequiredError( + 'txHash', + 'Required parameter "txHash" was null or undefined when calling runtimeTransactionsTxHashGet().' + ); } const queryParameters: any = {}; @@ -1936,11 +2055,11 @@ export class DefaultApi extends runtime.BaseAPI { const headerParameters: runtime.HTTPHeaders = {}; const response = await this.request({ - path: `/{runtime}/transactions/{tx_hash}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters.runtime))).replace(`{${"tx_hash"}}`, encodeURIComponent(String(requestParameters.txHash))), + path: `/{runtime}/transactions/{tx_hash}`.replace(`{${"runtime"}}`, encodeURIComponent(String(requestParameters['runtime']))).replace(`{${"tx_hash"}}`, encodeURIComponent(String(requestParameters['txHash']))), method: 'GET', headers: headerParameters, query: queryParameters, - }); + }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => RuntimeTransactionListFromJSON(jsonValue)); } @@ -1948,8 +2067,8 @@ export class DefaultApi extends runtime.BaseAPI { /** * Returns runtime transactions with the given transaction hash. */ - async runtimeTransactionsTxHashGet(requestParameters: RuntimeTransactionsTxHashGetRequest): Promise { - const response = await this.runtimeTransactionsTxHashGetRaw(requestParameters); + async runtimeTransactionsTxHashGet(requestParameters: RuntimeTransactionsTxHashGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runtimeTransactionsTxHashGetRaw(requestParameters, initOverrides); return await response.value(); } diff --git a/src/vendors/nexus/apis/index.ts b/src/vendors/nexus/apis/index.ts index 20eda2ab0a..69c44c00fa 100644 --- a/src/vendors/nexus/apis/index.ts +++ b/src/vendors/nexus/apis/index.ts @@ -1 +1,3 @@ -export * from './DefaultApi' +/* tslint:disable */ +/* eslint-disable */ +export * from './DefaultApi'; diff --git a/src/vendors/nexus/index.ts b/src/vendors/nexus/index.ts index 36e2d32324..bebe8bbbe2 100644 --- a/src/vendors/nexus/index.ts +++ b/src/vendors/nexus/index.ts @@ -1,3 +1,5 @@ -export * from './runtime' -export * from './apis' -export * from './models' +/* tslint:disable */ +/* eslint-disable */ +export * from './runtime'; +export * from './apis/index'; +export * from './models/index'; diff --git a/src/vendors/nexus/models/Account.ts b/src/vendors/nexus/models/Account.ts index 777086ff74..5307dcc3a5 100644 --- a/src/vendors/nexus/models/Account.ts +++ b/src/vendors/nexus/models/Account.ts @@ -12,20 +12,25 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { Allowance } from './Allowance'; import { - AccountStats, - AccountStatsFromJSON, - AccountStatsFromJSONTyped, - AccountStatsToJSON, - Allowance, AllowanceFromJSON, AllowanceFromJSONTyped, AllowanceToJSON, -} from './'; + AllowanceToJSONTyped, +} from './Allowance'; +import type { AccountStats } from './AccountStats'; +import { + AccountStatsFromJSON, + AccountStatsFromJSONTyped, + AccountStatsToJSON, + AccountStatsToJSONTyped, +} from './AccountStats'; /** * A consensus layer account. + * * @export * @interface Account */ @@ -75,6 +80,7 @@ export interface Account { /** * The second-granular consensus time of the block in which this account was first active. * Dates before Cobalt (2021-04-28) are approximate. + * * @type {Date} * @memberof Account */ @@ -82,6 +88,7 @@ export interface Account { /** * The allowances made by this account. * This field is omitted when listing multiple accounts. + * * @type {Array} * @memberof Account */ @@ -94,12 +101,28 @@ export interface Account { stats: AccountStats; } +/** + * Check if a given object implements the Account interface. + */ +export function instanceOfAccount(value: object): value is Account { + if (!('address' in value) || value['address'] === undefined) return false; + if (!('nonce' in value) || value['nonce'] === undefined) return false; + if (!('available' in value) || value['available'] === undefined) return false; + if (!('escrow' in value) || value['escrow'] === undefined) return false; + if (!('debonding' in value) || value['debonding'] === undefined) return false; + if (!('delegations_balance' in value) || value['delegations_balance'] === undefined) return false; + if (!('debonding_delegations_balance' in value) || value['debonding_delegations_balance'] === undefined) return false; + if (!('allowances' in value) || value['allowances'] === undefined) return false; + if (!('stats' in value) || value['stats'] === undefined) return false; + return true; +} + export function AccountFromJSON(json: any): Account { return AccountFromJSONTyped(json, false); } export function AccountFromJSONTyped(json: any, ignoreDiscriminator: boolean): Account { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -111,32 +134,33 @@ export function AccountFromJSONTyped(json: any, ignoreDiscriminator: boolean): A 'debonding': json['debonding'], 'delegations_balance': json['delegations_balance'], 'debonding_delegations_balance': json['debonding_delegations_balance'], - 'first_activity': !exists(json, 'first_activity') ? undefined : (new Date(json['first_activity'])), + 'first_activity': json['first_activity'] == null ? undefined : (new Date(json['first_activity'])), 'allowances': ((json['allowances'] as Array).map(AllowanceFromJSON)), 'stats': AccountStatsFromJSON(json['stats']), }; } -export function AccountToJSON(value?: Account | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function AccountToJSON(json: any): Account { + return AccountToJSONTyped(json, false); +} + +export function AccountToJSONTyped(value?: Account | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'address': value.address, - 'nonce': value.nonce, - 'available': value.available, - 'escrow': value.escrow, - 'debonding': value.debonding, - 'delegations_balance': value.delegations_balance, - 'debonding_delegations_balance': value.debonding_delegations_balance, - 'first_activity': value.first_activity === undefined ? undefined : (value.first_activity.toISOString()), - 'allowances': ((value.allowances as Array).map(AllowanceToJSON)), - 'stats': AccountStatsToJSON(value.stats), + 'address': value['address'], + 'nonce': value['nonce'], + 'available': value['available'], + 'escrow': value['escrow'], + 'debonding': value['debonding'], + 'delegations_balance': value['delegations_balance'], + 'debonding_delegations_balance': value['debonding_delegations_balance'], + 'first_activity': value['first_activity'] == null ? undefined : ((value['first_activity']).toISOString()), + 'allowances': ((value['allowances'] as Array).map(AllowanceToJSON)), + 'stats': AccountStatsToJSON(value['stats']), }; } - diff --git a/src/vendors/nexus/models/AccountList.ts b/src/vendors/nexus/models/AccountList.ts index d68b71113a..44131e2185 100644 --- a/src/vendors/nexus/models/AccountList.ts +++ b/src/vendors/nexus/models/AccountList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { AccountListAllOfAccounts } from './AccountListAllOfAccounts'; import { - Account, - AccountFromJSON, - AccountFromJSONTyped, - AccountToJSON, - AccountListAllOf, - AccountListAllOfFromJSON, - AccountListAllOfFromJSONTyped, - AccountListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + AccountListAllOfAccountsFromJSON, + AccountListAllOfAccountsFromJSONTyped, + AccountListAllOfAccountsToJSON, + AccountListAllOfAccountsToJSONTyped, +} from './AccountListAllOfAccounts'; /** * @@ -37,6 +30,7 @@ export interface AccountList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof AccountList */ @@ -49,10 +43,20 @@ export interface AccountList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof AccountList */ - accounts: Array; + accounts: Array; +} + +/** + * Check if a given object implements the AccountList interface. + */ +export function instanceOfAccountList(value: object): value is AccountList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('accounts' in value) || value['accounts'] === undefined) return false; + return true; } export function AccountListFromJSON(json: any): AccountList { @@ -60,30 +64,31 @@ export function AccountListFromJSON(json: any): AccountList { } export function AccountListFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'accounts': ((json['accounts'] as Array).map(AccountFromJSON)), + 'accounts': ((json['accounts'] as Array).map(AccountListAllOfAccountsFromJSON)), }; } -export function AccountListToJSON(value?: AccountList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function AccountListToJSON(json: any): AccountList { + return AccountListToJSONTyped(json, false); +} + +export function AccountListToJSONTyped(value?: AccountList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'accounts': ((value.accounts as Array).map(AccountToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'accounts': ((value['accounts'] as Array).map(AccountListAllOfAccountsToJSON)), }; } - diff --git a/src/vendors/nexus/models/AccountListAllOfAccounts.ts b/src/vendors/nexus/models/AccountListAllOfAccounts.ts new file mode 100644 index 0000000000..1a2d3b728b --- /dev/null +++ b/src/vendors/nexus/models/AccountListAllOfAccounts.ts @@ -0,0 +1,165 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Allowance } from './Allowance'; +import { + AllowanceFromJSON, + AllowanceFromJSONTyped, + AllowanceToJSON, + AllowanceToJSONTyped, +} from './Allowance'; +import type { AccountStats } from './AccountStats'; +import { + AccountStatsFromJSON, + AccountStatsFromJSONTyped, + AccountStatsToJSON, + AccountStatsToJSONTyped, +} from './AccountStats'; + +/** + * + * @export + * @interface AccountListAllOfAccounts + */ +export interface AccountListAllOfAccounts { + /** + * The staking address for this account. + * @type {string} + * @memberof AccountListAllOfAccounts + */ + address: string; + /** + * The expected nonce for the next transaction (= last used nonce + 1) + * @type {number} + * @memberof AccountListAllOfAccounts + */ + nonce: number; + /** + * The available balance, in base units. + * @type {string} + * @memberof AccountListAllOfAccounts + */ + available: string; + /** + * The active escrow balance, in base units. + * @type {string} + * @memberof AccountListAllOfAccounts + */ + escrow: string; + /** + * The debonding escrow balance, in base units. + * @type {string} + * @memberof AccountListAllOfAccounts + */ + debonding: string; + /** + * The balance of this accounts' (outgoing) delegations, in base units. + * @type {string} + * @memberof AccountListAllOfAccounts + */ + delegations_balance: string; + /** + * The balance of this accounts' (outgoing) debonding delegations, in base units. + * @type {string} + * @memberof AccountListAllOfAccounts + */ + debonding_delegations_balance: string; + /** + * The second-granular consensus time of the block in which this account was first active. + * Dates before Cobalt (2021-04-28) are approximate. + * + * @type {Date} + * @memberof AccountListAllOfAccounts + */ + first_activity?: Date; + /** + * The allowances made by this account. + * This field is omitted when listing multiple accounts. + * + * @type {Array} + * @memberof AccountListAllOfAccounts + */ + allowances: Array; + /** + * + * @type {AccountStats} + * @memberof AccountListAllOfAccounts + */ + stats: AccountStats; +} + +/** + * Check if a given object implements the AccountListAllOfAccounts interface. + */ +export function instanceOfAccountListAllOfAccounts(value: object): value is AccountListAllOfAccounts { + if (!('address' in value) || value['address'] === undefined) return false; + if (!('nonce' in value) || value['nonce'] === undefined) return false; + if (!('available' in value) || value['available'] === undefined) return false; + if (!('escrow' in value) || value['escrow'] === undefined) return false; + if (!('debonding' in value) || value['debonding'] === undefined) return false; + if (!('delegations_balance' in value) || value['delegations_balance'] === undefined) return false; + if (!('debonding_delegations_balance' in value) || value['debonding_delegations_balance'] === undefined) return false; + if (!('allowances' in value) || value['allowances'] === undefined) return false; + if (!('stats' in value) || value['stats'] === undefined) return false; + return true; +} + +export function AccountListAllOfAccountsFromJSON(json: any): AccountListAllOfAccounts { + return AccountListAllOfAccountsFromJSONTyped(json, false); +} + +export function AccountListAllOfAccountsFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountListAllOfAccounts { + if (json == null) { + return json; + } + return { + + 'address': json['address'], + 'nonce': json['nonce'], + 'available': json['available'], + 'escrow': json['escrow'], + 'debonding': json['debonding'], + 'delegations_balance': json['delegations_balance'], + 'debonding_delegations_balance': json['debonding_delegations_balance'], + 'first_activity': json['first_activity'] == null ? undefined : (new Date(json['first_activity'])), + 'allowances': ((json['allowances'] as Array).map(AllowanceFromJSON)), + 'stats': AccountStatsFromJSON(json['stats']), + }; +} + +export function AccountListAllOfAccountsToJSON(json: any): AccountListAllOfAccounts { + return AccountListAllOfAccountsToJSONTyped(json, false); +} + +export function AccountListAllOfAccountsToJSONTyped(value?: AccountListAllOfAccounts | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'address': value['address'], + 'nonce': value['nonce'], + 'available': value['available'], + 'escrow': value['escrow'], + 'debonding': value['debonding'], + 'delegations_balance': value['delegations_balance'], + 'debonding_delegations_balance': value['debonding_delegations_balance'], + 'first_activity': value['first_activity'] == null ? undefined : ((value['first_activity']).toISOString()), + 'allowances': ((value['allowances'] as Array).map(AllowanceToJSON)), + 'stats': AccountStatsToJSON(value['stats']), + }; +} + diff --git a/src/vendors/nexus/models/AccountStats.ts b/src/vendors/nexus/models/AccountStats.ts index 16cefdc71f..bb2bf8f201 100644 --- a/src/vendors/nexus/models/AccountStats.ts +++ b/src/vendors/nexus/models/AccountStats.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -23,16 +23,20 @@ export interface AccountStats { * The total amount of native tokens sent, in base units. * DEPRECATED: This field might be inaccurate. Nexus is currently not able to track * certain actions which subtract/add tokens. + * * @type {string} * @memberof AccountStats + * @deprecated */ total_sent?: string; /** * The total amount of native tokens received, in base units. * DEPRECATED: This field might be inaccurate. Nexus is currently not able to track * certain actions which subtract/add tokens. + * * @type {string} * @memberof AccountStats + * @deprecated */ total_received?: string; /** @@ -43,35 +47,44 @@ export interface AccountStats { num_txns: number; } +/** + * Check if a given object implements the AccountStats interface. + */ +export function instanceOfAccountStats(value: object): value is AccountStats { + if (!('num_txns' in value) || value['num_txns'] === undefined) return false; + return true; +} + export function AccountStatsFromJSON(json: any): AccountStats { return AccountStatsFromJSONTyped(json, false); } export function AccountStatsFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccountStats { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'total_sent': !exists(json, 'total_sent') ? undefined : json['total_sent'], - 'total_received': !exists(json, 'total_received') ? undefined : json['total_received'], + 'total_sent': json['total_sent'] == null ? undefined : json['total_sent'], + 'total_received': json['total_received'] == null ? undefined : json['total_received'], 'num_txns': json['num_txns'], }; } -export function AccountStatsToJSON(value?: AccountStats | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function AccountStatsToJSON(json: any): AccountStats { + return AccountStatsToJSONTyped(json, false); +} + +export function AccountStatsToJSONTyped(value?: AccountStats | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_sent': value.total_sent, - 'total_received': value.total_received, - 'num_txns': value.num_txns, + 'total_sent': value['total_sent'], + 'total_received': value['total_received'], + 'num_txns': value['num_txns'], }; } - diff --git a/src/vendors/nexus/models/ActiveAccounts.ts b/src/vendors/nexus/models/ActiveAccounts.ts index 871ca6e275..e595cec851 100644 --- a/src/vendors/nexus/models/ActiveAccounts.ts +++ b/src/vendors/nexus/models/ActiveAccounts.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -33,12 +33,21 @@ export interface ActiveAccounts { active_accounts: number; } +/** + * Check if a given object implements the ActiveAccounts interface. + */ +export function instanceOfActiveAccounts(value: object): value is ActiveAccounts { + if (!('window_end' in value) || value['window_end'] === undefined) return false; + if (!('active_accounts' in value) || value['active_accounts'] === undefined) return false; + return true; +} + export function ActiveAccountsFromJSON(json: any): ActiveAccounts { return ActiveAccountsFromJSONTyped(json, false); } export function ActiveAccountsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActiveAccounts { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -48,18 +57,19 @@ export function ActiveAccountsFromJSONTyped(json: any, ignoreDiscriminator: bool }; } -export function ActiveAccountsToJSON(value?: ActiveAccounts | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ActiveAccountsToJSON(json: any): ActiveAccounts { + return ActiveAccountsToJSONTyped(json, false); +} + +export function ActiveAccountsToJSONTyped(value?: ActiveAccounts | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'window_end': (value.window_end.toISOString()), - 'active_accounts': value.active_accounts, + 'window_end': ((value['window_end']).toISOString()), + 'active_accounts': value['active_accounts'], }; } - diff --git a/src/vendors/nexus/models/ActiveAccountsList.ts b/src/vendors/nexus/models/ActiveAccountsList.ts index e683d41990..58648066ac 100644 --- a/src/vendors/nexus/models/ActiveAccountsList.ts +++ b/src/vendors/nexus/models/ActiveAccountsList.ts @@ -12,16 +12,18 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ActiveAccounts } from './ActiveAccounts'; import { - ActiveAccounts, ActiveAccountsFromJSON, ActiveAccountsFromJSONTyped, ActiveAccountsToJSON, -} from './'; + ActiveAccountsToJSONTyped, +} from './ActiveAccounts'; /** * A list of daily unique active account windows. + * * @export * @interface ActiveAccountsList */ @@ -40,12 +42,21 @@ export interface ActiveAccountsList { windows: Array; } +/** + * Check if a given object implements the ActiveAccountsList interface. + */ +export function instanceOfActiveAccountsList(value: object): value is ActiveAccountsList { + if (!('window_size_seconds' in value) || value['window_size_seconds'] === undefined) return false; + if (!('windows' in value) || value['windows'] === undefined) return false; + return true; +} + export function ActiveAccountsListFromJSON(json: any): ActiveAccountsList { return ActiveAccountsListFromJSONTyped(json, false); } export function ActiveAccountsListFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActiveAccountsList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -55,18 +66,19 @@ export function ActiveAccountsListFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function ActiveAccountsListToJSON(value?: ActiveAccountsList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ActiveAccountsListToJSON(json: any): ActiveAccountsList { + return ActiveAccountsListToJSONTyped(json, false); +} + +export function ActiveAccountsListToJSONTyped(value?: ActiveAccountsList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'window_size_seconds': value.window_size_seconds, - 'windows': ((value.windows as Array).map(ActiveAccountsToJSON)), + 'window_size_seconds': value['window_size_seconds'], + 'windows': ((value['windows'] as Array).map(ActiveAccountsToJSON)), }; } - diff --git a/src/vendors/nexus/models/AddressDerivationContext.ts b/src/vendors/nexus/models/AddressDerivationContext.ts index 7c170b6d80..91b9ed94d7 100644 --- a/src/vendors/nexus/models/AddressDerivationContext.ts +++ b/src/vendors/nexus/models/AddressDerivationContext.ts @@ -12,18 +12,31 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum AddressDerivationContext { - CoreAddressStaking = 'oasis-core/address: staking', - RuntimeSdkAddressSecp256k1eth = 'oasis-runtime-sdk/address: secp256k1eth', - RuntimeSdkAddressSr25519 = 'oasis-runtime-sdk/address: sr25519', - RuntimeSdkAddressMultisig = 'oasis-runtime-sdk/address: multisig', - RuntimeSdkAddressModule = 'oasis-runtime-sdk/address: module', - RuntimeSdkAddressRuntime = 'oasis-runtime-sdk/address: runtime' +export const AddressDerivationContext = { + CoreAddressStaking: 'oasis-core/address: staking', + RuntimeSdkAddressSecp256k1eth: 'oasis-runtime-sdk/address: secp256k1eth', + RuntimeSdkAddressSr25519: 'oasis-runtime-sdk/address: sr25519', + RuntimeSdkAddressMultisig: 'oasis-runtime-sdk/address: multisig', + RuntimeSdkAddressModule: 'oasis-runtime-sdk/address: module', + RuntimeSdkAddressRuntime: 'oasis-runtime-sdk/address: runtime' +} as const; +export type AddressDerivationContext = typeof AddressDerivationContext[keyof typeof AddressDerivationContext]; + + +export function instanceOfAddressDerivationContext(value: any): boolean { + for (const key in AddressDerivationContext) { + if (Object.prototype.hasOwnProperty.call(AddressDerivationContext, key)) { + if (AddressDerivationContext[key as keyof typeof AddressDerivationContext] === value) { + return true; + } + } + } + return false; } export function AddressDerivationContextFromJSON(json: any): AddressDerivationContext { @@ -38,3 +51,7 @@ export function AddressDerivationContextToJSON(value?: AddressDerivationContext return value as any; } +export function AddressDerivationContextToJSONTyped(value: any, ignoreDiscriminator: boolean): AddressDerivationContext { + return value as AddressDerivationContext; +} + diff --git a/src/vendors/nexus/models/AddressPreimage.ts b/src/vendors/nexus/models/AddressPreimage.ts index 2d8c9a45b7..f74e720dc5 100644 --- a/src/vendors/nexus/models/AddressPreimage.ts +++ b/src/vendors/nexus/models/AddressPreimage.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { AddressDerivationContext } from './AddressDerivationContext'; import { - AddressDerivationContext, AddressDerivationContextFromJSON, AddressDerivationContextFromJSONTyped, AddressDerivationContextToJSON, -} from './'; + AddressDerivationContextToJSONTyped, +} from './AddressDerivationContext'; /** * The data from which a consensus-style address (`oasis1...`) @@ -36,12 +37,14 @@ import { * valid in every runtime. For example, in EVM runtimes, you can use staking * addresses, but only with Oasis tools (e.g. a wallet); EVM contracts such as * ERC20 tokens or tools such as Metamask cannot interact with staking addresses. + * * @export * @interface AddressPreimage */ export interface AddressPreimage { /** * The method by which the Oasis address was derived from `address_data`. + * * @type {AddressDerivationContext} * @memberof AddressPreimage */ @@ -56,41 +59,54 @@ export interface AddressPreimage { * The base64-encoded data from which the Oasis address was derived. * When `context = "oasis-runtime-sdk/address: secp256k1eth"`, this * is the Ethereum address (in base64, not hex!). + * * @type {string} * @memberof AddressPreimage */ address_data: string; } + + +/** + * Check if a given object implements the AddressPreimage interface. + */ +export function instanceOfAddressPreimage(value: object): value is AddressPreimage { + if (!('context' in value) || value['context'] === undefined) return false; + if (!('address_data' in value) || value['address_data'] === undefined) return false; + return true; +} + export function AddressPreimageFromJSON(json: any): AddressPreimage { return AddressPreimageFromJSONTyped(json, false); } export function AddressPreimageFromJSONTyped(json: any, ignoreDiscriminator: boolean): AddressPreimage { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'context': AddressDerivationContextFromJSON(json['context']), - 'context_version': !exists(json, 'context_version') ? undefined : json['context_version'], + 'context_version': json['context_version'] == null ? undefined : json['context_version'], 'address_data': json['address_data'], }; } -export function AddressPreimageToJSON(value?: AddressPreimage | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function AddressPreimageToJSON(json: any): AddressPreimage { + return AddressPreimageToJSONTyped(json, false); +} + +export function AddressPreimageToJSONTyped(value?: AddressPreimage | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'context': AddressDerivationContextToJSON(value.context), - 'context_version': value.context_version, - 'address_data': value.address_data, + 'context': AddressDerivationContextToJSON(value['context']), + 'context_version': value['context_version'], + 'address_data': value['address_data'], }; } - diff --git a/src/vendors/nexus/models/Allowance.ts b/src/vendors/nexus/models/Allowance.ts index a6b20a6c98..c3101d9e95 100644 --- a/src/vendors/nexus/models/Allowance.ts +++ b/src/vendors/nexus/models/Allowance.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -28,18 +28,28 @@ export interface Allowance { /** * The amount allowed for the allowed account. * This field is omitted when listing multiple accounts. + * * @type {string} * @memberof Allowance */ amount: string; } +/** + * Check if a given object implements the Allowance interface. + */ +export function instanceOfAllowance(value: object): value is Allowance { + if (!('address' in value) || value['address'] === undefined) return false; + if (!('amount' in value) || value['amount'] === undefined) return false; + return true; +} + export function AllowanceFromJSON(json: any): Allowance { return AllowanceFromJSONTyped(json, false); } export function AllowanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): Allowance { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -49,18 +59,19 @@ export function AllowanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function AllowanceToJSON(value?: Allowance | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function AllowanceToJSON(json: any): Allowance { + return AllowanceToJSONTyped(json, false); +} + +export function AllowanceToJSONTyped(value?: Allowance | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'address': value.address, - 'amount': value.amount, + 'address': value['address'], + 'amount': value['amount'], }; } - diff --git a/src/vendors/nexus/models/BareTokenHolder.ts b/src/vendors/nexus/models/BareTokenHolder.ts index 9a131341cc..dd66f394d9 100644 --- a/src/vendors/nexus/models/BareTokenHolder.ts +++ b/src/vendors/nexus/models/BareTokenHolder.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * Balance of an account for a specific (implied) runtime and token. + * * @export * @interface BareTokenHolder */ @@ -39,35 +40,45 @@ export interface BareTokenHolder { balance: string; } +/** + * Check if a given object implements the BareTokenHolder interface. + */ +export function instanceOfBareTokenHolder(value: object): value is BareTokenHolder { + if (!('holder_address' in value) || value['holder_address'] === undefined) return false; + if (!('balance' in value) || value['balance'] === undefined) return false; + return true; +} + export function BareTokenHolderFromJSON(json: any): BareTokenHolder { return BareTokenHolderFromJSONTyped(json, false); } export function BareTokenHolderFromJSONTyped(json: any, ignoreDiscriminator: boolean): BareTokenHolder { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'holder_address': json['holder_address'], - 'eth_holder_address': !exists(json, 'eth_holder_address') ? undefined : json['eth_holder_address'], + 'eth_holder_address': json['eth_holder_address'] == null ? undefined : json['eth_holder_address'], 'balance': json['balance'], }; } -export function BareTokenHolderToJSON(value?: BareTokenHolder | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function BareTokenHolderToJSON(json: any): BareTokenHolder { + return BareTokenHolderToJSONTyped(json, false); +} + +export function BareTokenHolderToJSONTyped(value?: BareTokenHolder | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'holder_address': value.holder_address, - 'eth_holder_address': value.eth_holder_address, - 'balance': value.balance, + 'holder_address': value['holder_address'], + 'eth_holder_address': value['eth_holder_address'], + 'balance': value['balance'], }; } - diff --git a/src/vendors/nexus/models/Block.ts b/src/vendors/nexus/models/Block.ts index 2062bbade2..ebe42fa864 100644 --- a/src/vendors/nexus/models/Block.ts +++ b/src/vendors/nexus/models/Block.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A consensus block. + * * @export * @interface Block */ @@ -47,12 +48,14 @@ export interface Block { * The gas limit for the block. A gas limit 0 means that the max block gas was unlimited. * Blocks from Cobalt, Damask, and early Eden had no gas limit as their sizes were only * restricted by byte size until an upgrade during Eden introduced a gas limit. + * * @type {string} * @memberof Block */ gas_limit: string; /** * The size limit for the block in bytes. + * * @type {string} * @memberof Block */ @@ -71,12 +74,26 @@ export interface Block { state_root: string; } +/** + * Check if a given object implements the Block interface. + */ +export function instanceOfBlock(value: object): value is Block { + if (!('height' in value) || value['height'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('num_transactions' in value) || value['num_transactions'] === undefined) return false; + if (!('gas_limit' in value) || value['gas_limit'] === undefined) return false; + if (!('epoch' in value) || value['epoch'] === undefined) return false; + if (!('state_root' in value) || value['state_root'] === undefined) return false; + return true; +} + export function BlockFromJSON(json: any): Block { return BlockFromJSONTyped(json, false); } export function BlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): Block { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -86,30 +103,31 @@ export function BlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): Blo 'timestamp': (new Date(json['timestamp'])), 'num_transactions': json['num_transactions'], 'gas_limit': json['gas_limit'], - 'size_limit': !exists(json, 'size_limit') ? undefined : json['size_limit'], + 'size_limit': json['size_limit'] == null ? undefined : json['size_limit'], 'epoch': json['epoch'], 'state_root': json['state_root'], }; } -export function BlockToJSON(value?: Block | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function BlockToJSON(json: any): Block { + return BlockToJSONTyped(json, false); +} + +export function BlockToJSONTyped(value?: Block | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'height': value.height, - 'hash': value.hash, - 'timestamp': (value.timestamp.toISOString()), - 'num_transactions': value.num_transactions, - 'gas_limit': value.gas_limit, - 'size_limit': value.size_limit, - 'epoch': value.epoch, - 'state_root': value.state_root, + 'height': value['height'], + 'hash': value['hash'], + 'timestamp': ((value['timestamp']).toISOString()), + 'num_transactions': value['num_transactions'], + 'gas_limit': value['gas_limit'], + 'size_limit': value['size_limit'], + 'epoch': value['epoch'], + 'state_root': value['state_root'], }; } - diff --git a/src/vendors/nexus/models/BlockList.ts b/src/vendors/nexus/models/BlockList.ts index cd635765d2..e43e0a3136 100644 --- a/src/vendors/nexus/models/BlockList.ts +++ b/src/vendors/nexus/models/BlockList.ts @@ -12,24 +12,18 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { BlockListAllOfBlocks } from './BlockListAllOfBlocks'; import { - Block, - BlockFromJSON, - BlockFromJSONTyped, - BlockToJSON, - BlockListAllOf, - BlockListAllOfFromJSON, - BlockListAllOfFromJSONTyped, - BlockListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + BlockListAllOfBlocksFromJSON, + BlockListAllOfBlocksFromJSONTyped, + BlockListAllOfBlocksToJSON, + BlockListAllOfBlocksToJSONTyped, +} from './BlockListAllOfBlocks'; /** * A list of consensus blocks. + * * @export * @interface BlockList */ @@ -37,6 +31,7 @@ export interface BlockList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof BlockList */ @@ -49,10 +44,20 @@ export interface BlockList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof BlockList */ - blocks: Array; + blocks: Array; +} + +/** + * Check if a given object implements the BlockList interface. + */ +export function instanceOfBlockList(value: object): value is BlockList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('blocks' in value) || value['blocks'] === undefined) return false; + return true; } export function BlockListFromJSON(json: any): BlockList { @@ -60,30 +65,31 @@ export function BlockListFromJSON(json: any): BlockList { } export function BlockListFromJSONTyped(json: any, ignoreDiscriminator: boolean): BlockList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'blocks': ((json['blocks'] as Array).map(BlockFromJSON)), + 'blocks': ((json['blocks'] as Array).map(BlockListAllOfBlocksFromJSON)), }; } -export function BlockListToJSON(value?: BlockList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function BlockListToJSON(json: any): BlockList { + return BlockListToJSONTyped(json, false); +} + +export function BlockListToJSONTyped(value?: BlockList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'blocks': ((value.blocks as Array).map(BlockToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'blocks': ((value['blocks'] as Array).map(BlockListAllOfBlocksToJSON)), }; } - diff --git a/src/vendors/nexus/models/BlockListAllOfBlocks.ts b/src/vendors/nexus/models/BlockListAllOfBlocks.ts new file mode 100644 index 0000000000..d1270505a6 --- /dev/null +++ b/src/vendors/nexus/models/BlockListAllOfBlocks.ts @@ -0,0 +1,132 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface BlockListAllOfBlocks + */ +export interface BlockListAllOfBlocks { + /** + * The block height. + * @type {number} + * @memberof BlockListAllOfBlocks + */ + height: number; + /** + * The block header hash. + * @type {string} + * @memberof BlockListAllOfBlocks + */ + hash: string; + /** + * The second-granular consensus time. + * @type {Date} + * @memberof BlockListAllOfBlocks + */ + timestamp: Date; + /** + * Number of transactions in the block. + * @type {number} + * @memberof BlockListAllOfBlocks + */ + num_transactions: number; + /** + * The gas limit for the block. A gas limit 0 means that the max block gas was unlimited. + * Blocks from Cobalt, Damask, and early Eden had no gas limit as their sizes were only + * restricted by byte size until an upgrade during Eden introduced a gas limit. + * + * @type {string} + * @memberof BlockListAllOfBlocks + */ + gas_limit: string; + /** + * The size limit for the block in bytes. + * + * @type {string} + * @memberof BlockListAllOfBlocks + */ + size_limit?: string; + /** + * The epoch number of the epoch in which the block was produced. + * @type {number} + * @memberof BlockListAllOfBlocks + */ + epoch: number; + /** + * The Merkle root of the state tree after applying the block. + * @type {string} + * @memberof BlockListAllOfBlocks + */ + state_root: string; +} + +/** + * Check if a given object implements the BlockListAllOfBlocks interface. + */ +export function instanceOfBlockListAllOfBlocks(value: object): value is BlockListAllOfBlocks { + if (!('height' in value) || value['height'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('num_transactions' in value) || value['num_transactions'] === undefined) return false; + if (!('gas_limit' in value) || value['gas_limit'] === undefined) return false; + if (!('epoch' in value) || value['epoch'] === undefined) return false; + if (!('state_root' in value) || value['state_root'] === undefined) return false; + return true; +} + +export function BlockListAllOfBlocksFromJSON(json: any): BlockListAllOfBlocks { + return BlockListAllOfBlocksFromJSONTyped(json, false); +} + +export function BlockListAllOfBlocksFromJSONTyped(json: any, ignoreDiscriminator: boolean): BlockListAllOfBlocks { + if (json == null) { + return json; + } + return { + + 'height': json['height'], + 'hash': json['hash'], + 'timestamp': (new Date(json['timestamp'])), + 'num_transactions': json['num_transactions'], + 'gas_limit': json['gas_limit'], + 'size_limit': json['size_limit'] == null ? undefined : json['size_limit'], + 'epoch': json['epoch'], + 'state_root': json['state_root'], + }; +} + +export function BlockListAllOfBlocksToJSON(json: any): BlockListAllOfBlocks { + return BlockListAllOfBlocksToJSONTyped(json, false); +} + +export function BlockListAllOfBlocksToJSONTyped(value?: BlockListAllOfBlocks | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'height': value['height'], + 'hash': value['hash'], + 'timestamp': ((value['timestamp']).toISOString()), + 'num_transactions': value['num_transactions'], + 'gas_limit': value['gas_limit'], + 'size_limit': value['size_limit'], + 'epoch': value['epoch'], + 'state_root': value['state_root'], + }; +} + diff --git a/src/vendors/nexus/models/ConsensusEvent.ts b/src/vendors/nexus/models/ConsensusEvent.ts index 262ddea624..c578da3d2e 100644 --- a/src/vendors/nexus/models/ConsensusEvent.ts +++ b/src/vendors/nexus/models/ConsensusEvent.ts @@ -12,20 +12,25 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { Runtime } from './Runtime'; import { - ConsensusEventType, - ConsensusEventTypeFromJSON, - ConsensusEventTypeFromJSONTyped, - ConsensusEventTypeToJSON, - Runtime, RuntimeFromJSON, RuntimeFromJSONTyped, RuntimeToJSON, -} from './'; + RuntimeToJSONTyped, +} from './Runtime'; +import type { ConsensusEventType } from './ConsensusEventType'; +import { + ConsensusEventTypeFromJSON, + ConsensusEventTypeFromJSONTyped, + ConsensusEventTypeToJSON, + ConsensusEventTypeToJSONTyped, +} from './ConsensusEventType'; /** * An event emitted by the consensus layer. + * * @export * @interface ConsensusEvent */ @@ -39,6 +44,7 @@ export interface ConsensusEvent { /** * 0-based index of this event's originating transaction within its block. * Absent if the event did not originate from a transaction. + * * @type {number} * @memberof ConsensusEvent */ @@ -46,6 +52,7 @@ export interface ConsensusEvent { /** * Hash of this event's originating transaction. * Absent if the event did not originate from a transaction. + * * @type {string} * @memberof ConsensusEvent */ @@ -53,6 +60,7 @@ export interface ConsensusEvent { /** * The ID of the runtime to which the event relates, encoded in hex. * Present only for events of type `roothash.*`. + * * @type {string} * @memberof ConsensusEvent */ @@ -60,6 +68,7 @@ export interface ConsensusEvent { /** * The runtime to which the event relates. * Present only for events of type `roothash.*`. + * * @type {Runtime} * @memberof ConsensusEvent */ @@ -69,6 +78,7 @@ export interface ConsensusEvent { * relates. * Present only for events of type `roothash.*` except for * `roothash.execution_discrepancy` before Eden. + * * @type {number} * @memberof ConsensusEvent */ @@ -84,51 +94,65 @@ export interface ConsensusEvent { * instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/consensus/api/transaction/results#Event) of oasis-core. * This object will conform to one of the `*Event` types two levels down * the hierarchy, e.g. `TransferEvent` from `Event > staking.Event > TransferEvent` + * * @type {object} * @memberof ConsensusEvent */ body: object; } + + +/** + * Check if a given object implements the ConsensusEvent interface. + */ +export function instanceOfConsensusEvent(value: object): value is ConsensusEvent { + if (!('block' in value) || value['block'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('body' in value) || value['body'] === undefined) return false; + return true; +} + export function ConsensusEventFromJSON(json: any): ConsensusEvent { return ConsensusEventFromJSONTyped(json, false); } export function ConsensusEventFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConsensusEvent { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'block': json['block'], - 'tx_index': !exists(json, 'tx_index') ? undefined : json['tx_index'], - 'tx_hash': !exists(json, 'tx_hash') ? undefined : json['tx_hash'], - 'roothash_runtime_id': !exists(json, 'roothash_runtime_id') ? undefined : json['roothash_runtime_id'], - 'roothash_runtime': !exists(json, 'roothash_runtime') ? undefined : RuntimeFromJSON(json['roothash_runtime']), - 'roothash_runtime_round': !exists(json, 'roothash_runtime_round') ? undefined : json['roothash_runtime_round'], + 'tx_index': json['tx_index'] == null ? undefined : json['tx_index'], + 'tx_hash': json['tx_hash'] == null ? undefined : json['tx_hash'], + 'roothash_runtime_id': json['roothash_runtime_id'] == null ? undefined : json['roothash_runtime_id'], + 'roothash_runtime': json['roothash_runtime'] == null ? undefined : RuntimeFromJSON(json['roothash_runtime']), + 'roothash_runtime_round': json['roothash_runtime_round'] == null ? undefined : json['roothash_runtime_round'], 'type': ConsensusEventTypeFromJSON(json['type']), 'body': json['body'], }; } -export function ConsensusEventToJSON(value?: ConsensusEvent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ConsensusEventToJSON(json: any): ConsensusEvent { + return ConsensusEventToJSONTyped(json, false); +} + +export function ConsensusEventToJSONTyped(value?: ConsensusEvent | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'block': value.block, - 'tx_index': value.tx_index, - 'tx_hash': value.tx_hash, - 'roothash_runtime_id': value.roothash_runtime_id, - 'roothash_runtime': RuntimeToJSON(value.roothash_runtime), - 'roothash_runtime_round': value.roothash_runtime_round, - 'type': ConsensusEventTypeToJSON(value.type), - 'body': value.body, + 'block': value['block'], + 'tx_index': value['tx_index'], + 'tx_hash': value['tx_hash'], + 'roothash_runtime_id': value['roothash_runtime_id'], + 'roothash_runtime': RuntimeToJSON(value['roothash_runtime']), + 'roothash_runtime_round': value['roothash_runtime_round'], + 'type': ConsensusEventTypeToJSON(value['type']), + 'body': value['body'], }; } - diff --git a/src/vendors/nexus/models/ConsensusEventList.ts b/src/vendors/nexus/models/ConsensusEventList.ts index 2a9af56962..eb55ac213e 100644 --- a/src/vendors/nexus/models/ConsensusEventList.ts +++ b/src/vendors/nexus/models/ConsensusEventList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ConsensusEventListAllOfEvents } from './ConsensusEventListAllOfEvents'; import { - ConsensusEvent, - ConsensusEventFromJSON, - ConsensusEventFromJSONTyped, - ConsensusEventToJSON, - ConsensusEventListAllOf, - ConsensusEventListAllOfFromJSON, - ConsensusEventListAllOfFromJSONTyped, - ConsensusEventListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + ConsensusEventListAllOfEventsFromJSON, + ConsensusEventListAllOfEventsFromJSONTyped, + ConsensusEventListAllOfEventsToJSON, + ConsensusEventListAllOfEventsToJSONTyped, +} from './ConsensusEventListAllOfEvents'; /** * @@ -37,6 +30,7 @@ export interface ConsensusEventList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof ConsensusEventList */ @@ -49,10 +43,20 @@ export interface ConsensusEventList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof ConsensusEventList */ - events: Array; + events: Array; +} + +/** + * Check if a given object implements the ConsensusEventList interface. + */ +export function instanceOfConsensusEventList(value: object): value is ConsensusEventList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('events' in value) || value['events'] === undefined) return false; + return true; } export function ConsensusEventListFromJSON(json: any): ConsensusEventList { @@ -60,30 +64,31 @@ export function ConsensusEventListFromJSON(json: any): ConsensusEventList { } export function ConsensusEventListFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConsensusEventList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'events': ((json['events'] as Array).map(ConsensusEventFromJSON)), + 'events': ((json['events'] as Array).map(ConsensusEventListAllOfEventsFromJSON)), }; } -export function ConsensusEventListToJSON(value?: ConsensusEventList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ConsensusEventListToJSON(json: any): ConsensusEventList { + return ConsensusEventListToJSONTyped(json, false); +} + +export function ConsensusEventListToJSONTyped(value?: ConsensusEventList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'events': ((value.events as Array).map(ConsensusEventToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'events': ((value['events'] as Array).map(ConsensusEventListAllOfEventsToJSON)), }; } - diff --git a/src/vendors/nexus/models/ConsensusEventListAllOfEvents.ts b/src/vendors/nexus/models/ConsensusEventListAllOfEvents.ts new file mode 100644 index 0000000000..3a7d77c183 --- /dev/null +++ b/src/vendors/nexus/models/ConsensusEventListAllOfEvents.ts @@ -0,0 +1,157 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Runtime } from './Runtime'; +import { + RuntimeFromJSON, + RuntimeFromJSONTyped, + RuntimeToJSON, + RuntimeToJSONTyped, +} from './Runtime'; +import type { ConsensusEventType } from './ConsensusEventType'; +import { + ConsensusEventTypeFromJSON, + ConsensusEventTypeFromJSONTyped, + ConsensusEventTypeToJSON, + ConsensusEventTypeToJSONTyped, +} from './ConsensusEventType'; + +/** + * + * @export + * @interface ConsensusEventListAllOfEvents + */ +export interface ConsensusEventListAllOfEvents { + /** + * The block height at which this event was generated. + * @type {number} + * @memberof ConsensusEventListAllOfEvents + */ + block: number; + /** + * 0-based index of this event's originating transaction within its block. + * Absent if the event did not originate from a transaction. + * + * @type {number} + * @memberof ConsensusEventListAllOfEvents + */ + tx_index?: number; + /** + * Hash of this event's originating transaction. + * Absent if the event did not originate from a transaction. + * + * @type {string} + * @memberof ConsensusEventListAllOfEvents + */ + tx_hash?: string; + /** + * The ID of the runtime to which the event relates, encoded in hex. + * Present only for events of type `roothash.*`. + * + * @type {string} + * @memberof ConsensusEventListAllOfEvents + */ + roothash_runtime_id?: string; + /** + * The runtime to which the event relates. + * Present only for events of type `roothash.*`. + * + * @type {Runtime} + * @memberof ConsensusEventListAllOfEvents + */ + roothash_runtime?: Runtime; + /** + * When applicable, the round in the runtime to which this event + * relates. + * Present only for events of type `roothash.*` except for + * `roothash.execution_discrepancy` before Eden. + * + * @type {number} + * @memberof ConsensusEventListAllOfEvents + */ + roothash_runtime_round?: number; + /** + * The type of the event. + * @type {ConsensusEventType} + * @memberof ConsensusEventListAllOfEvents + */ + type: ConsensusEventType; + /** + * The event contents. This spec does not encode the many possible types; + * instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/consensus/api/transaction/results#Event) of oasis-core. + * This object will conform to one of the `*Event` types two levels down + * the hierarchy, e.g. `TransferEvent` from `Event > staking.Event > TransferEvent` + * + * @type {object} + * @memberof ConsensusEventListAllOfEvents + */ + body: object; +} + + + +/** + * Check if a given object implements the ConsensusEventListAllOfEvents interface. + */ +export function instanceOfConsensusEventListAllOfEvents(value: object): value is ConsensusEventListAllOfEvents { + if (!('block' in value) || value['block'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('body' in value) || value['body'] === undefined) return false; + return true; +} + +export function ConsensusEventListAllOfEventsFromJSON(json: any): ConsensusEventListAllOfEvents { + return ConsensusEventListAllOfEventsFromJSONTyped(json, false); +} + +export function ConsensusEventListAllOfEventsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConsensusEventListAllOfEvents { + if (json == null) { + return json; + } + return { + + 'block': json['block'], + 'tx_index': json['tx_index'] == null ? undefined : json['tx_index'], + 'tx_hash': json['tx_hash'] == null ? undefined : json['tx_hash'], + 'roothash_runtime_id': json['roothash_runtime_id'] == null ? undefined : json['roothash_runtime_id'], + 'roothash_runtime': json['roothash_runtime'] == null ? undefined : RuntimeFromJSON(json['roothash_runtime']), + 'roothash_runtime_round': json['roothash_runtime_round'] == null ? undefined : json['roothash_runtime_round'], + 'type': ConsensusEventTypeFromJSON(json['type']), + 'body': json['body'], + }; +} + +export function ConsensusEventListAllOfEventsToJSON(json: any): ConsensusEventListAllOfEvents { + return ConsensusEventListAllOfEventsToJSONTyped(json, false); +} + +export function ConsensusEventListAllOfEventsToJSONTyped(value?: ConsensusEventListAllOfEvents | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'block': value['block'], + 'tx_index': value['tx_index'], + 'tx_hash': value['tx_hash'], + 'roothash_runtime_id': value['roothash_runtime_id'], + 'roothash_runtime': RuntimeToJSON(value['roothash_runtime']), + 'roothash_runtime_round': value['roothash_runtime_round'], + 'type': ConsensusEventTypeToJSON(value['type']), + 'body': value['body'], + }; +} + diff --git a/src/vendors/nexus/models/ConsensusEventType.ts b/src/vendors/nexus/models/ConsensusEventType.ts index 8a43288428..0a89f118ac 100644 --- a/src/vendors/nexus/models/ConsensusEventType.ts +++ b/src/vendors/nexus/models/ConsensusEventType.ts @@ -12,33 +12,46 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum ConsensusEventType { - GovernanceProposalExecuted = 'governance.proposal_executed', - GovernanceProposalFinalized = 'governance.proposal_finalized', - GovernanceProposalSubmitted = 'governance.proposal_submitted', - GovernanceVote = 'governance.vote', - RegistryEntity = 'registry.entity', - RegistryNodeUnfrozen = 'registry.node_unfrozen', - RegistryNode = 'registry.node', - RegistryRuntime = 'registry.runtime', - RegistryRuntimeSuspended = 'registry.runtime_suspended', - RoothashExecutionDiscrepancy = 'roothash.execution_discrepancy', - RoothashExecutorCommitted = 'roothash.executor_committed', - RoothashFinalized = 'roothash.finalized', - RoothashMessage = 'roothash.message', - RoothashInMsgProcessed = 'roothash.in_msg_processed', - StakingAllowanceChange = 'staking.allowance_change', - StakingBurn = 'staking.burn', - StakingEscrowAdd = 'staking.escrow.add', - StakingEscrowDebondingStart = 'staking.escrow.debonding_start', - StakingEscrowReclaim = 'staking.escrow.reclaim', - StakingEscrowTake = 'staking.escrow.take', - StakingTransfer = 'staking.transfer' +export const ConsensusEventType = { + GovernanceProposalExecuted: 'governance.proposal_executed', + GovernanceProposalFinalized: 'governance.proposal_finalized', + GovernanceProposalSubmitted: 'governance.proposal_submitted', + GovernanceVote: 'governance.vote', + RegistryEntity: 'registry.entity', + RegistryNodeUnfrozen: 'registry.node_unfrozen', + RegistryNode: 'registry.node', + RegistryRuntime: 'registry.runtime', + RegistryRuntimeSuspended: 'registry.runtime_suspended', + RoothashExecutionDiscrepancy: 'roothash.execution_discrepancy', + RoothashExecutorCommitted: 'roothash.executor_committed', + RoothashFinalized: 'roothash.finalized', + RoothashMessage: 'roothash.message', + RoothashInMsgProcessed: 'roothash.in_msg_processed', + StakingAllowanceChange: 'staking.allowance_change', + StakingBurn: 'staking.burn', + StakingEscrowAdd: 'staking.escrow.add', + StakingEscrowDebondingStart: 'staking.escrow.debonding_start', + StakingEscrowReclaim: 'staking.escrow.reclaim', + StakingEscrowTake: 'staking.escrow.take', + StakingTransfer: 'staking.transfer' +} as const; +export type ConsensusEventType = typeof ConsensusEventType[keyof typeof ConsensusEventType]; + + +export function instanceOfConsensusEventType(value: any): boolean { + for (const key in ConsensusEventType) { + if (Object.prototype.hasOwnProperty.call(ConsensusEventType, key)) { + if (ConsensusEventType[key as keyof typeof ConsensusEventType] === value) { + return true; + } + } + } + return false; } export function ConsensusEventTypeFromJSON(json: any): ConsensusEventType { @@ -53,3 +66,7 @@ export function ConsensusEventTypeToJSON(value?: ConsensusEventType | null): any return value as any; } +export function ConsensusEventTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): ConsensusEventType { + return value as ConsensusEventType; +} + diff --git a/src/vendors/nexus/models/ConsensusTxMethod.ts b/src/vendors/nexus/models/ConsensusTxMethod.ts index f4efa18f43..e2599a6b23 100644 --- a/src/vendors/nexus/models/ConsensusTxMethod.ts +++ b/src/vendors/nexus/models/ConsensusTxMethod.ts @@ -12,45 +12,58 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum ConsensusTxMethod { - BeaconPvssCommit = 'beacon.PVSSCommit', - BeaconPvssReveal = 'beacon.PVSSReveal', - BeaconVrfProve = 'beacon.VRFProve', - ConsensusMeta = 'consensus.Meta', - GovernanceCastVote = 'governance.CastVote', - GovernanceSubmitProposal = 'governance.SubmitProposal', - KeymanagerPublishEphemeralSecret = 'keymanager.PublishEphemeralSecret', - KeymanagerPublishMasterSecret = 'keymanager.PublishMasterSecret', - KeymanagerUpdatePolicy = 'keymanager.UpdatePolicy', - RegistryDeregisterEntity = 'registry.DeregisterEntity', - RegistryProveFreshness = 'registry.ProveFreshness', - RegistryRegisterEntity = 'registry.RegisterEntity', - RegistryRegisterNode = 'registry.RegisterNode', - RegistryRegisterRuntime = 'registry.RegisterRuntime', - RegistryUnfreezeNode = 'registry.UnfreezeNode', - RoothashEvidence = 'roothash.Evidence', - RoothashExecutorCommit = 'roothash.ExecutorCommit', - RoothashExecutorProposerTimeout = 'roothash.ExecutorProposerTimeout', - RoothashSubmitMsg = 'roothash.SubmitMsg', - StakingAddEscrow = 'staking.AddEscrow', - StakingAllow = 'staking.Allow', - StakingAmendCommissionSchedule = 'staking.AmendCommissionSchedule', - StakingBurn = 'staking.Burn', - StakingReclaimEscrow = 'staking.ReclaimEscrow', - StakingTransfer = 'staking.Transfer', - StakingWithdraw = 'staking.Withdraw', - KeymanagerChurpApply = 'keymanager/churp.Apply', - KeymanagerChurpConfirm = 'keymanager/churp.Confirm', - KeymanagerChurpCreate = 'keymanager/churp.Create', - KeymanagerChurpUpdate = 'keymanager/churp.Update', - VaultAuthorizeAction = 'vault.AuthorizeAction', - VaultCancelAction = 'vault.CancelAction', - VaultCreate = 'vault.Create' +export const ConsensusTxMethod = { + BeaconPvssCommit: 'beacon.PVSSCommit', + BeaconPvssReveal: 'beacon.PVSSReveal', + BeaconVrfProve: 'beacon.VRFProve', + ConsensusMeta: 'consensus.Meta', + GovernanceCastVote: 'governance.CastVote', + GovernanceSubmitProposal: 'governance.SubmitProposal', + KeymanagerPublishEphemeralSecret: 'keymanager.PublishEphemeralSecret', + KeymanagerPublishMasterSecret: 'keymanager.PublishMasterSecret', + KeymanagerUpdatePolicy: 'keymanager.UpdatePolicy', + RegistryDeregisterEntity: 'registry.DeregisterEntity', + RegistryProveFreshness: 'registry.ProveFreshness', + RegistryRegisterEntity: 'registry.RegisterEntity', + RegistryRegisterNode: 'registry.RegisterNode', + RegistryRegisterRuntime: 'registry.RegisterRuntime', + RegistryUnfreezeNode: 'registry.UnfreezeNode', + RoothashEvidence: 'roothash.Evidence', + RoothashExecutorCommit: 'roothash.ExecutorCommit', + RoothashExecutorProposerTimeout: 'roothash.ExecutorProposerTimeout', + RoothashSubmitMsg: 'roothash.SubmitMsg', + StakingAddEscrow: 'staking.AddEscrow', + StakingAllow: 'staking.Allow', + StakingAmendCommissionSchedule: 'staking.AmendCommissionSchedule', + StakingBurn: 'staking.Burn', + StakingReclaimEscrow: 'staking.ReclaimEscrow', + StakingTransfer: 'staking.Transfer', + StakingWithdraw: 'staking.Withdraw', + KeymanagerChurpApply: 'keymanager/churp.Apply', + KeymanagerChurpConfirm: 'keymanager/churp.Confirm', + KeymanagerChurpCreate: 'keymanager/churp.Create', + KeymanagerChurpUpdate: 'keymanager/churp.Update', + VaultAuthorizeAction: 'vault.AuthorizeAction', + VaultCancelAction: 'vault.CancelAction', + VaultCreate: 'vault.Create' +} as const; +export type ConsensusTxMethod = typeof ConsensusTxMethod[keyof typeof ConsensusTxMethod]; + + +export function instanceOfConsensusTxMethod(value: any): boolean { + for (const key in ConsensusTxMethod) { + if (Object.prototype.hasOwnProperty.call(ConsensusTxMethod, key)) { + if (ConsensusTxMethod[key as keyof typeof ConsensusTxMethod] === value) { + return true; + } + } + } + return false; } export function ConsensusTxMethodFromJSON(json: any): ConsensusTxMethod { @@ -65,3 +78,7 @@ export function ConsensusTxMethodToJSON(value?: ConsensusTxMethod | null): any { return value as any; } +export function ConsensusTxMethodToJSONTyped(value: any, ignoreDiscriminator: boolean): ConsensusTxMethod { + return value as ConsensusTxMethod; +} + diff --git a/src/vendors/nexus/models/DebondingDelegation.ts b/src/vendors/nexus/models/DebondingDelegation.ts index 7db4a2312a..764b3010f7 100644 --- a/src/vendors/nexus/models/DebondingDelegation.ts +++ b/src/vendors/nexus/models/DebondingDelegation.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A debonding delegation. + * * @export * @interface DebondingDelegation */ @@ -51,12 +52,24 @@ export interface DebondingDelegation { debond_end: number; } +/** + * Check if a given object implements the DebondingDelegation interface. + */ +export function instanceOfDebondingDelegation(value: object): value is DebondingDelegation { + if (!('amount' in value) || value['amount'] === undefined) return false; + if (!('shares' in value) || value['shares'] === undefined) return false; + if (!('validator' in value) || value['validator'] === undefined) return false; + if (!('delegator' in value) || value['delegator'] === undefined) return false; + if (!('debond_end' in value) || value['debond_end'] === undefined) return false; + return true; +} + export function DebondingDelegationFromJSON(json: any): DebondingDelegation { return DebondingDelegationFromJSONTyped(json, false); } export function DebondingDelegationFromJSONTyped(json: any, ignoreDiscriminator: boolean): DebondingDelegation { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -69,21 +82,22 @@ export function DebondingDelegationFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function DebondingDelegationToJSON(value?: DebondingDelegation | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function DebondingDelegationToJSON(json: any): DebondingDelegation { + return DebondingDelegationToJSONTyped(json, false); +} + +export function DebondingDelegationToJSONTyped(value?: DebondingDelegation | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'amount': value.amount, - 'shares': value.shares, - 'validator': value.validator, - 'delegator': value.delegator, - 'debond_end': value.debond_end, + 'amount': value['amount'], + 'shares': value['shares'], + 'validator': value['validator'], + 'delegator': value['delegator'], + 'debond_end': value['debond_end'], }; } - diff --git a/src/vendors/nexus/models/DebondingDelegationList.ts b/src/vendors/nexus/models/DebondingDelegationList.ts index 322921946f..073d0f2e5f 100644 --- a/src/vendors/nexus/models/DebondingDelegationList.ts +++ b/src/vendors/nexus/models/DebondingDelegationList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { DebondingDelegationListAllOfDebondingDelegations } from './DebondingDelegationListAllOfDebondingDelegations'; import { - DebondingDelegation, - DebondingDelegationFromJSON, - DebondingDelegationFromJSONTyped, - DebondingDelegationToJSON, - DebondingDelegationListAllOf, - DebondingDelegationListAllOfFromJSON, - DebondingDelegationListAllOfFromJSONTyped, - DebondingDelegationListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + DebondingDelegationListAllOfDebondingDelegationsFromJSON, + DebondingDelegationListAllOfDebondingDelegationsFromJSONTyped, + DebondingDelegationListAllOfDebondingDelegationsToJSON, + DebondingDelegationListAllOfDebondingDelegationsToJSONTyped, +} from './DebondingDelegationListAllOfDebondingDelegations'; /** * @@ -37,6 +30,7 @@ export interface DebondingDelegationList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof DebondingDelegationList */ @@ -49,10 +43,20 @@ export interface DebondingDelegationList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof DebondingDelegationList */ - debonding_delegations: Array; + debonding_delegations: Array; +} + +/** + * Check if a given object implements the DebondingDelegationList interface. + */ +export function instanceOfDebondingDelegationList(value: object): value is DebondingDelegationList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('debonding_delegations' in value) || value['debonding_delegations'] === undefined) return false; + return true; } export function DebondingDelegationListFromJSON(json: any): DebondingDelegationList { @@ -60,30 +64,31 @@ export function DebondingDelegationListFromJSON(json: any): DebondingDelegationL } export function DebondingDelegationListFromJSONTyped(json: any, ignoreDiscriminator: boolean): DebondingDelegationList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'debonding_delegations': ((json['debonding_delegations'] as Array).map(DebondingDelegationFromJSON)), + 'debonding_delegations': ((json['debonding_delegations'] as Array).map(DebondingDelegationListAllOfDebondingDelegationsFromJSON)), }; } -export function DebondingDelegationListToJSON(value?: DebondingDelegationList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function DebondingDelegationListToJSON(json: any): DebondingDelegationList { + return DebondingDelegationListToJSONTyped(json, false); +} + +export function DebondingDelegationListToJSONTyped(value?: DebondingDelegationList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'debonding_delegations': ((value.debonding_delegations as Array).map(DebondingDelegationToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'debonding_delegations': ((value['debonding_delegations'] as Array).map(DebondingDelegationListAllOfDebondingDelegationsToJSON)), }; } - diff --git a/src/vendors/nexus/models/DebondingDelegationListAllOfDebondingDelegations.ts b/src/vendors/nexus/models/DebondingDelegationListAllOfDebondingDelegations.ts new file mode 100644 index 0000000000..09f180d936 --- /dev/null +++ b/src/vendors/nexus/models/DebondingDelegationListAllOfDebondingDelegations.ts @@ -0,0 +1,102 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface DebondingDelegationListAllOfDebondingDelegations + */ +export interface DebondingDelegationListAllOfDebondingDelegations { + /** + * The amount of tokens delegated in base units. + * @type {string} + * @memberof DebondingDelegationListAllOfDebondingDelegations + */ + amount: string; + /** + * The shares of tokens delegated. + * @type {string} + * @memberof DebondingDelegationListAllOfDebondingDelegations + */ + shares: string; + /** + * The delegatee (validator) address. + * @type {string} + * @memberof DebondingDelegationListAllOfDebondingDelegations + */ + validator: string; + /** + * The delegator address. + * @type {string} + * @memberof DebondingDelegationListAllOfDebondingDelegations + */ + delegator: string; + /** + * The epoch at which the debonding ends. + * @type {number} + * @memberof DebondingDelegationListAllOfDebondingDelegations + */ + debond_end: number; +} + +/** + * Check if a given object implements the DebondingDelegationListAllOfDebondingDelegations interface. + */ +export function instanceOfDebondingDelegationListAllOfDebondingDelegations(value: object): value is DebondingDelegationListAllOfDebondingDelegations { + if (!('amount' in value) || value['amount'] === undefined) return false; + if (!('shares' in value) || value['shares'] === undefined) return false; + if (!('validator' in value) || value['validator'] === undefined) return false; + if (!('delegator' in value) || value['delegator'] === undefined) return false; + if (!('debond_end' in value) || value['debond_end'] === undefined) return false; + return true; +} + +export function DebondingDelegationListAllOfDebondingDelegationsFromJSON(json: any): DebondingDelegationListAllOfDebondingDelegations { + return DebondingDelegationListAllOfDebondingDelegationsFromJSONTyped(json, false); +} + +export function DebondingDelegationListAllOfDebondingDelegationsFromJSONTyped(json: any, ignoreDiscriminator: boolean): DebondingDelegationListAllOfDebondingDelegations { + if (json == null) { + return json; + } + return { + + 'amount': json['amount'], + 'shares': json['shares'], + 'validator': json['validator'], + 'delegator': json['delegator'], + 'debond_end': json['debond_end'], + }; +} + +export function DebondingDelegationListAllOfDebondingDelegationsToJSON(json: any): DebondingDelegationListAllOfDebondingDelegations { + return DebondingDelegationListAllOfDebondingDelegationsToJSONTyped(json, false); +} + +export function DebondingDelegationListAllOfDebondingDelegationsToJSONTyped(value?: DebondingDelegationListAllOfDebondingDelegations | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'amount': value['amount'], + 'shares': value['shares'], + 'validator': value['validator'], + 'delegator': value['delegator'], + 'debond_end': value['debond_end'], + }; +} + diff --git a/src/vendors/nexus/models/Delegation.ts b/src/vendors/nexus/models/Delegation.ts index ebeef29277..9b2bfd5412 100644 --- a/src/vendors/nexus/models/Delegation.ts +++ b/src/vendors/nexus/models/Delegation.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A delegation. + * * @export * @interface Delegation */ @@ -45,12 +46,23 @@ export interface Delegation { delegator: string; } +/** + * Check if a given object implements the Delegation interface. + */ +export function instanceOfDelegation(value: object): value is Delegation { + if (!('amount' in value) || value['amount'] === undefined) return false; + if (!('shares' in value) || value['shares'] === undefined) return false; + if (!('validator' in value) || value['validator'] === undefined) return false; + if (!('delegator' in value) || value['delegator'] === undefined) return false; + return true; +} + export function DelegationFromJSON(json: any): Delegation { return DelegationFromJSONTyped(json, false); } export function DelegationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Delegation { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -62,20 +74,21 @@ export function DelegationFromJSONTyped(json: any, ignoreDiscriminator: boolean) }; } -export function DelegationToJSON(value?: Delegation | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function DelegationToJSON(json: any): Delegation { + return DelegationToJSONTyped(json, false); +} + +export function DelegationToJSONTyped(value?: Delegation | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'amount': value.amount, - 'shares': value.shares, - 'validator': value.validator, - 'delegator': value.delegator, + 'amount': value['amount'], + 'shares': value['shares'], + 'validator': value['validator'], + 'delegator': value['delegator'], }; } - diff --git a/src/vendors/nexus/models/DelegationList.ts b/src/vendors/nexus/models/DelegationList.ts index 18a49c9264..1c28770ec2 100644 --- a/src/vendors/nexus/models/DelegationList.ts +++ b/src/vendors/nexus/models/DelegationList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { DelegationListAllOfDelegations } from './DelegationListAllOfDelegations'; import { - Delegation, - DelegationFromJSON, - DelegationFromJSONTyped, - DelegationToJSON, - DelegationListAllOf, - DelegationListAllOfFromJSON, - DelegationListAllOfFromJSONTyped, - DelegationListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + DelegationListAllOfDelegationsFromJSON, + DelegationListAllOfDelegationsFromJSONTyped, + DelegationListAllOfDelegationsToJSON, + DelegationListAllOfDelegationsToJSONTyped, +} from './DelegationListAllOfDelegations'; /** * @@ -37,6 +30,7 @@ export interface DelegationList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof DelegationList */ @@ -49,10 +43,20 @@ export interface DelegationList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof DelegationList */ - delegations: Array; + delegations: Array; +} + +/** + * Check if a given object implements the DelegationList interface. + */ +export function instanceOfDelegationList(value: object): value is DelegationList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('delegations' in value) || value['delegations'] === undefined) return false; + return true; } export function DelegationListFromJSON(json: any): DelegationList { @@ -60,30 +64,31 @@ export function DelegationListFromJSON(json: any): DelegationList { } export function DelegationListFromJSONTyped(json: any, ignoreDiscriminator: boolean): DelegationList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'delegations': ((json['delegations'] as Array).map(DelegationFromJSON)), + 'delegations': ((json['delegations'] as Array).map(DelegationListAllOfDelegationsFromJSON)), }; } -export function DelegationListToJSON(value?: DelegationList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function DelegationListToJSON(json: any): DelegationList { + return DelegationListToJSONTyped(json, false); +} + +export function DelegationListToJSONTyped(value?: DelegationList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'delegations': ((value.delegations as Array).map(DelegationToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'delegations': ((value['delegations'] as Array).map(DelegationListAllOfDelegationsToJSON)), }; } - diff --git a/src/vendors/nexus/models/DelegationListAllOfDelegations.ts b/src/vendors/nexus/models/DelegationListAllOfDelegations.ts new file mode 100644 index 0000000000..066544363e --- /dev/null +++ b/src/vendors/nexus/models/DelegationListAllOfDelegations.ts @@ -0,0 +1,93 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface DelegationListAllOfDelegations + */ +export interface DelegationListAllOfDelegations { + /** + * The amount of tokens delegated in base units. + * @type {string} + * @memberof DelegationListAllOfDelegations + */ + amount: string; + /** + * The shares of tokens delegated. + * @type {string} + * @memberof DelegationListAllOfDelegations + */ + shares: string; + /** + * The delegatee (validator) address. + * @type {string} + * @memberof DelegationListAllOfDelegations + */ + validator: string; + /** + * The delegator address. + * @type {string} + * @memberof DelegationListAllOfDelegations + */ + delegator: string; +} + +/** + * Check if a given object implements the DelegationListAllOfDelegations interface. + */ +export function instanceOfDelegationListAllOfDelegations(value: object): value is DelegationListAllOfDelegations { + if (!('amount' in value) || value['amount'] === undefined) return false; + if (!('shares' in value) || value['shares'] === undefined) return false; + if (!('validator' in value) || value['validator'] === undefined) return false; + if (!('delegator' in value) || value['delegator'] === undefined) return false; + return true; +} + +export function DelegationListAllOfDelegationsFromJSON(json: any): DelegationListAllOfDelegations { + return DelegationListAllOfDelegationsFromJSONTyped(json, false); +} + +export function DelegationListAllOfDelegationsFromJSONTyped(json: any, ignoreDiscriminator: boolean): DelegationListAllOfDelegations { + if (json == null) { + return json; + } + return { + + 'amount': json['amount'], + 'shares': json['shares'], + 'validator': json['validator'], + 'delegator': json['delegator'], + }; +} + +export function DelegationListAllOfDelegationsToJSON(json: any): DelegationListAllOfDelegations { + return DelegationListAllOfDelegationsToJSONTyped(json, false); +} + +export function DelegationListAllOfDelegationsToJSONTyped(value?: DelegationListAllOfDelegations | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'amount': value['amount'], + 'shares': value['shares'], + 'validator': value['validator'], + 'delegator': value['delegator'], + }; +} + diff --git a/src/vendors/nexus/models/Entity.ts b/src/vendors/nexus/models/Entity.ts index 02a283c994..e5bbda6874 100644 --- a/src/vendors/nexus/models/Entity.ts +++ b/src/vendors/nexus/models/Entity.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * An entity registered at the consensus layer. + * * @export * @interface Entity */ @@ -39,12 +40,22 @@ export interface Entity { nodes: Array; } +/** + * Check if a given object implements the Entity interface. + */ +export function instanceOfEntity(value: object): value is Entity { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('address' in value) || value['address'] === undefined) return false; + if (!('nodes' in value) || value['nodes'] === undefined) return false; + return true; +} + export function EntityFromJSON(json: any): Entity { return EntityFromJSONTyped(json, false); } export function EntityFromJSONTyped(json: any, ignoreDiscriminator: boolean): Entity { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -55,19 +66,20 @@ export function EntityFromJSONTyped(json: any, ignoreDiscriminator: boolean): En }; } -export function EntityToJSON(value?: Entity | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EntityToJSON(json: any): Entity { + return EntityToJSONTyped(json, false); +} + +export function EntityToJSONTyped(value?: Entity | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'id': value.id, - 'address': value.address, - 'nodes': value.nodes, + 'id': value['id'], + 'address': value['address'], + 'nodes': value['nodes'], }; } - diff --git a/src/vendors/nexus/models/EntityList.ts b/src/vendors/nexus/models/EntityList.ts index c4fb7de4ce..fd46fb9567 100644 --- a/src/vendors/nexus/models/EntityList.ts +++ b/src/vendors/nexus/models/EntityList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EntityListAllOfEntities } from './EntityListAllOfEntities'; import { - Entity, - EntityFromJSON, - EntityFromJSONTyped, - EntityToJSON, - EntityListAllOf, - EntityListAllOfFromJSON, - EntityListAllOfFromJSONTyped, - EntityListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + EntityListAllOfEntitiesFromJSON, + EntityListAllOfEntitiesFromJSONTyped, + EntityListAllOfEntitiesToJSON, + EntityListAllOfEntitiesToJSONTyped, +} from './EntityListAllOfEntities'; /** * @@ -37,6 +30,7 @@ export interface EntityList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof EntityList */ @@ -49,10 +43,20 @@ export interface EntityList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof EntityList */ - entities: Array; + entities: Array; +} + +/** + * Check if a given object implements the EntityList interface. + */ +export function instanceOfEntityList(value: object): value is EntityList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('entities' in value) || value['entities'] === undefined) return false; + return true; } export function EntityListFromJSON(json: any): EntityList { @@ -60,30 +64,31 @@ export function EntityListFromJSON(json: any): EntityList { } export function EntityListFromJSONTyped(json: any, ignoreDiscriminator: boolean): EntityList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'entities': ((json['entities'] as Array).map(EntityFromJSON)), + 'entities': ((json['entities'] as Array).map(EntityListAllOfEntitiesFromJSON)), }; } -export function EntityListToJSON(value?: EntityList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EntityListToJSON(json: any): EntityList { + return EntityListToJSONTyped(json, false); +} + +export function EntityListToJSONTyped(value?: EntityList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'entities': ((value.entities as Array).map(EntityToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'entities': ((value['entities'] as Array).map(EntityListAllOfEntitiesToJSON)), }; } - diff --git a/src/vendors/nexus/models/EntityListAllOfEntities.ts b/src/vendors/nexus/models/EntityListAllOfEntities.ts new file mode 100644 index 0000000000..3df93ed4cc --- /dev/null +++ b/src/vendors/nexus/models/EntityListAllOfEntities.ts @@ -0,0 +1,84 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface EntityListAllOfEntities + */ +export interface EntityListAllOfEntities { + /** + * The public key identifying this entity. + * @type {string} + * @memberof EntityListAllOfEntities + */ + id: string; + /** + * The staking address belonging to this entity; derived from the entity's public key. + * @type {string} + * @memberof EntityListAllOfEntities + */ + address: string; + /** + * The vector of nodes owned by this entity. + * @type {Array} + * @memberof EntityListAllOfEntities + */ + nodes: Array; +} + +/** + * Check if a given object implements the EntityListAllOfEntities interface. + */ +export function instanceOfEntityListAllOfEntities(value: object): value is EntityListAllOfEntities { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('address' in value) || value['address'] === undefined) return false; + if (!('nodes' in value) || value['nodes'] === undefined) return false; + return true; +} + +export function EntityListAllOfEntitiesFromJSON(json: any): EntityListAllOfEntities { + return EntityListAllOfEntitiesFromJSONTyped(json, false); +} + +export function EntityListAllOfEntitiesFromJSONTyped(json: any, ignoreDiscriminator: boolean): EntityListAllOfEntities { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'address': json['address'], + 'nodes': json['nodes'], + }; +} + +export function EntityListAllOfEntitiesToJSON(json: any): EntityListAllOfEntities { + return EntityListAllOfEntitiesToJSONTyped(json, false); +} + +export function EntityListAllOfEntitiesToJSONTyped(value?: EntityListAllOfEntities | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'address': value['address'], + 'nodes': value['nodes'], + }; +} + diff --git a/src/vendors/nexus/models/Epoch.ts b/src/vendors/nexus/models/Epoch.ts index 8de6da612c..3bd72ca2bf 100644 --- a/src/vendors/nexus/models/Epoch.ts +++ b/src/vendors/nexus/models/Epoch.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A consensus epoch. + * * @export * @interface Epoch */ @@ -39,35 +40,45 @@ export interface Epoch { end_height?: number; } +/** + * Check if a given object implements the Epoch interface. + */ +export function instanceOfEpoch(value: object): value is Epoch { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('start_height' in value) || value['start_height'] === undefined) return false; + return true; +} + export function EpochFromJSON(json: any): Epoch { return EpochFromJSONTyped(json, false); } export function EpochFromJSONTyped(json: any, ignoreDiscriminator: boolean): Epoch { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'id': json['id'], 'start_height': json['start_height'], - 'end_height': !exists(json, 'end_height') ? undefined : json['end_height'], + 'end_height': json['end_height'] == null ? undefined : json['end_height'], }; } -export function EpochToJSON(value?: Epoch | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EpochToJSON(json: any): Epoch { + return EpochToJSONTyped(json, false); +} + +export function EpochToJSONTyped(value?: Epoch | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'id': value.id, - 'start_height': value.start_height, - 'end_height': value.end_height, + 'id': value['id'], + 'start_height': value['start_height'], + 'end_height': value['end_height'], }; } - diff --git a/src/vendors/nexus/models/EpochList.ts b/src/vendors/nexus/models/EpochList.ts index b4de01d371..8a1ba19c95 100644 --- a/src/vendors/nexus/models/EpochList.ts +++ b/src/vendors/nexus/models/EpochList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EpochListAllOfEpochs } from './EpochListAllOfEpochs'; import { - Epoch, - EpochFromJSON, - EpochFromJSONTyped, - EpochToJSON, - EpochListAllOf, - EpochListAllOfFromJSON, - EpochListAllOfFromJSONTyped, - EpochListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + EpochListAllOfEpochsFromJSON, + EpochListAllOfEpochsFromJSONTyped, + EpochListAllOfEpochsToJSON, + EpochListAllOfEpochsToJSONTyped, +} from './EpochListAllOfEpochs'; /** * @@ -37,6 +30,7 @@ export interface EpochList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof EpochList */ @@ -49,10 +43,20 @@ export interface EpochList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof EpochList */ - epochs: Array; + epochs: Array; +} + +/** + * Check if a given object implements the EpochList interface. + */ +export function instanceOfEpochList(value: object): value is EpochList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('epochs' in value) || value['epochs'] === undefined) return false; + return true; } export function EpochListFromJSON(json: any): EpochList { @@ -60,30 +64,31 @@ export function EpochListFromJSON(json: any): EpochList { } export function EpochListFromJSONTyped(json: any, ignoreDiscriminator: boolean): EpochList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'epochs': ((json['epochs'] as Array).map(EpochFromJSON)), + 'epochs': ((json['epochs'] as Array).map(EpochListAllOfEpochsFromJSON)), }; } -export function EpochListToJSON(value?: EpochList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EpochListToJSON(json: any): EpochList { + return EpochListToJSONTyped(json, false); +} + +export function EpochListToJSONTyped(value?: EpochList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'epochs': ((value.epochs as Array).map(EpochToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'epochs': ((value['epochs'] as Array).map(EpochListAllOfEpochsToJSON)), }; } - diff --git a/src/vendors/nexus/models/EpochListAllOfEpochs.ts b/src/vendors/nexus/models/EpochListAllOfEpochs.ts new file mode 100644 index 0000000000..aa4c49cf05 --- /dev/null +++ b/src/vendors/nexus/models/EpochListAllOfEpochs.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface EpochListAllOfEpochs + */ +export interface EpochListAllOfEpochs { + /** + * The epoch number. + * @type {number} + * @memberof EpochListAllOfEpochs + */ + id: number; + /** + * The (inclusive) height at which this epoch started. + * @type {number} + * @memberof EpochListAllOfEpochs + */ + start_height: number; + /** + * The (inclusive) height at which this epoch ended. Omitted if the epoch is still active. + * @type {number} + * @memberof EpochListAllOfEpochs + */ + end_height?: number; +} + +/** + * Check if a given object implements the EpochListAllOfEpochs interface. + */ +export function instanceOfEpochListAllOfEpochs(value: object): value is EpochListAllOfEpochs { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('start_height' in value) || value['start_height'] === undefined) return false; + return true; +} + +export function EpochListAllOfEpochsFromJSON(json: any): EpochListAllOfEpochs { + return EpochListAllOfEpochsFromJSONTyped(json, false); +} + +export function EpochListAllOfEpochsFromJSONTyped(json: any, ignoreDiscriminator: boolean): EpochListAllOfEpochs { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'start_height': json['start_height'], + 'end_height': json['end_height'] == null ? undefined : json['end_height'], + }; +} + +export function EpochListAllOfEpochsToJSON(json: any): EpochListAllOfEpochs { + return EpochListAllOfEpochsToJSONTyped(json, false); +} + +export function EpochListAllOfEpochsToJSONTyped(value?: EpochListAllOfEpochs | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'start_height': value['start_height'], + 'end_height': value['end_height'], + }; +} + diff --git a/src/vendors/nexus/models/Escrow.ts b/src/vendors/nexus/models/Escrow.ts index c60d139e4f..f8c13303e8 100644 --- a/src/vendors/nexus/models/Escrow.ts +++ b/src/vendors/nexus/models/Escrow.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -69,45 +69,53 @@ export interface Escrow { num_delegators?: number; } +/** + * Check if a given object implements the Escrow interface. + */ +export function instanceOfEscrow(value: object): value is Escrow { + return true; +} + export function EscrowFromJSON(json: any): Escrow { return EscrowFromJSONTyped(json, false); } export function EscrowFromJSONTyped(json: any, ignoreDiscriminator: boolean): Escrow { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'active_balance': !exists(json, 'active_balance') ? undefined : json['active_balance'], - 'active_shares': !exists(json, 'active_shares') ? undefined : json['active_shares'], - 'debonding_balance': !exists(json, 'debonding_balance') ? undefined : json['debonding_balance'], - 'debonding_shares': !exists(json, 'debonding_shares') ? undefined : json['debonding_shares'], - 'self_delegation_balance': !exists(json, 'self_delegation_balance') ? undefined : json['self_delegation_balance'], - 'self_delegation_shares': !exists(json, 'self_delegation_shares') ? undefined : json['self_delegation_shares'], - 'active_balance_24': !exists(json, 'active_balance_24') ? undefined : json['active_balance_24'], - 'num_delegators': !exists(json, 'num_delegators') ? undefined : json['num_delegators'], + 'active_balance': json['active_balance'] == null ? undefined : json['active_balance'], + 'active_shares': json['active_shares'] == null ? undefined : json['active_shares'], + 'debonding_balance': json['debonding_balance'] == null ? undefined : json['debonding_balance'], + 'debonding_shares': json['debonding_shares'] == null ? undefined : json['debonding_shares'], + 'self_delegation_balance': json['self_delegation_balance'] == null ? undefined : json['self_delegation_balance'], + 'self_delegation_shares': json['self_delegation_shares'] == null ? undefined : json['self_delegation_shares'], + 'active_balance_24': json['active_balance_24'] == null ? undefined : json['active_balance_24'], + 'num_delegators': json['num_delegators'] == null ? undefined : json['num_delegators'], }; } -export function EscrowToJSON(value?: Escrow | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EscrowToJSON(json: any): Escrow { + return EscrowToJSONTyped(json, false); +} + +export function EscrowToJSONTyped(value?: Escrow | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'active_balance': value.active_balance, - 'active_shares': value.active_shares, - 'debonding_balance': value.debonding_balance, - 'debonding_shares': value.debonding_shares, - 'self_delegation_balance': value.self_delegation_balance, - 'self_delegation_shares': value.self_delegation_shares, - 'active_balance_24': value.active_balance_24, - 'num_delegators': value.num_delegators, + 'active_balance': value['active_balance'], + 'active_shares': value['active_shares'], + 'debonding_balance': value['debonding_balance'], + 'debonding_shares': value['debonding_shares'], + 'self_delegation_balance': value['self_delegation_balance'], + 'self_delegation_shares': value['self_delegation_shares'], + 'active_balance_24': value['active_balance_24'], + 'num_delegators': value['num_delegators'], }; } - diff --git a/src/vendors/nexus/models/EvmAbiParam.ts b/src/vendors/nexus/models/EvmAbiParam.ts index 4dafa034fa..13e17a8dd3 100644 --- a/src/vendors/nexus/models/EvmAbiParam.ts +++ b/src/vendors/nexus/models/EvmAbiParam.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A decoded parameter of an event or error emitted from an EVM runtime. * Values of EVM type `int128`, `uint128`, `int256`, `uint256`, `fixed`, and `ufixed` are represented as strings. * Values of EVM type `address` and `address payable` are represented as lowercase hex strings with a "0x" prefix. * Values of EVM type `bytes` and `bytes` are represented as base64 strings. * Values of other EVM types (integer types, strings, arrays, etc.) are represented as their JSON counterpart. + * * @export * @interface EvmAbiParam */ @@ -43,12 +44,22 @@ export interface EvmAbiParam { value: any | null; } +/** + * Check if a given object implements the EvmAbiParam interface. + */ +export function instanceOfEvmAbiParam(value: object): value is EvmAbiParam { + if (!('name' in value) || value['name'] === undefined) return false; + if (!('evm_type' in value) || value['evm_type'] === undefined) return false; + if (!('value' in value) || value['value'] === undefined) return false; + return true; +} + export function EvmAbiParamFromJSON(json: any): EvmAbiParam { return EvmAbiParamFromJSONTyped(json, false); } export function EvmAbiParamFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmAbiParam { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -59,19 +70,20 @@ export function EvmAbiParamFromJSONTyped(json: any, ignoreDiscriminator: boolean }; } -export function EvmAbiParamToJSON(value?: EvmAbiParam | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EvmAbiParamToJSON(json: any): EvmAbiParam { + return EvmAbiParamToJSONTyped(json, false); +} + +export function EvmAbiParamToJSONTyped(value?: EvmAbiParam | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'name': value.name, - 'evm_type': value.evm_type, - 'value': value.value, + 'name': value['name'], + 'evm_type': value['evm_type'], + 'value': value['value'], }; } - diff --git a/src/vendors/nexus/models/EvmEventToken.ts b/src/vendors/nexus/models/EvmEventToken.ts index 2cd0094c9f..43823c97db 100644 --- a/src/vendors/nexus/models/EvmEventToken.ts +++ b/src/vendors/nexus/models/EvmEventToken.ts @@ -12,16 +12,18 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmTokenType } from './EvmTokenType'; import { - EvmTokenType, EvmTokenTypeFromJSON, EvmTokenTypeFromJSONTyped, EvmTokenTypeToJSON, -} from './'; + EvmTokenTypeToJSONTyped, +} from './EvmTokenType'; /** * Details about the EVM token involved in the event, if any. + * * @export * @interface EvmEventToken */ @@ -42,41 +44,52 @@ export interface EvmEventToken { * The number of least significant digits in base units that should be displayed as * decimals when displaying tokens. `tokens = base_units / (10**decimals)`. * Affects display only. Often equals 18, to match ETH. + * * @type {number} * @memberof EvmEventToken */ decimals?: number; } + + +/** + * Check if a given object implements the EvmEventToken interface. + */ +export function instanceOfEvmEventToken(value: object): value is EvmEventToken { + return true; +} + export function EvmEventTokenFromJSON(json: any): EvmEventToken { return EvmEventTokenFromJSONTyped(json, false); } export function EvmEventTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmEventToken { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'type': !exists(json, 'type') ? undefined : EvmTokenTypeFromJSON(json['type']), - 'symbol': !exists(json, 'symbol') ? undefined : json['symbol'], - 'decimals': !exists(json, 'decimals') ? undefined : json['decimals'], + 'type': json['type'] == null ? undefined : EvmTokenTypeFromJSON(json['type']), + 'symbol': json['symbol'] == null ? undefined : json['symbol'], + 'decimals': json['decimals'] == null ? undefined : json['decimals'], }; } -export function EvmEventTokenToJSON(value?: EvmEventToken | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EvmEventTokenToJSON(json: any): EvmEventToken { + return EvmEventTokenToJSONTyped(json, false); +} + +export function EvmEventTokenToJSONTyped(value?: EvmEventToken | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'type': EvmTokenTypeToJSON(value.type), - 'symbol': value.symbol, - 'decimals': value.decimals, + 'type': EvmTokenTypeToJSON(value['type']), + 'symbol': value['symbol'], + 'decimals': value['decimals'], }; } - diff --git a/src/vendors/nexus/models/EvmNft.ts b/src/vendors/nexus/models/EvmNft.ts index 471a2419f6..a32eeffacb 100644 --- a/src/vendors/nexus/models/EvmNft.ts +++ b/src/vendors/nexus/models/EvmNft.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmToken } from './EvmToken'; import { - EvmToken, EvmTokenFromJSON, EvmTokenFromJSONTyped, EvmTokenToJSON, -} from './'; + EvmTokenToJSONTyped, +} from './EvmToken'; /** * @@ -52,6 +53,7 @@ export interface EvmNft { owner_eth?: string; /** * The total number of transfers of this NFT instance. + * * @type {number} * @memberof EvmNft */ @@ -71,6 +73,7 @@ export interface EvmNft { /** * A metadata document for this NFT instance. * Currently only ERC-721 is supported, where the document is an Asset Metadata from the ERC721 Metadata JSON Schema. + * * @type {any} * @memberof EvmNft */ @@ -91,57 +94,68 @@ export interface EvmNft { * A URI pointing to a resource with mime type image/* representing * the asset which this NFT represents. (Additional * non-descriptive text from ERC-721 omitted.) + * * @type {string} * @memberof EvmNft */ image?: string; } +/** + * Check if a given object implements the EvmNft interface. + */ +export function instanceOfEvmNft(value: object): value is EvmNft { + if (!('token' in value) || value['token'] === undefined) return false; + if (!('id' in value) || value['id'] === undefined) return false; + return true; +} + export function EvmNftFromJSON(json: any): EvmNft { return EvmNftFromJSONTyped(json, false); } export function EvmNftFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmNft { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'token': EvmTokenFromJSON(json['token']), 'id': json['id'], - 'owner': !exists(json, 'owner') ? undefined : json['owner'], - 'owner_eth': !exists(json, 'owner_eth') ? undefined : json['owner_eth'], - 'num_transfers': !exists(json, 'num_transfers') ? undefined : json['num_transfers'], - 'metadata_uri': !exists(json, 'metadata_uri') ? undefined : json['metadata_uri'], - 'metadata_accessed': !exists(json, 'metadata_accessed') ? undefined : json['metadata_accessed'], - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - 'name': !exists(json, 'name') ? undefined : json['name'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'image': !exists(json, 'image') ? undefined : json['image'], + 'owner': json['owner'] == null ? undefined : json['owner'], + 'owner_eth': json['owner_eth'] == null ? undefined : json['owner_eth'], + 'num_transfers': json['num_transfers'] == null ? undefined : json['num_transfers'], + 'metadata_uri': json['metadata_uri'] == null ? undefined : json['metadata_uri'], + 'metadata_accessed': json['metadata_accessed'] == null ? undefined : json['metadata_accessed'], + 'metadata': json['metadata'] == null ? undefined : json['metadata'], + 'name': json['name'] == null ? undefined : json['name'], + 'description': json['description'] == null ? undefined : json['description'], + 'image': json['image'] == null ? undefined : json['image'], }; } -export function EvmNftToJSON(value?: EvmNft | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EvmNftToJSON(json: any): EvmNft { + return EvmNftToJSONTyped(json, false); +} + +export function EvmNftToJSONTyped(value?: EvmNft | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'token': EvmTokenToJSON(value.token), - 'id': value.id, - 'owner': value.owner, - 'owner_eth': value.owner_eth, - 'num_transfers': value.num_transfers, - 'metadata_uri': value.metadata_uri, - 'metadata_accessed': value.metadata_accessed, - 'metadata': value.metadata, - 'name': value.name, - 'description': value.description, - 'image': value.image, + 'token': EvmTokenToJSON(value['token']), + 'id': value['id'], + 'owner': value['owner'], + 'owner_eth': value['owner_eth'], + 'num_transfers': value['num_transfers'], + 'metadata_uri': value['metadata_uri'], + 'metadata_accessed': value['metadata_accessed'], + 'metadata': value['metadata'], + 'name': value['name'], + 'description': value['description'], + 'image': value['image'], }; } - diff --git a/src/vendors/nexus/models/EvmNftList.ts b/src/vendors/nexus/models/EvmNftList.ts index 9ad1406434..a6c7cae238 100644 --- a/src/vendors/nexus/models/EvmNftList.ts +++ b/src/vendors/nexus/models/EvmNftList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmNftListAllOfEvmNfts } from './EvmNftListAllOfEvmNfts'; import { - EvmNft, - EvmNftFromJSON, - EvmNftFromJSONTyped, - EvmNftToJSON, - EvmNftListAllOf, - EvmNftListAllOfFromJSON, - EvmNftListAllOfFromJSONTyped, - EvmNftListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + EvmNftListAllOfEvmNftsFromJSON, + EvmNftListAllOfEvmNftsFromJSONTyped, + EvmNftListAllOfEvmNftsToJSON, + EvmNftListAllOfEvmNftsToJSONTyped, +} from './EvmNftListAllOfEvmNfts'; /** * @@ -37,6 +30,7 @@ export interface EvmNftList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof EvmNftList */ @@ -49,10 +43,20 @@ export interface EvmNftList { is_total_count_clipped: boolean; /** * A list of L2 EVM NFT (ERC-721, ...) instances. - * @type {Array} + * @type {Array} * @memberof EvmNftList */ - evm_nfts: Array; + evm_nfts: Array; +} + +/** + * Check if a given object implements the EvmNftList interface. + */ +export function instanceOfEvmNftList(value: object): value is EvmNftList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('evm_nfts' in value) || value['evm_nfts'] === undefined) return false; + return true; } export function EvmNftListFromJSON(json: any): EvmNftList { @@ -60,30 +64,31 @@ export function EvmNftListFromJSON(json: any): EvmNftList { } export function EvmNftListFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmNftList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'evm_nfts': ((json['evm_nfts'] as Array).map(EvmNftFromJSON)), + 'evm_nfts': ((json['evm_nfts'] as Array).map(EvmNftListAllOfEvmNftsFromJSON)), }; } -export function EvmNftListToJSON(value?: EvmNftList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EvmNftListToJSON(json: any): EvmNftList { + return EvmNftListToJSONTyped(json, false); +} + +export function EvmNftListToJSONTyped(value?: EvmNftList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'evm_nfts': ((value.evm_nfts as Array).map(EvmNftToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'evm_nfts': ((value['evm_nfts'] as Array).map(EvmNftListAllOfEvmNftsToJSON)), }; } - diff --git a/src/vendors/nexus/models/EvmNftListAllOfEvmNfts.ts b/src/vendors/nexus/models/EvmNftListAllOfEvmNfts.ts new file mode 100644 index 0000000000..cddf8ce320 --- /dev/null +++ b/src/vendors/nexus/models/EvmNftListAllOfEvmNfts.ts @@ -0,0 +1,161 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { EvmToken } from './EvmToken'; +import { + EvmTokenFromJSON, + EvmTokenFromJSONTyped, + EvmTokenToJSON, + EvmTokenToJSONTyped, +} from './EvmToken'; + +/** + * + * @export + * @interface EvmNftListAllOfEvmNfts + */ +export interface EvmNftListAllOfEvmNfts { + /** + * + * @type {EvmToken} + * @memberof EvmNftListAllOfEvmNfts + */ + token: EvmToken; + /** + * The instance ID of this NFT within the collection represented by `token`. + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + id: string; + /** + * The Oasis address of this NFT instance's owner. + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + owner?: string; + /** + * The Ethereum address of this NFT instance's owner. + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + owner_eth?: string; + /** + * The total number of transfers of this NFT instance. + * + * @type {number} + * @memberof EvmNftListAllOfEvmNfts + */ + num_transfers?: number; + /** + * + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + metadata_uri?: string; + /** + * + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + metadata_accessed?: string; + /** + * A metadata document for this NFT instance. + * Currently only ERC-721 is supported, where the document is an Asset Metadata from the ERC721 Metadata JSON Schema. + * + * @type {any} + * @memberof EvmNftListAllOfEvmNfts + */ + metadata?: any | null; + /** + * Identifies the asset which this NFT represents + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + name?: string; + /** + * Describes the asset which this NFT represents + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + description?: string; + /** + * A URI pointing to a resource with mime type image/* representing + * the asset which this NFT represents. (Additional + * non-descriptive text from ERC-721 omitted.) + * + * @type {string} + * @memberof EvmNftListAllOfEvmNfts + */ + image?: string; +} + +/** + * Check if a given object implements the EvmNftListAllOfEvmNfts interface. + */ +export function instanceOfEvmNftListAllOfEvmNfts(value: object): value is EvmNftListAllOfEvmNfts { + if (!('token' in value) || value['token'] === undefined) return false; + if (!('id' in value) || value['id'] === undefined) return false; + return true; +} + +export function EvmNftListAllOfEvmNftsFromJSON(json: any): EvmNftListAllOfEvmNfts { + return EvmNftListAllOfEvmNftsFromJSONTyped(json, false); +} + +export function EvmNftListAllOfEvmNftsFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmNftListAllOfEvmNfts { + if (json == null) { + return json; + } + return { + + 'token': EvmTokenFromJSON(json['token']), + 'id': json['id'], + 'owner': json['owner'] == null ? undefined : json['owner'], + 'owner_eth': json['owner_eth'] == null ? undefined : json['owner_eth'], + 'num_transfers': json['num_transfers'] == null ? undefined : json['num_transfers'], + 'metadata_uri': json['metadata_uri'] == null ? undefined : json['metadata_uri'], + 'metadata_accessed': json['metadata_accessed'] == null ? undefined : json['metadata_accessed'], + 'metadata': json['metadata'] == null ? undefined : json['metadata'], + 'name': json['name'] == null ? undefined : json['name'], + 'description': json['description'] == null ? undefined : json['description'], + 'image': json['image'] == null ? undefined : json['image'], + }; +} + +export function EvmNftListAllOfEvmNftsToJSON(json: any): EvmNftListAllOfEvmNfts { + return EvmNftListAllOfEvmNftsToJSONTyped(json, false); +} + +export function EvmNftListAllOfEvmNftsToJSONTyped(value?: EvmNftListAllOfEvmNfts | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'token': EvmTokenToJSON(value['token']), + 'id': value['id'], + 'owner': value['owner'], + 'owner_eth': value['owner_eth'], + 'num_transfers': value['num_transfers'], + 'metadata_uri': value['metadata_uri'], + 'metadata_accessed': value['metadata_accessed'], + 'metadata': value['metadata'], + 'name': value['name'], + 'description': value['description'], + 'image': value['image'], + }; +} + diff --git a/src/vendors/nexus/models/EvmToken.ts b/src/vendors/nexus/models/EvmToken.ts index de87571cb0..662e5370b3 100644 --- a/src/vendors/nexus/models/EvmToken.ts +++ b/src/vendors/nexus/models/EvmToken.ts @@ -12,17 +12,21 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmTokenType } from './EvmTokenType'; import { - EvmTokenType, EvmTokenTypeFromJSON, EvmTokenTypeFromJSONTyped, EvmTokenTypeToJSON, - VerificationLevel, + EvmTokenTypeToJSONTyped, +} from './EvmTokenType'; +import type { VerificationLevel } from './VerificationLevel'; +import { VerificationLevelFromJSON, VerificationLevelFromJSONTyped, VerificationLevelToJSON, -} from './'; + VerificationLevelToJSONTyped, +} from './VerificationLevel'; /** * @@ -58,6 +62,7 @@ export interface EvmToken { * The number of least significant digits in base units that should be displayed as * decimals when displaying tokens. `tokens = base_units / (10**decimals)`. * Affects display only. Often equals 18, to match ETH. + * * @type {number} * @memberof EvmToken */ @@ -67,6 +72,7 @@ export interface EvmToken { * A less specialized variant of the token might be detected; for example, an * ERC-1363 token might be labeled as ERC-20 here. If the type cannot be * detected or is not supported, this field will be null/absent. + * * @type {EvmTokenType} * @memberof EvmToken */ @@ -79,12 +85,14 @@ export interface EvmToken { total_supply?: string; /** * The total number of transfers of this token. + * * @type {number} * @memberof EvmToken */ num_transfers?: number; /** * The number of addresses that have a nonzero balance of this token. + * * @type {number} * @memberof EvmToken */ @@ -94,8 +102,10 @@ export interface EvmToken { * Additional information on verified contracts is available via * the `/{runtime}/accounts/{address}` endpoint. * DEPRECATED: This field will be removed in the future in favor of verification_level + * * @type {boolean} * @memberof EvmToken + * @deprecated */ is_verified: boolean; /** @@ -106,51 +116,66 @@ export interface EvmToken { verification_level?: VerificationLevel; } + + +/** + * Check if a given object implements the EvmToken interface. + */ +export function instanceOfEvmToken(value: object): value is EvmToken { + if (!('contract_addr' in value) || value['contract_addr'] === undefined) return false; + if (!('eth_contract_addr' in value) || value['eth_contract_addr'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('num_holders' in value) || value['num_holders'] === undefined) return false; + if (!('is_verified' in value) || value['is_verified'] === undefined) return false; + return true; +} + export function EvmTokenFromJSON(json: any): EvmToken { return EvmTokenFromJSONTyped(json, false); } export function EvmTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmToken { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'contract_addr': json['contract_addr'], 'eth_contract_addr': json['eth_contract_addr'], - 'name': !exists(json, 'name') ? undefined : json['name'], - 'symbol': !exists(json, 'symbol') ? undefined : json['symbol'], - 'decimals': !exists(json, 'decimals') ? undefined : json['decimals'], + 'name': json['name'] == null ? undefined : json['name'], + 'symbol': json['symbol'] == null ? undefined : json['symbol'], + 'decimals': json['decimals'] == null ? undefined : json['decimals'], 'type': EvmTokenTypeFromJSON(json['type']), - 'total_supply': !exists(json, 'total_supply') ? undefined : json['total_supply'], - 'num_transfers': !exists(json, 'num_transfers') ? undefined : json['num_transfers'], + 'total_supply': json['total_supply'] == null ? undefined : json['total_supply'], + 'num_transfers': json['num_transfers'] == null ? undefined : json['num_transfers'], 'num_holders': json['num_holders'], 'is_verified': json['is_verified'], - 'verification_level': !exists(json, 'verification_level') ? undefined : VerificationLevelFromJSON(json['verification_level']), + 'verification_level': json['verification_level'] == null ? undefined : VerificationLevelFromJSON(json['verification_level']), }; } -export function EvmTokenToJSON(value?: EvmToken | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EvmTokenToJSON(json: any): EvmToken { + return EvmTokenToJSONTyped(json, false); +} + +export function EvmTokenToJSONTyped(value?: EvmToken | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'contract_addr': value.contract_addr, - 'eth_contract_addr': value.eth_contract_addr, - 'name': value.name, - 'symbol': value.symbol, - 'decimals': value.decimals, - 'type': EvmTokenTypeToJSON(value.type), - 'total_supply': value.total_supply, - 'num_transfers': value.num_transfers, - 'num_holders': value.num_holders, - 'is_verified': value.is_verified, - 'verification_level': VerificationLevelToJSON(value.verification_level), + 'contract_addr': value['contract_addr'], + 'eth_contract_addr': value['eth_contract_addr'], + 'name': value['name'], + 'symbol': value['symbol'], + 'decimals': value['decimals'], + 'type': EvmTokenTypeToJSON(value['type']), + 'total_supply': value['total_supply'], + 'num_transfers': value['num_transfers'], + 'num_holders': value['num_holders'], + 'is_verified': value['is_verified'], + 'verification_level': VerificationLevelToJSON(value['verification_level']), }; } - diff --git a/src/vendors/nexus/models/EvmTokenList.ts b/src/vendors/nexus/models/EvmTokenList.ts index ecf18d026c..e14474fa5c 100644 --- a/src/vendors/nexus/models/EvmTokenList.ts +++ b/src/vendors/nexus/models/EvmTokenList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmTokenListAllOfEvmTokens } from './EvmTokenListAllOfEvmTokens'; import { - EvmToken, - EvmTokenFromJSON, - EvmTokenFromJSONTyped, - EvmTokenToJSON, - EvmTokenListAllOf, - EvmTokenListAllOfFromJSON, - EvmTokenListAllOfFromJSONTyped, - EvmTokenListAllOfToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, -} from './'; + EvmTokenListAllOfEvmTokensFromJSON, + EvmTokenListAllOfEvmTokensFromJSONTyped, + EvmTokenListAllOfEvmTokensToJSON, + EvmTokenListAllOfEvmTokensToJSONTyped, +} from './EvmTokenListAllOfEvmTokens'; /** * @@ -37,6 +30,7 @@ export interface EvmTokenList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof EvmTokenList */ @@ -49,10 +43,20 @@ export interface EvmTokenList { is_total_count_clipped: boolean; /** * A list of L2 EVM tokens (ERC-20, ERC-721, ...). - * @type {Array} + * @type {Array} * @memberof EvmTokenList */ - evm_tokens: Array; + evm_tokens: Array; +} + +/** + * Check if a given object implements the EvmTokenList interface. + */ +export function instanceOfEvmTokenList(value: object): value is EvmTokenList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('evm_tokens' in value) || value['evm_tokens'] === undefined) return false; + return true; } export function EvmTokenListFromJSON(json: any): EvmTokenList { @@ -60,30 +64,31 @@ export function EvmTokenListFromJSON(json: any): EvmTokenList { } export function EvmTokenListFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmTokenList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'evm_tokens': ((json['evm_tokens'] as Array).map(EvmTokenFromJSON)), + 'evm_tokens': ((json['evm_tokens'] as Array).map(EvmTokenListAllOfEvmTokensFromJSON)), }; } -export function EvmTokenListToJSON(value?: EvmTokenList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function EvmTokenListToJSON(json: any): EvmTokenList { + return EvmTokenListToJSONTyped(json, false); +} + +export function EvmTokenListToJSONTyped(value?: EvmTokenList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'evm_tokens': ((value.evm_tokens as Array).map(EvmTokenToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'evm_tokens': ((value['evm_tokens'] as Array).map(EvmTokenListAllOfEvmTokensToJSON)), }; } - diff --git a/src/vendors/nexus/models/EvmTokenListAllOfEvmTokens.ts b/src/vendors/nexus/models/EvmTokenListAllOfEvmTokens.ts new file mode 100644 index 0000000000..deb3f7916e --- /dev/null +++ b/src/vendors/nexus/models/EvmTokenListAllOfEvmTokens.ts @@ -0,0 +1,181 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { EvmTokenType } from './EvmTokenType'; +import { + EvmTokenTypeFromJSON, + EvmTokenTypeFromJSONTyped, + EvmTokenTypeToJSON, + EvmTokenTypeToJSONTyped, +} from './EvmTokenType'; +import type { VerificationLevel } from './VerificationLevel'; +import { + VerificationLevelFromJSON, + VerificationLevelFromJSONTyped, + VerificationLevelToJSON, + VerificationLevelToJSONTyped, +} from './VerificationLevel'; + +/** + * + * @export + * @interface EvmTokenListAllOfEvmTokens + */ +export interface EvmTokenListAllOfEvmTokens { + /** + * The Oasis address of this token's contract. + * @type {string} + * @memberof EvmTokenListAllOfEvmTokens + */ + contract_addr: string; + /** + * The Ethereum address of this token's contract. + * @type {string} + * @memberof EvmTokenListAllOfEvmTokens + */ + eth_contract_addr: string; + /** + * Name of the token, as provided by token contract's `name()` method. + * @type {string} + * @memberof EvmTokenListAllOfEvmTokens + */ + name?: string; + /** + * Symbol of the token, as provided by token contract's `symbol()` method. + * @type {string} + * @memberof EvmTokenListAllOfEvmTokens + */ + symbol?: string; + /** + * The number of least significant digits in base units that should be displayed as + * decimals when displaying tokens. `tokens = base_units / (10**decimals)`. + * Affects display only. Often equals 18, to match ETH. + * + * @type {number} + * @memberof EvmTokenListAllOfEvmTokens + */ + decimals?: number; + /** + * The heuristically determined interface that the token contract implements. + * A less specialized variant of the token might be detected; for example, an + * ERC-1363 token might be labeled as ERC-20 here. If the type cannot be + * detected or is not supported, this field will be null/absent. + * + * @type {EvmTokenType} + * @memberof EvmTokenListAllOfEvmTokens + */ + type: EvmTokenType; + /** + * The total number of base units available. + * @type {string} + * @memberof EvmTokenListAllOfEvmTokens + */ + total_supply?: string; + /** + * The total number of transfers of this token. + * + * @type {number} + * @memberof EvmTokenListAllOfEvmTokens + */ + num_transfers?: number; + /** + * The number of addresses that have a nonzero balance of this token. + * + * @type {number} + * @memberof EvmTokenListAllOfEvmTokens + */ + num_holders: number; + /** + * Whether the contract has been successfully verified by Sourcify. + * Additional information on verified contracts is available via + * the `/{runtime}/accounts/{address}` endpoint. + * DEPRECATED: This field will be removed in the future in favor of verification_level + * + * @type {boolean} + * @memberof EvmTokenListAllOfEvmTokens + * @deprecated + */ + is_verified: boolean; + /** + * + * @type {VerificationLevel} + * @memberof EvmTokenListAllOfEvmTokens + */ + verification_level?: VerificationLevel; +} + + + +/** + * Check if a given object implements the EvmTokenListAllOfEvmTokens interface. + */ +export function instanceOfEvmTokenListAllOfEvmTokens(value: object): value is EvmTokenListAllOfEvmTokens { + if (!('contract_addr' in value) || value['contract_addr'] === undefined) return false; + if (!('eth_contract_addr' in value) || value['eth_contract_addr'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('num_holders' in value) || value['num_holders'] === undefined) return false; + if (!('is_verified' in value) || value['is_verified'] === undefined) return false; + return true; +} + +export function EvmTokenListAllOfEvmTokensFromJSON(json: any): EvmTokenListAllOfEvmTokens { + return EvmTokenListAllOfEvmTokensFromJSONTyped(json, false); +} + +export function EvmTokenListAllOfEvmTokensFromJSONTyped(json: any, ignoreDiscriminator: boolean): EvmTokenListAllOfEvmTokens { + if (json == null) { + return json; + } + return { + + 'contract_addr': json['contract_addr'], + 'eth_contract_addr': json['eth_contract_addr'], + 'name': json['name'] == null ? undefined : json['name'], + 'symbol': json['symbol'] == null ? undefined : json['symbol'], + 'decimals': json['decimals'] == null ? undefined : json['decimals'], + 'type': EvmTokenTypeFromJSON(json['type']), + 'total_supply': json['total_supply'] == null ? undefined : json['total_supply'], + 'num_transfers': json['num_transfers'] == null ? undefined : json['num_transfers'], + 'num_holders': json['num_holders'], + 'is_verified': json['is_verified'], + 'verification_level': json['verification_level'] == null ? undefined : VerificationLevelFromJSON(json['verification_level']), + }; +} + +export function EvmTokenListAllOfEvmTokensToJSON(json: any): EvmTokenListAllOfEvmTokens { + return EvmTokenListAllOfEvmTokensToJSONTyped(json, false); +} + +export function EvmTokenListAllOfEvmTokensToJSONTyped(value?: EvmTokenListAllOfEvmTokens | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'contract_addr': value['contract_addr'], + 'eth_contract_addr': value['eth_contract_addr'], + 'name': value['name'], + 'symbol': value['symbol'], + 'decimals': value['decimals'], + 'type': EvmTokenTypeToJSON(value['type']), + 'total_supply': value['total_supply'], + 'num_transfers': value['num_transfers'], + 'num_holders': value['num_holders'], + 'is_verified': value['is_verified'], + 'verification_level': VerificationLevelToJSON(value['verification_level']), + }; +} + diff --git a/src/vendors/nexus/models/EvmTokenType.ts b/src/vendors/nexus/models/EvmTokenType.ts index 5e25f44f47..bcfba49962 100644 --- a/src/vendors/nexus/models/EvmTokenType.ts +++ b/src/vendors/nexus/models/EvmTokenType.ts @@ -12,14 +12,28 @@ * Do not edit the class manually. */ + /** * The type of a EVM token. + * * @export - * @enum {string} */ -export enum EvmTokenType { - Erc20 = 'ERC20', - Erc721 = 'ERC721' +export const EvmTokenType = { + Erc20: 'ERC20', + Erc721: 'ERC721' +} as const; +export type EvmTokenType = typeof EvmTokenType[keyof typeof EvmTokenType]; + + +export function instanceOfEvmTokenType(value: any): boolean { + for (const key in EvmTokenType) { + if (Object.prototype.hasOwnProperty.call(EvmTokenType, key)) { + if (EvmTokenType[key as keyof typeof EvmTokenType] === value) { + return true; + } + } + } + return false; } export function EvmTokenTypeFromJSON(json: any): EvmTokenType { @@ -34,3 +48,7 @@ export function EvmTokenTypeToJSON(value?: EvmTokenType | null): any { return value as any; } +export function EvmTokenTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): EvmTokenType { + return value as EvmTokenType; +} + diff --git a/src/vendors/nexus/models/GetStatus400Response.ts b/src/vendors/nexus/models/GetStatus400Response.ts new file mode 100644 index 0000000000..81bac61f44 --- /dev/null +++ b/src/vendors/nexus/models/GetStatus400Response.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface GetStatus400Response + */ +export interface GetStatus400Response { + /** + * An error message. + * @type {string} + * @memberof GetStatus400Response + */ + msg: string; +} + +/** + * Check if a given object implements the GetStatus400Response interface. + */ +export function instanceOfGetStatus400Response(value: object): value is GetStatus400Response { + if (!('msg' in value) || value['msg'] === undefined) return false; + return true; +} + +export function GetStatus400ResponseFromJSON(json: any): GetStatus400Response { + return GetStatus400ResponseFromJSONTyped(json, false); +} + +export function GetStatus400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetStatus400Response { + if (json == null) { + return json; + } + return { + + 'msg': json['msg'], + }; +} + +export function GetStatus400ResponseToJSON(json: any): GetStatus400Response { + return GetStatus400ResponseToJSONTyped(json, false); +} + +export function GetStatus400ResponseToJSONTyped(value?: GetStatus400Response | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'msg': value['msg'], + }; +} + diff --git a/src/vendors/nexus/models/Layer.ts b/src/vendors/nexus/models/Layer.ts index 80bde82fc8..e5b33e3c73 100644 --- a/src/vendors/nexus/models/Layer.ts +++ b/src/vendors/nexus/models/Layer.ts @@ -12,18 +12,31 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum Layer { - Emerald = 'emerald', - Sapphire = 'sapphire', - Pontusxtest = 'pontusxtest', - Pontusxdev = 'pontusxdev', - Cipher = 'cipher', - Consensus = 'consensus' +export const Layer = { + Emerald: 'emerald', + Sapphire: 'sapphire', + Pontusxtest: 'pontusxtest', + Pontusxdev: 'pontusxdev', + Cipher: 'cipher', + Consensus: 'consensus' +} as const; +export type Layer = typeof Layer[keyof typeof Layer]; + + +export function instanceOfLayer(value: any): boolean { + for (const key in Layer) { + if (Object.prototype.hasOwnProperty.call(Layer, key)) { + if (Layer[key as keyof typeof Layer] === value) { + return true; + } + } + } + return false; } export function LayerFromJSON(json: any): Layer { @@ -38,3 +51,7 @@ export function LayerToJSON(value?: Layer | null): any { return value as any; } +export function LayerToJSONTyped(value: any, ignoreDiscriminator: boolean): Layer { + return value as Layer; +} + diff --git a/src/vendors/nexus/models/List.ts b/src/vendors/nexus/models/List.ts index 06aadf1156..746c4a1fff 100644 --- a/src/vendors/nexus/models/List.ts +++ b/src/vendors/nexus/models/List.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -22,6 +22,7 @@ export interface List { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof List */ @@ -34,12 +35,21 @@ export interface List { is_total_count_clipped: boolean; } +/** + * Check if a given object implements the List interface. + */ +export function instanceOfList(value: object): value is List { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + return true; +} + export function ListFromJSON(json: any): List { return ListFromJSONTyped(json, false); } export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -49,18 +59,19 @@ export function ListFromJSONTyped(json: any, ignoreDiscriminator: boolean): List }; } -export function ListToJSON(value?: List | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ListToJSON(json: any): List { + return ListToJSONTyped(json, false); +} + +export function ListToJSONTyped(value?: List | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], }; } - diff --git a/src/vendors/nexus/models/Node.ts b/src/vendors/nexus/models/Node.ts index 4d00181fd0..a4442cad22 100644 --- a/src/vendors/nexus/models/Node.ts +++ b/src/vendors/nexus/models/Node.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A node registered at the consensus layer. + * * @export * @interface Node */ @@ -27,6 +28,7 @@ export interface Node { id: string; /** * The public key identifying the entity controlling this node. + * * @type {string} * @memberof Node */ @@ -46,6 +48,7 @@ export interface Node { /** * The public key that will be used for establishing TLS connections * upon rotation. + * * @type {string} * @memberof Node */ @@ -70,12 +73,27 @@ export interface Node { roles: string; } +/** + * Check if a given object implements the Node interface. + */ +export function instanceOfNode(value: object): value is Node { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('entity_id' in value) || value['entity_id'] === undefined) return false; + if (!('expiration' in value) || value['expiration'] === undefined) return false; + if (!('tls_pubkey' in value) || value['tls_pubkey'] === undefined) return false; + if (!('tls_next_pubkey' in value) || value['tls_next_pubkey'] === undefined) return false; + if (!('p2p_pubkey' in value) || value['p2p_pubkey'] === undefined) return false; + if (!('consensus_pubkey' in value) || value['consensus_pubkey'] === undefined) return false; + if (!('roles' in value) || value['roles'] === undefined) return false; + return true; +} + export function NodeFromJSON(json: any): Node { return NodeFromJSONTyped(json, false); } export function NodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): Node { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -91,24 +109,25 @@ export function NodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): Node }; } -export function NodeToJSON(value?: Node | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function NodeToJSON(json: any): Node { + return NodeToJSONTyped(json, false); +} + +export function NodeToJSONTyped(value?: Node | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'id': value.id, - 'entity_id': value.entity_id, - 'expiration': value.expiration, - 'tls_pubkey': value.tls_pubkey, - 'tls_next_pubkey': value.tls_next_pubkey, - 'p2p_pubkey': value.p2p_pubkey, - 'consensus_pubkey': value.consensus_pubkey, - 'roles': value.roles, + 'id': value['id'], + 'entity_id': value['entity_id'], + 'expiration': value['expiration'], + 'tls_pubkey': value['tls_pubkey'], + 'tls_next_pubkey': value['tls_next_pubkey'], + 'p2p_pubkey': value['p2p_pubkey'], + 'consensus_pubkey': value['consensus_pubkey'], + 'roles': value['roles'], }; } - diff --git a/src/vendors/nexus/models/NodeList.ts b/src/vendors/nexus/models/NodeList.ts index b6b5e82bd1..7e73c2072a 100644 --- a/src/vendors/nexus/models/NodeList.ts +++ b/src/vendors/nexus/models/NodeList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { NodeListAllOfNodes } from './NodeListAllOfNodes'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - Node, - NodeFromJSON, - NodeFromJSONTyped, - NodeToJSON, - NodeListAllOf, - NodeListAllOfFromJSON, - NodeListAllOfFromJSONTyped, - NodeListAllOfToJSON, -} from './'; + NodeListAllOfNodesFromJSON, + NodeListAllOfNodesFromJSONTyped, + NodeListAllOfNodesToJSON, + NodeListAllOfNodesToJSONTyped, +} from './NodeListAllOfNodes'; /** * @@ -37,6 +30,7 @@ export interface NodeList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof NodeList */ @@ -55,10 +49,21 @@ export interface NodeList { entity_id: string; /** * - * @type {Array} + * @type {Array} * @memberof NodeList */ - nodes: Array; + nodes: Array; +} + +/** + * Check if a given object implements the NodeList interface. + */ +export function instanceOfNodeList(value: object): value is NodeList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('entity_id' in value) || value['entity_id'] === undefined) return false; + if (!('nodes' in value) || value['nodes'] === undefined) return false; + return true; } export function NodeListFromJSON(json: any): NodeList { @@ -66,7 +71,7 @@ export function NodeListFromJSON(json: any): NodeList { } export function NodeListFromJSONTyped(json: any, ignoreDiscriminator: boolean): NodeList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -74,24 +79,25 @@ export function NodeListFromJSONTyped(json: any, ignoreDiscriminator: boolean): 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], 'entity_id': json['entity_id'], - 'nodes': ((json['nodes'] as Array).map(NodeFromJSON)), + 'nodes': ((json['nodes'] as Array).map(NodeListAllOfNodesFromJSON)), }; } -export function NodeListToJSON(value?: NodeList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function NodeListToJSON(json: any): NodeList { + return NodeListToJSONTyped(json, false); +} + +export function NodeListToJSONTyped(value?: NodeList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'entity_id': value.entity_id, - 'nodes': ((value.nodes as Array).map(NodeToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'entity_id': value['entity_id'], + 'nodes': ((value['nodes'] as Array).map(NodeListAllOfNodesToJSON)), }; } - diff --git a/src/vendors/nexus/models/NodeListAllOfNodes.ts b/src/vendors/nexus/models/NodeListAllOfNodes.ts new file mode 100644 index 0000000000..99508eab00 --- /dev/null +++ b/src/vendors/nexus/models/NodeListAllOfNodes.ts @@ -0,0 +1,132 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface NodeListAllOfNodes + */ +export interface NodeListAllOfNodes { + /** + * The public key identifying this node. + * @type {string} + * @memberof NodeListAllOfNodes + */ + id: string; + /** + * The public key identifying the entity controlling this node. + * + * @type {string} + * @memberof NodeListAllOfNodes + */ + entity_id: string; + /** + * The epoch in which this node's commitment expires. + * @type {number} + * @memberof NodeListAllOfNodes + */ + expiration: number; + /** + * The public key used for establishing TLS connections. + * @type {string} + * @memberof NodeListAllOfNodes + */ + tls_pubkey: string; + /** + * The public key that will be used for establishing TLS connections + * upon rotation. + * + * @type {string} + * @memberof NodeListAllOfNodes + */ + tls_next_pubkey: string; + /** + * The unique identifier of this node on the P2P transport. + * @type {string} + * @memberof NodeListAllOfNodes + */ + p2p_pubkey: string; + /** + * The unique identifier of this node as a consensus member + * @type {string} + * @memberof NodeListAllOfNodes + */ + consensus_pubkey: string; + /** + * A bitmask representing this node's roles. + * @type {string} + * @memberof NodeListAllOfNodes + */ + roles: string; +} + +/** + * Check if a given object implements the NodeListAllOfNodes interface. + */ +export function instanceOfNodeListAllOfNodes(value: object): value is NodeListAllOfNodes { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('entity_id' in value) || value['entity_id'] === undefined) return false; + if (!('expiration' in value) || value['expiration'] === undefined) return false; + if (!('tls_pubkey' in value) || value['tls_pubkey'] === undefined) return false; + if (!('tls_next_pubkey' in value) || value['tls_next_pubkey'] === undefined) return false; + if (!('p2p_pubkey' in value) || value['p2p_pubkey'] === undefined) return false; + if (!('consensus_pubkey' in value) || value['consensus_pubkey'] === undefined) return false; + if (!('roles' in value) || value['roles'] === undefined) return false; + return true; +} + +export function NodeListAllOfNodesFromJSON(json: any): NodeListAllOfNodes { + return NodeListAllOfNodesFromJSONTyped(json, false); +} + +export function NodeListAllOfNodesFromJSONTyped(json: any, ignoreDiscriminator: boolean): NodeListAllOfNodes { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'entity_id': json['entity_id'], + 'expiration': json['expiration'], + 'tls_pubkey': json['tls_pubkey'], + 'tls_next_pubkey': json['tls_next_pubkey'], + 'p2p_pubkey': json['p2p_pubkey'], + 'consensus_pubkey': json['consensus_pubkey'], + 'roles': json['roles'], + }; +} + +export function NodeListAllOfNodesToJSON(json: any): NodeListAllOfNodes { + return NodeListAllOfNodesToJSONTyped(json, false); +} + +export function NodeListAllOfNodesToJSONTyped(value?: NodeListAllOfNodes | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'entity_id': value['entity_id'], + 'expiration': value['expiration'], + 'tls_pubkey': value['tls_pubkey'], + 'tls_next_pubkey': value['tls_next_pubkey'], + 'p2p_pubkey': value['p2p_pubkey'], + 'consensus_pubkey': value['consensus_pubkey'], + 'roles': value['roles'], + }; +} + diff --git a/src/vendors/nexus/models/Proposal.ts b/src/vendors/nexus/models/Proposal.ts index 0b12498737..57dd83e66d 100644 --- a/src/vendors/nexus/models/Proposal.ts +++ b/src/vendors/nexus/models/Proposal.ts @@ -12,20 +12,25 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ProposalState } from './ProposalState'; import { - ProposalState, ProposalStateFromJSON, ProposalStateFromJSONTyped, ProposalStateToJSON, - ProposalTarget, + ProposalStateToJSONTyped, +} from './ProposalState'; +import type { ProposalTarget } from './ProposalTarget'; +import { ProposalTargetFromJSON, ProposalTargetFromJSONTyped, ProposalTargetToJSON, -} from './'; + ProposalTargetToJSONTyped, +} from './ProposalTarget'; /** * A governance proposal. + * * @export * @interface Proposal */ @@ -87,6 +92,7 @@ export interface Proposal { /** * The proposal to cancel, if this proposal proposes * cancelling an existing proposal. + * * @type {number} * @memberof Proposal */ @@ -94,6 +100,7 @@ export interface Proposal { /** * The name of the module whose parameters are to be changed * by this 'parameters_change' proposal. + * * @type {string} * @memberof Proposal */ @@ -118,18 +125,35 @@ export interface Proposal { closes_at: number; /** * The number of invalid votes for this proposal, after tallying. + * * @type {string} * @memberof Proposal */ invalid_votes: string; } + + +/** + * Check if a given object implements the Proposal interface. + */ +export function instanceOfProposal(value: object): value is Proposal { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('submitter' in value) || value['submitter'] === undefined) return false; + if (!('state' in value) || value['state'] === undefined) return false; + if (!('deposit' in value) || value['deposit'] === undefined) return false; + if (!('created_at' in value) || value['created_at'] === undefined) return false; + if (!('closes_at' in value) || value['closes_at'] === undefined) return false; + if (!('invalid_votes' in value) || value['invalid_votes'] === undefined) return false; + return true; +} + export function ProposalFromJSON(json: any): Proposal { return ProposalFromJSONTyped(json, false); } export function ProposalFromJSONTyped(json: any, ignoreDiscriminator: boolean): Proposal { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -138,45 +162,46 @@ export function ProposalFromJSONTyped(json: any, ignoreDiscriminator: boolean): 'submitter': json['submitter'], 'state': ProposalStateFromJSON(json['state']), 'deposit': json['deposit'], - 'title': !exists(json, 'title') ? undefined : json['title'], - 'description': !exists(json, 'description') ? undefined : json['description'], - 'handler': !exists(json, 'handler') ? undefined : json['handler'], - 'target': !exists(json, 'target') ? undefined : ProposalTargetFromJSON(json['target']), - 'epoch': !exists(json, 'epoch') ? undefined : json['epoch'], - 'cancels': !exists(json, 'cancels') ? undefined : json['cancels'], - 'parameters_change_module': !exists(json, 'parameters_change_module') ? undefined : json['parameters_change_module'], - 'parameters_change': !exists(json, 'parameters_change') ? undefined : json['parameters_change'], + 'title': json['title'] == null ? undefined : json['title'], + 'description': json['description'] == null ? undefined : json['description'], + 'handler': json['handler'] == null ? undefined : json['handler'], + 'target': json['target'] == null ? undefined : ProposalTargetFromJSON(json['target']), + 'epoch': json['epoch'] == null ? undefined : json['epoch'], + 'cancels': json['cancels'] == null ? undefined : json['cancels'], + 'parameters_change_module': json['parameters_change_module'] == null ? undefined : json['parameters_change_module'], + 'parameters_change': json['parameters_change'] == null ? undefined : json['parameters_change'], 'created_at': json['created_at'], 'closes_at': json['closes_at'], 'invalid_votes': json['invalid_votes'], }; } -export function ProposalToJSON(value?: Proposal | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ProposalToJSON(json: any): Proposal { + return ProposalToJSONTyped(json, false); +} + +export function ProposalToJSONTyped(value?: Proposal | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'id': value.id, - 'submitter': value.submitter, - 'state': ProposalStateToJSON(value.state), - 'deposit': value.deposit, - 'title': value.title, - 'description': value.description, - 'handler': value.handler, - 'target': ProposalTargetToJSON(value.target), - 'epoch': value.epoch, - 'cancels': value.cancels, - 'parameters_change_module': value.parameters_change_module, - 'parameters_change': value.parameters_change, - 'created_at': value.created_at, - 'closes_at': value.closes_at, - 'invalid_votes': value.invalid_votes, + 'id': value['id'], + 'submitter': value['submitter'], + 'state': ProposalStateToJSON(value['state']), + 'deposit': value['deposit'], + 'title': value['title'], + 'description': value['description'], + 'handler': value['handler'], + 'target': ProposalTargetToJSON(value['target']), + 'epoch': value['epoch'], + 'cancels': value['cancels'], + 'parameters_change_module': value['parameters_change_module'], + 'parameters_change': value['parameters_change'], + 'created_at': value['created_at'], + 'closes_at': value['closes_at'], + 'invalid_votes': value['invalid_votes'], }; } - diff --git a/src/vendors/nexus/models/ProposalList.ts b/src/vendors/nexus/models/ProposalList.ts index df4ae062e7..e41e1682e2 100644 --- a/src/vendors/nexus/models/ProposalList.ts +++ b/src/vendors/nexus/models/ProposalList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ProposalListAllOfProposals } from './ProposalListAllOfProposals'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - Proposal, - ProposalFromJSON, - ProposalFromJSONTyped, - ProposalToJSON, - ProposalListAllOf, - ProposalListAllOfFromJSON, - ProposalListAllOfFromJSONTyped, - ProposalListAllOfToJSON, -} from './'; + ProposalListAllOfProposalsFromJSON, + ProposalListAllOfProposalsFromJSONTyped, + ProposalListAllOfProposalsToJSON, + ProposalListAllOfProposalsToJSONTyped, +} from './ProposalListAllOfProposals'; /** * @@ -37,6 +30,7 @@ export interface ProposalList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof ProposalList */ @@ -49,10 +43,20 @@ export interface ProposalList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof ProposalList */ - proposals: Array; + proposals: Array; +} + +/** + * Check if a given object implements the ProposalList interface. + */ +export function instanceOfProposalList(value: object): value is ProposalList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('proposals' in value) || value['proposals'] === undefined) return false; + return true; } export function ProposalListFromJSON(json: any): ProposalList { @@ -60,30 +64,31 @@ export function ProposalListFromJSON(json: any): ProposalList { } export function ProposalListFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProposalList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'proposals': ((json['proposals'] as Array).map(ProposalFromJSON)), + 'proposals': ((json['proposals'] as Array).map(ProposalListAllOfProposalsFromJSON)), }; } -export function ProposalListToJSON(value?: ProposalList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ProposalListToJSON(json: any): ProposalList { + return ProposalListToJSONTyped(json, false); +} + +export function ProposalListToJSONTyped(value?: ProposalList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'proposals': ((value.proposals as Array).map(ProposalToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'proposals': ((value['proposals'] as Array).map(ProposalListAllOfProposalsToJSON)), }; } - diff --git a/src/vendors/nexus/models/ProposalListAllOfProposals.ts b/src/vendors/nexus/models/ProposalListAllOfProposals.ts new file mode 100644 index 0000000000..ec7e867794 --- /dev/null +++ b/src/vendors/nexus/models/ProposalListAllOfProposals.ts @@ -0,0 +1,206 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { ProposalState } from './ProposalState'; +import { + ProposalStateFromJSON, + ProposalStateFromJSONTyped, + ProposalStateToJSON, + ProposalStateToJSONTyped, +} from './ProposalState'; +import type { ProposalTarget } from './ProposalTarget'; +import { + ProposalTargetFromJSON, + ProposalTargetFromJSONTyped, + ProposalTargetToJSON, + ProposalTargetToJSONTyped, +} from './ProposalTarget'; + +/** + * + * @export + * @interface ProposalListAllOfProposals + */ +export interface ProposalListAllOfProposals { + /** + * The unique identifier of the proposal. + * @type {number} + * @memberof ProposalListAllOfProposals + */ + id: number; + /** + * The staking address of the proposal submitter. + * @type {string} + * @memberof ProposalListAllOfProposals + */ + submitter: string; + /** + * + * @type {ProposalState} + * @memberof ProposalListAllOfProposals + */ + state: ProposalState; + /** + * The deposit attached to this proposal. + * @type {string} + * @memberof ProposalListAllOfProposals + */ + deposit: string; + /** + * The (optional) title of the proposal. + * @type {string} + * @memberof ProposalListAllOfProposals + */ + title?: string; + /** + * The (optional) description of the proposal. + * @type {string} + * @memberof ProposalListAllOfProposals + */ + description?: string; + /** + * The name of the upgrade handler. + * @type {string} + * @memberof ProposalListAllOfProposals + */ + handler?: string; + /** + * + * @type {ProposalTarget} + * @memberof ProposalListAllOfProposals + */ + target?: ProposalTarget; + /** + * The epoch at which the proposed upgrade will happen. + * @type {number} + * @memberof ProposalListAllOfProposals + */ + epoch?: number; + /** + * The proposal to cancel, if this proposal proposes + * cancelling an existing proposal. + * + * @type {number} + * @memberof ProposalListAllOfProposals + */ + cancels?: number; + /** + * The name of the module whose parameters are to be changed + * by this 'parameters_change' proposal. + * + * @type {string} + * @memberof ProposalListAllOfProposals + */ + parameters_change_module?: string; + /** + * The parameters change proposal body. This spec does not encode the many possible types; instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go) of oasis-core. This object will conform to one of the `ConsensusParameterChanges` types, depending on the `parameters_change_module`. + * @type {any} + * @memberof ProposalListAllOfProposals + */ + parameters_change?: any | null; + /** + * The epoch at which this proposal was created. + * @type {number} + * @memberof ProposalListAllOfProposals + */ + created_at: number; + /** + * The epoch at which voting for this proposal will close. + * @type {number} + * @memberof ProposalListAllOfProposals + */ + closes_at: number; + /** + * The number of invalid votes for this proposal, after tallying. + * + * @type {string} + * @memberof ProposalListAllOfProposals + */ + invalid_votes: string; +} + + + +/** + * Check if a given object implements the ProposalListAllOfProposals interface. + */ +export function instanceOfProposalListAllOfProposals(value: object): value is ProposalListAllOfProposals { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('submitter' in value) || value['submitter'] === undefined) return false; + if (!('state' in value) || value['state'] === undefined) return false; + if (!('deposit' in value) || value['deposit'] === undefined) return false; + if (!('created_at' in value) || value['created_at'] === undefined) return false; + if (!('closes_at' in value) || value['closes_at'] === undefined) return false; + if (!('invalid_votes' in value) || value['invalid_votes'] === undefined) return false; + return true; +} + +export function ProposalListAllOfProposalsFromJSON(json: any): ProposalListAllOfProposals { + return ProposalListAllOfProposalsFromJSONTyped(json, false); +} + +export function ProposalListAllOfProposalsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProposalListAllOfProposals { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'submitter': json['submitter'], + 'state': ProposalStateFromJSON(json['state']), + 'deposit': json['deposit'], + 'title': json['title'] == null ? undefined : json['title'], + 'description': json['description'] == null ? undefined : json['description'], + 'handler': json['handler'] == null ? undefined : json['handler'], + 'target': json['target'] == null ? undefined : ProposalTargetFromJSON(json['target']), + 'epoch': json['epoch'] == null ? undefined : json['epoch'], + 'cancels': json['cancels'] == null ? undefined : json['cancels'], + 'parameters_change_module': json['parameters_change_module'] == null ? undefined : json['parameters_change_module'], + 'parameters_change': json['parameters_change'] == null ? undefined : json['parameters_change'], + 'created_at': json['created_at'], + 'closes_at': json['closes_at'], + 'invalid_votes': json['invalid_votes'], + }; +} + +export function ProposalListAllOfProposalsToJSON(json: any): ProposalListAllOfProposals { + return ProposalListAllOfProposalsToJSONTyped(json, false); +} + +export function ProposalListAllOfProposalsToJSONTyped(value?: ProposalListAllOfProposals | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'submitter': value['submitter'], + 'state': ProposalStateToJSON(value['state']), + 'deposit': value['deposit'], + 'title': value['title'], + 'description': value['description'], + 'handler': value['handler'], + 'target': ProposalTargetToJSON(value['target']), + 'epoch': value['epoch'], + 'cancels': value['cancels'], + 'parameters_change_module': value['parameters_change_module'], + 'parameters_change': value['parameters_change'], + 'created_at': value['created_at'], + 'closes_at': value['closes_at'], + 'invalid_votes': value['invalid_votes'], + }; +} + diff --git a/src/vendors/nexus/models/ProposalState.ts b/src/vendors/nexus/models/ProposalState.ts index ee154c8952..59ea3304c3 100644 --- a/src/vendors/nexus/models/ProposalState.ts +++ b/src/vendors/nexus/models/ProposalState.ts @@ -12,16 +12,29 @@ * Do not edit the class manually. */ + /** * The state of the proposal. * @export - * @enum {string} */ -export enum ProposalState { - Active = 'active', - Passed = 'passed', - Failed = 'failed', - Rejected = 'rejected' +export const ProposalState = { + Active: 'active', + Passed: 'passed', + Failed: 'failed', + Rejected: 'rejected' +} as const; +export type ProposalState = typeof ProposalState[keyof typeof ProposalState]; + + +export function instanceOfProposalState(value: any): boolean { + for (const key in ProposalState) { + if (Object.prototype.hasOwnProperty.call(ProposalState, key)) { + if (ProposalState[key as keyof typeof ProposalState] === value) { + return true; + } + } + } + return false; } export function ProposalStateFromJSON(json: any): ProposalState { @@ -36,3 +49,7 @@ export function ProposalStateToJSON(value?: ProposalState | null): any { return value as any; } +export function ProposalStateToJSONTyped(value: any, ignoreDiscriminator: boolean): ProposalState { + return value as ProposalState; +} + diff --git a/src/vendors/nexus/models/ProposalTarget.ts b/src/vendors/nexus/models/ProposalTarget.ts index 58ac18fb93..4768a50992 100644 --- a/src/vendors/nexus/models/ProposalTarget.ts +++ b/src/vendors/nexus/models/ProposalTarget.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * The target propotocol versions for this upgrade proposal. * @export @@ -39,35 +39,43 @@ export interface ProposalTarget { runtime_committee_protocol?: string; } +/** + * Check if a given object implements the ProposalTarget interface. + */ +export function instanceOfProposalTarget(value: object): value is ProposalTarget { + return true; +} + export function ProposalTargetFromJSON(json: any): ProposalTarget { return ProposalTargetFromJSONTyped(json, false); } export function ProposalTargetFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProposalTarget { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'consensus_protocol': !exists(json, 'consensus_protocol') ? undefined : json['consensus_protocol'], - 'runtime_host_protocol': !exists(json, 'runtime_host_protocol') ? undefined : json['runtime_host_protocol'], - 'runtime_committee_protocol': !exists(json, 'runtime_committee_protocol') ? undefined : json['runtime_committee_protocol'], + 'consensus_protocol': json['consensus_protocol'] == null ? undefined : json['consensus_protocol'], + 'runtime_host_protocol': json['runtime_host_protocol'] == null ? undefined : json['runtime_host_protocol'], + 'runtime_committee_protocol': json['runtime_committee_protocol'] == null ? undefined : json['runtime_committee_protocol'], }; } -export function ProposalTargetToJSON(value?: ProposalTarget | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ProposalTargetToJSON(json: any): ProposalTarget { + return ProposalTargetToJSONTyped(json, false); +} + +export function ProposalTargetToJSONTyped(value?: ProposalTarget | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'consensus_protocol': value.consensus_protocol, - 'runtime_host_protocol': value.runtime_host_protocol, - 'runtime_committee_protocol': value.runtime_committee_protocol, + 'consensus_protocol': value['consensus_protocol'], + 'runtime_host_protocol': value['runtime_host_protocol'], + 'runtime_committee_protocol': value['runtime_committee_protocol'], }; } - diff --git a/src/vendors/nexus/models/ProposalVote.ts b/src/vendors/nexus/models/ProposalVote.ts index 54b7691597..517f1c50d5 100644 --- a/src/vendors/nexus/models/ProposalVote.ts +++ b/src/vendors/nexus/models/ProposalVote.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -45,37 +45,47 @@ export interface ProposalVote { timestamp?: Date; } +/** + * Check if a given object implements the ProposalVote interface. + */ +export function instanceOfProposalVote(value: object): value is ProposalVote { + if (!('address' in value) || value['address'] === undefined) return false; + if (!('vote' in value) || value['vote'] === undefined) return false; + return true; +} + export function ProposalVoteFromJSON(json: any): ProposalVote { return ProposalVoteFromJSONTyped(json, false); } export function ProposalVoteFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProposalVote { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'address': json['address'], 'vote': json['vote'], - 'height': !exists(json, 'height') ? undefined : json['height'], - 'timestamp': !exists(json, 'timestamp') ? undefined : (new Date(json['timestamp'])), + 'height': json['height'] == null ? undefined : json['height'], + 'timestamp': json['timestamp'] == null ? undefined : (new Date(json['timestamp'])), }; } -export function ProposalVoteToJSON(value?: ProposalVote | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ProposalVoteToJSON(json: any): ProposalVote { + return ProposalVoteToJSONTyped(json, false); +} + +export function ProposalVoteToJSONTyped(value?: ProposalVote | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'address': value.address, - 'vote': value.vote, - 'height': value.height, - 'timestamp': value.timestamp === undefined ? undefined : (value.timestamp.toISOString()), + 'address': value['address'], + 'vote': value['vote'], + 'height': value['height'], + 'timestamp': value['timestamp'] == null ? undefined : ((value['timestamp']).toISOString()), }; } - diff --git a/src/vendors/nexus/models/ProposalVotes.ts b/src/vendors/nexus/models/ProposalVotes.ts index 51392f1607..42053b12e0 100644 --- a/src/vendors/nexus/models/ProposalVotes.ts +++ b/src/vendors/nexus/models/ProposalVotes.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ProposalVotesAllOfVotes } from './ProposalVotesAllOfVotes'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - ProposalVote, - ProposalVoteFromJSON, - ProposalVoteFromJSONTyped, - ProposalVoteToJSON, - ProposalVotesAllOf, - ProposalVotesAllOfFromJSON, - ProposalVotesAllOfFromJSONTyped, - ProposalVotesAllOfToJSON, -} from './'; + ProposalVotesAllOfVotesFromJSON, + ProposalVotesAllOfVotesFromJSONTyped, + ProposalVotesAllOfVotesToJSON, + ProposalVotesAllOfVotesToJSONTyped, +} from './ProposalVotesAllOfVotes'; /** * @@ -37,6 +30,7 @@ export interface ProposalVotes { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof ProposalVotes */ @@ -55,10 +49,21 @@ export interface ProposalVotes { proposal_id: number; /** * The list of votes for the proposal. - * @type {Array} + * @type {Array} * @memberof ProposalVotes */ - votes: Array; + votes: Array; +} + +/** + * Check if a given object implements the ProposalVotes interface. + */ +export function instanceOfProposalVotes(value: object): value is ProposalVotes { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('proposal_id' in value) || value['proposal_id'] === undefined) return false; + if (!('votes' in value) || value['votes'] === undefined) return false; + return true; } export function ProposalVotesFromJSON(json: any): ProposalVotes { @@ -66,7 +71,7 @@ export function ProposalVotesFromJSON(json: any): ProposalVotes { } export function ProposalVotesFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProposalVotes { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -74,24 +79,25 @@ export function ProposalVotesFromJSONTyped(json: any, ignoreDiscriminator: boole 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], 'proposal_id': json['proposal_id'], - 'votes': ((json['votes'] as Array).map(ProposalVoteFromJSON)), + 'votes': ((json['votes'] as Array).map(ProposalVotesAllOfVotesFromJSON)), }; } -export function ProposalVotesToJSON(value?: ProposalVotes | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ProposalVotesToJSON(json: any): ProposalVotes { + return ProposalVotesToJSONTyped(json, false); +} + +export function ProposalVotesToJSONTyped(value?: ProposalVotes | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'proposal_id': value.proposal_id, - 'votes': ((value.votes as Array).map(ProposalVoteToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'proposal_id': value['proposal_id'], + 'votes': ((value['votes'] as Array).map(ProposalVotesAllOfVotesToJSON)), }; } - diff --git a/src/vendors/nexus/models/ProposalVotesAllOfVotes.ts b/src/vendors/nexus/models/ProposalVotesAllOfVotes.ts new file mode 100644 index 0000000000..17e4ddf687 --- /dev/null +++ b/src/vendors/nexus/models/ProposalVotesAllOfVotes.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface ProposalVotesAllOfVotes + */ +export interface ProposalVotesAllOfVotes { + /** + * The staking address casting this vote. + * @type {string} + * @memberof ProposalVotesAllOfVotes + */ + address: string; + /** + * The vote cast. + * @type {string} + * @memberof ProposalVotesAllOfVotes + */ + vote: string; + /** + * The block height at which this vote was recorded. + * @type {number} + * @memberof ProposalVotesAllOfVotes + */ + height?: number; + /** + * The second-granular consensus time of the block in which this vote was cast. + * @type {Date} + * @memberof ProposalVotesAllOfVotes + */ + timestamp?: Date; +} + +/** + * Check if a given object implements the ProposalVotesAllOfVotes interface. + */ +export function instanceOfProposalVotesAllOfVotes(value: object): value is ProposalVotesAllOfVotes { + if (!('address' in value) || value['address'] === undefined) return false; + if (!('vote' in value) || value['vote'] === undefined) return false; + return true; +} + +export function ProposalVotesAllOfVotesFromJSON(json: any): ProposalVotesAllOfVotes { + return ProposalVotesAllOfVotesFromJSONTyped(json, false); +} + +export function ProposalVotesAllOfVotesFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProposalVotesAllOfVotes { + if (json == null) { + return json; + } + return { + + 'address': json['address'], + 'vote': json['vote'], + 'height': json['height'] == null ? undefined : json['height'], + 'timestamp': json['timestamp'] == null ? undefined : (new Date(json['timestamp'])), + }; +} + +export function ProposalVotesAllOfVotesToJSON(json: any): ProposalVotesAllOfVotes { + return ProposalVotesAllOfVotesToJSONTyped(json, false); +} + +export function ProposalVotesAllOfVotesToJSONTyped(value?: ProposalVotesAllOfVotes | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'address': value['address'], + 'vote': value['vote'], + 'height': value['height'], + 'timestamp': value['timestamp'] == null ? undefined : ((value['timestamp']).toISOString()), + }; +} + diff --git a/src/vendors/nexus/models/RoothashMessage.ts b/src/vendors/nexus/models/RoothashMessage.ts index c28474d2ca..c58e8ee6ae 100644 --- a/src/vendors/nexus/models/RoothashMessage.ts +++ b/src/vendors/nexus/models/RoothashMessage.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RoothashMessageType } from './RoothashMessageType'; import { - RoothashMessageType, RoothashMessageTypeFromJSON, RoothashMessageTypeFromJSONTyped, RoothashMessageTypeToJSON, -} from './'; + RoothashMessageTypeToJSONTyped, +} from './RoothashMessageType'; /** * @@ -28,24 +29,28 @@ import { export interface RoothashMessage { /** * The runtime that sent this message. + * * @type {string} * @memberof RoothashMessage */ runtime: string; /** * The block round when the runtime sent this message. + * * @type {number} * @memberof RoothashMessage */ round: number; /** * The 0-based index of this message in the block. + * * @type {number} * @memberof RoothashMessage */ index: number; /** * The type of thies message. + * * @type {RoothashMessageType} * @memberof RoothashMessage */ @@ -61,6 +66,7 @@ export interface RoothashMessage { * structure * (https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/staking/api#Withdraw), * with `from` and `amount` fields in JSON. + * * @type {object} * @memberof RoothashMessage */ @@ -68,6 +74,7 @@ export interface RoothashMessage { /** * If executing this message resulted in an error, this is the * error's module. + * * @type {string} * @memberof RoothashMessage */ @@ -75,6 +82,7 @@ export interface RoothashMessage { /** * If executing this message resulted in an error, this is the * error's code. + * * @type {number} * @memberof RoothashMessage */ @@ -91,18 +99,31 @@ export interface RoothashMessage { * (`https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/staking/api#WithdrawResult`) * with `owner`, `beneficiary`, `allowance`, and `amount_change` * fields. + * * @type {any} * @memberof RoothashMessage */ result?: any | null; } + + +/** + * Check if a given object implements the RoothashMessage interface. + */ +export function instanceOfRoothashMessage(value: object): value is RoothashMessage { + if (!('runtime' in value) || value['runtime'] === undefined) return false; + if (!('round' in value) || value['round'] === undefined) return false; + if (!('index' in value) || value['index'] === undefined) return false; + return true; +} + export function RoothashMessageFromJSON(json: any): RoothashMessage { return RoothashMessageFromJSONTyped(json, false); } export function RoothashMessageFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoothashMessage { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -110,32 +131,33 @@ export function RoothashMessageFromJSONTyped(json: any, ignoreDiscriminator: boo 'runtime': json['runtime'], 'round': json['round'], 'index': json['index'], - 'type': !exists(json, 'type') ? undefined : RoothashMessageTypeFromJSON(json['type']), - 'body': !exists(json, 'body') ? undefined : json['body'], - 'error_module': !exists(json, 'error_module') ? undefined : json['error_module'], - 'error_code': !exists(json, 'error_code') ? undefined : json['error_code'], - 'result': !exists(json, 'result') ? undefined : json['result'], + 'type': json['type'] == null ? undefined : RoothashMessageTypeFromJSON(json['type']), + 'body': json['body'] == null ? undefined : json['body'], + 'error_module': json['error_module'] == null ? undefined : json['error_module'], + 'error_code': json['error_code'] == null ? undefined : json['error_code'], + 'result': json['result'] == null ? undefined : json['result'], }; } -export function RoothashMessageToJSON(value?: RoothashMessage | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RoothashMessageToJSON(json: any): RoothashMessage { + return RoothashMessageToJSONTyped(json, false); +} + +export function RoothashMessageToJSONTyped(value?: RoothashMessage | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'runtime': value.runtime, - 'round': value.round, - 'index': value.index, - 'type': RoothashMessageTypeToJSON(value.type), - 'body': value.body, - 'error_module': value.error_module, - 'error_code': value.error_code, - 'result': value.result, + 'runtime': value['runtime'], + 'round': value['round'], + 'index': value['index'], + 'type': RoothashMessageTypeToJSON(value['type']), + 'body': value['body'], + 'error_module': value['error_module'], + 'error_code': value['error_code'], + 'result': value['result'], }; } - diff --git a/src/vendors/nexus/models/RoothashMessageList.ts b/src/vendors/nexus/models/RoothashMessageList.ts index c26fecdf22..c0c160ca4d 100644 --- a/src/vendors/nexus/models/RoothashMessageList.ts +++ b/src/vendors/nexus/models/RoothashMessageList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RoothashMessageListAllOfRoothashMessages } from './RoothashMessageListAllOfRoothashMessages'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - RoothashMessage, - RoothashMessageFromJSON, - RoothashMessageFromJSONTyped, - RoothashMessageToJSON, - RoothashMessageListAllOf, - RoothashMessageListAllOfFromJSON, - RoothashMessageListAllOfFromJSONTyped, - RoothashMessageListAllOfToJSON, -} from './'; + RoothashMessageListAllOfRoothashMessagesFromJSON, + RoothashMessageListAllOfRoothashMessagesFromJSONTyped, + RoothashMessageListAllOfRoothashMessagesToJSON, + RoothashMessageListAllOfRoothashMessagesToJSONTyped, +} from './RoothashMessageListAllOfRoothashMessages'; /** * @@ -37,6 +30,7 @@ export interface RoothashMessageList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof RoothashMessageList */ @@ -49,10 +43,20 @@ export interface RoothashMessageList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof RoothashMessageList */ - roothash_messages: Array; + roothash_messages: Array; +} + +/** + * Check if a given object implements the RoothashMessageList interface. + */ +export function instanceOfRoothashMessageList(value: object): value is RoothashMessageList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('roothash_messages' in value) || value['roothash_messages'] === undefined) return false; + return true; } export function RoothashMessageListFromJSON(json: any): RoothashMessageList { @@ -60,30 +64,31 @@ export function RoothashMessageListFromJSON(json: any): RoothashMessageList { } export function RoothashMessageListFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoothashMessageList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'roothash_messages': ((json['roothash_messages'] as Array).map(RoothashMessageFromJSON)), + 'roothash_messages': ((json['roothash_messages'] as Array).map(RoothashMessageListAllOfRoothashMessagesFromJSON)), }; } -export function RoothashMessageListToJSON(value?: RoothashMessageList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RoothashMessageListToJSON(json: any): RoothashMessageList { + return RoothashMessageListToJSONTyped(json, false); +} + +export function RoothashMessageListToJSONTyped(value?: RoothashMessageList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'roothash_messages': ((value.roothash_messages as Array).map(RoothashMessageToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'roothash_messages': ((value['roothash_messages'] as Array).map(RoothashMessageListAllOfRoothashMessagesToJSON)), }; } - diff --git a/src/vendors/nexus/models/RoothashMessageListAllOfRoothashMessages.ts b/src/vendors/nexus/models/RoothashMessageListAllOfRoothashMessages.ts new file mode 100644 index 0000000000..898e351f4c --- /dev/null +++ b/src/vendors/nexus/models/RoothashMessageListAllOfRoothashMessages.ts @@ -0,0 +1,163 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { RoothashMessageType } from './RoothashMessageType'; +import { + RoothashMessageTypeFromJSON, + RoothashMessageTypeFromJSONTyped, + RoothashMessageTypeToJSON, + RoothashMessageTypeToJSONTyped, +} from './RoothashMessageType'; + +/** + * + * @export + * @interface RoothashMessageListAllOfRoothashMessages + */ +export interface RoothashMessageListAllOfRoothashMessages { + /** + * The runtime that sent this message. + * + * @type {string} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + runtime: string; + /** + * The block round when the runtime sent this message. + * + * @type {number} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + round: number; + /** + * The 0-based index of this message in the block. + * + * @type {number} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + index: number; + /** + * The type of thies message. + * + * @type {RoothashMessageType} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + type?: RoothashMessageType; + /** + * The "body" of a message is a structure within the + * `github.com/oasisprotocol/oasis-core/go/roothash/api/message` + * `Message` structure + * (https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/roothash/api/message#Message). + * For example, if the type is `staking.withdraw`, the body is the Go + * `Message` structure's `.Staking.Withdraw` field, which is a + * `github.com/oasisprotocol/oasis-core/go/staking/api` `Withdraw` + * structure + * (https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/staking/api#Withdraw), + * with `from` and `amount` fields in JSON. + * + * @type {object} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + body?: object; + /** + * If executing this message resulted in an error, this is the + * error's module. + * + * @type {string} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + error_module?: string; + /** + * If executing this message resulted in an error, this is the + * error's code. + * + * @type {number} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + error_code?: number; + /** + * A result value that consensus provided after executing this + * message. These aren't centrally registered anywhere, so look at + * the consensus apps' `ExecuteMessage` + * (https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/consensus/cometbft/api#MessageSubscriber) + * implementations to see what they return. For example, a + * `staking.withdraw` type message gives a + * `github.com/oasisprotocol/oasis-core/go/staking/api` + * `WithdrawResult` structure as its result + * (`https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go/staking/api#WithdrawResult`) + * with `owner`, `beneficiary`, `allowance`, and `amount_change` + * fields. + * + * @type {any} + * @memberof RoothashMessageListAllOfRoothashMessages + */ + result?: any | null; +} + + + +/** + * Check if a given object implements the RoothashMessageListAllOfRoothashMessages interface. + */ +export function instanceOfRoothashMessageListAllOfRoothashMessages(value: object): value is RoothashMessageListAllOfRoothashMessages { + if (!('runtime' in value) || value['runtime'] === undefined) return false; + if (!('round' in value) || value['round'] === undefined) return false; + if (!('index' in value) || value['index'] === undefined) return false; + return true; +} + +export function RoothashMessageListAllOfRoothashMessagesFromJSON(json: any): RoothashMessageListAllOfRoothashMessages { + return RoothashMessageListAllOfRoothashMessagesFromJSONTyped(json, false); +} + +export function RoothashMessageListAllOfRoothashMessagesFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoothashMessageListAllOfRoothashMessages { + if (json == null) { + return json; + } + return { + + 'runtime': json['runtime'], + 'round': json['round'], + 'index': json['index'], + 'type': json['type'] == null ? undefined : RoothashMessageTypeFromJSON(json['type']), + 'body': json['body'] == null ? undefined : json['body'], + 'error_module': json['error_module'] == null ? undefined : json['error_module'], + 'error_code': json['error_code'] == null ? undefined : json['error_code'], + 'result': json['result'] == null ? undefined : json['result'], + }; +} + +export function RoothashMessageListAllOfRoothashMessagesToJSON(json: any): RoothashMessageListAllOfRoothashMessages { + return RoothashMessageListAllOfRoothashMessagesToJSONTyped(json, false); +} + +export function RoothashMessageListAllOfRoothashMessagesToJSONTyped(value?: RoothashMessageListAllOfRoothashMessages | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'runtime': value['runtime'], + 'round': value['round'], + 'index': value['index'], + 'type': RoothashMessageTypeToJSON(value['type']), + 'body': value['body'], + 'error_module': value['error_module'], + 'error_code': value['error_code'], + 'result': value['result'], + }; +} + diff --git a/src/vendors/nexus/models/RoothashMessageType.ts b/src/vendors/nexus/models/RoothashMessageType.ts index 203ec3fd39..13eb876c95 100644 --- a/src/vendors/nexus/models/RoothashMessageType.ts +++ b/src/vendors/nexus/models/RoothashMessageType.ts @@ -12,19 +12,32 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum RoothashMessageType { - StakingTransfer = 'staking.transfer', - StakingWithdraw = 'staking.withdraw', - StakingAddEscrow = 'staking.add_escrow', - StakingReclaimEscrow = 'staking.reclaim_escrow', - RegistryUpdateRuntime = 'registry.update_runtime', - GovernanceCastVote = 'governance.cast_vote', - GovernanceSubmitProposal = 'governance.submit_proposal' +export const RoothashMessageType = { + StakingTransfer: 'staking.transfer', + StakingWithdraw: 'staking.withdraw', + StakingAddEscrow: 'staking.add_escrow', + StakingReclaimEscrow: 'staking.reclaim_escrow', + RegistryUpdateRuntime: 'registry.update_runtime', + GovernanceCastVote: 'governance.cast_vote', + GovernanceSubmitProposal: 'governance.submit_proposal' +} as const; +export type RoothashMessageType = typeof RoothashMessageType[keyof typeof RoothashMessageType]; + + +export function instanceOfRoothashMessageType(value: any): boolean { + for (const key in RoothashMessageType) { + if (Object.prototype.hasOwnProperty.call(RoothashMessageType, key)) { + if (RoothashMessageType[key as keyof typeof RoothashMessageType] === value) { + return true; + } + } + } + return false; } export function RoothashMessageTypeFromJSON(json: any): RoothashMessageType { @@ -39,3 +52,7 @@ export function RoothashMessageTypeToJSON(value?: RoothashMessageType | null): a return value as any; } +export function RoothashMessageTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): RoothashMessageType { + return value as RoothashMessageType; +} + diff --git a/src/vendors/nexus/models/Runtime.ts b/src/vendors/nexus/models/Runtime.ts index 2fcde0e362..f3042dd24e 100644 --- a/src/vendors/nexus/models/Runtime.ts +++ b/src/vendors/nexus/models/Runtime.ts @@ -12,17 +12,30 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum Runtime { - Emerald = 'emerald', - Sapphire = 'sapphire', - Pontusxtest = 'pontusxtest', - Pontusxdev = 'pontusxdev', - Cipher = 'cipher' +export const Runtime = { + Emerald: 'emerald', + Sapphire: 'sapphire', + Pontusxtest: 'pontusxtest', + Pontusxdev: 'pontusxdev', + Cipher: 'cipher' +} as const; +export type Runtime = typeof Runtime[keyof typeof Runtime]; + + +export function instanceOfRuntime(value: any): boolean { + for (const key in Runtime) { + if (Object.prototype.hasOwnProperty.call(Runtime, key)) { + if (Runtime[key as keyof typeof Runtime] === value) { + return true; + } + } + } + return false; } export function RuntimeFromJSON(json: any): Runtime { @@ -37,3 +50,7 @@ export function RuntimeToJSON(value?: Runtime | null): any { return value as any; } +export function RuntimeToJSONTyped(value: any, ignoreDiscriminator: boolean): Runtime { + return value as Runtime; +} + diff --git a/src/vendors/nexus/models/RuntimeAccount.ts b/src/vendors/nexus/models/RuntimeAccount.ts index b03962bc6d..71b39a6d00 100644 --- a/src/vendors/nexus/models/RuntimeAccount.ts +++ b/src/vendors/nexus/models/RuntimeAccount.ts @@ -12,29 +12,42 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RuntimeEvmBalance } from './RuntimeEvmBalance'; import { - AccountStats, - AccountStatsFromJSON, - AccountStatsFromJSONTyped, - AccountStatsToJSON, - AddressPreimage, - AddressPreimageFromJSON, - AddressPreimageFromJSONTyped, - AddressPreimageToJSON, - RuntimeEvmBalance, RuntimeEvmBalanceFromJSON, RuntimeEvmBalanceFromJSONTyped, RuntimeEvmBalanceToJSON, - RuntimeEvmContract, - RuntimeEvmContractFromJSON, - RuntimeEvmContractFromJSONTyped, - RuntimeEvmContractToJSON, - RuntimeSdkBalance, + RuntimeEvmBalanceToJSONTyped, +} from './RuntimeEvmBalance'; +import type { RuntimeSdkBalance } from './RuntimeSdkBalance'; +import { RuntimeSdkBalanceFromJSON, RuntimeSdkBalanceFromJSONTyped, RuntimeSdkBalanceToJSON, -} from './'; + RuntimeSdkBalanceToJSONTyped, +} from './RuntimeSdkBalance'; +import type { RuntimeEvmContract } from './RuntimeEvmContract'; +import { + RuntimeEvmContractFromJSON, + RuntimeEvmContractFromJSONTyped, + RuntimeEvmContractToJSON, + RuntimeEvmContractToJSONTyped, +} from './RuntimeEvmContract'; +import type { AccountStats } from './AccountStats'; +import { + AccountStatsFromJSON, + AccountStatsFromJSONTyped, + AccountStatsToJSON, + AccountStatsToJSONTyped, +} from './AccountStats'; +import type { AddressPreimage } from './AddressPreimage'; +import { + AddressPreimageFromJSON, + AddressPreimageFromJSONTyped, + AddressPreimageToJSON, + AddressPreimageToJSONTyped, +} from './AddressPreimage'; /** * @@ -59,6 +72,7 @@ export interface RuntimeAccount { * produce only one balance here. These balances do not include "layer (n+1) tokens", i.e. tokens * managed by smart contracts deployed in this runtime. For example, in EVM-compatible runtimes, * this does not include ERC-20 tokens + * * @type {Array} * @memberof RuntimeAccount */ @@ -66,6 +80,7 @@ export interface RuntimeAccount { /** * Data on the EVM smart contract associated with this account address. Only present for accounts * that represent a smart contract on EVM. + * * @type {RuntimeEvmContract} * @memberof RuntimeAccount */ @@ -73,6 +88,7 @@ export interface RuntimeAccount { /** * The balances of this account in each runtime, as managed by EVM smart contracts (notably, ERC-20). * NOTE: This field is limited to 1000 entries. If you need more, please let us know in a GitHub issue. + * * @type {Array} * @memberof RuntimeAccount */ @@ -85,41 +101,53 @@ export interface RuntimeAccount { stats: AccountStats; } +/** + * Check if a given object implements the RuntimeAccount interface. + */ +export function instanceOfRuntimeAccount(value: object): value is RuntimeAccount { + if (!('address' in value) || value['address'] === undefined) return false; + if (!('balances' in value) || value['balances'] === undefined) return false; + if (!('evm_balances' in value) || value['evm_balances'] === undefined) return false; + if (!('stats' in value) || value['stats'] === undefined) return false; + return true; +} + export function RuntimeAccountFromJSON(json: any): RuntimeAccount { return RuntimeAccountFromJSONTyped(json, false); } export function RuntimeAccountFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeAccount { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'address': json['address'], - 'address_preimage': !exists(json, 'address_preimage') ? undefined : AddressPreimageFromJSON(json['address_preimage']), + 'address_preimage': json['address_preimage'] == null ? undefined : AddressPreimageFromJSON(json['address_preimage']), 'balances': ((json['balances'] as Array).map(RuntimeSdkBalanceFromJSON)), - 'evm_contract': !exists(json, 'evm_contract') ? undefined : RuntimeEvmContractFromJSON(json['evm_contract']), + 'evm_contract': json['evm_contract'] == null ? undefined : RuntimeEvmContractFromJSON(json['evm_contract']), 'evm_balances': ((json['evm_balances'] as Array).map(RuntimeEvmBalanceFromJSON)), 'stats': AccountStatsFromJSON(json['stats']), }; } -export function RuntimeAccountToJSON(value?: RuntimeAccount | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeAccountToJSON(json: any): RuntimeAccount { + return RuntimeAccountToJSONTyped(json, false); +} + +export function RuntimeAccountToJSONTyped(value?: RuntimeAccount | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'address': value.address, - 'address_preimage': AddressPreimageToJSON(value.address_preimage), - 'balances': ((value.balances as Array).map(RuntimeSdkBalanceToJSON)), - 'evm_contract': RuntimeEvmContractToJSON(value.evm_contract), - 'evm_balances': ((value.evm_balances as Array).map(RuntimeEvmBalanceToJSON)), - 'stats': AccountStatsToJSON(value.stats), + 'address': value['address'], + 'address_preimage': AddressPreimageToJSON(value['address_preimage']), + 'balances': ((value['balances'] as Array).map(RuntimeSdkBalanceToJSON)), + 'evm_contract': RuntimeEvmContractToJSON(value['evm_contract']), + 'evm_balances': ((value['evm_balances'] as Array).map(RuntimeEvmBalanceToJSON)), + 'stats': AccountStatsToJSON(value['stats']), }; } - diff --git a/src/vendors/nexus/models/RuntimeBlock.ts b/src/vendors/nexus/models/RuntimeBlock.ts index b7ac5660ee..a6d48143e9 100644 --- a/src/vendors/nexus/models/RuntimeBlock.ts +++ b/src/vendors/nexus/models/RuntimeBlock.ts @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * A ParaTime block. + * * @export * @interface RuntimeBlock */ @@ -57,12 +58,25 @@ export interface RuntimeBlock { gas_used: number; } +/** + * Check if a given object implements the RuntimeBlock interface. + */ +export function instanceOfRuntimeBlock(value: object): value is RuntimeBlock { + if (!('round' in value) || value['round'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('num_transactions' in value) || value['num_transactions'] === undefined) return false; + if (!('size' in value) || value['size'] === undefined) return false; + if (!('gas_used' in value) || value['gas_used'] === undefined) return false; + return true; +} + export function RuntimeBlockFromJSON(json: any): RuntimeBlock { return RuntimeBlockFromJSONTyped(json, false); } export function RuntimeBlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeBlock { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -76,22 +90,23 @@ export function RuntimeBlockFromJSONTyped(json: any, ignoreDiscriminator: boolea }; } -export function RuntimeBlockToJSON(value?: RuntimeBlock | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeBlockToJSON(json: any): RuntimeBlock { + return RuntimeBlockToJSONTyped(json, false); +} + +export function RuntimeBlockToJSONTyped(value?: RuntimeBlock | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'round': value.round, - 'hash': value.hash, - 'timestamp': (value.timestamp.toISOString()), - 'num_transactions': value.num_transactions, - 'size': value.size, - 'gas_used': value.gas_used, + 'round': value['round'], + 'hash': value['hash'], + 'timestamp': ((value['timestamp']).toISOString()), + 'num_transactions': value['num_transactions'], + 'size': value['size'], + 'gas_used': value['gas_used'], }; } - diff --git a/src/vendors/nexus/models/RuntimeBlockList.ts b/src/vendors/nexus/models/RuntimeBlockList.ts index 541fb7ff12..58ca6960d9 100644 --- a/src/vendors/nexus/models/RuntimeBlockList.ts +++ b/src/vendors/nexus/models/RuntimeBlockList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RuntimeBlockListAllOfBlocks } from './RuntimeBlockListAllOfBlocks'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - RuntimeBlock, - RuntimeBlockFromJSON, - RuntimeBlockFromJSONTyped, - RuntimeBlockToJSON, - RuntimeBlockListAllOf, - RuntimeBlockListAllOfFromJSON, - RuntimeBlockListAllOfFromJSONTyped, - RuntimeBlockListAllOfToJSON, -} from './'; + RuntimeBlockListAllOfBlocksFromJSON, + RuntimeBlockListAllOfBlocksFromJSONTyped, + RuntimeBlockListAllOfBlocksToJSON, + RuntimeBlockListAllOfBlocksToJSONTyped, +} from './RuntimeBlockListAllOfBlocks'; /** * @@ -37,6 +30,7 @@ export interface RuntimeBlockList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof RuntimeBlockList */ @@ -49,10 +43,20 @@ export interface RuntimeBlockList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof RuntimeBlockList */ - blocks: Array; + blocks: Array; +} + +/** + * Check if a given object implements the RuntimeBlockList interface. + */ +export function instanceOfRuntimeBlockList(value: object): value is RuntimeBlockList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('blocks' in value) || value['blocks'] === undefined) return false; + return true; } export function RuntimeBlockListFromJSON(json: any): RuntimeBlockList { @@ -60,30 +64,31 @@ export function RuntimeBlockListFromJSON(json: any): RuntimeBlockList { } export function RuntimeBlockListFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeBlockList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'blocks': ((json['blocks'] as Array).map(RuntimeBlockFromJSON)), + 'blocks': ((json['blocks'] as Array).map(RuntimeBlockListAllOfBlocksFromJSON)), }; } -export function RuntimeBlockListToJSON(value?: RuntimeBlockList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeBlockListToJSON(json: any): RuntimeBlockList { + return RuntimeBlockListToJSONTyped(json, false); +} + +export function RuntimeBlockListToJSONTyped(value?: RuntimeBlockList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'blocks': ((value.blocks as Array).map(RuntimeBlockToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'blocks': ((value['blocks'] as Array).map(RuntimeBlockListAllOfBlocksToJSON)), }; } - diff --git a/src/vendors/nexus/models/RuntimeBlockListAllOfBlocks.ts b/src/vendors/nexus/models/RuntimeBlockListAllOfBlocks.ts new file mode 100644 index 0000000000..d1af6805d0 --- /dev/null +++ b/src/vendors/nexus/models/RuntimeBlockListAllOfBlocks.ts @@ -0,0 +1,111 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface RuntimeBlockListAllOfBlocks + */ +export interface RuntimeBlockListAllOfBlocks { + /** + * The block round. + * @type {number} + * @memberof RuntimeBlockListAllOfBlocks + */ + round: number; + /** + * The block header hash. + * @type {string} + * @memberof RuntimeBlockListAllOfBlocks + */ + hash: string; + /** + * The second-granular consensus time. + * @type {Date} + * @memberof RuntimeBlockListAllOfBlocks + */ + timestamp: Date; + /** + * The number of transactions in the block. + * @type {number} + * @memberof RuntimeBlockListAllOfBlocks + */ + num_transactions: number; + /** + * The total byte size of all transactions in the block. + * @type {number} + * @memberof RuntimeBlockListAllOfBlocks + */ + size: number; + /** + * The total gas used by all transactions in the block. + * @type {number} + * @memberof RuntimeBlockListAllOfBlocks + */ + gas_used: number; +} + +/** + * Check if a given object implements the RuntimeBlockListAllOfBlocks interface. + */ +export function instanceOfRuntimeBlockListAllOfBlocks(value: object): value is RuntimeBlockListAllOfBlocks { + if (!('round' in value) || value['round'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('num_transactions' in value) || value['num_transactions'] === undefined) return false; + if (!('size' in value) || value['size'] === undefined) return false; + if (!('gas_used' in value) || value['gas_used'] === undefined) return false; + return true; +} + +export function RuntimeBlockListAllOfBlocksFromJSON(json: any): RuntimeBlockListAllOfBlocks { + return RuntimeBlockListAllOfBlocksFromJSONTyped(json, false); +} + +export function RuntimeBlockListAllOfBlocksFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeBlockListAllOfBlocks { + if (json == null) { + return json; + } + return { + + 'round': json['round'], + 'hash': json['hash'], + 'timestamp': (new Date(json['timestamp'])), + 'num_transactions': json['num_transactions'], + 'size': json['size'], + 'gas_used': json['gas_used'], + }; +} + +export function RuntimeBlockListAllOfBlocksToJSON(json: any): RuntimeBlockListAllOfBlocks { + return RuntimeBlockListAllOfBlocksToJSONTyped(json, false); +} + +export function RuntimeBlockListAllOfBlocksToJSONTyped(value?: RuntimeBlockListAllOfBlocks | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'round': value['round'], + 'hash': value['hash'], + 'timestamp': ((value['timestamp']).toISOString()), + 'num_transactions': value['num_transactions'], + 'size': value['size'], + 'gas_used': value['gas_used'], + }; +} + diff --git a/src/vendors/nexus/models/RuntimeEvent.ts b/src/vendors/nexus/models/RuntimeEvent.ts index 336f6c477d..c0b8bc305b 100644 --- a/src/vendors/nexus/models/RuntimeEvent.ts +++ b/src/vendors/nexus/models/RuntimeEvent.ts @@ -12,21 +12,28 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmAbiParam } from './EvmAbiParam'; import { - EvmAbiParam, EvmAbiParamFromJSON, EvmAbiParamFromJSONTyped, EvmAbiParamToJSON, - EvmEventToken, + EvmAbiParamToJSONTyped, +} from './EvmAbiParam'; +import type { EvmEventToken } from './EvmEventToken'; +import { EvmEventTokenFromJSON, EvmEventTokenFromJSONTyped, EvmEventTokenToJSON, - RuntimeEventType, + EvmEventTokenToJSONTyped, +} from './EvmEventToken'; +import type { RuntimeEventType } from './RuntimeEventType'; +import { RuntimeEventTypeFromJSON, RuntimeEventTypeFromJSONTyped, RuntimeEventTypeToJSON, -} from './'; + RuntimeEventTypeToJSONTyped, +} from './RuntimeEventType'; /** * An event emitted by the runtime layer @@ -43,6 +50,7 @@ export interface RuntimeEvent { /** * 0-based index of this event's originating transaction within its block. * Absent if the event did not originate from a transaction. + * * @type {number} * @memberof RuntimeEvent */ @@ -50,6 +58,7 @@ export interface RuntimeEvent { /** * Hash of this event's originating transaction. * Absent if the event did not originate from a transaction. + * * @type {string} * @memberof RuntimeEvent */ @@ -57,12 +66,14 @@ export interface RuntimeEvent { /** * Ethereum trasnsaction hash of this event's originating transaction. * Absent if the event did not originate from an EVM transaction. + * * @type {string} * @memberof RuntimeEvent */ eth_tx_hash?: string; /** * The second-granular consensus time of this event's block. + * * @type {Date} * @memberof RuntimeEvent */ @@ -81,6 +92,7 @@ export interface RuntimeEvent { * OR `evm > Event`. For object fields that specify an oasis-style address, Nexus * will add a field specifying the corresponding Ethereum address, if known. Currently, * the only such possible fields are `from_eth`, `to_eth`, and `owner_eth`. + * * @type {object} * @memberof RuntimeEvent */ @@ -89,6 +101,7 @@ export interface RuntimeEvent { * If the event type is `evm.log`, this field describes the human-readable type of * evm event, e.g. `Transfer`. * Absent if the event type is not `evm.log`. + * * @type {string} * @memberof RuntimeEvent */ @@ -96,6 +109,7 @@ export interface RuntimeEvent { /** * The decoded `evm.log` event data. * Absent if the event type is not `evm.log`. + * * @type {Array} * @memberof RuntimeEvent */ @@ -108,49 +122,63 @@ export interface RuntimeEvent { evm_token?: EvmEventToken; } + + +/** + * Check if a given object implements the RuntimeEvent interface. + */ +export function instanceOfRuntimeEvent(value: object): value is RuntimeEvent { + if (!('round' in value) || value['round'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('body' in value) || value['body'] === undefined) return false; + return true; +} + export function RuntimeEventFromJSON(json: any): RuntimeEvent { return RuntimeEventFromJSONTyped(json, false); } export function RuntimeEventFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeEvent { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'round': json['round'], - 'tx_index': !exists(json, 'tx_index') ? undefined : json['tx_index'], - 'tx_hash': !exists(json, 'tx_hash') ? undefined : json['tx_hash'], - 'eth_tx_hash': !exists(json, 'eth_tx_hash') ? undefined : json['eth_tx_hash'], + 'tx_index': json['tx_index'] == null ? undefined : json['tx_index'], + 'tx_hash': json['tx_hash'] == null ? undefined : json['tx_hash'], + 'eth_tx_hash': json['eth_tx_hash'] == null ? undefined : json['eth_tx_hash'], 'timestamp': (new Date(json['timestamp'])), 'type': RuntimeEventTypeFromJSON(json['type']), 'body': json['body'], - 'evm_log_name': !exists(json, 'evm_log_name') ? undefined : json['evm_log_name'], - 'evm_log_params': !exists(json, 'evm_log_params') ? undefined : ((json['evm_log_params'] as Array).map(EvmAbiParamFromJSON)), - 'evm_token': !exists(json, 'evm_token') ? undefined : EvmEventTokenFromJSON(json['evm_token']), + 'evm_log_name': json['evm_log_name'] == null ? undefined : json['evm_log_name'], + 'evm_log_params': json['evm_log_params'] == null ? undefined : ((json['evm_log_params'] as Array).map(EvmAbiParamFromJSON)), + 'evm_token': json['evm_token'] == null ? undefined : EvmEventTokenFromJSON(json['evm_token']), }; } -export function RuntimeEventToJSON(value?: RuntimeEvent | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeEventToJSON(json: any): RuntimeEvent { + return RuntimeEventToJSONTyped(json, false); +} + +export function RuntimeEventToJSONTyped(value?: RuntimeEvent | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'round': value.round, - 'tx_index': value.tx_index, - 'tx_hash': value.tx_hash, - 'eth_tx_hash': value.eth_tx_hash, - 'timestamp': (value.timestamp.toISOString()), - 'type': RuntimeEventTypeToJSON(value.type), - 'body': value.body, - 'evm_log_name': value.evm_log_name, - 'evm_log_params': value.evm_log_params === undefined ? undefined : ((value.evm_log_params as Array).map(EvmAbiParamToJSON)), - 'evm_token': EvmEventTokenToJSON(value.evm_token), + 'round': value['round'], + 'tx_index': value['tx_index'], + 'tx_hash': value['tx_hash'], + 'eth_tx_hash': value['eth_tx_hash'], + 'timestamp': ((value['timestamp']).toISOString()), + 'type': RuntimeEventTypeToJSON(value['type']), + 'body': value['body'], + 'evm_log_name': value['evm_log_name'], + 'evm_log_params': value['evm_log_params'] == null ? undefined : ((value['evm_log_params'] as Array).map(EvmAbiParamToJSON)), + 'evm_token': EvmEventTokenToJSON(value['evm_token']), }; } - diff --git a/src/vendors/nexus/models/RuntimeEventList.ts b/src/vendors/nexus/models/RuntimeEventList.ts index 24484731c7..a8b1180583 100644 --- a/src/vendors/nexus/models/RuntimeEventList.ts +++ b/src/vendors/nexus/models/RuntimeEventList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RuntimeEventListAllOfEvents } from './RuntimeEventListAllOfEvents'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - RuntimeEvent, - RuntimeEventFromJSON, - RuntimeEventFromJSONTyped, - RuntimeEventToJSON, - RuntimeEventListAllOf, - RuntimeEventListAllOfFromJSON, - RuntimeEventListAllOfFromJSONTyped, - RuntimeEventListAllOfToJSON, -} from './'; + RuntimeEventListAllOfEventsFromJSON, + RuntimeEventListAllOfEventsFromJSONTyped, + RuntimeEventListAllOfEventsToJSON, + RuntimeEventListAllOfEventsToJSONTyped, +} from './RuntimeEventListAllOfEvents'; /** * @@ -37,6 +30,7 @@ export interface RuntimeEventList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof RuntimeEventList */ @@ -49,10 +43,20 @@ export interface RuntimeEventList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof RuntimeEventList */ - events: Array; + events: Array; +} + +/** + * Check if a given object implements the RuntimeEventList interface. + */ +export function instanceOfRuntimeEventList(value: object): value is RuntimeEventList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('events' in value) || value['events'] === undefined) return false; + return true; } export function RuntimeEventListFromJSON(json: any): RuntimeEventList { @@ -60,30 +64,31 @@ export function RuntimeEventListFromJSON(json: any): RuntimeEventList { } export function RuntimeEventListFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeEventList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'events': ((json['events'] as Array).map(RuntimeEventFromJSON)), + 'events': ((json['events'] as Array).map(RuntimeEventListAllOfEventsFromJSON)), }; } -export function RuntimeEventListToJSON(value?: RuntimeEventList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeEventListToJSON(json: any): RuntimeEventList { + return RuntimeEventListToJSONTyped(json, false); +} + +export function RuntimeEventListToJSONTyped(value?: RuntimeEventList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'events': ((value.events as Array).map(RuntimeEventToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'events': ((value['events'] as Array).map(RuntimeEventListAllOfEventsToJSON)), }; } - diff --git a/src/vendors/nexus/models/RuntimeEventListAllOfEvents.ts b/src/vendors/nexus/models/RuntimeEventListAllOfEvents.ts new file mode 100644 index 0000000000..c335f9f374 --- /dev/null +++ b/src/vendors/nexus/models/RuntimeEventListAllOfEvents.ts @@ -0,0 +1,184 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { EvmAbiParam } from './EvmAbiParam'; +import { + EvmAbiParamFromJSON, + EvmAbiParamFromJSONTyped, + EvmAbiParamToJSON, + EvmAbiParamToJSONTyped, +} from './EvmAbiParam'; +import type { EvmEventToken } from './EvmEventToken'; +import { + EvmEventTokenFromJSON, + EvmEventTokenFromJSONTyped, + EvmEventTokenToJSON, + EvmEventTokenToJSONTyped, +} from './EvmEventToken'; +import type { RuntimeEventType } from './RuntimeEventType'; +import { + RuntimeEventTypeFromJSON, + RuntimeEventTypeFromJSONTyped, + RuntimeEventTypeToJSON, + RuntimeEventTypeToJSONTyped, +} from './RuntimeEventType'; + +/** + * + * @export + * @interface RuntimeEventListAllOfEvents + */ +export interface RuntimeEventListAllOfEvents { + /** + * The block height at which this event was generated. + * @type {number} + * @memberof RuntimeEventListAllOfEvents + */ + round: number; + /** + * 0-based index of this event's originating transaction within its block. + * Absent if the event did not originate from a transaction. + * + * @type {number} + * @memberof RuntimeEventListAllOfEvents + */ + tx_index?: number; + /** + * Hash of this event's originating transaction. + * Absent if the event did not originate from a transaction. + * + * @type {string} + * @memberof RuntimeEventListAllOfEvents + */ + tx_hash?: string; + /** + * Ethereum trasnsaction hash of this event's originating transaction. + * Absent if the event did not originate from an EVM transaction. + * + * @type {string} + * @memberof RuntimeEventListAllOfEvents + */ + eth_tx_hash?: string; + /** + * The second-granular consensus time of this event's block. + * + * @type {Date} + * @memberof RuntimeEventListAllOfEvents + */ + timestamp: Date; + /** + * The type of the event. + * @type {RuntimeEventType} + * @memberof RuntimeEventListAllOfEvents + */ + type: RuntimeEventType; + /** + * The decoded event contents, possibly augmented with additional address info. + * This spec does not encode the many possible types; instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-sdk/client-sdk/go/modules). + * This object will conform to one of the `*Event` types two levels down + * the hierarchy (e.g. `MintEvent` from `accounts > Event > MintEvent`), + * OR `evm > Event`. For object fields that specify an oasis-style address, Nexus + * will add a field specifying the corresponding Ethereum address, if known. Currently, + * the only such possible fields are `from_eth`, `to_eth`, and `owner_eth`. + * + * @type {object} + * @memberof RuntimeEventListAllOfEvents + */ + body: object; + /** + * If the event type is `evm.log`, this field describes the human-readable type of + * evm event, e.g. `Transfer`. + * Absent if the event type is not `evm.log`. + * + * @type {string} + * @memberof RuntimeEventListAllOfEvents + */ + evm_log_name?: string; + /** + * The decoded `evm.log` event data. + * Absent if the event type is not `evm.log`. + * + * @type {Array} + * @memberof RuntimeEventListAllOfEvents + */ + evm_log_params?: Array; + /** + * + * @type {EvmEventToken} + * @memberof RuntimeEventListAllOfEvents + */ + evm_token?: EvmEventToken; +} + + + +/** + * Check if a given object implements the RuntimeEventListAllOfEvents interface. + */ +export function instanceOfRuntimeEventListAllOfEvents(value: object): value is RuntimeEventListAllOfEvents { + if (!('round' in value) || value['round'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('body' in value) || value['body'] === undefined) return false; + return true; +} + +export function RuntimeEventListAllOfEventsFromJSON(json: any): RuntimeEventListAllOfEvents { + return RuntimeEventListAllOfEventsFromJSONTyped(json, false); +} + +export function RuntimeEventListAllOfEventsFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeEventListAllOfEvents { + if (json == null) { + return json; + } + return { + + 'round': json['round'], + 'tx_index': json['tx_index'] == null ? undefined : json['tx_index'], + 'tx_hash': json['tx_hash'] == null ? undefined : json['tx_hash'], + 'eth_tx_hash': json['eth_tx_hash'] == null ? undefined : json['eth_tx_hash'], + 'timestamp': (new Date(json['timestamp'])), + 'type': RuntimeEventTypeFromJSON(json['type']), + 'body': json['body'], + 'evm_log_name': json['evm_log_name'] == null ? undefined : json['evm_log_name'], + 'evm_log_params': json['evm_log_params'] == null ? undefined : ((json['evm_log_params'] as Array).map(EvmAbiParamFromJSON)), + 'evm_token': json['evm_token'] == null ? undefined : EvmEventTokenFromJSON(json['evm_token']), + }; +} + +export function RuntimeEventListAllOfEventsToJSON(json: any): RuntimeEventListAllOfEvents { + return RuntimeEventListAllOfEventsToJSONTyped(json, false); +} + +export function RuntimeEventListAllOfEventsToJSONTyped(value?: RuntimeEventListAllOfEvents | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'round': value['round'], + 'tx_index': value['tx_index'], + 'tx_hash': value['tx_hash'], + 'eth_tx_hash': value['eth_tx_hash'], + 'timestamp': ((value['timestamp']).toISOString()), + 'type': RuntimeEventTypeToJSON(value['type']), + 'body': value['body'], + 'evm_log_name': value['evm_log_name'], + 'evm_log_params': value['evm_log_params'] == null ? undefined : ((value['evm_log_params'] as Array).map(EvmAbiParamToJSON)), + 'evm_token': EvmEventTokenToJSON(value['evm_token']), + }; +} + diff --git a/src/vendors/nexus/models/RuntimeEventType.ts b/src/vendors/nexus/models/RuntimeEventType.ts index ac23ec87ff..69e133fafc 100644 --- a/src/vendors/nexus/models/RuntimeEventType.ts +++ b/src/vendors/nexus/models/RuntimeEventType.ts @@ -12,22 +12,35 @@ * Do not edit the class manually. */ + /** * * @export - * @enum {string} */ -export enum RuntimeEventType { - AccountsTransfer = 'accounts.transfer', - AccountsBurn = 'accounts.burn', - AccountsMint = 'accounts.mint', - ConsensusAccountsDeposit = 'consensus_accounts.deposit', - ConsensusAccountsWithdraw = 'consensus_accounts.withdraw', - ConsensusAccountsDelegate = 'consensus_accounts.delegate', - ConsensusAccountsUndelegateStart = 'consensus_accounts.undelegate_start', - ConsensusAccountsUndelegateDone = 'consensus_accounts.undelegate_done', - CoreGasUsed = 'core.gas_used', - EvmLog = 'evm.log' +export const RuntimeEventType = { + AccountsTransfer: 'accounts.transfer', + AccountsBurn: 'accounts.burn', + AccountsMint: 'accounts.mint', + ConsensusAccountsDeposit: 'consensus_accounts.deposit', + ConsensusAccountsWithdraw: 'consensus_accounts.withdraw', + ConsensusAccountsDelegate: 'consensus_accounts.delegate', + ConsensusAccountsUndelegateStart: 'consensus_accounts.undelegate_start', + ConsensusAccountsUndelegateDone: 'consensus_accounts.undelegate_done', + CoreGasUsed: 'core.gas_used', + EvmLog: 'evm.log' +} as const; +export type RuntimeEventType = typeof RuntimeEventType[keyof typeof RuntimeEventType]; + + +export function instanceOfRuntimeEventType(value: any): boolean { + for (const key in RuntimeEventType) { + if (Object.prototype.hasOwnProperty.call(RuntimeEventType, key)) { + if (RuntimeEventType[key as keyof typeof RuntimeEventType] === value) { + return true; + } + } + } + return false; } export function RuntimeEventTypeFromJSON(json: any): RuntimeEventType { @@ -42,3 +55,7 @@ export function RuntimeEventTypeToJSON(value?: RuntimeEventType | null): any { return value as any; } +export function RuntimeEventTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): RuntimeEventType { + return value as RuntimeEventType; +} + diff --git a/src/vendors/nexus/models/RuntimeEvmBalance.ts b/src/vendors/nexus/models/RuntimeEvmBalance.ts index ac254093c8..6604aa1226 100644 --- a/src/vendors/nexus/models/RuntimeEvmBalance.ts +++ b/src/vendors/nexus/models/RuntimeEvmBalance.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmTokenType } from './EvmTokenType'; import { - EvmTokenType, EvmTokenTypeFromJSON, EvmTokenTypeFromJSONTyped, EvmTokenTypeToJSON, -} from './'; + EvmTokenTypeToJSONTyped, +} from './EvmTokenType'; /** * Balance of an account for a specific runtime and EVM token. @@ -70,12 +71,26 @@ export interface RuntimeEvmBalance { token_decimals: number; } + + +/** + * Check if a given object implements the RuntimeEvmBalance interface. + */ +export function instanceOfRuntimeEvmBalance(value: object): value is RuntimeEvmBalance { + if (!('balance' in value) || value['balance'] === undefined) return false; + if (!('token_contract_addr' in value) || value['token_contract_addr'] === undefined) return false; + if (!('token_contract_addr_eth' in value) || value['token_contract_addr_eth'] === undefined) return false; + if (!('token_type' in value) || value['token_type'] === undefined) return false; + if (!('token_decimals' in value) || value['token_decimals'] === undefined) return false; + return true; +} + export function RuntimeEvmBalanceFromJSON(json: any): RuntimeEvmBalance { return RuntimeEvmBalanceFromJSONTyped(json, false); } export function RuntimeEvmBalanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeEvmBalance { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -83,30 +98,31 @@ export function RuntimeEvmBalanceFromJSONTyped(json: any, ignoreDiscriminator: b 'balance': json['balance'], 'token_contract_addr': json['token_contract_addr'], 'token_contract_addr_eth': json['token_contract_addr_eth'], - 'token_symbol': !exists(json, 'token_symbol') ? undefined : json['token_symbol'], - 'token_name': !exists(json, 'token_name') ? undefined : json['token_name'], + 'token_symbol': json['token_symbol'] == null ? undefined : json['token_symbol'], + 'token_name': json['token_name'] == null ? undefined : json['token_name'], 'token_type': EvmTokenTypeFromJSON(json['token_type']), 'token_decimals': json['token_decimals'], }; } -export function RuntimeEvmBalanceToJSON(value?: RuntimeEvmBalance | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeEvmBalanceToJSON(json: any): RuntimeEvmBalance { + return RuntimeEvmBalanceToJSONTyped(json, false); +} + +export function RuntimeEvmBalanceToJSONTyped(value?: RuntimeEvmBalance | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'balance': value.balance, - 'token_contract_addr': value.token_contract_addr, - 'token_contract_addr_eth': value.token_contract_addr_eth, - 'token_symbol': value.token_symbol, - 'token_name': value.token_name, - 'token_type': EvmTokenTypeToJSON(value.token_type), - 'token_decimals': value.token_decimals, + 'balance': value['balance'], + 'token_contract_addr': value['token_contract_addr'], + 'token_contract_addr_eth': value['token_contract_addr_eth'], + 'token_symbol': value['token_symbol'], + 'token_name': value['token_name'], + 'token_type': EvmTokenTypeToJSON(value['token_type']), + 'token_decimals': value['token_decimals'], }; } - diff --git a/src/vendors/nexus/models/RuntimeEvmContract.ts b/src/vendors/nexus/models/RuntimeEvmContract.ts index 1e25e60251..9f0f84ea55 100644 --- a/src/vendors/nexus/models/RuntimeEvmContract.ts +++ b/src/vendors/nexus/models/RuntimeEvmContract.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RuntimeEvmContractVerification } from './RuntimeEvmContractVerification'; import { - RuntimeEvmContractVerification, RuntimeEvmContractVerificationFromJSON, RuntimeEvmContractVerificationFromJSONTyped, RuntimeEvmContractVerificationToJSON, -} from './'; + RuntimeEvmContractVerificationToJSONTyped, +} from './RuntimeEvmContractVerification'; /** * @@ -30,6 +31,7 @@ export interface RuntimeEvmContract { * The Oasis cryptographic hash of the transaction that created the smart contract. * Can be omitted for contracts that were created by another contract, as opposed * to a direct `Create` call. + * * @type {string} * @memberof RuntimeEvmContract */ @@ -37,6 +39,7 @@ export interface RuntimeEvmContract { /** * The Ethereum transaction hash of the transaction in `creation_tx`. * Encoded as a lowercase hex string. + * * @type {string} * @memberof RuntimeEvmContract */ @@ -46,6 +49,7 @@ export interface RuntimeEvmContract { * and the constructor parameters. When run, this code generates the runtime bytecode. * Can be omitted for contracts that were created by another contract, as opposed * to a direct `Create` call. + * * @type {string} * @memberof RuntimeEvmContract */ @@ -55,6 +59,7 @@ export interface RuntimeEvmContract { * describes a smart contract. Every contract has this info, but Nexus fetches * it separately, so the field may be missing for very fresh contracts (or if the fetching * process is stalled). + * * @type {string} * @memberof RuntimeEvmContract */ @@ -68,47 +73,57 @@ export interface RuntimeEvmContract { /** * Additional information obtained from contract verification. Only available for smart * contracts that have been verified successfully by Sourcify. + * * @type {RuntimeEvmContractVerification} * @memberof RuntimeEvmContract */ verification?: RuntimeEvmContractVerification; } +/** + * Check if a given object implements the RuntimeEvmContract interface. + */ +export function instanceOfRuntimeEvmContract(value: object): value is RuntimeEvmContract { + if (!('gas_used' in value) || value['gas_used'] === undefined) return false; + return true; +} + export function RuntimeEvmContractFromJSON(json: any): RuntimeEvmContract { return RuntimeEvmContractFromJSONTyped(json, false); } export function RuntimeEvmContractFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeEvmContract { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'creation_tx': !exists(json, 'creation_tx') ? undefined : json['creation_tx'], - 'eth_creation_tx': !exists(json, 'eth_creation_tx') ? undefined : json['eth_creation_tx'], - 'creation_bytecode': !exists(json, 'creation_bytecode') ? undefined : json['creation_bytecode'], - 'runtime_bytecode': !exists(json, 'runtime_bytecode') ? undefined : json['runtime_bytecode'], + 'creation_tx': json['creation_tx'] == null ? undefined : json['creation_tx'], + 'eth_creation_tx': json['eth_creation_tx'] == null ? undefined : json['eth_creation_tx'], + 'creation_bytecode': json['creation_bytecode'] == null ? undefined : json['creation_bytecode'], + 'runtime_bytecode': json['runtime_bytecode'] == null ? undefined : json['runtime_bytecode'], 'gas_used': json['gas_used'], - 'verification': !exists(json, 'verification') ? undefined : RuntimeEvmContractVerificationFromJSON(json['verification']), + 'verification': json['verification'] == null ? undefined : RuntimeEvmContractVerificationFromJSON(json['verification']), }; } -export function RuntimeEvmContractToJSON(value?: RuntimeEvmContract | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeEvmContractToJSON(json: any): RuntimeEvmContract { + return RuntimeEvmContractToJSONTyped(json, false); +} + +export function RuntimeEvmContractToJSONTyped(value?: RuntimeEvmContract | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'creation_tx': value.creation_tx, - 'eth_creation_tx': value.eth_creation_tx, - 'creation_bytecode': value.creation_bytecode, - 'runtime_bytecode': value.runtime_bytecode, - 'gas_used': value.gas_used, - 'verification': RuntimeEvmContractVerificationToJSON(value.verification), + 'creation_tx': value['creation_tx'], + 'eth_creation_tx': value['eth_creation_tx'], + 'creation_bytecode': value['creation_bytecode'], + 'runtime_bytecode': value['runtime_bytecode'], + 'gas_used': value['gas_used'], + 'verification': RuntimeEvmContractVerificationToJSON(value['verification']), }; } - diff --git a/src/vendors/nexus/models/RuntimeEvmContractVerification.ts b/src/vendors/nexus/models/RuntimeEvmContractVerification.ts index e4807ae954..f190f46cb7 100644 --- a/src/vendors/nexus/models/RuntimeEvmContractVerification.ts +++ b/src/vendors/nexus/models/RuntimeEvmContractVerification.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { VerificationLevel } from './VerificationLevel'; import { - VerificationLevel, VerificationLevelFromJSON, VerificationLevelFromJSONTyped, VerificationLevelToJSON, -} from './'; + VerificationLevelToJSONTyped, +} from './VerificationLevel'; /** * @@ -35,47 +36,59 @@ export interface RuntimeEvmContractVerification { /** * The smart contract's [metadata.json](https://docs.soliditylang.org/en/latest/metadata.html) file in JSON format as defined by Solidity. * Includes the smart contract's [ABI](https://docs.soliditylang.org/en/develop/abi-spec.html). + * * @type {object} * @memberof RuntimeEvmContractVerification */ compilation_metadata?: object; /** * Array of all contract source files, in JSON format as returned by [Sourcify](https://sourcify.dev/server/api-docs/#/Repository/get_files_any__chain___address_). + * * @type {Array} * @memberof RuntimeEvmContractVerification */ source_files?: Array; } + + +/** + * Check if a given object implements the RuntimeEvmContractVerification interface. + */ +export function instanceOfRuntimeEvmContractVerification(value: object): value is RuntimeEvmContractVerification { + return true; +} + export function RuntimeEvmContractVerificationFromJSON(json: any): RuntimeEvmContractVerification { return RuntimeEvmContractVerificationFromJSONTyped(json, false); } export function RuntimeEvmContractVerificationFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeEvmContractVerification { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'verification_level': !exists(json, 'verification_level') ? undefined : VerificationLevelFromJSON(json['verification_level']), - 'compilation_metadata': !exists(json, 'compilation_metadata') ? undefined : json['compilation_metadata'], - 'source_files': !exists(json, 'source_files') ? undefined : json['source_files'], + 'verification_level': json['verification_level'] == null ? undefined : VerificationLevelFromJSON(json['verification_level']), + 'compilation_metadata': json['compilation_metadata'] == null ? undefined : json['compilation_metadata'], + 'source_files': json['source_files'] == null ? undefined : json['source_files'], }; } -export function RuntimeEvmContractVerificationToJSON(value?: RuntimeEvmContractVerification | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeEvmContractVerificationToJSON(json: any): RuntimeEvmContractVerification { + return RuntimeEvmContractVerificationToJSONTyped(json, false); +} + +export function RuntimeEvmContractVerificationToJSONTyped(value?: RuntimeEvmContractVerification | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'verification_level': VerificationLevelToJSON(value.verification_level), - 'compilation_metadata': value.compilation_metadata, - 'source_files': value.source_files, + 'verification_level': VerificationLevelToJSON(value['verification_level']), + 'compilation_metadata': value['compilation_metadata'], + 'source_files': value['source_files'], }; } - diff --git a/src/vendors/nexus/models/RuntimeSdkBalance.ts b/src/vendors/nexus/models/RuntimeSdkBalance.ts index d1e6d3e507..98f8f7f957 100644 --- a/src/vendors/nexus/models/RuntimeSdkBalance.ts +++ b/src/vendors/nexus/models/RuntimeSdkBalance.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * Balance of an account for a specific runtime and oasis-sdk token (e.g. ROSE). * @export @@ -39,12 +39,22 @@ export interface RuntimeSdkBalance { token_decimals: number; } +/** + * Check if a given object implements the RuntimeSdkBalance interface. + */ +export function instanceOfRuntimeSdkBalance(value: object): value is RuntimeSdkBalance { + if (!('balance' in value) || value['balance'] === undefined) return false; + if (!('token_symbol' in value) || value['token_symbol'] === undefined) return false; + if (!('token_decimals' in value) || value['token_decimals'] === undefined) return false; + return true; +} + export function RuntimeSdkBalanceFromJSON(json: any): RuntimeSdkBalance { return RuntimeSdkBalanceFromJSONTyped(json, false); } export function RuntimeSdkBalanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeSdkBalance { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -55,19 +65,20 @@ export function RuntimeSdkBalanceFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function RuntimeSdkBalanceToJSON(value?: RuntimeSdkBalance | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeSdkBalanceToJSON(json: any): RuntimeSdkBalance { + return RuntimeSdkBalanceToJSONTyped(json, false); +} + +export function RuntimeSdkBalanceToJSONTyped(value?: RuntimeSdkBalance | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'balance': value.balance, - 'token_symbol': value.token_symbol, - 'token_decimals': value.token_decimals, + 'balance': value['balance'], + 'token_symbol': value['token_symbol'], + 'token_decimals': value['token_decimals'], }; } - diff --git a/src/vendors/nexus/models/RuntimeStatus.ts b/src/vendors/nexus/models/RuntimeStatus.ts index 5bee1f5054..c7e9e54ede 100644 --- a/src/vendors/nexus/models/RuntimeStatus.ts +++ b/src/vendors/nexus/models/RuntimeStatus.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -45,12 +45,23 @@ export interface RuntimeStatus { latest_update_age_ms: number; } +/** + * Check if a given object implements the RuntimeStatus interface. + */ +export function instanceOfRuntimeStatus(value: object): value is RuntimeStatus { + if (!('active_nodes' in value) || value['active_nodes'] === undefined) return false; + if (!('latest_block' in value) || value['latest_block'] === undefined) return false; + if (!('latest_block_time' in value) || value['latest_block_time'] === undefined) return false; + if (!('latest_update_age_ms' in value) || value['latest_update_age_ms'] === undefined) return false; + return true; +} + export function RuntimeStatusFromJSON(json: any): RuntimeStatus { return RuntimeStatusFromJSONTyped(json, false); } export function RuntimeStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeStatus { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -62,20 +73,21 @@ export function RuntimeStatusFromJSONTyped(json: any, ignoreDiscriminator: boole }; } -export function RuntimeStatusToJSON(value?: RuntimeStatus | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeStatusToJSON(json: any): RuntimeStatus { + return RuntimeStatusToJSONTyped(json, false); +} + +export function RuntimeStatusToJSONTyped(value?: RuntimeStatus | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'active_nodes': value.active_nodes, - 'latest_block': value.latest_block, - 'latest_block_time': (value.latest_block_time.toISOString()), - 'latest_update_age_ms': value.latest_update_age_ms, + 'active_nodes': value['active_nodes'], + 'latest_block': value['latest_block'], + 'latest_block_time': ((value['latest_block_time']).toISOString()), + 'latest_update_age_ms': value['latest_update_age_ms'], }; } - diff --git a/src/vendors/nexus/models/RuntimeTransaction.ts b/src/vendors/nexus/models/RuntimeTransaction.ts index acb70cdad6..1c4c82f868 100644 --- a/src/vendors/nexus/models/RuntimeTransaction.ts +++ b/src/vendors/nexus/models/RuntimeTransaction.ts @@ -12,24 +12,32 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmAbiParam } from './EvmAbiParam'; import { - EvmAbiParam, EvmAbiParamFromJSON, EvmAbiParamFromJSONTyped, EvmAbiParamToJSON, - RuntimeTransactionEncryptionEnvelope, + EvmAbiParamToJSONTyped, +} from './EvmAbiParam'; +import type { RuntimeTransactionEncryptionEnvelope } from './RuntimeTransactionEncryptionEnvelope'; +import { RuntimeTransactionEncryptionEnvelopeFromJSON, RuntimeTransactionEncryptionEnvelopeFromJSONTyped, RuntimeTransactionEncryptionEnvelopeToJSON, - TxError, + RuntimeTransactionEncryptionEnvelopeToJSONTyped, +} from './RuntimeTransactionEncryptionEnvelope'; +import type { TxError } from './TxError'; +import { TxErrorFromJSON, TxErrorFromJSONTyped, TxErrorToJSON, -} from './'; + TxErrorToJSONTyped, +} from './TxError'; /** * A runtime transaction. + * * @export * @interface RuntimeTransaction */ @@ -61,6 +69,7 @@ export interface RuntimeTransaction { /** * The Ethereum cryptographic hash of this transaction's encoding. * Absent for non-Ethereum-format transactions. + * * @type {string} * @memberof RuntimeTransaction */ @@ -70,12 +79,14 @@ export interface RuntimeTransaction { * Unlike Ethereum, Oasis natively supports multiple-signature transactions. * However, the great majority of transactions only have a single signer in practice. * Retrieving the other signers is currently not supported by this API. + * * @type {string} * @memberof RuntimeTransaction */ sender_0: string; /** * The Ethereum address of this transaction's 0th signer. + * * @type {string} * @memberof RuntimeTransaction */ @@ -89,24 +100,28 @@ export interface RuntimeTransaction { /** * The fee that this transaction's sender committed to pay to execute * it (total ParaTime base units, as a string). + * * @type {string} * @memberof RuntimeTransaction */ fee: string; /** * The denomination of the fee. + * * @type {string} * @memberof RuntimeTransaction */ fee_symbol: string; /** * The module of the fee proxy. + * * @type {string} * @memberof RuntimeTransaction */ fee_proxy_module?: string; /** * the base64-encoded id of the fee proxy. + * * @type {string} * @memberof RuntimeTransaction */ @@ -114,6 +129,7 @@ export interface RuntimeTransaction { /** * The maximum gas that this transaction's sender committed to use to * execute it. + * * @type {number} * @memberof RuntimeTransaction */ @@ -129,6 +145,7 @@ export interface RuntimeTransaction { * ParaTime base units, as a string). * For EVM transactions this is calculated as `gas_price * gas_used`, where `gas_price = fee / gas_limit`, for compatibility with Ethereum. * For other transactions this equals to `fee`. + * * @type {string} * @memberof RuntimeTransaction */ @@ -150,6 +167,7 @@ export interface RuntimeTransaction { * - "evm.Create" * - "evm.Call" * May be null if the transaction was malformed or encrypted. + * * @type {string} * @memberof RuntimeTransaction */ @@ -167,6 +185,7 @@ export interface RuntimeTransaction { * - Transactions with method "accounts.Transfer". Those are always native token transfers. * - Transactions with method "evm.Call" that have no `data` field in their `body`. Those tend to be transfers, but the runtimes provides no reliable visibility into whether a transfer happened. * Note: Other transactions with method "evm.Call", and possibly "evm.Create", may also be (or include) native token transfers. The heuristic will be `false` for those. + * * @type {boolean} * @memberof RuntimeTransaction */ @@ -181,12 +200,14 @@ export interface RuntimeTransaction { * - For `method = "consensus.Undelegate"`, this is the consensus (!) account to which funds were previously delegated. Note that this corresponds with the `.from` field in the transaction body. * - For `method = "evm.Create"`, this is the address of the newly created smart contract. * - For `method = "evm.Call"`, this is the address of the called smart contract + * * @type {string} * @memberof RuntimeTransaction */ to?: string; /** * A reasonable "to" Ethereum address associated with this transaction, + * * @type {string} * @memberof RuntimeTransaction */ @@ -195,12 +216,14 @@ export interface RuntimeTransaction { * A reasonable "amount" associated with this transaction, if * applicable. The meaning varies based on the transaction method. * Usually in native denomination, ParaTime units. As a string. + * * @type {string} * @memberof RuntimeTransaction */ amount?: string; /** * The denomination of the "amount" associated with this transaction, if applicable. + * * @type {string} * @memberof RuntimeTransaction */ @@ -210,6 +233,7 @@ export interface RuntimeTransaction { * transactions in confidential EVM runtimes like Sapphire. * Note: The term "envelope" in this context refers to the [Oasis-style encryption envelopes](https://github.com/oasisprotocol/oasis-sdk/blob/c36a7ee194abf4ca28fdac0edbefe3843b39bf69/runtime-sdk/src/types/callformat.rs) * which differ slightly from [digital envelopes](hhttps://en.wikipedia.org/wiki/Hybrid_cryptosystem#Envelope_encryption). + * * @type {RuntimeTransactionEncryptionEnvelope} * @memberof RuntimeTransaction */ @@ -217,6 +241,7 @@ export interface RuntimeTransaction { /** * Whether this transaction successfully executed. * Can be absent (meaning "unknown") for confidential runtimes. + * * @type {boolean} * @memberof RuntimeTransaction */ @@ -224,6 +249,7 @@ export interface RuntimeTransaction { /** * The name of the smart contract function called by the transaction. * Only present for `evm.log` transaction calls to contracts that have been verified. + * * @type {string} * @memberof RuntimeTransaction */ @@ -231,6 +257,7 @@ export interface RuntimeTransaction { /** * The decoded parameters with which the smart contract function was called. * Only present for `evm.log` transaction calls to contracts that have been verified. + * * @type {Array} * @memberof RuntimeTransaction */ @@ -243,12 +270,31 @@ export interface RuntimeTransaction { error?: TxError; } +/** + * Check if a given object implements the RuntimeTransaction interface. + */ +export function instanceOfRuntimeTransaction(value: object): value is RuntimeTransaction { + if (!('round' in value) || value['round'] === undefined) return false; + if (!('index' in value) || value['index'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('sender_0' in value) || value['sender_0'] === undefined) return false; + if (!('nonce_0' in value) || value['nonce_0'] === undefined) return false; + if (!('fee' in value) || value['fee'] === undefined) return false; + if (!('fee_symbol' in value) || value['fee_symbol'] === undefined) return false; + if (!('gas_limit' in value) || value['gas_limit'] === undefined) return false; + if (!('gas_used' in value) || value['gas_used'] === undefined) return false; + if (!('charged_fee' in value) || value['charged_fee'] === undefined) return false; + if (!('size' in value) || value['size'] === undefined) return false; + return true; +} + export function RuntimeTransactionFromJSON(json: any): RuntimeTransaction { return RuntimeTransactionFromJSONTyped(json, false); } export function RuntimeTransactionFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeTransaction { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -257,71 +303,72 @@ export function RuntimeTransactionFromJSONTyped(json: any, ignoreDiscriminator: 'index': json['index'], 'timestamp': (new Date(json['timestamp'])), 'hash': json['hash'], - 'eth_hash': !exists(json, 'eth_hash') ? undefined : json['eth_hash'], + 'eth_hash': json['eth_hash'] == null ? undefined : json['eth_hash'], 'sender_0': json['sender_0'], - 'sender_0_eth': !exists(json, 'sender_0_eth') ? undefined : json['sender_0_eth'], + 'sender_0_eth': json['sender_0_eth'] == null ? undefined : json['sender_0_eth'], 'nonce_0': json['nonce_0'], 'fee': json['fee'], 'fee_symbol': json['fee_symbol'], - 'fee_proxy_module': !exists(json, 'fee_proxy_module') ? undefined : json['fee_proxy_module'], - 'fee_proxy_id': !exists(json, 'fee_proxy_id') ? undefined : json['fee_proxy_id'], + 'fee_proxy_module': json['fee_proxy_module'] == null ? undefined : json['fee_proxy_module'], + 'fee_proxy_id': json['fee_proxy_id'] == null ? undefined : json['fee_proxy_id'], 'gas_limit': json['gas_limit'], 'gas_used': json['gas_used'], 'charged_fee': json['charged_fee'], 'size': json['size'], - 'method': !exists(json, 'method') ? undefined : json['method'], - 'body': !exists(json, 'body') ? undefined : json['body'], - 'is_likely_native_token_transfer': !exists(json, 'is_likely_native_token_transfer') ? undefined : json['is_likely_native_token_transfer'], - 'to': !exists(json, 'to') ? undefined : json['to'], - 'to_eth': !exists(json, 'to_eth') ? undefined : json['to_eth'], - 'amount': !exists(json, 'amount') ? undefined : json['amount'], - 'amount_symbol': !exists(json, 'amount_symbol') ? undefined : json['amount_symbol'], - 'encryption_envelope': !exists(json, 'encryption_envelope') ? undefined : RuntimeTransactionEncryptionEnvelopeFromJSON(json['encryption_envelope']), - 'success': !exists(json, 'success') ? undefined : json['success'], - 'evm_fn_name': !exists(json, 'evm_fn_name') ? undefined : json['evm_fn_name'], - 'evm_fn_params': !exists(json, 'evm_fn_params') ? undefined : ((json['evm_fn_params'] as Array).map(EvmAbiParamFromJSON)), - 'error': !exists(json, 'error') ? undefined : TxErrorFromJSON(json['error']), + 'method': json['method'] == null ? undefined : json['method'], + 'body': json['body'] == null ? undefined : json['body'], + 'is_likely_native_token_transfer': json['is_likely_native_token_transfer'] == null ? undefined : json['is_likely_native_token_transfer'], + 'to': json['to'] == null ? undefined : json['to'], + 'to_eth': json['to_eth'] == null ? undefined : json['to_eth'], + 'amount': json['amount'] == null ? undefined : json['amount'], + 'amount_symbol': json['amount_symbol'] == null ? undefined : json['amount_symbol'], + 'encryption_envelope': json['encryption_envelope'] == null ? undefined : RuntimeTransactionEncryptionEnvelopeFromJSON(json['encryption_envelope']), + 'success': json['success'] == null ? undefined : json['success'], + 'evm_fn_name': json['evm_fn_name'] == null ? undefined : json['evm_fn_name'], + 'evm_fn_params': json['evm_fn_params'] == null ? undefined : ((json['evm_fn_params'] as Array).map(EvmAbiParamFromJSON)), + 'error': json['error'] == null ? undefined : TxErrorFromJSON(json['error']), }; } -export function RuntimeTransactionToJSON(value?: RuntimeTransaction | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeTransactionToJSON(json: any): RuntimeTransaction { + return RuntimeTransactionToJSONTyped(json, false); +} + +export function RuntimeTransactionToJSONTyped(value?: RuntimeTransaction | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'round': value.round, - 'index': value.index, - 'timestamp': (value.timestamp.toISOString()), - 'hash': value.hash, - 'eth_hash': value.eth_hash, - 'sender_0': value.sender_0, - 'sender_0_eth': value.sender_0_eth, - 'nonce_0': value.nonce_0, - 'fee': value.fee, - 'fee_symbol': value.fee_symbol, - 'fee_proxy_module': value.fee_proxy_module, - 'fee_proxy_id': value.fee_proxy_id, - 'gas_limit': value.gas_limit, - 'gas_used': value.gas_used, - 'charged_fee': value.charged_fee, - 'size': value.size, - 'method': value.method, - 'body': value.body, - 'is_likely_native_token_transfer': value.is_likely_native_token_transfer, - 'to': value.to, - 'to_eth': value.to_eth, - 'amount': value.amount, - 'amount_symbol': value.amount_symbol, - 'encryption_envelope': RuntimeTransactionEncryptionEnvelopeToJSON(value.encryption_envelope), - 'success': value.success, - 'evm_fn_name': value.evm_fn_name, - 'evm_fn_params': value.evm_fn_params === undefined ? undefined : ((value.evm_fn_params as Array).map(EvmAbiParamToJSON)), - 'error': TxErrorToJSON(value.error), + 'round': value['round'], + 'index': value['index'], + 'timestamp': ((value['timestamp']).toISOString()), + 'hash': value['hash'], + 'eth_hash': value['eth_hash'], + 'sender_0': value['sender_0'], + 'sender_0_eth': value['sender_0_eth'], + 'nonce_0': value['nonce_0'], + 'fee': value['fee'], + 'fee_symbol': value['fee_symbol'], + 'fee_proxy_module': value['fee_proxy_module'], + 'fee_proxy_id': value['fee_proxy_id'], + 'gas_limit': value['gas_limit'], + 'gas_used': value['gas_used'], + 'charged_fee': value['charged_fee'], + 'size': value['size'], + 'method': value['method'], + 'body': value['body'], + 'is_likely_native_token_transfer': value['is_likely_native_token_transfer'], + 'to': value['to'], + 'to_eth': value['to_eth'], + 'amount': value['amount'], + 'amount_symbol': value['amount_symbol'], + 'encryption_envelope': RuntimeTransactionEncryptionEnvelopeToJSON(value['encryption_envelope']), + 'success': value['success'], + 'evm_fn_name': value['evm_fn_name'], + 'evm_fn_params': value['evm_fn_params'] == null ? undefined : ((value['evm_fn_params'] as Array).map(EvmAbiParamToJSON)), + 'error': TxErrorToJSON(value['error']), }; } - diff --git a/src/vendors/nexus/models/RuntimeTransactionEncryptionEnvelope.ts b/src/vendors/nexus/models/RuntimeTransactionEncryptionEnvelope.ts index 5f0f0633b5..433f752e3d 100644 --- a/src/vendors/nexus/models/RuntimeTransactionEncryptionEnvelope.ts +++ b/src/vendors/nexus/models/RuntimeTransactionEncryptionEnvelope.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -57,41 +57,50 @@ export interface RuntimeTransactionEncryptionEnvelope { result?: string; } +/** + * Check if a given object implements the RuntimeTransactionEncryptionEnvelope interface. + */ +export function instanceOfRuntimeTransactionEncryptionEnvelope(value: object): value is RuntimeTransactionEncryptionEnvelope { + if (!('format' in value) || value['format'] === undefined) return false; + return true; +} + export function RuntimeTransactionEncryptionEnvelopeFromJSON(json: any): RuntimeTransactionEncryptionEnvelope { return RuntimeTransactionEncryptionEnvelopeFromJSONTyped(json, false); } export function RuntimeTransactionEncryptionEnvelopeFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeTransactionEncryptionEnvelope { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'format': json['format'], - 'public_key': !exists(json, 'public_key') ? undefined : json['public_key'], - 'data_nonce': !exists(json, 'data_nonce') ? undefined : json['data_nonce'], - 'data': !exists(json, 'data') ? undefined : json['data'], - 'result_nonce': !exists(json, 'result_nonce') ? undefined : json['result_nonce'], - 'result': !exists(json, 'result') ? undefined : json['result'], + 'public_key': json['public_key'] == null ? undefined : json['public_key'], + 'data_nonce': json['data_nonce'] == null ? undefined : json['data_nonce'], + 'data': json['data'] == null ? undefined : json['data'], + 'result_nonce': json['result_nonce'] == null ? undefined : json['result_nonce'], + 'result': json['result'] == null ? undefined : json['result'], }; } -export function RuntimeTransactionEncryptionEnvelopeToJSON(value?: RuntimeTransactionEncryptionEnvelope | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeTransactionEncryptionEnvelopeToJSON(json: any): RuntimeTransactionEncryptionEnvelope { + return RuntimeTransactionEncryptionEnvelopeToJSONTyped(json, false); +} + +export function RuntimeTransactionEncryptionEnvelopeToJSONTyped(value?: RuntimeTransactionEncryptionEnvelope | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'format': value.format, - 'public_key': value.public_key, - 'data_nonce': value.data_nonce, - 'data': value.data, - 'result_nonce': value.result_nonce, - 'result': value.result, + 'format': value['format'], + 'public_key': value['public_key'], + 'data_nonce': value['data_nonce'], + 'data': value['data'], + 'result_nonce': value['result_nonce'], + 'result': value['result'], }; } - diff --git a/src/vendors/nexus/models/RuntimeTransactionList.ts b/src/vendors/nexus/models/RuntimeTransactionList.ts index 6c94c8c9c7..473af82fe8 100644 --- a/src/vendors/nexus/models/RuntimeTransactionList.ts +++ b/src/vendors/nexus/models/RuntimeTransactionList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { RuntimeTransactionListAllOfTransactions } from './RuntimeTransactionListAllOfTransactions'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - RuntimeTransaction, - RuntimeTransactionFromJSON, - RuntimeTransactionFromJSONTyped, - RuntimeTransactionToJSON, - RuntimeTransactionListAllOf, - RuntimeTransactionListAllOfFromJSON, - RuntimeTransactionListAllOfFromJSONTyped, - RuntimeTransactionListAllOfToJSON, -} from './'; + RuntimeTransactionListAllOfTransactionsFromJSON, + RuntimeTransactionListAllOfTransactionsFromJSONTyped, + RuntimeTransactionListAllOfTransactionsToJSON, + RuntimeTransactionListAllOfTransactionsToJSONTyped, +} from './RuntimeTransactionListAllOfTransactions'; /** * @@ -37,6 +30,7 @@ export interface RuntimeTransactionList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof RuntimeTransactionList */ @@ -49,10 +43,20 @@ export interface RuntimeTransactionList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof RuntimeTransactionList */ - transactions: Array; + transactions: Array; +} + +/** + * Check if a given object implements the RuntimeTransactionList interface. + */ +export function instanceOfRuntimeTransactionList(value: object): value is RuntimeTransactionList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('transactions' in value) || value['transactions'] === undefined) return false; + return true; } export function RuntimeTransactionListFromJSON(json: any): RuntimeTransactionList { @@ -60,30 +64,31 @@ export function RuntimeTransactionListFromJSON(json: any): RuntimeTransactionLis } export function RuntimeTransactionListFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeTransactionList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'transactions': ((json['transactions'] as Array).map(RuntimeTransactionFromJSON)), + 'transactions': ((json['transactions'] as Array).map(RuntimeTransactionListAllOfTransactionsFromJSON)), }; } -export function RuntimeTransactionListToJSON(value?: RuntimeTransactionList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function RuntimeTransactionListToJSON(json: any): RuntimeTransactionList { + return RuntimeTransactionListToJSONTyped(json, false); +} + +export function RuntimeTransactionListToJSONTyped(value?: RuntimeTransactionList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'transactions': ((value.transactions as Array).map(RuntimeTransactionToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'transactions': ((value['transactions'] as Array).map(RuntimeTransactionListAllOfTransactionsToJSON)), }; } - diff --git a/src/vendors/nexus/models/RuntimeTransactionListAllOfTransactions.ts b/src/vendors/nexus/models/RuntimeTransactionListAllOfTransactions.ts new file mode 100644 index 0000000000..5132853f68 --- /dev/null +++ b/src/vendors/nexus/models/RuntimeTransactionListAllOfTransactions.ts @@ -0,0 +1,373 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { EvmAbiParam } from './EvmAbiParam'; +import { + EvmAbiParamFromJSON, + EvmAbiParamFromJSONTyped, + EvmAbiParamToJSON, + EvmAbiParamToJSONTyped, +} from './EvmAbiParam'; +import type { RuntimeTransactionEncryptionEnvelope } from './RuntimeTransactionEncryptionEnvelope'; +import { + RuntimeTransactionEncryptionEnvelopeFromJSON, + RuntimeTransactionEncryptionEnvelopeFromJSONTyped, + RuntimeTransactionEncryptionEnvelopeToJSON, + RuntimeTransactionEncryptionEnvelopeToJSONTyped, +} from './RuntimeTransactionEncryptionEnvelope'; +import type { TxError } from './TxError'; +import { + TxErrorFromJSON, + TxErrorFromJSONTyped, + TxErrorToJSON, + TxErrorToJSONTyped, +} from './TxError'; + +/** + * + * @export + * @interface RuntimeTransactionListAllOfTransactions + */ +export interface RuntimeTransactionListAllOfTransactions { + /** + * The block round at which this transaction was executed. + * @type {number} + * @memberof RuntimeTransactionListAllOfTransactions + */ + round: number; + /** + * The 0-based index of this transaction in the block. + * @type {number} + * @memberof RuntimeTransactionListAllOfTransactions + */ + index: number; + /** + * The second-granular consensus time when this tx's block was proposed. + * @type {Date} + * @memberof RuntimeTransactionListAllOfTransactions + */ + timestamp: Date; + /** + * The Oasis cryptographic hash of this transaction's encoding. + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + hash: string; + /** + * The Ethereum cryptographic hash of this transaction's encoding. + * Absent for non-Ethereum-format transactions. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + eth_hash?: string; + /** + * The Oasis address of this transaction's 0th signer. + * Unlike Ethereum, Oasis natively supports multiple-signature transactions. + * However, the great majority of transactions only have a single signer in practice. + * Retrieving the other signers is currently not supported by this API. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + sender_0: string; + /** + * The Ethereum address of this transaction's 0th signer. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + sender_0_eth?: string; + /** + * The nonce used with this transaction's 0th signer, to prevent replay. + * @type {number} + * @memberof RuntimeTransactionListAllOfTransactions + */ + nonce_0: number; + /** + * The fee that this transaction's sender committed to pay to execute + * it (total ParaTime base units, as a string). + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + fee: string; + /** + * The denomination of the fee. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + fee_symbol: string; + /** + * The module of the fee proxy. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + fee_proxy_module?: string; + /** + * the base64-encoded id of the fee proxy. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + fee_proxy_id?: string; + /** + * The maximum gas that this transaction's sender committed to use to + * execute it. + * + * @type {number} + * @memberof RuntimeTransactionListAllOfTransactions + */ + gas_limit: number; + /** + * The total gas used by the transaction. + * @type {number} + * @memberof RuntimeTransactionListAllOfTransactions + */ + gas_used: number; + /** + * The fee that was charged for the transaction execution (total, native denomination, + * ParaTime base units, as a string). + * For EVM transactions this is calculated as `gas_price * gas_used`, where `gas_price = fee / gas_limit`, for compatibility with Ethereum. + * For other transactions this equals to `fee`. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + charged_fee: string; + /** + * The total byte size of the transaction. + * @type {number} + * @memberof RuntimeTransactionListAllOfTransactions + */ + size: number; + /** + * The method that was called. Defined by the runtime. In theory, this could be any string as the runtimes evolve. + * In practice, Nexus currently expects only the following methods: + * - "accounts.Transfer" + * - "consensus.Deposit" + * - "consensus.Withdraw" + * - "consensus.Delegate" + * - "consensus.Undelegate" + * - "evm.Create" + * - "evm.Call" + * May be null if the transaction was malformed or encrypted. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + method?: string; + /** + * The method call body. May be null if the transaction was malformed. + * @type {object} + * @memberof RuntimeTransactionListAllOfTransactions + */ + body?: object; + /** + * Whether this transaction likely represents a native token transfer. + * This is based on a heuristic, and can change at any time without warning and possibly without updating the documentation. + * The current heuristic sets this to `true` for: + * - Transactions with method "accounts.Transfer". Those are always native token transfers. + * - Transactions with method "evm.Call" that have no `data` field in their `body`. Those tend to be transfers, but the runtimes provides no reliable visibility into whether a transfer happened. + * Note: Other transactions with method "evm.Call", and possibly "evm.Create", may also be (or include) native token transfers. The heuristic will be `false` for those. + * + * @type {boolean} + * @memberof RuntimeTransactionListAllOfTransactions + */ + is_likely_native_token_transfer?: boolean; + /** + * A reasonable "to" Oasis address associated with this transaction, + * if applicable. The meaning varies based on the transaction method. Some notable examples: + * - For `method = "accounts.Transfer"`, this is the paratime account receiving the funds. + * - For `method = "consensus.Deposit"`, this is the paratime account receiving the funds. + * - For `method = "consensus.Withdraw"`, this is the consensus (!) account receiving the funds. + * - For `method = "consensus.Delegate"`, this is the consensus (!) account receiving the funds. + * - For `method = "consensus.Undelegate"`, this is the consensus (!) account to which funds were previously delegated. Note that this corresponds with the `.from` field in the transaction body. + * - For `method = "evm.Create"`, this is the address of the newly created smart contract. + * - For `method = "evm.Call"`, this is the address of the called smart contract + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + to?: string; + /** + * A reasonable "to" Ethereum address associated with this transaction, + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + to_eth?: string; + /** + * A reasonable "amount" associated with this transaction, if + * applicable. The meaning varies based on the transaction method. + * Usually in native denomination, ParaTime units. As a string. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + amount?: string; + /** + * The denomination of the "amount" associated with this transaction, if applicable. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + amount_symbol?: string; + /** + * The data relevant to the encrypted transaction. Only present for encrypted + * transactions in confidential EVM runtimes like Sapphire. + * Note: The term "envelope" in this context refers to the [Oasis-style encryption envelopes](https://github.com/oasisprotocol/oasis-sdk/blob/c36a7ee194abf4ca28fdac0edbefe3843b39bf69/runtime-sdk/src/types/callformat.rs) + * which differ slightly from [digital envelopes](hhttps://en.wikipedia.org/wiki/Hybrid_cryptosystem#Envelope_encryption). + * + * @type {RuntimeTransactionEncryptionEnvelope} + * @memberof RuntimeTransactionListAllOfTransactions + */ + encryption_envelope?: RuntimeTransactionEncryptionEnvelope; + /** + * Whether this transaction successfully executed. + * Can be absent (meaning "unknown") for confidential runtimes. + * + * @type {boolean} + * @memberof RuntimeTransactionListAllOfTransactions + */ + success?: boolean; + /** + * The name of the smart contract function called by the transaction. + * Only present for `evm.log` transaction calls to contracts that have been verified. + * + * @type {string} + * @memberof RuntimeTransactionListAllOfTransactions + */ + evm_fn_name?: string; + /** + * The decoded parameters with which the smart contract function was called. + * Only present for `evm.log` transaction calls to contracts that have been verified. + * + * @type {Array} + * @memberof RuntimeTransactionListAllOfTransactions + */ + evm_fn_params?: Array; + /** + * Error details of a failed transaction. + * @type {TxError} + * @memberof RuntimeTransactionListAllOfTransactions + */ + error?: TxError; +} + +/** + * Check if a given object implements the RuntimeTransactionListAllOfTransactions interface. + */ +export function instanceOfRuntimeTransactionListAllOfTransactions(value: object): value is RuntimeTransactionListAllOfTransactions { + if (!('round' in value) || value['round'] === undefined) return false; + if (!('index' in value) || value['index'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('sender_0' in value) || value['sender_0'] === undefined) return false; + if (!('nonce_0' in value) || value['nonce_0'] === undefined) return false; + if (!('fee' in value) || value['fee'] === undefined) return false; + if (!('fee_symbol' in value) || value['fee_symbol'] === undefined) return false; + if (!('gas_limit' in value) || value['gas_limit'] === undefined) return false; + if (!('gas_used' in value) || value['gas_used'] === undefined) return false; + if (!('charged_fee' in value) || value['charged_fee'] === undefined) return false; + if (!('size' in value) || value['size'] === undefined) return false; + return true; +} + +export function RuntimeTransactionListAllOfTransactionsFromJSON(json: any): RuntimeTransactionListAllOfTransactions { + return RuntimeTransactionListAllOfTransactionsFromJSONTyped(json, false); +} + +export function RuntimeTransactionListAllOfTransactionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): RuntimeTransactionListAllOfTransactions { + if (json == null) { + return json; + } + return { + + 'round': json['round'], + 'index': json['index'], + 'timestamp': (new Date(json['timestamp'])), + 'hash': json['hash'], + 'eth_hash': json['eth_hash'] == null ? undefined : json['eth_hash'], + 'sender_0': json['sender_0'], + 'sender_0_eth': json['sender_0_eth'] == null ? undefined : json['sender_0_eth'], + 'nonce_0': json['nonce_0'], + 'fee': json['fee'], + 'fee_symbol': json['fee_symbol'], + 'fee_proxy_module': json['fee_proxy_module'] == null ? undefined : json['fee_proxy_module'], + 'fee_proxy_id': json['fee_proxy_id'] == null ? undefined : json['fee_proxy_id'], + 'gas_limit': json['gas_limit'], + 'gas_used': json['gas_used'], + 'charged_fee': json['charged_fee'], + 'size': json['size'], + 'method': json['method'] == null ? undefined : json['method'], + 'body': json['body'] == null ? undefined : json['body'], + 'is_likely_native_token_transfer': json['is_likely_native_token_transfer'] == null ? undefined : json['is_likely_native_token_transfer'], + 'to': json['to'] == null ? undefined : json['to'], + 'to_eth': json['to_eth'] == null ? undefined : json['to_eth'], + 'amount': json['amount'] == null ? undefined : json['amount'], + 'amount_symbol': json['amount_symbol'] == null ? undefined : json['amount_symbol'], + 'encryption_envelope': json['encryption_envelope'] == null ? undefined : RuntimeTransactionEncryptionEnvelopeFromJSON(json['encryption_envelope']), + 'success': json['success'] == null ? undefined : json['success'], + 'evm_fn_name': json['evm_fn_name'] == null ? undefined : json['evm_fn_name'], + 'evm_fn_params': json['evm_fn_params'] == null ? undefined : ((json['evm_fn_params'] as Array).map(EvmAbiParamFromJSON)), + 'error': json['error'] == null ? undefined : TxErrorFromJSON(json['error']), + }; +} + +export function RuntimeTransactionListAllOfTransactionsToJSON(json: any): RuntimeTransactionListAllOfTransactions { + return RuntimeTransactionListAllOfTransactionsToJSONTyped(json, false); +} + +export function RuntimeTransactionListAllOfTransactionsToJSONTyped(value?: RuntimeTransactionListAllOfTransactions | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'round': value['round'], + 'index': value['index'], + 'timestamp': ((value['timestamp']).toISOString()), + 'hash': value['hash'], + 'eth_hash': value['eth_hash'], + 'sender_0': value['sender_0'], + 'sender_0_eth': value['sender_0_eth'], + 'nonce_0': value['nonce_0'], + 'fee': value['fee'], + 'fee_symbol': value['fee_symbol'], + 'fee_proxy_module': value['fee_proxy_module'], + 'fee_proxy_id': value['fee_proxy_id'], + 'gas_limit': value['gas_limit'], + 'gas_used': value['gas_used'], + 'charged_fee': value['charged_fee'], + 'size': value['size'], + 'method': value['method'], + 'body': value['body'], + 'is_likely_native_token_transfer': value['is_likely_native_token_transfer'], + 'to': value['to'], + 'to_eth': value['to_eth'], + 'amount': value['amount'], + 'amount_symbol': value['amount_symbol'], + 'encryption_envelope': RuntimeTransactionEncryptionEnvelopeToJSON(value['encryption_envelope']), + 'success': value['success'], + 'evm_fn_name': value['evm_fn_name'], + 'evm_fn_params': value['evm_fn_params'] == null ? undefined : ((value['evm_fn_params'] as Array).map(EvmAbiParamToJSON)), + 'error': TxErrorToJSON(value['error']), + }; +} + diff --git a/src/vendors/nexus/models/Status.ts b/src/vendors/nexus/models/Status.ts index 9252a92a31..ae3642e92c 100644 --- a/src/vendors/nexus/models/Status.ts +++ b/src/vendors/nexus/models/Status.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -22,6 +22,7 @@ export interface Status { /** * The height of the most recent indexed block. Compare with latest_node_block to measure * how far behind Nexus is from the chain. + * * @type {number} * @memberof Status */ @@ -46,12 +47,23 @@ export interface Status { latest_update_age_ms: number; } +/** + * Check if a given object implements the Status interface. + */ +export function instanceOfStatus(value: object): value is Status { + if (!('latest_block' in value) || value['latest_block'] === undefined) return false; + if (!('latest_node_block' in value) || value['latest_node_block'] === undefined) return false; + if (!('latest_block_time' in value) || value['latest_block_time'] === undefined) return false; + if (!('latest_update_age_ms' in value) || value['latest_update_age_ms'] === undefined) return false; + return true; +} + export function StatusFromJSON(json: any): Status { return StatusFromJSONTyped(json, false); } export function StatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): Status { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -63,20 +75,21 @@ export function StatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): St }; } -export function StatusToJSON(value?: Status | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function StatusToJSON(json: any): Status { + return StatusToJSONTyped(json, false); +} + +export function StatusToJSONTyped(value?: Status | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'latest_block': value.latest_block, - 'latest_node_block': value.latest_node_block, - 'latest_block_time': (value.latest_block_time.toISOString()), - 'latest_update_age_ms': value.latest_update_age_ms, + 'latest_block': value['latest_block'], + 'latest_node_block': value['latest_node_block'], + 'latest_block_time': ((value['latest_block_time']).toISOString()), + 'latest_update_age_ms': value['latest_update_age_ms'], }; } - diff --git a/src/vendors/nexus/models/TokenHolderList.ts b/src/vendors/nexus/models/TokenHolderList.ts index 9dd54dc502..1dfd60ca98 100644 --- a/src/vendors/nexus/models/TokenHolderList.ts +++ b/src/vendors/nexus/models/TokenHolderList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { TokenHolderListAllOfHolders } from './TokenHolderListAllOfHolders'; import { - BareTokenHolder, - BareTokenHolderFromJSON, - BareTokenHolderFromJSONTyped, - BareTokenHolderToJSON, - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - TokenHolderListAllOf, - TokenHolderListAllOfFromJSON, - TokenHolderListAllOfFromJSONTyped, - TokenHolderListAllOfToJSON, -} from './'; + TokenHolderListAllOfHoldersFromJSON, + TokenHolderListAllOfHoldersFromJSONTyped, + TokenHolderListAllOfHoldersToJSON, + TokenHolderListAllOfHoldersToJSONTyped, +} from './TokenHolderListAllOfHolders'; /** * @@ -37,6 +30,7 @@ export interface TokenHolderList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof TokenHolderList */ @@ -49,10 +43,20 @@ export interface TokenHolderList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof TokenHolderList */ - holders: Array; + holders: Array; +} + +/** + * Check if a given object implements the TokenHolderList interface. + */ +export function instanceOfTokenHolderList(value: object): value is TokenHolderList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('holders' in value) || value['holders'] === undefined) return false; + return true; } export function TokenHolderListFromJSON(json: any): TokenHolderList { @@ -60,30 +64,31 @@ export function TokenHolderListFromJSON(json: any): TokenHolderList { } export function TokenHolderListFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenHolderList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'holders': ((json['holders'] as Array).map(BareTokenHolderFromJSON)), + 'holders': ((json['holders'] as Array).map(TokenHolderListAllOfHoldersFromJSON)), }; } -export function TokenHolderListToJSON(value?: TokenHolderList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function TokenHolderListToJSON(json: any): TokenHolderList { + return TokenHolderListToJSONTyped(json, false); +} + +export function TokenHolderListToJSONTyped(value?: TokenHolderList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'holders': ((value.holders as Array).map(BareTokenHolderToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'holders': ((value['holders'] as Array).map(TokenHolderListAllOfHoldersToJSON)), }; } - diff --git a/src/vendors/nexus/models/TokenHolderListAllOfHolders.ts b/src/vendors/nexus/models/TokenHolderListAllOfHolders.ts new file mode 100644 index 0000000000..7344f6ab5f --- /dev/null +++ b/src/vendors/nexus/models/TokenHolderListAllOfHolders.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface TokenHolderListAllOfHolders + */ +export interface TokenHolderListAllOfHolders { + /** + * The Oasis address of the account holder. + * @type {string} + * @memberof TokenHolderListAllOfHolders + */ + holder_address: string; + /** + * The Ethereum address of the same account holder, if meaningfully defined. + * @type {string} + * @memberof TokenHolderListAllOfHolders + */ + eth_holder_address?: string; + /** + * Number of tokens held, in base units. + * @type {string} + * @memberof TokenHolderListAllOfHolders + */ + balance: string; +} + +/** + * Check if a given object implements the TokenHolderListAllOfHolders interface. + */ +export function instanceOfTokenHolderListAllOfHolders(value: object): value is TokenHolderListAllOfHolders { + if (!('holder_address' in value) || value['holder_address'] === undefined) return false; + if (!('balance' in value) || value['balance'] === undefined) return false; + return true; +} + +export function TokenHolderListAllOfHoldersFromJSON(json: any): TokenHolderListAllOfHolders { + return TokenHolderListAllOfHoldersFromJSONTyped(json, false); +} + +export function TokenHolderListAllOfHoldersFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenHolderListAllOfHolders { + if (json == null) { + return json; + } + return { + + 'holder_address': json['holder_address'], + 'eth_holder_address': json['eth_holder_address'] == null ? undefined : json['eth_holder_address'], + 'balance': json['balance'], + }; +} + +export function TokenHolderListAllOfHoldersToJSON(json: any): TokenHolderListAllOfHolders { + return TokenHolderListAllOfHoldersToJSONTyped(json, false); +} + +export function TokenHolderListAllOfHoldersToJSONTyped(value?: TokenHolderListAllOfHolders | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'holder_address': value['holder_address'], + 'eth_holder_address': value['eth_holder_address'], + 'balance': value['balance'], + }; +} + diff --git a/src/vendors/nexus/models/Transaction.ts b/src/vendors/nexus/models/Transaction.ts index e610d9d8d0..d60af9ef15 100644 --- a/src/vendors/nexus/models/Transaction.ts +++ b/src/vendors/nexus/models/Transaction.ts @@ -12,20 +12,25 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ConsensusTxMethod } from './ConsensusTxMethod'; import { - ConsensusTxMethod, ConsensusTxMethodFromJSON, ConsensusTxMethodFromJSONTyped, ConsensusTxMethodToJSON, - TxError, + ConsensusTxMethodToJSONTyped, +} from './ConsensusTxMethod'; +import type { TxError } from './TxError'; +import { TxErrorFromJSON, TxErrorFromJSONTyped, TxErrorToJSON, -} from './'; + TxErrorToJSONTyped, +} from './TxError'; /** * A consensus transaction. + * * @export * @interface Transaction */ @@ -45,6 +50,7 @@ export interface Transaction { /** * The second-granular consensus time of this tx's block, i.e. roughly when the * [block was proposed](https://github.com/tendermint/tendermint/blob/v0.34.x/spec/core/data_structures.md#header). + * * @type {Date} * @memberof Transaction */ @@ -70,12 +76,14 @@ export interface Transaction { /** * The fee that this transaction's sender committed * to pay to execute it. + * * @type {string} * @memberof Transaction */ fee: string; /** * The maximum gas that a transaction can use. + * * @type {string} * @memberof Transaction */ @@ -106,12 +114,32 @@ export interface Transaction { error?: TxError; } + + +/** + * Check if a given object implements the Transaction interface. + */ +export function instanceOfTransaction(value: object): value is Transaction { + if (!('block' in value) || value['block'] === undefined) return false; + if (!('index' in value) || value['index'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('sender' in value) || value['sender'] === undefined) return false; + if (!('nonce' in value) || value['nonce'] === undefined) return false; + if (!('fee' in value) || value['fee'] === undefined) return false; + if (!('gas_limit' in value) || value['gas_limit'] === undefined) return false; + if (!('method' in value) || value['method'] === undefined) return false; + if (!('body' in value) || value['body'] === undefined) return false; + if (!('success' in value) || value['success'] === undefined) return false; + return true; +} + export function TransactionFromJSON(json: any): Transaction { return TransactionFromJSONTyped(json, false); } export function TransactionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Transaction { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -127,32 +155,33 @@ export function TransactionFromJSONTyped(json: any, ignoreDiscriminator: boolean 'method': ConsensusTxMethodFromJSON(json['method']), 'body': json['body'], 'success': json['success'], - 'error': !exists(json, 'error') ? undefined : TxErrorFromJSON(json['error']), + 'error': json['error'] == null ? undefined : TxErrorFromJSON(json['error']), }; } -export function TransactionToJSON(value?: Transaction | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function TransactionToJSON(json: any): Transaction { + return TransactionToJSONTyped(json, false); +} + +export function TransactionToJSONTyped(value?: Transaction | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'block': value.block, - 'index': value.index, - 'timestamp': (value.timestamp.toISOString()), - 'hash': value.hash, - 'sender': value.sender, - 'nonce': value.nonce, - 'fee': value.fee, - 'gas_limit': value.gas_limit, - 'method': ConsensusTxMethodToJSON(value.method), - 'body': value.body, - 'success': value.success, - 'error': TxErrorToJSON(value.error), + 'block': value['block'], + 'index': value['index'], + 'timestamp': ((value['timestamp']).toISOString()), + 'hash': value['hash'], + 'sender': value['sender'], + 'nonce': value['nonce'], + 'fee': value['fee'], + 'gas_limit': value['gas_limit'], + 'method': ConsensusTxMethodToJSON(value['method']), + 'body': value['body'], + 'success': value['success'], + 'error': TxErrorToJSON(value['error']), }; } - diff --git a/src/vendors/nexus/models/TransactionList.ts b/src/vendors/nexus/models/TransactionList.ts index 26321adfc9..45d4f554df 100644 --- a/src/vendors/nexus/models/TransactionList.ts +++ b/src/vendors/nexus/models/TransactionList.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { TransactionListAllOfTransactions } from './TransactionListAllOfTransactions'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - Transaction, - TransactionFromJSON, - TransactionFromJSONTyped, - TransactionToJSON, - TransactionListAllOf, - TransactionListAllOfFromJSON, - TransactionListAllOfFromJSONTyped, - TransactionListAllOfToJSON, -} from './'; + TransactionListAllOfTransactionsFromJSON, + TransactionListAllOfTransactionsFromJSONTyped, + TransactionListAllOfTransactionsToJSON, + TransactionListAllOfTransactionsToJSONTyped, +} from './TransactionListAllOfTransactions'; /** * @@ -37,6 +30,7 @@ export interface TransactionList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof TransactionList */ @@ -49,10 +43,20 @@ export interface TransactionList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof TransactionList */ - transactions: Array; + transactions: Array; +} + +/** + * Check if a given object implements the TransactionList interface. + */ +export function instanceOfTransactionList(value: object): value is TransactionList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('transactions' in value) || value['transactions'] === undefined) return false; + return true; } export function TransactionListFromJSON(json: any): TransactionList { @@ -60,30 +64,31 @@ export function TransactionListFromJSON(json: any): TransactionList { } export function TransactionListFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'transactions': ((json['transactions'] as Array).map(TransactionFromJSON)), + 'transactions': ((json['transactions'] as Array).map(TransactionListAllOfTransactionsFromJSON)), }; } -export function TransactionListToJSON(value?: TransactionList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function TransactionListToJSON(json: any): TransactionList { + return TransactionListToJSONTyped(json, false); +} + +export function TransactionListToJSONTyped(value?: TransactionList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'transactions': ((value.transactions as Array).map(TransactionToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'transactions': ((value['transactions'] as Array).map(TransactionListAllOfTransactionsToJSON)), }; } - diff --git a/src/vendors/nexus/models/TransactionListAllOfTransactions.ts b/src/vendors/nexus/models/TransactionListAllOfTransactions.ts new file mode 100644 index 0000000000..0c97d65efb --- /dev/null +++ b/src/vendors/nexus/models/TransactionListAllOfTransactions.ts @@ -0,0 +1,186 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { ConsensusTxMethod } from './ConsensusTxMethod'; +import { + ConsensusTxMethodFromJSON, + ConsensusTxMethodFromJSONTyped, + ConsensusTxMethodToJSON, + ConsensusTxMethodToJSONTyped, +} from './ConsensusTxMethod'; +import type { TxError } from './TxError'; +import { + TxErrorFromJSON, + TxErrorFromJSONTyped, + TxErrorToJSON, + TxErrorToJSONTyped, +} from './TxError'; + +/** + * + * @export + * @interface TransactionListAllOfTransactions + */ +export interface TransactionListAllOfTransactions { + /** + * The block height at which this transaction was executed. + * @type {number} + * @memberof TransactionListAllOfTransactions + */ + block: number; + /** + * 0-based index of this transaction in its block + * @type {number} + * @memberof TransactionListAllOfTransactions + */ + index: number; + /** + * The second-granular consensus time of this tx's block, i.e. roughly when the + * [block was proposed](https://github.com/tendermint/tendermint/blob/v0.34.x/spec/core/data_structures.md#header). + * + * @type {Date} + * @memberof TransactionListAllOfTransactions + */ + timestamp: Date; + /** + * The cryptographic hash of this transaction's encoding. + * @type {string} + * @memberof TransactionListAllOfTransactions + */ + hash: string; + /** + * The address of who sent this transaction. + * @type {string} + * @memberof TransactionListAllOfTransactions + */ + sender: string; + /** + * The nonce used with this transaction, to prevent replay. + * @type {number} + * @memberof TransactionListAllOfTransactions + */ + nonce: number; + /** + * The fee that this transaction's sender committed + * to pay to execute it. + * + * @type {string} + * @memberof TransactionListAllOfTransactions + */ + fee: string; + /** + * The maximum gas that a transaction can use. + * + * @type {string} + * @memberof TransactionListAllOfTransactions + */ + gas_limit: string; + /** + * The method that was called. + * @type {ConsensusTxMethod} + * @memberof TransactionListAllOfTransactions + */ + method: ConsensusTxMethod; + /** + * The method call body. This spec does not encode the many possible types; instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go) of oasis-core. This object will conform to one of the types passed to variable instantiations using `NewMethodName` two levels down the hierarchy, e.g. `MethodTransfer` from `oasis-core/go/staking/api` seen [here](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go@v0.2300.10/staking/api#pkg-variables). + * @type {object} + * @memberof TransactionListAllOfTransactions + */ + body: object; + /** + * Whether this transaction successfully executed. + * @type {boolean} + * @memberof TransactionListAllOfTransactions + */ + success: boolean; + /** + * Error details of a failed transaction. + * @type {TxError} + * @memberof TransactionListAllOfTransactions + */ + error?: TxError; +} + + + +/** + * Check if a given object implements the TransactionListAllOfTransactions interface. + */ +export function instanceOfTransactionListAllOfTransactions(value: object): value is TransactionListAllOfTransactions { + if (!('block' in value) || value['block'] === undefined) return false; + if (!('index' in value) || value['index'] === undefined) return false; + if (!('timestamp' in value) || value['timestamp'] === undefined) return false; + if (!('hash' in value) || value['hash'] === undefined) return false; + if (!('sender' in value) || value['sender'] === undefined) return false; + if (!('nonce' in value) || value['nonce'] === undefined) return false; + if (!('fee' in value) || value['fee'] === undefined) return false; + if (!('gas_limit' in value) || value['gas_limit'] === undefined) return false; + if (!('method' in value) || value['method'] === undefined) return false; + if (!('body' in value) || value['body'] === undefined) return false; + if (!('success' in value) || value['success'] === undefined) return false; + return true; +} + +export function TransactionListAllOfTransactionsFromJSON(json: any): TransactionListAllOfTransactions { + return TransactionListAllOfTransactionsFromJSONTyped(json, false); +} + +export function TransactionListAllOfTransactionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): TransactionListAllOfTransactions { + if (json == null) { + return json; + } + return { + + 'block': json['block'], + 'index': json['index'], + 'timestamp': (new Date(json['timestamp'])), + 'hash': json['hash'], + 'sender': json['sender'], + 'nonce': json['nonce'], + 'fee': json['fee'], + 'gas_limit': json['gas_limit'], + 'method': ConsensusTxMethodFromJSON(json['method']), + 'body': json['body'], + 'success': json['success'], + 'error': json['error'] == null ? undefined : TxErrorFromJSON(json['error']), + }; +} + +export function TransactionListAllOfTransactionsToJSON(json: any): TransactionListAllOfTransactions { + return TransactionListAllOfTransactionsToJSONTyped(json, false); +} + +export function TransactionListAllOfTransactionsToJSONTyped(value?: TransactionListAllOfTransactions | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'block': value['block'], + 'index': value['index'], + 'timestamp': ((value['timestamp']).toISOString()), + 'hash': value['hash'], + 'sender': value['sender'], + 'nonce': value['nonce'], + 'fee': value['fee'], + 'gas_limit': value['gas_limit'], + 'method': ConsensusTxMethodToJSON(value['method']), + 'body': value['body'], + 'success': value['success'], + 'error': TxErrorToJSON(value['error']), + }; +} + diff --git a/src/vendors/nexus/models/TxError.ts b/src/vendors/nexus/models/TxError.ts index 848e584a07..af592377f7 100644 --- a/src/vendors/nexus/models/TxError.ts +++ b/src/vendors/nexus/models/TxError.ts @@ -12,13 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { EvmAbiParam } from './EvmAbiParam'; import { - EvmAbiParam, EvmAbiParamFromJSON, EvmAbiParamFromJSONTyped, EvmAbiParamToJSON, -} from './'; + EvmAbiParamToJSONTyped, +} from './EvmAbiParam'; /** * @@ -49,6 +50,7 @@ export interface TxError { * will be true: * - `module` will be "evm" and `code` will be 8; see [here](https://github.com/oasisprotocol/oasis-sdk/blob/runtime-sdk/v0.8.3/runtime-sdk/modules/evm/src/lib.rs#L128) for other possible errors in the `evm` module. * - `message` will contain the best-effort human-readable revert reason. + * * @type {string} * @memberof TxError */ @@ -60,43 +62,53 @@ export interface TxError { * If this field is present, `message` will include the name of the error, e.g. 'InsufficentBalance'. * Note that users should be cautious when evaluating error data since the * data origin is not tracked and error information can be faked. + * * @type {Array} * @memberof TxError */ revert_params?: Array; } +/** + * Check if a given object implements the TxError interface. + */ +export function instanceOfTxError(value: object): value is TxError { + if (!('code' in value) || value['code'] === undefined) return false; + return true; +} + export function TxErrorFromJSON(json: any): TxError { return TxErrorFromJSONTyped(json, false); } export function TxErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): TxError { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'module': !exists(json, 'module') ? undefined : json['module'], + 'module': json['module'] == null ? undefined : json['module'], 'code': json['code'], - 'message': !exists(json, 'message') ? undefined : json['message'], - 'revert_params': !exists(json, 'revert_params') ? undefined : ((json['revert_params'] as Array).map(EvmAbiParamFromJSON)), + 'message': json['message'] == null ? undefined : json['message'], + 'revert_params': json['revert_params'] == null ? undefined : ((json['revert_params'] as Array).map(EvmAbiParamFromJSON)), }; } -export function TxErrorToJSON(value?: TxError | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function TxErrorToJSON(json: any): TxError { + return TxErrorToJSONTyped(json, false); +} + +export function TxErrorToJSONTyped(value?: TxError | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'module': value.module, - 'code': value.code, - 'message': value.message, - 'revert_params': value.revert_params === undefined ? undefined : ((value.revert_params as Array).map(EvmAbiParamToJSON)), + 'module': value['module'], + 'code': value['code'], + 'message': value['message'], + 'revert_params': value['revert_params'] == null ? undefined : ((value['revert_params'] as Array).map(EvmAbiParamToJSON)), }; } - diff --git a/src/vendors/nexus/models/TxVolume.ts b/src/vendors/nexus/models/TxVolume.ts index cfce8abeba..2cbeb7943f 100644 --- a/src/vendors/nexus/models/TxVolume.ts +++ b/src/vendors/nexus/models/TxVolume.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -33,12 +33,21 @@ export interface TxVolume { tx_volume: number; } +/** + * Check if a given object implements the TxVolume interface. + */ +export function instanceOfTxVolume(value: object): value is TxVolume { + if (!('window_end' in value) || value['window_end'] === undefined) return false; + if (!('tx_volume' in value) || value['tx_volume'] === undefined) return false; + return true; +} + export function TxVolumeFromJSON(json: any): TxVolume { return TxVolumeFromJSONTyped(json, false); } export function TxVolumeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TxVolume { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -48,18 +57,19 @@ export function TxVolumeFromJSONTyped(json: any, ignoreDiscriminator: boolean): }; } -export function TxVolumeToJSON(value?: TxVolume | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function TxVolumeToJSON(json: any): TxVolume { + return TxVolumeToJSONTyped(json, false); +} + +export function TxVolumeToJSONTyped(value?: TxVolume | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'window_end': (value.window_end.toISOString()), - 'tx_volume': value.tx_volume, + 'window_end': ((value['window_end']).toISOString()), + 'tx_volume': value['tx_volume'], }; } - diff --git a/src/vendors/nexus/models/TxVolumeList.ts b/src/vendors/nexus/models/TxVolumeList.ts index eb15e86ce2..ebd0f3ddab 100644 --- a/src/vendors/nexus/models/TxVolumeList.ts +++ b/src/vendors/nexus/models/TxVolumeList.ts @@ -12,16 +12,18 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { TxVolume } from './TxVolume'; import { - TxVolume, TxVolumeFromJSON, TxVolumeFromJSONTyped, TxVolumeToJSON, -} from './'; + TxVolumeToJSONTyped, +} from './TxVolume'; /** * A list of daily transaction volumes. + * * @export * @interface TxVolumeList */ @@ -40,12 +42,21 @@ export interface TxVolumeList { windows: Array; } +/** + * Check if a given object implements the TxVolumeList interface. + */ +export function instanceOfTxVolumeList(value: object): value is TxVolumeList { + if (!('window_size_seconds' in value) || value['window_size_seconds'] === undefined) return false; + if (!('windows' in value) || value['windows'] === undefined) return false; + return true; +} + export function TxVolumeListFromJSON(json: any): TxVolumeList { return TxVolumeListFromJSONTyped(json, false); } export function TxVolumeListFromJSONTyped(json: any, ignoreDiscriminator: boolean): TxVolumeList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -55,18 +66,19 @@ export function TxVolumeListFromJSONTyped(json: any, ignoreDiscriminator: boolea }; } -export function TxVolumeListToJSON(value?: TxVolumeList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function TxVolumeListToJSON(json: any): TxVolumeList { + return TxVolumeListToJSONTyped(json, false); +} + +export function TxVolumeListToJSONTyped(value?: TxVolumeList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'window_size_seconds': value.window_size_seconds, - 'windows': ((value.windows as Array).map(TxVolumeToJSON)), + 'window_size_seconds': value['window_size_seconds'], + 'windows': ((value['windows'] as Array).map(TxVolumeToJSON)), }; } - diff --git a/src/vendors/nexus/models/Validator.ts b/src/vendors/nexus/models/Validator.ts index 8e5e566979..096578c4ed 100644 --- a/src/vendors/nexus/models/Validator.ts +++ b/src/vendors/nexus/models/Validator.ts @@ -12,24 +12,32 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { Escrow } from './Escrow'; import { - Escrow, EscrowFromJSON, EscrowFromJSONTyped, EscrowToJSON, - ValidatorCommissionBound, - ValidatorCommissionBoundFromJSON, - ValidatorCommissionBoundFromJSONTyped, - ValidatorCommissionBoundToJSON, - ValidatorMedia, + EscrowToJSONTyped, +} from './Escrow'; +import type { ValidatorMedia } from './ValidatorMedia'; +import { ValidatorMediaFromJSON, ValidatorMediaFromJSONTyped, ValidatorMediaToJSON, -} from './'; + ValidatorMediaToJSONTyped, +} from './ValidatorMedia'; +import type { ValidatorCommissionBound } from './ValidatorCommissionBound'; +import { + ValidatorCommissionBoundFromJSON, + ValidatorCommissionBoundFromJSONTyped, + ValidatorCommissionBoundToJSON, + ValidatorCommissionBoundToJSONTyped, +} from './ValidatorCommissionBound'; /** * An validator registered at the consensus layer. + * * @export * @interface Validator */ @@ -114,55 +122,73 @@ export interface Validator { current_commission_bound: ValidatorCommissionBound; } +/** + * Check if a given object implements the Validator interface. + */ +export function instanceOfValidator(value: object): value is Validator { + if (!('entity_address' in value) || value['entity_address'] === undefined) return false; + if (!('entity_id' in value) || value['entity_id'] === undefined) return false; + if (!('escrow' in value) || value['escrow'] === undefined) return false; + if (!('voting_power' in value) || value['voting_power'] === undefined) return false; + if (!('active' in value) || value['active'] === undefined) return false; + if (!('start_date' in value) || value['start_date'] === undefined) return false; + if (!('rank' in value) || value['rank'] === undefined) return false; + if (!('in_validator_set' in value) || value['in_validator_set'] === undefined) return false; + if (!('current_rate' in value) || value['current_rate'] === undefined) return false; + if (!('current_commission_bound' in value) || value['current_commission_bound'] === undefined) return false; + return true; +} + export function ValidatorFromJSON(json: any): Validator { return ValidatorFromJSONTyped(json, false); } export function ValidatorFromJSONTyped(json: any, ignoreDiscriminator: boolean): Validator { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'entity_address': json['entity_address'], 'entity_id': json['entity_id'], - 'node_id': !exists(json, 'node_id') ? undefined : json['node_id'], + 'node_id': json['node_id'] == null ? undefined : json['node_id'], 'escrow': EscrowFromJSON(json['escrow']), 'voting_power': json['voting_power'], - 'voting_power_cumulative': !exists(json, 'voting_power_cumulative') ? undefined : json['voting_power_cumulative'], + 'voting_power_cumulative': json['voting_power_cumulative'] == null ? undefined : json['voting_power_cumulative'], 'active': json['active'], 'start_date': (new Date(json['start_date'])), 'rank': json['rank'], 'in_validator_set': json['in_validator_set'], - 'media': !exists(json, 'media') ? undefined : ValidatorMediaFromJSON(json['media']), + 'media': json['media'] == null ? undefined : ValidatorMediaFromJSON(json['media']), 'current_rate': json['current_rate'], 'current_commission_bound': ValidatorCommissionBoundFromJSON(json['current_commission_bound']), }; } -export function ValidatorToJSON(value?: Validator | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorToJSON(json: any): Validator { + return ValidatorToJSONTyped(json, false); +} + +export function ValidatorToJSONTyped(value?: Validator | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'entity_address': value.entity_address, - 'entity_id': value.entity_id, - 'node_id': value.node_id, - 'escrow': EscrowToJSON(value.escrow), - 'voting_power': value.voting_power, - 'voting_power_cumulative': value.voting_power_cumulative, - 'active': value.active, - 'start_date': (value.start_date.toISOString()), - 'rank': value.rank, - 'in_validator_set': value.in_validator_set, - 'media': ValidatorMediaToJSON(value.media), - 'current_rate': value.current_rate, - 'current_commission_bound': ValidatorCommissionBoundToJSON(value.current_commission_bound), + 'entity_address': value['entity_address'], + 'entity_id': value['entity_id'], + 'node_id': value['node_id'], + 'escrow': EscrowToJSON(value['escrow']), + 'voting_power': value['voting_power'], + 'voting_power_cumulative': value['voting_power_cumulative'], + 'active': value['active'], + 'start_date': ((value['start_date']).toISOString()), + 'rank': value['rank'], + 'in_validator_set': value['in_validator_set'], + 'media': ValidatorMediaToJSON(value['media']), + 'current_rate': value['current_rate'], + 'current_commission_bound': ValidatorCommissionBoundToJSON(value['current_commission_bound']), }; } - diff --git a/src/vendors/nexus/models/ValidatorAggStats.ts b/src/vendors/nexus/models/ValidatorAggStats.ts index f5921cfa86..68b07bc7e9 100644 --- a/src/vendors/nexus/models/ValidatorAggStats.ts +++ b/src/vendors/nexus/models/ValidatorAggStats.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -39,12 +39,22 @@ export interface ValidatorAggStats { total_staked_balance: string; } +/** + * Check if a given object implements the ValidatorAggStats interface. + */ +export function instanceOfValidatorAggStats(value: object): value is ValidatorAggStats { + if (!('total_voting_power' in value) || value['total_voting_power'] === undefined) return false; + if (!('total_delegators' in value) || value['total_delegators'] === undefined) return false; + if (!('total_staked_balance' in value) || value['total_staked_balance'] === undefined) return false; + return true; +} + export function ValidatorAggStatsFromJSON(json: any): ValidatorAggStats { return ValidatorAggStatsFromJSONTyped(json, false); } export function ValidatorAggStatsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorAggStats { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -55,19 +65,20 @@ export function ValidatorAggStatsFromJSONTyped(json: any, ignoreDiscriminator: b }; } -export function ValidatorAggStatsToJSON(value?: ValidatorAggStats | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorAggStatsToJSON(json: any): ValidatorAggStats { + return ValidatorAggStatsToJSONTyped(json, false); +} + +export function ValidatorAggStatsToJSONTyped(value?: ValidatorAggStats | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_voting_power': value.total_voting_power, - 'total_delegators': value.total_delegators, - 'total_staked_balance': value.total_staked_balance, + 'total_voting_power': value['total_voting_power'], + 'total_delegators': value['total_delegators'], + 'total_staked_balance': value['total_staked_balance'], }; } - diff --git a/src/vendors/nexus/models/ValidatorCommissionBound.ts b/src/vendors/nexus/models/ValidatorCommissionBound.ts index 47b09be5e8..d9df9ca4cc 100644 --- a/src/vendors/nexus/models/ValidatorCommissionBound.ts +++ b/src/vendors/nexus/models/ValidatorCommissionBound.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -45,12 +45,23 @@ export interface ValidatorCommissionBound { epoch_end: number; } +/** + * Check if a given object implements the ValidatorCommissionBound interface. + */ +export function instanceOfValidatorCommissionBound(value: object): value is ValidatorCommissionBound { + if (!('lower' in value) || value['lower'] === undefined) return false; + if (!('upper' in value) || value['upper'] === undefined) return false; + if (!('epoch_start' in value) || value['epoch_start'] === undefined) return false; + if (!('epoch_end' in value) || value['epoch_end'] === undefined) return false; + return true; +} + export function ValidatorCommissionBoundFromJSON(json: any): ValidatorCommissionBound { return ValidatorCommissionBoundFromJSONTyped(json, false); } export function ValidatorCommissionBoundFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorCommissionBound { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -62,20 +73,21 @@ export function ValidatorCommissionBoundFromJSONTyped(json: any, ignoreDiscrimin }; } -export function ValidatorCommissionBoundToJSON(value?: ValidatorCommissionBound | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorCommissionBoundToJSON(json: any): ValidatorCommissionBound { + return ValidatorCommissionBoundToJSONTyped(json, false); +} + +export function ValidatorCommissionBoundToJSONTyped(value?: ValidatorCommissionBound | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'lower': value.lower, - 'upper': value.upper, - 'epoch_start': value.epoch_start, - 'epoch_end': value.epoch_end, + 'lower': value['lower'], + 'upper': value['upper'], + 'epoch_start': value['epoch_start'], + 'epoch_end': value['epoch_end'], }; } - diff --git a/src/vendors/nexus/models/ValidatorHistory.ts b/src/vendors/nexus/models/ValidatorHistory.ts index 37b653cc81..569eb9ae3c 100644 --- a/src/vendors/nexus/models/ValidatorHistory.ts +++ b/src/vendors/nexus/models/ValidatorHistory.ts @@ -12,21 +12,14 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ValidatorHistoryAllOfHistory } from './ValidatorHistoryAllOfHistory'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - ValidatorHistoryAllOf, - ValidatorHistoryAllOfFromJSON, - ValidatorHistoryAllOfFromJSONTyped, - ValidatorHistoryAllOfToJSON, - ValidatorHistoryPoint, - ValidatorHistoryPointFromJSON, - ValidatorHistoryPointFromJSONTyped, - ValidatorHistoryPointToJSON, -} from './'; + ValidatorHistoryAllOfHistoryFromJSON, + ValidatorHistoryAllOfHistoryFromJSONTyped, + ValidatorHistoryAllOfHistoryToJSON, + ValidatorHistoryAllOfHistoryToJSONTyped, +} from './ValidatorHistoryAllOfHistory'; /** * @@ -37,6 +30,7 @@ export interface ValidatorHistory { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof ValidatorHistory */ @@ -55,10 +49,20 @@ export interface ValidatorHistory { address?: string; /** * - * @type {Array} + * @type {Array} * @memberof ValidatorHistory */ - history: Array; + history: Array; +} + +/** + * Check if a given object implements the ValidatorHistory interface. + */ +export function instanceOfValidatorHistory(value: object): value is ValidatorHistory { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('history' in value) || value['history'] === undefined) return false; + return true; } export function ValidatorHistoryFromJSON(json: any): ValidatorHistory { @@ -66,32 +70,33 @@ export function ValidatorHistoryFromJSON(json: any): ValidatorHistory { } export function ValidatorHistoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorHistory { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'address': !exists(json, 'address') ? undefined : json['address'], - 'history': ((json['history'] as Array).map(ValidatorHistoryPointFromJSON)), + 'address': json['address'] == null ? undefined : json['address'], + 'history': ((json['history'] as Array).map(ValidatorHistoryAllOfHistoryFromJSON)), }; } -export function ValidatorHistoryToJSON(value?: ValidatorHistory | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorHistoryToJSON(json: any): ValidatorHistory { + return ValidatorHistoryToJSONTyped(json, false); +} + +export function ValidatorHistoryToJSONTyped(value?: ValidatorHistory | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'address': value.address, - 'history': ((value.history as Array).map(ValidatorHistoryPointToJSON)), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'address': value['address'], + 'history': ((value['history'] as Array).map(ValidatorHistoryAllOfHistoryToJSON)), }; } - diff --git a/src/vendors/nexus/models/ValidatorHistoryAllOfHistory.ts b/src/vendors/nexus/models/ValidatorHistoryAllOfHistory.ts new file mode 100644 index 0000000000..f8002924a5 --- /dev/null +++ b/src/vendors/nexus/models/ValidatorHistoryAllOfHistory.ts @@ -0,0 +1,116 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface ValidatorHistoryAllOfHistory + */ +export interface ValidatorHistoryAllOfHistory { + /** + * The epoch number. + * @type {number} + * @memberof ValidatorHistoryAllOfHistory + */ + epoch: number; + /** + * The amount of tokens that were delegated to this validator account, + * at the start of this epoch, and are NOT in the process of debonding. + * + * @type {string} + * @memberof ValidatorHistoryAllOfHistory + */ + active_balance?: string; + /** + * The shares of tokens that were delegated to this validator account, + * at the start of this epoch, and are NOT in the process of debonding. + * + * @type {string} + * @memberof ValidatorHistoryAllOfHistory + */ + active_shares?: string; + /** + * The amount of tokens that were delegated to this validator account + * at the start of this epoch, but are also in the process of debonding + * (i.e. they will be unstaked within ~2 weeks). + * + * @type {string} + * @memberof ValidatorHistoryAllOfHistory + */ + debonding_balance?: string; + /** + * The shares of tokens that were delegated to this validator account + * at the start of this epoch, but are also in the process of debonding + * (i.e. they will be unstaked within ~2 weeks). + * + * @type {string} + * @memberof ValidatorHistoryAllOfHistory + */ + debonding_shares?: string; + /** + * The number of accounts that have delegated token to this account. + * @type {number} + * @memberof ValidatorHistoryAllOfHistory + */ + num_delegators?: number; +} + +/** + * Check if a given object implements the ValidatorHistoryAllOfHistory interface. + */ +export function instanceOfValidatorHistoryAllOfHistory(value: object): value is ValidatorHistoryAllOfHistory { + if (!('epoch' in value) || value['epoch'] === undefined) return false; + return true; +} + +export function ValidatorHistoryAllOfHistoryFromJSON(json: any): ValidatorHistoryAllOfHistory { + return ValidatorHistoryAllOfHistoryFromJSONTyped(json, false); +} + +export function ValidatorHistoryAllOfHistoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorHistoryAllOfHistory { + if (json == null) { + return json; + } + return { + + 'epoch': json['epoch'], + 'active_balance': json['active_balance'] == null ? undefined : json['active_balance'], + 'active_shares': json['active_shares'] == null ? undefined : json['active_shares'], + 'debonding_balance': json['debonding_balance'] == null ? undefined : json['debonding_balance'], + 'debonding_shares': json['debonding_shares'] == null ? undefined : json['debonding_shares'], + 'num_delegators': json['num_delegators'] == null ? undefined : json['num_delegators'], + }; +} + +export function ValidatorHistoryAllOfHistoryToJSON(json: any): ValidatorHistoryAllOfHistory { + return ValidatorHistoryAllOfHistoryToJSONTyped(json, false); +} + +export function ValidatorHistoryAllOfHistoryToJSONTyped(value?: ValidatorHistoryAllOfHistory | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'epoch': value['epoch'], + 'active_balance': value['active_balance'], + 'active_shares': value['active_shares'], + 'debonding_balance': value['debonding_balance'], + 'debonding_shares': value['debonding_shares'], + 'num_delegators': value['num_delegators'], + }; +} + diff --git a/src/vendors/nexus/models/ValidatorHistoryPoint.ts b/src/vendors/nexus/models/ValidatorHistoryPoint.ts index 68a40f1df9..528dcab0a8 100644 --- a/src/vendors/nexus/models/ValidatorHistoryPoint.ts +++ b/src/vendors/nexus/models/ValidatorHistoryPoint.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -28,6 +28,7 @@ export interface ValidatorHistoryPoint { /** * The amount of tokens that were delegated to this validator account, * at the start of this epoch, and are NOT in the process of debonding. + * * @type {string} * @memberof ValidatorHistoryPoint */ @@ -35,6 +36,7 @@ export interface ValidatorHistoryPoint { /** * The shares of tokens that were delegated to this validator account, * at the start of this epoch, and are NOT in the process of debonding. + * * @type {string} * @memberof ValidatorHistoryPoint */ @@ -43,6 +45,7 @@ export interface ValidatorHistoryPoint { * The amount of tokens that were delegated to this validator account * at the start of this epoch, but are also in the process of debonding * (i.e. they will be unstaked within ~2 weeks). + * * @type {string} * @memberof ValidatorHistoryPoint */ @@ -51,6 +54,7 @@ export interface ValidatorHistoryPoint { * The shares of tokens that were delegated to this validator account * at the start of this epoch, but are also in the process of debonding * (i.e. they will be unstaked within ~2 weeks). + * * @type {string} * @memberof ValidatorHistoryPoint */ @@ -63,41 +67,50 @@ export interface ValidatorHistoryPoint { num_delegators?: number; } +/** + * Check if a given object implements the ValidatorHistoryPoint interface. + */ +export function instanceOfValidatorHistoryPoint(value: object): value is ValidatorHistoryPoint { + if (!('epoch' in value) || value['epoch'] === undefined) return false; + return true; +} + export function ValidatorHistoryPointFromJSON(json: any): ValidatorHistoryPoint { return ValidatorHistoryPointFromJSONTyped(json, false); } export function ValidatorHistoryPointFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorHistoryPoint { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'epoch': json['epoch'], - 'active_balance': !exists(json, 'active_balance') ? undefined : json['active_balance'], - 'active_shares': !exists(json, 'active_shares') ? undefined : json['active_shares'], - 'debonding_balance': !exists(json, 'debonding_balance') ? undefined : json['debonding_balance'], - 'debonding_shares': !exists(json, 'debonding_shares') ? undefined : json['debonding_shares'], - 'num_delegators': !exists(json, 'num_delegators') ? undefined : json['num_delegators'], + 'active_balance': json['active_balance'] == null ? undefined : json['active_balance'], + 'active_shares': json['active_shares'] == null ? undefined : json['active_shares'], + 'debonding_balance': json['debonding_balance'] == null ? undefined : json['debonding_balance'], + 'debonding_shares': json['debonding_shares'] == null ? undefined : json['debonding_shares'], + 'num_delegators': json['num_delegators'] == null ? undefined : json['num_delegators'], }; } -export function ValidatorHistoryPointToJSON(value?: ValidatorHistoryPoint | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorHistoryPointToJSON(json: any): ValidatorHistoryPoint { + return ValidatorHistoryPointToJSONTyped(json, false); +} + +export function ValidatorHistoryPointToJSONTyped(value?: ValidatorHistoryPoint | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'epoch': value.epoch, - 'active_balance': value.active_balance, - 'active_shares': value.active_shares, - 'debonding_balance': value.debonding_balance, - 'debonding_shares': value.debonding_shares, - 'num_delegators': value.num_delegators, + 'epoch': value['epoch'], + 'active_balance': value['active_balance'], + 'active_shares': value['active_shares'], + 'debonding_balance': value['debonding_balance'], + 'debonding_shares': value['debonding_shares'], + 'num_delegators': value['num_delegators'], }; } - diff --git a/src/vendors/nexus/models/ValidatorList.ts b/src/vendors/nexus/models/ValidatorList.ts index 4151571d9f..c4071278e8 100644 --- a/src/vendors/nexus/models/ValidatorList.ts +++ b/src/vendors/nexus/models/ValidatorList.ts @@ -12,25 +12,21 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ValidatorListAllOfValidators } from './ValidatorListAllOfValidators'; +import { + ValidatorListAllOfValidatorsFromJSON, + ValidatorListAllOfValidatorsFromJSONTyped, + ValidatorListAllOfValidatorsToJSON, + ValidatorListAllOfValidatorsToJSONTyped, +} from './ValidatorListAllOfValidators'; +import type { ValidatorAggStats } from './ValidatorAggStats'; import { - List, - ListFromJSON, - ListFromJSONTyped, - ListToJSON, - Validator, - ValidatorFromJSON, - ValidatorFromJSONTyped, - ValidatorToJSON, - ValidatorAggStats, ValidatorAggStatsFromJSON, ValidatorAggStatsFromJSONTyped, ValidatorAggStatsToJSON, - ValidatorListAllOf, - ValidatorListAllOfFromJSON, - ValidatorListAllOfFromJSONTyped, - ValidatorListAllOfToJSON, -} from './'; + ValidatorAggStatsToJSONTyped, +} from './ValidatorAggStats'; /** * @@ -41,6 +37,7 @@ export interface ValidatorList { /** * The total number of records that match the query, i.e. the number of records * the query would return with limit=infinity. + * * @type {number} * @memberof ValidatorList */ @@ -53,10 +50,10 @@ export interface ValidatorList { is_total_count_clipped: boolean; /** * - * @type {Array} + * @type {Array} * @memberof ValidatorList */ - validators: Array; + validators: Array; /** * Summary statistics across all consensus validators. * @type {ValidatorAggStats} @@ -65,37 +62,49 @@ export interface ValidatorList { stats: ValidatorAggStats; } +/** + * Check if a given object implements the ValidatorList interface. + */ +export function instanceOfValidatorList(value: object): value is ValidatorList { + if (!('total_count' in value) || value['total_count'] === undefined) return false; + if (!('is_total_count_clipped' in value) || value['is_total_count_clipped'] === undefined) return false; + if (!('validators' in value) || value['validators'] === undefined) return false; + if (!('stats' in value) || value['stats'] === undefined) return false; + return true; +} + export function ValidatorListFromJSON(json: any): ValidatorList { return ValidatorListFromJSONTyped(json, false); } export function ValidatorListFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorList { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { 'total_count': json['total_count'], 'is_total_count_clipped': json['is_total_count_clipped'], - 'validators': ((json['validators'] as Array).map(ValidatorFromJSON)), + 'validators': ((json['validators'] as Array).map(ValidatorListAllOfValidatorsFromJSON)), 'stats': ValidatorAggStatsFromJSON(json['stats']), }; } -export function ValidatorListToJSON(value?: ValidatorList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorListToJSON(json: any): ValidatorList { + return ValidatorListToJSONTyped(json, false); +} + +export function ValidatorListToJSONTyped(value?: ValidatorList | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'total_count': value.total_count, - 'is_total_count_clipped': value.is_total_count_clipped, - 'validators': ((value.validators as Array).map(ValidatorToJSON)), - 'stats': ValidatorAggStatsToJSON(value.stats), + 'total_count': value['total_count'], + 'is_total_count_clipped': value['is_total_count_clipped'], + 'validators': ((value['validators'] as Array).map(ValidatorListAllOfValidatorsToJSON)), + 'stats': ValidatorAggStatsToJSON(value['stats']), }; } - diff --git a/src/vendors/nexus/models/ValidatorListAllOfValidators.ts b/src/vendors/nexus/models/ValidatorListAllOfValidators.ts new file mode 100644 index 0000000000..e0ec5299aa --- /dev/null +++ b/src/vendors/nexus/models/ValidatorListAllOfValidators.ts @@ -0,0 +1,193 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Oasis Nexus API V1 + * An API for accessing indexed data from the Oasis Network. # Endpoints + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Escrow } from './Escrow'; +import { + EscrowFromJSON, + EscrowFromJSONTyped, + EscrowToJSON, + EscrowToJSONTyped, +} from './Escrow'; +import type { ValidatorMedia } from './ValidatorMedia'; +import { + ValidatorMediaFromJSON, + ValidatorMediaFromJSONTyped, + ValidatorMediaToJSON, + ValidatorMediaToJSONTyped, +} from './ValidatorMedia'; +import type { ValidatorCommissionBound } from './ValidatorCommissionBound'; +import { + ValidatorCommissionBoundFromJSON, + ValidatorCommissionBoundFromJSONTyped, + ValidatorCommissionBoundToJSON, + ValidatorCommissionBoundToJSONTyped, +} from './ValidatorCommissionBound'; + +/** + * + * @export + * @interface ValidatorListAllOfValidators + */ +export interface ValidatorListAllOfValidators { + /** + * The staking address identifying this validator. + * @type {string} + * @memberof ValidatorListAllOfValidators + */ + entity_address: string; + /** + * The public key identifying this validator. + * @type {string} + * @memberof ValidatorListAllOfValidators + */ + entity_id: string; + /** + * The public key identifying this validator's node. + * @type {string} + * @memberof ValidatorListAllOfValidators + */ + node_id?: string; + /** + * The escrow account data for this validator. + * @type {Escrow} + * @memberof ValidatorListAllOfValidators + */ + escrow: Escrow; + /** + * The voting power of this validator. + * @type {number} + * @memberof ValidatorListAllOfValidators + */ + voting_power: number; + /** + * The cumulative voting power of this validator and all other validators ranked higher than itself. + * @type {number} + * @memberof ValidatorListAllOfValidators + */ + voting_power_cumulative?: number; + /** + * Whether the entity has a node that is registered for being a validator, node is up to date, and has successfully registered itself. It may or may not be part of validator set. + * @type {boolean} + * @memberof ValidatorListAllOfValidators + */ + active: boolean; + /** + * The second-granular consensus time. + * @type {Date} + * @memberof ValidatorListAllOfValidators + */ + start_date: Date; + /** + * The rank of the validator, determined by voting power. + * @type {number} + * @memberof ValidatorListAllOfValidators + */ + rank: number; + /** + * Whether the entity is part of the validator set (top by stake among active entities). + * @type {boolean} + * @memberof ValidatorListAllOfValidators + */ + in_validator_set: boolean; + /** + * + * @type {ValidatorMedia} + * @memberof ValidatorListAllOfValidators + */ + media?: ValidatorMedia; + /** + * Commission rate. + * @type {number} + * @memberof ValidatorListAllOfValidators + */ + current_rate: number; + /** + * + * @type {ValidatorCommissionBound} + * @memberof ValidatorListAllOfValidators + */ + current_commission_bound: ValidatorCommissionBound; +} + +/** + * Check if a given object implements the ValidatorListAllOfValidators interface. + */ +export function instanceOfValidatorListAllOfValidators(value: object): value is ValidatorListAllOfValidators { + if (!('entity_address' in value) || value['entity_address'] === undefined) return false; + if (!('entity_id' in value) || value['entity_id'] === undefined) return false; + if (!('escrow' in value) || value['escrow'] === undefined) return false; + if (!('voting_power' in value) || value['voting_power'] === undefined) return false; + if (!('active' in value) || value['active'] === undefined) return false; + if (!('start_date' in value) || value['start_date'] === undefined) return false; + if (!('rank' in value) || value['rank'] === undefined) return false; + if (!('in_validator_set' in value) || value['in_validator_set'] === undefined) return false; + if (!('current_rate' in value) || value['current_rate'] === undefined) return false; + if (!('current_commission_bound' in value) || value['current_commission_bound'] === undefined) return false; + return true; +} + +export function ValidatorListAllOfValidatorsFromJSON(json: any): ValidatorListAllOfValidators { + return ValidatorListAllOfValidatorsFromJSONTyped(json, false); +} + +export function ValidatorListAllOfValidatorsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorListAllOfValidators { + if (json == null) { + return json; + } + return { + + 'entity_address': json['entity_address'], + 'entity_id': json['entity_id'], + 'node_id': json['node_id'] == null ? undefined : json['node_id'], + 'escrow': EscrowFromJSON(json['escrow']), + 'voting_power': json['voting_power'], + 'voting_power_cumulative': json['voting_power_cumulative'] == null ? undefined : json['voting_power_cumulative'], + 'active': json['active'], + 'start_date': (new Date(json['start_date'])), + 'rank': json['rank'], + 'in_validator_set': json['in_validator_set'], + 'media': json['media'] == null ? undefined : ValidatorMediaFromJSON(json['media']), + 'current_rate': json['current_rate'], + 'current_commission_bound': ValidatorCommissionBoundFromJSON(json['current_commission_bound']), + }; +} + +export function ValidatorListAllOfValidatorsToJSON(json: any): ValidatorListAllOfValidators { + return ValidatorListAllOfValidatorsToJSONTyped(json, false); +} + +export function ValidatorListAllOfValidatorsToJSONTyped(value?: ValidatorListAllOfValidators | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'entity_address': value['entity_address'], + 'entity_id': value['entity_id'], + 'node_id': value['node_id'], + 'escrow': EscrowToJSON(value['escrow']), + 'voting_power': value['voting_power'], + 'voting_power_cumulative': value['voting_power_cumulative'], + 'active': value['active'], + 'start_date': ((value['start_date']).toISOString()), + 'rank': value['rank'], + 'in_validator_set': value['in_validator_set'], + 'media': ValidatorMediaToJSON(value['media']), + 'current_rate': value['current_rate'], + 'current_commission_bound': ValidatorCommissionBoundToJSON(value['current_commission_bound']), + }; +} + diff --git a/src/vendors/nexus/models/ValidatorMedia.ts b/src/vendors/nexus/models/ValidatorMedia.ts index ff20df6b8d..8089775dea 100644 --- a/src/vendors/nexus/models/ValidatorMedia.ts +++ b/src/vendors/nexus/models/ValidatorMedia.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; /** * * @export @@ -57,41 +57,49 @@ export interface ValidatorMedia { logoUrl?: string; } +/** + * Check if a given object implements the ValidatorMedia interface. + */ +export function instanceOfValidatorMedia(value: object): value is ValidatorMedia { + return true; +} + export function ValidatorMediaFromJSON(json: any): ValidatorMedia { return ValidatorMediaFromJSONTyped(json, false); } export function ValidatorMediaFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorMedia { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { - 'url': !exists(json, 'url') ? undefined : json['url'], - 'email': !exists(json, 'email') ? undefined : json['email'], - 'twitter': !exists(json, 'twitter') ? undefined : json['twitter'], - 'keybase': !exists(json, 'keybase') ? undefined : json['keybase'], - 'name': !exists(json, 'name') ? undefined : json['name'], - 'logoUrl': !exists(json, 'logoUrl') ? undefined : json['logoUrl'], + 'url': json['url'] == null ? undefined : json['url'], + 'email': json['email'] == null ? undefined : json['email'], + 'twitter': json['twitter'] == null ? undefined : json['twitter'], + 'keybase': json['keybase'] == null ? undefined : json['keybase'], + 'name': json['name'] == null ? undefined : json['name'], + 'logoUrl': json['logoUrl'] == null ? undefined : json['logoUrl'], }; } -export function ValidatorMediaToJSON(value?: ValidatorMedia | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorMediaToJSON(json: any): ValidatorMedia { + return ValidatorMediaToJSONTyped(json, false); +} + +export function ValidatorMediaToJSONTyped(value?: ValidatorMedia | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'url': value.url, - 'email': value.email, - 'twitter': value.twitter, - 'keybase': value.keybase, - 'name': value.name, - 'logoUrl': value.logoUrl, + 'url': value['url'], + 'email': value['email'], + 'twitter': value['twitter'], + 'keybase': value['keybase'], + 'name': value['name'], + 'logoUrl': value['logoUrl'], }; } - diff --git a/src/vendors/nexus/models/ValidatorsResponse.ts b/src/vendors/nexus/models/ValidatorsResponse.ts index 945b8598c8..39d4eac76e 100644 --- a/src/vendors/nexus/models/ValidatorsResponse.ts +++ b/src/vendors/nexus/models/ValidatorsResponse.ts @@ -12,17 +12,21 @@ * Do not edit the class manually. */ -import { exists, mapValues } from '../runtime'; +import { mapValues } from '../runtime'; +import type { ValidatorList } from './ValidatorList'; import { - ValidatorAggStats, - ValidatorAggStatsFromJSON, - ValidatorAggStatsFromJSONTyped, - ValidatorAggStatsToJSON, - ValidatorList, ValidatorListFromJSON, ValidatorListFromJSONTyped, ValidatorListToJSON, -} from './'; + ValidatorListToJSONTyped, +} from './ValidatorList'; +import type { ValidatorAggStats } from './ValidatorAggStats'; +import { + ValidatorAggStatsFromJSON, + ValidatorAggStatsFromJSONTyped, + ValidatorAggStatsToJSON, + ValidatorAggStatsToJSONTyped, +} from './ValidatorAggStats'; /** * @@ -44,12 +48,21 @@ export interface ValidatorsResponse { stats: ValidatorAggStats; } +/** + * Check if a given object implements the ValidatorsResponse interface. + */ +export function instanceOfValidatorsResponse(value: object): value is ValidatorsResponse { + if (!('validator_list' in value) || value['validator_list'] === undefined) return false; + if (!('stats' in value) || value['stats'] === undefined) return false; + return true; +} + export function ValidatorsResponseFromJSON(json: any): ValidatorsResponse { return ValidatorsResponseFromJSONTyped(json, false); } export function ValidatorsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidatorsResponse { - if ((json === undefined) || (json === null)) { + if (json == null) { return json; } return { @@ -59,18 +72,19 @@ export function ValidatorsResponseFromJSONTyped(json: any, ignoreDiscriminator: }; } -export function ValidatorsResponseToJSON(value?: ValidatorsResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; +export function ValidatorsResponseToJSON(json: any): ValidatorsResponse { + return ValidatorsResponseToJSONTyped(json, false); +} + +export function ValidatorsResponseToJSONTyped(value?: ValidatorsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; } + return { - 'validator_list': ValidatorListToJSON(value.validator_list), - 'stats': ValidatorAggStatsToJSON(value.stats), + 'validator_list': ValidatorListToJSON(value['validator_list']), + 'stats': ValidatorAggStatsToJSON(value['stats']), }; } - diff --git a/src/vendors/nexus/models/VerificationLevel.ts b/src/vendors/nexus/models/VerificationLevel.ts index a9778069b8..a15f86da68 100644 --- a/src/vendors/nexus/models/VerificationLevel.ts +++ b/src/vendors/nexus/models/VerificationLevel.ts @@ -12,16 +12,30 @@ * Do not edit the class manually. */ + /** * The level of verification of a smart contract, as defined by Sourcify. * An absence of this field means that the contract has not been verified. * See also https://docs.sourcify.dev/docs/full-vs-partial-match/ + * * @export - * @enum {string} */ -export enum VerificationLevel { - Partial = 'partial', - Full = 'full' +export const VerificationLevel = { + Partial: 'partial', + Full: 'full' +} as const; +export type VerificationLevel = typeof VerificationLevel[keyof typeof VerificationLevel]; + + +export function instanceOfVerificationLevel(value: any): boolean { + for (const key in VerificationLevel) { + if (Object.prototype.hasOwnProperty.call(VerificationLevel, key)) { + if (VerificationLevel[key as keyof typeof VerificationLevel] === value) { + return true; + } + } + } + return false; } export function VerificationLevelFromJSON(json: any): VerificationLevel { @@ -36,3 +50,7 @@ export function VerificationLevelToJSON(value?: VerificationLevel | null): any { return value as any; } +export function VerificationLevelToJSONTyped(value: any, ignoreDiscriminator: boolean): VerificationLevel { + return value as VerificationLevel; +} + diff --git a/src/vendors/nexus/models/index.ts b/src/vendors/nexus/models/index.ts index b9709f7080..bde5fcd066 100644 --- a/src/vendors/nexus/models/index.ts +++ b/src/vendors/nexus/models/index.ts @@ -1,96 +1,98 @@ -export * from './Account' -export * from './AccountList' -export * from './AccountListAllOf' -export * from './AccountStats' -export * from './ActiveAccounts' -export * from './ActiveAccountsList' -export * from './AddressDerivationContext' -export * from './AddressPreimage' -export * from './Allowance' -export * from './BareTokenHolder' -export * from './Block' -export * from './BlockList' -export * from './BlockListAllOf' -export * from './ConsensusEvent' -export * from './ConsensusEventList' -export * from './ConsensusEventListAllOf' -export * from './ConsensusEventType' -export * from './ConsensusTxMethod' -export * from './DebondingDelegation' -export * from './DebondingDelegationList' -export * from './DebondingDelegationListAllOf' -export * from './Delegation' -export * from './DelegationList' -export * from './DelegationListAllOf' -export * from './Entity' -export * from './EntityList' -export * from './EntityListAllOf' -export * from './Epoch' -export * from './EpochList' -export * from './EpochListAllOf' -export * from './Escrow' -export * from './EvmAbiParam' -export * from './EvmEventToken' -export * from './EvmNft' -export * from './EvmNftList' -export * from './EvmNftListAllOf' -export * from './EvmToken' -export * from './EvmTokenList' -export * from './EvmTokenListAllOf' -export * from './EvmTokenType' -export * from './InlineResponse400' -export * from './Layer' -export * from './List' -export * from './Node' -export * from './NodeList' -export * from './NodeListAllOf' -export * from './Proposal' -export * from './ProposalList' -export * from './ProposalListAllOf' -export * from './ProposalState' -export * from './ProposalTarget' -export * from './ProposalVote' -export * from './ProposalVotes' -export * from './ProposalVotesAllOf' -export * from './RoothashMessage' -export * from './RoothashMessageList' -export * from './RoothashMessageListAllOf' -export * from './RoothashMessageType' -export * from './Runtime' -export * from './RuntimeAccount' -export * from './RuntimeBlock' -export * from './RuntimeBlockList' -export * from './RuntimeBlockListAllOf' -export * from './RuntimeEvent' -export * from './RuntimeEventList' -export * from './RuntimeEventListAllOf' -export * from './RuntimeEventType' -export * from './RuntimeEvmBalance' -export * from './RuntimeEvmContract' -export * from './RuntimeEvmContractVerification' -export * from './RuntimeSdkBalance' -export * from './RuntimeStatus' -export * from './RuntimeTransaction' -export * from './RuntimeTransactionEncryptionEnvelope' -export * from './RuntimeTransactionList' -export * from './RuntimeTransactionListAllOf' -export * from './Status' -export * from './TokenHolderList' -export * from './TokenHolderListAllOf' -export * from './Transaction' -export * from './TransactionList' -export * from './TransactionListAllOf' -export * from './TxError' -export * from './TxVolume' -export * from './TxVolumeList' -export * from './Validator' -export * from './ValidatorAggStats' -export * from './ValidatorCommissionBound' -export * from './ValidatorHistory' -export * from './ValidatorHistoryAllOf' -export * from './ValidatorHistoryPoint' -export * from './ValidatorList' -export * from './ValidatorListAllOf' -export * from './ValidatorMedia' -export * from './ValidatorsResponse' -export * from './VerificationLevel' +/* tslint:disable */ +/* eslint-disable */ +export * from './Account'; +export * from './AccountList'; +export * from './AccountListAllOfAccounts'; +export * from './AccountStats'; +export * from './ActiveAccounts'; +export * from './ActiveAccountsList'; +export * from './AddressDerivationContext'; +export * from './AddressPreimage'; +export * from './Allowance'; +export * from './BareTokenHolder'; +export * from './Block'; +export * from './BlockList'; +export * from './BlockListAllOfBlocks'; +export * from './ConsensusEvent'; +export * from './ConsensusEventList'; +export * from './ConsensusEventListAllOfEvents'; +export * from './ConsensusEventType'; +export * from './ConsensusTxMethod'; +export * from './DebondingDelegation'; +export * from './DebondingDelegationList'; +export * from './DebondingDelegationListAllOfDebondingDelegations'; +export * from './Delegation'; +export * from './DelegationList'; +export * from './DelegationListAllOfDelegations'; +export * from './Entity'; +export * from './EntityList'; +export * from './EntityListAllOfEntities'; +export * from './Epoch'; +export * from './EpochList'; +export * from './EpochListAllOfEpochs'; +export * from './Escrow'; +export * from './EvmAbiParam'; +export * from './EvmEventToken'; +export * from './EvmNft'; +export * from './EvmNftList'; +export * from './EvmNftListAllOfEvmNfts'; +export * from './EvmToken'; +export * from './EvmTokenList'; +export * from './EvmTokenListAllOfEvmTokens'; +export * from './EvmTokenType'; +export * from './GetStatus400Response'; +export * from './Layer'; +export * from './List'; +export * from './Node'; +export * from './NodeList'; +export * from './NodeListAllOfNodes'; +export * from './Proposal'; +export * from './ProposalList'; +export * from './ProposalListAllOfProposals'; +export * from './ProposalState'; +export * from './ProposalTarget'; +export * from './ProposalVote'; +export * from './ProposalVotes'; +export * from './ProposalVotesAllOfVotes'; +export * from './RoothashMessage'; +export * from './RoothashMessageList'; +export * from './RoothashMessageListAllOfRoothashMessages'; +export * from './RoothashMessageType'; +export * from './Runtime'; +export * from './RuntimeAccount'; +export * from './RuntimeBlock'; +export * from './RuntimeBlockList'; +export * from './RuntimeBlockListAllOfBlocks'; +export * from './RuntimeEvent'; +export * from './RuntimeEventList'; +export * from './RuntimeEventListAllOfEvents'; +export * from './RuntimeEventType'; +export * from './RuntimeEvmBalance'; +export * from './RuntimeEvmContract'; +export * from './RuntimeEvmContractVerification'; +export * from './RuntimeSdkBalance'; +export * from './RuntimeStatus'; +export * from './RuntimeTransaction'; +export * from './RuntimeTransactionEncryptionEnvelope'; +export * from './RuntimeTransactionList'; +export * from './RuntimeTransactionListAllOfTransactions'; +export * from './Status'; +export * from './TokenHolderList'; +export * from './TokenHolderListAllOfHolders'; +export * from './Transaction'; +export * from './TransactionList'; +export * from './TransactionListAllOfTransactions'; +export * from './TxError'; +export * from './TxVolume'; +export * from './TxVolumeList'; +export * from './Validator'; +export * from './ValidatorAggStats'; +export * from './ValidatorCommissionBound'; +export * from './ValidatorHistory'; +export * from './ValidatorHistoryAllOfHistory'; +export * from './ValidatorHistoryPoint'; +export * from './ValidatorList'; +export * from './ValidatorListAllOfValidators'; +export * from './ValidatorMedia'; +export * from './ValidatorsResponse'; +export * from './VerificationLevel'; diff --git a/src/vendors/nexus/openapitools.json b/src/vendors/nexus/openapitools.json index 86ee945ba6..25d6d30b7f 100644 --- a/src/vendors/nexus/openapitools.json +++ b/src/vendors/nexus/openapitools.json @@ -2,6 +2,6 @@ "$schema": "https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/v2.5.1/apps/generator-cli/src/config.schema.json", "spaces": 2, "generator-cli": { - "version": "5.1.0" + "version": "7.10.0" } } diff --git a/src/vendors/nexus/runtime.ts b/src/vendors/nexus/runtime.ts index 598596291b..9808dcb02f 100644 --- a/src/vendors/nexus/runtime.ts +++ b/src/vendors/nexus/runtime.ts @@ -15,16 +15,86 @@ export const BASE_PATH = "https://nexus.oasis.io/v1".replace(/\/+$/, ""); -const isBlob = (value: any) => typeof Blob !== 'undefined' && value instanceof Blob; +export interface ConfigurationParameters { + basePath?: string; // override base path + fetchApi?: FetchAPI; // override for fetch implementation + middleware?: Middleware[]; // middleware to apply before/after fetch requests + queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings + username?: string; // parameter for basic security + password?: string; // parameter for basic security + apiKey?: string | Promise | ((name: string) => string | Promise); // parameter for apiKey security + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security + headers?: HTTPHeaders; //header params we want to use on every request + credentials?: RequestCredentials; //value for the credentials param we want to use on each request +} + +export class Configuration { + constructor(private configuration: ConfigurationParameters = {}) {} + + set config(configuration: Configuration) { + this.configuration = configuration; + } + + get basePath(): string { + return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; + } + + get fetchApi(): FetchAPI | undefined { + return this.configuration.fetchApi; + } + + get middleware(): Middleware[] { + return this.configuration.middleware || []; + } + + get queryParamsStringify(): (params: HTTPQuery) => string { + return this.configuration.queryParamsStringify || querystring; + } + + get username(): string | undefined { + return this.configuration.username; + } + + get password(): string | undefined { + return this.configuration.password; + } + + get apiKey(): ((name: string) => string | Promise) | undefined { + const apiKey = this.configuration.apiKey; + if (apiKey) { + return typeof apiKey === 'function' ? apiKey : () => apiKey; + } + return undefined; + } + + get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { + const accessToken = this.configuration.accessToken; + if (accessToken) { + return typeof accessToken === 'function' ? accessToken : async () => accessToken; + } + return undefined; + } + + get headers(): HTTPHeaders | undefined { + return this.configuration.headers; + } + + get credentials(): RequestCredentials | undefined { + return this.configuration.credentials; + } +} + +export const DefaultConfig = new Configuration(); /** * This is the base class for all generated API classes. */ export class BaseAPI { + private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i'); private middleware: Middleware[]; - constructor(protected configuration = new Configuration()) { + constructor(protected configuration = DefaultConfig) { this.middleware = configuration.middleware; } @@ -44,16 +114,33 @@ export class BaseAPI { return this.withMiddleware(...middlewares); } - protected async request(context: RequestOpts): Promise { - const { url, init } = this.createFetchParams(context); + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + protected isJsonMime(mime: string | null | undefined): boolean { + if (!mime) { + return false; + } + return BaseAPI.jsonRegex.test(mime); + } + + protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { + const { url, init } = await this.createFetchParams(context, initOverrides); const response = await this.fetchApi(url, init); - if (response.status >= 200 && response.status < 300) { + if (response && (response.status >= 200 && response.status < 300)) { return response; } - throw response; + throw new ResponseError(response, 'Response returned an error code'); } - private createFetchParams(context: RequestOpts) { + private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { let url = this.configuration.basePath + context.path; if (context.query !== undefined && Object.keys(context.query).length !== 0) { // only add the querystring to the URL if there are query parameters. @@ -61,17 +148,46 @@ export class BaseAPI { // do not handle correctly sometimes. url += '?' + this.configuration.queryParamsStringify(context.query); } - const body = ((typeof FormData !== "undefined" && context.body instanceof FormData) || context.body instanceof URLSearchParams || isBlob(context.body)) - ? context.body - : JSON.stringify(context.body); const headers = Object.assign({}, this.configuration.headers, context.headers); - const init = { + Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); + + const initOverrideFn = + typeof initOverrides === "function" + ? initOverrides + : async () => initOverrides; + + const initParams = { method: context.method, - headers: headers, - body, - credentials: this.configuration.credentials + headers, + body: context.body, + credentials: this.configuration.credentials, + }; + + const overriddenInit: RequestInit = { + ...initParams, + ...(await initOverrideFn({ + init: initParams, + context, + })) }; + + let body: any; + if (isFormData(overriddenInit.body) + || (overriddenInit.body instanceof URLSearchParams) + || isBlob(overriddenInit.body)) { + body = overriddenInit.body; + } else if (this.isJsonMime(headers['Content-Type'])) { + body = JSON.stringify(overriddenInit.body); + } else { + body = overriddenInit.body; + } + + const init: RequestInit = { + ...overriddenInit, + body + }; + return { url, init }; } @@ -85,13 +201,35 @@ export class BaseAPI { }) || fetchParams; } } - let response = await this.configuration.fetchApi(fetchParams.url, fetchParams.init); + let response: Response | undefined = undefined; + try { + response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); + } catch (e) { + for (const middleware of this.middleware) { + if (middleware.onError) { + response = await middleware.onError({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + error: e, + response: response ? response.clone() : undefined, + }) || response; + } + } + if (response === undefined) { + if (e instanceof Error) { + throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); + } else { + throw e; + } + } + } for (const middleware of this.middleware) { if (middleware.post) { response = await middleware.post({ fetch: this.fetchApi, - url, - init, + url: fetchParams.url, + init: fetchParams.init, response: response.clone(), }) || response; } @@ -111,8 +249,30 @@ export class BaseAPI { } }; +function isBlob(value: any): value is Blob { + return typeof Blob !== 'undefined' && value instanceof Blob; +} + +function isFormData(value: any): value is FormData { + return typeof FormData !== "undefined" && value instanceof FormData; +} + +export class ResponseError extends Error { + override name: "ResponseError" = "ResponseError"; + constructor(public response: Response, msg?: string) { + super(msg); + } +} + +export class FetchError extends Error { + override name: "FetchError" = "FetchError"; + constructor(public cause: Error, msg?: string) { + super(msg); + } +} + export class RequiredError extends Error { - name: "RequiredError" = "RequiredError"; + override name: "RequiredError" = "RequiredError"; constructor(public field: string, msg?: string) { super(msg); } @@ -127,78 +287,16 @@ export const COLLECTION_FORMATS = { export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; -export interface ConfigurationParameters { - basePath?: string; // override base path - fetchApi?: FetchAPI; // override for fetch implementation - middleware?: Middleware[]; // middleware to apply before/after fetch requests - queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings - username?: string; // parameter for basic security - password?: string; // parameter for basic security - apiKey?: string | ((name: string) => string); // parameter for apiKey security - accessToken?: string | ((name?: string, scopes?: string[]) => string); // parameter for oauth2 security - headers?: HTTPHeaders; //header params we want to use on every request - credentials?: RequestCredentials; //value for the credentials param we want to use on each request -} - -export class Configuration { - constructor(private configuration: ConfigurationParameters = {}) {} - - get basePath(): string { - return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; - } - - get fetchApi(): FetchAPI { - return this.configuration.fetchApi || window.fetch.bind(window); - } - - get middleware(): Middleware[] { - return this.configuration.middleware || []; - } - - get queryParamsStringify(): (params: HTTPQuery) => string { - return this.configuration.queryParamsStringify || querystring; - } - - get username(): string | undefined { - return this.configuration.username; - } - - get password(): string | undefined { - return this.configuration.password; - } - - get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; - if (apiKey) { - return typeof apiKey === 'function' ? apiKey : () => apiKey; - } - return undefined; - } - - get accessToken(): ((name: string, scopes?: string[]) => string) | undefined { - const accessToken = this.configuration.accessToken; - if (accessToken) { - return typeof accessToken === 'function' ? accessToken : () => accessToken; - } - return undefined; - } - - get headers(): HTTPHeaders | undefined { - return this.configuration.headers; - } - - get credentials(): RequestCredentials | undefined { - return this.configuration.credentials; - } -} - export type Json = any; export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; export type HTTPHeaders = { [key: string]: string }; -export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | HTTPQuery }; +export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; export type HTTPBody = Json | FormData | URLSearchParams; +export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; +export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise + export interface FetchParams { url: string; init: RequestInit; @@ -212,33 +310,38 @@ export interface RequestOpts { body?: HTTPBody; } -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - export function querystring(params: HTTPQuery, prefix: string = ''): string { return Object.keys(params) - .map((key) => { - const fullKey = prefix + (prefix.length ? `[${key}]` : key); - const value = params[key]; - if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) - .join(`&${encodeURIComponent(fullKey)}=`); - return `${encodeURIComponent(fullKey)}=${multiValue}`; - } - if (value instanceof Date) { - return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; - } - if (value instanceof Object) { - return querystring(value as HTTPQuery, fullKey); - } - return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; - }) + .map(key => querystringSingleKey(key, params[key], prefix)) .filter(part => part.length > 0) .join('&'); } +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { + const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); + if (value instanceof Array) { + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) + .join(`&${encodeURIComponent(fullKey)}=`); + return `${encodeURIComponent(fullKey)}=${multiValue}`; + } + if (value instanceof Set) { + const valueAsArray = Array.from(value); + return querystringSingleKey(key, valueAsArray, keyPrefix); + } + if (value instanceof Date) { + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; + } + if (value instanceof Object) { + return querystring(value as HTTPQuery, fullKey); + } + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; +} + +export function exists(json: any, key: string) { + const value = json[key]; + return value !== null && value !== undefined; +} + export function mapValues(data: any, fn: (item: any) => any) { return Object.keys(data).reduce( (acc, key) => ({ ...acc, [key]: fn(data[key]) }), @@ -256,7 +359,7 @@ export function canConsumeForm(consumes: Consume[]): boolean { } export interface Consume { - contentType: string + contentType: string; } export interface RequestContext { @@ -272,9 +375,18 @@ export interface ResponseContext { response: Response; } +export interface ErrorContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + error: unknown; + response?: Response; +} + export interface Middleware { pre?(context: RequestContext): Promise; post?(context: ResponseContext): Promise; + onError?(context: ErrorContext): Promise; } export interface ApiResponse {