From 0e42c93d844d8adddab258c3a6080fed21ae8cd8 Mon Sep 17 00:00:00 2001 From: Kayode Odole <31928403+Kayconfig@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:43:18 +0100 Subject: [PATCH] feat: getWalletApprovals --- .changeset/tall-lobsters-sing.md | 7 ++ .../common/evmUtils/generator.config.json | 3 +- .../src/generated/client/abstractClient.ts | 19 ++- ...GetTopProfitableWalletPerTokenOperation.ts | 2 +- .../operations/GetWalletApprovalsOperation.ts | 65 ++++++++++ .../src/generated/operations/index.ts | 1 + .../src/generated/operations/operations.ts | 2 + .../src/generated/types/EvmApprovalData.ts | 64 ++++++++++ .../generated/types/EvmApprovalResponse.ts | 50 ++++++++ .../generated/types/EvmCommonContractData.ts | 64 ---------- .../types/EvmContractSpenderDetails.ts | 70 ----------- .../types/EvmContractTokenDetails.ts | 70 ----------- .../EvmResolveContractInteractionResponse.ts | 103 ++++++++-------- .../src/generated/types/EvmRevokeResponse.ts | 50 ++++++++ .../generated/types/EvmSetApprovalAllData.ts | 50 ++++++++ .../types/EvmSetApprovalAllResponse.ts | 50 ++++++++ .../types/EvmSetRevokeAllResponse.ts | 50 ++++++++ .../src/generated/types/EvmSpenderDetails.ts | 84 +++++++++++++ .../src/generated/types/EvmTokenApproval.ts | 86 ++++++++++++++ .../types/EvmTokenApprovalSpender.ts | 63 ++++++++++ .../generated/types/EvmTokenApprovalToken.ts | 112 ++++++++++++++++++ .../src/generated/types/EvmTokenDetails.ts | 70 +++++++++++ .../src/generated/types/EvmWalletApprovals.ts | 72 +++++++++++ .../types/EvmWalletHistoryTransaction.ts | 14 +-- .../types/EvmWalletProfitabilityTokenData.ts | 26 +--- .../evmUtils/src/generated/types/index.ts | 17 ++- packages/evmApi/src/generated/ClientEvmApi.ts | 7 +- 27 files changed, 977 insertions(+), 294 deletions(-) create mode 100644 .changeset/tall-lobsters-sing.md create mode 100644 packages/common/evmUtils/src/generated/operations/GetWalletApprovalsOperation.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmApprovalData.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmApprovalResponse.ts delete mode 100644 packages/common/evmUtils/src/generated/types/EvmCommonContractData.ts delete mode 100644 packages/common/evmUtils/src/generated/types/EvmContractSpenderDetails.ts delete mode 100644 packages/common/evmUtils/src/generated/types/EvmContractTokenDetails.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmRevokeResponse.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSetApprovalAllData.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSetApprovalAllResponse.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSetRevokeAllResponse.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmSpenderDetails.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmTokenApproval.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmTokenApprovalSpender.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmTokenApprovalToken.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmTokenDetails.ts create mode 100644 packages/common/evmUtils/src/generated/types/EvmWalletApprovals.ts diff --git a/.changeset/tall-lobsters-sing.md b/.changeset/tall-lobsters-sing.md new file mode 100644 index 0000000000..c6cec6b0a0 --- /dev/null +++ b/.changeset/tall-lobsters-sing.md @@ -0,0 +1,7 @@ +--- +'@moralisweb3/common-evm-utils': patch +'@moralisweb3/evm-api': patch +'moralis': patch +--- + +Add getWalletApprovals to SDK diff --git a/packages/common/evmUtils/generator.config.json b/packages/common/evmUtils/generator.config.json index b263253572..553e3b9571 100644 --- a/packages/common/evmUtils/generator.config.json +++ b/packages/common/evmUtils/generator.config.json @@ -132,7 +132,8 @@ "getWalletProfitabilitySummary", "getWalletProfitability", "getTopProfitableWalletPerToken", - "getNFTTradesByToken" + "getNFTTradesByToken", + "getWalletApprovals" ] } } diff --git a/packages/common/evmUtils/src/generated/client/abstractClient.ts b/packages/common/evmUtils/src/generated/client/abstractClient.ts index 25d68e844a..0f1736f52d 100644 --- a/packages/common/evmUtils/src/generated/client/abstractClient.ts +++ b/packages/common/evmUtils/src/generated/client/abstractClient.ts @@ -9,6 +9,8 @@ import { EvmErc20Price, EvmErc20PriceJSON } from '../types/EvmErc20Price'; import { EvmGetMultipleTokenPricesDto, EvmGetMultipleTokenPricesDtoInput, EvmGetMultipleTokenPricesDtoJSON } from '../types/EvmGetMultipleTokenPricesDto'; import { GetTokenOwnersOperation, GetTokenOwnersOperationRequest, GetTokenOwnersOperationRequestJSON } from '../operations/GetTokenOwnersOperation'; import { EvmErc20TokenOwnerCollection, EvmErc20TokenOwnerCollectionJSON } from '../types/EvmErc20TokenOwnerCollection'; +import { GetWalletApprovalsOperation, GetWalletApprovalsOperationRequest, GetWalletApprovalsOperationRequestJSON } from '../operations/GetWalletApprovalsOperation'; +import { EvmWalletApprovals, EvmWalletApprovalsJSON } from '../types/EvmWalletApprovals'; import { GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationRequestJSON } from '../operations/GetWalletHistoryOperation'; import { EvmWalletHistory, EvmWalletHistoryJSON } from '../types/EvmWalletHistory'; import { GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationRequestJSON } from '../operations/GetWalletTokenBalancesPriceOperation'; @@ -368,7 +370,7 @@ export abstract class AbstractClient { * @description Retrieves a list of the top profitable wallets for a specific ERC20 token. * @param request Request with parameters. * @param {Object} request.address The ERC20 token address. - * @param {String} [request.days] Timeframe in days for which profitability is calculated, Options include 'all', '7', '30', '60', '90' default is 'all'. (optional) + * @param {String} [request.days] Timeframe in days for which profitability is calculated, Options include 'all', '7', '30' default is 'all'. (optional) * @param {Object} [request.chain] The chain to query (optional) * @returns {Object} Response for the request. */ @@ -420,6 +422,21 @@ export abstract class AbstractClient { >(ReviewContractsOperation), }; public readonly wallets = { + /** + * @description Retrieve active ERC20 token approvals for the specified wallet address + * @param request Request with parameters. + * @param {Object} request.address The wallet address from which to retrieve active ERC20 token approvals + * @param {Object} [request.chain] The chain to query (optional) + * @param {Number} [request.limit] The desired page size of the result. (optional) + * @param {String} [request.cursor] The cursor returned in the previous response (used for getting the next page). (optional) + * @returns {Object} Response for the request. + */ + getWalletApprovals: this.createEndpoint< + GetWalletApprovalsOperationRequest, + GetWalletApprovalsOperationRequestJSON, + EvmWalletApprovals, + EvmWalletApprovalsJSON + >(GetWalletApprovalsOperation), /** * @description Get the complete history of a wallet * @param request Request with parameters. diff --git a/packages/common/evmUtils/src/generated/operations/GetTopProfitableWalletPerTokenOperation.ts b/packages/common/evmUtils/src/generated/operations/GetTopProfitableWalletPerTokenOperation.ts index 47620a5f65..1cd4c86389 100644 --- a/packages/common/evmUtils/src/generated/operations/GetTopProfitableWalletPerTokenOperation.ts +++ b/packages/common/evmUtils/src/generated/operations/GetTopProfitableWalletPerTokenOperation.ts @@ -12,7 +12,7 @@ export interface GetTopProfitableWalletPerTokenOperationRequest { */ readonly address: EvmAddressInput | EvmAddress; /** - * @description Timeframe in days for which profitability is calculated, Options include 'all', '7', '30', '60', '90' default is 'all'. + * @description Timeframe in days for which profitability is calculated, Options include 'all', '7', '30' default is 'all'. */ readonly days?: string; /** diff --git a/packages/common/evmUtils/src/generated/operations/GetWalletApprovalsOperation.ts b/packages/common/evmUtils/src/generated/operations/GetWalletApprovalsOperation.ts new file mode 100644 index 0000000000..e20b8f38d2 --- /dev/null +++ b/packages/common/evmUtils/src/generated/operations/GetWalletApprovalsOperation.ts @@ -0,0 +1,65 @@ +import { EvmChain, EvmChainInput, EvmChainJSON, EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; +import { EvmWalletApprovals, EvmWalletApprovalsJSON } from '../types/EvmWalletApprovals'; + +// request parameters: +// - chain ($ref: #/components/schemas/chainList) +// - limit ($ref: #/paths/~1wallets~1{address}~1approvals/get/parameters/1/schema) +// - cursor ($ref: #/paths/~1wallets~1{address}~1approvals/get/parameters/2/schema) +// - address ($ref: #/paths/~1wallets~1{address}~1approvals/get/parameters/3/schema) + +export interface GetWalletApprovalsOperationRequest { + /** + * @description The chain to query + */ + readonly chain?: EvmChainInput | EvmChain; + /** + * @description The desired page size of the result. + */ + readonly limit?: number; + /** + * @description The cursor returned in the previous response (used for getting the next page). + */ + readonly cursor?: string; + /** + * @description The wallet address from which to retrieve active ERC20 token approvals + */ + readonly address: EvmAddressInput | EvmAddress; +} + +export interface GetWalletApprovalsOperationRequestJSON { + readonly chain?: EvmChainJSON; + readonly limit?: number; + readonly cursor?: string; + readonly address: EvmAddressJSON; +} + +export type GetWalletApprovalsOperationResponse = EvmWalletApprovals; +export type GetWalletApprovalsOperationResponseJSON = EvmWalletApprovalsJSON; + +export const GetWalletApprovalsOperation = { + operationId: "getWalletApprovals", + groupName: "wallets", + httpMethod: "get", + routePattern: "/wallets/{address}/approvals", + parameterNames: ["chain","limit","cursor","address"], + hasResponse: true, + hasBody: false, + + parseResponse(json: EvmWalletApprovalsJSON): EvmWalletApprovals { + return EvmWalletApprovals.fromJSON(json); + }, + + serializeRequest(request: GetWalletApprovalsOperationRequest): GetWalletApprovalsOperationRequestJSON { + const chain = request.chain ? EvmChain.create(request.chain) : undefined; + const limit = request.limit; + const cursor = request.cursor; + const address = EvmAddress.create(request.address); + return { + chain: chain ? chain.toJSON() : undefined, + limit: limit, + cursor: cursor, + address: address.toJSON(), + }; + }, + +} diff --git a/packages/common/evmUtils/src/generated/operations/index.ts b/packages/common/evmUtils/src/generated/operations/index.ts index f01c8213e5..5221c9228b 100644 --- a/packages/common/evmUtils/src/generated/operations/index.ts +++ b/packages/common/evmUtils/src/generated/operations/index.ts @@ -4,6 +4,7 @@ export * from './GetNFTContractSalePricesOperation'; export * from './GetNFTSalePricesOperation'; export * from './GetMultipleTokenPricesOperation'; export * from './GetTokenOwnersOperation'; +export * from './GetWalletApprovalsOperation'; export * from './GetWalletHistoryOperation'; export * from './GetWalletTokenBalancesPriceOperation'; export * from './GetWalletNetWorthOperation'; diff --git a/packages/common/evmUtils/src/generated/operations/operations.ts b/packages/common/evmUtils/src/generated/operations/operations.ts index fbeaf265cd..e7f8d14f26 100644 --- a/packages/common/evmUtils/src/generated/operations/operations.ts +++ b/packages/common/evmUtils/src/generated/operations/operations.ts @@ -4,6 +4,7 @@ import { GetNFTContractSalePricesOperation } from './GetNFTContractSalePricesOpe import { GetNFTSalePricesOperation } from './GetNFTSalePricesOperation'; import { GetMultipleTokenPricesOperation } from './GetMultipleTokenPricesOperation'; import { GetTokenOwnersOperation } from './GetTokenOwnersOperation'; +import { GetWalletApprovalsOperation } from './GetWalletApprovalsOperation'; import { GetWalletHistoryOperation } from './GetWalletHistoryOperation'; import { GetWalletTokenBalancesPriceOperation } from './GetWalletTokenBalancesPriceOperation'; import { GetWalletNetWorthOperation } from './GetWalletNetWorthOperation'; @@ -38,6 +39,7 @@ export const operations = [ GetNFTSalePricesOperation, GetMultipleTokenPricesOperation, GetTokenOwnersOperation, + GetWalletApprovalsOperation, GetWalletHistoryOperation, GetWalletTokenBalancesPriceOperation, GetWalletNetWorthOperation, diff --git a/packages/common/evmUtils/src/generated/types/EvmApprovalData.ts b/packages/common/evmUtils/src/generated/types/EvmApprovalData.ts new file mode 100644 index 0000000000..792d0b05db --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmApprovalData.ts @@ -0,0 +1,64 @@ +import { EvmTokenDetails, EvmTokenDetailsInput, EvmTokenDetailsJSON } from '../types/EvmTokenDetails'; +import { EvmSpenderDetails, EvmSpenderDetailsInput, EvmSpenderDetailsJSON } from '../types/EvmSpenderDetails'; + +// $ref: #/components/schemas/ApprovalData +// type: ApprovalData +// properties: +// - value ($ref: #/components/schemas/ApprovalData/properties/value) +// - value_formatted ($ref: #/components/schemas/ApprovalData/properties/value_formatted) +// - token ($ref: #/components/schemas/TokenDetails) +// - spender ($ref: #/components/schemas/SpenderDetails) + +export interface EvmApprovalDataJSON { + readonly value?: string; + readonly value_formatted?: string; + readonly token?: EvmTokenDetailsJSON; + readonly spender?: EvmSpenderDetailsJSON; +} + +export interface EvmApprovalDataInput { + readonly value?: string; + readonly valueFormatted?: string; + readonly token?: EvmTokenDetailsInput | EvmTokenDetails; + readonly spender?: EvmSpenderDetailsInput | EvmSpenderDetails; +} + +export class EvmApprovalData { + public static create(input: EvmApprovalDataInput | EvmApprovalData): EvmApprovalData { + if (input instanceof EvmApprovalData) { + return input; + } + return new EvmApprovalData(input); + } + + public static fromJSON(json: EvmApprovalDataJSON): EvmApprovalData { + const input: EvmApprovalDataInput = { + value: json.value, + valueFormatted: json.value_formatted, + token: json.token ? EvmTokenDetails.fromJSON(json.token) : undefined, + spender: json.spender ? EvmSpenderDetails.fromJSON(json.spender) : undefined, + }; + return EvmApprovalData.create(input); + } + + public readonly value?: string; + public readonly valueFormatted?: string; + public readonly token?: EvmTokenDetails; + public readonly spender?: EvmSpenderDetails; + + private constructor(input: EvmApprovalDataInput) { + this.value = input.value; + this.valueFormatted = input.valueFormatted; + this.token = input.token ? EvmTokenDetails.create(input.token) : undefined; + this.spender = input.spender ? EvmSpenderDetails.create(input.spender) : undefined; + } + + public toJSON(): EvmApprovalDataJSON { + return { + value: this.value, + value_formatted: this.valueFormatted, + token: this.token ? this.token.toJSON() : undefined, + spender: this.spender ? this.spender.toJSON() : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmApprovalResponse.ts b/packages/common/evmUtils/src/generated/types/EvmApprovalResponse.ts new file mode 100644 index 0000000000..299df1006f --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmApprovalResponse.ts @@ -0,0 +1,50 @@ +import { EvmApprovalData, EvmApprovalDataInput, EvmApprovalDataJSON } from '../types/EvmApprovalData'; + +// $ref: #/components/schemas/ApprovalResponse +// type: ApprovalResponse +// properties: +// - approvals ($ref: #/components/schemas/ApprovalData) + +export interface EvmApprovalResponseJSON { + readonly approvals?: EvmApprovalDataJSON[]; +} + +export interface EvmApprovalResponseInput { + readonly approvals?: EvmApprovalDataInput[] | EvmApprovalData[]; +} + +export class EvmApprovalResponse { + public static create(input: EvmApprovalResponseInput | EvmApprovalResponse): EvmApprovalResponse { + if (input instanceof EvmApprovalResponse) { + return input; + } + return new EvmApprovalResponse(input); + } + + public static fromJSON(json: EvmApprovalResponseJSON): EvmApprovalResponse { + const input: EvmApprovalResponseInput = { + approvals: json.approvals ? json.approvals.map((item) => EvmApprovalData.fromJSON(item)) : undefined, + }; + return EvmApprovalResponse.create(input); + } + + public static isInput(input: any): input is EvmApprovalResponseInput { + return [].every((name) => input[name] !== undefined); + } + + public static isJSON(json: any): json is EvmApprovalResponseJSON { + return [].every((name) => json[name] !== undefined); + } + + public readonly approvals?: EvmApprovalData[]; + + private constructor(input: EvmApprovalResponseInput) { + this.approvals = input.approvals ? input.approvals.map((item) => EvmApprovalData.create(item)) : undefined; + } + + public toJSON(): EvmApprovalResponseJSON { + return { + approvals: this.approvals ? this.approvals.map((item) => item.toJSON()) : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmCommonContractData.ts b/packages/common/evmUtils/src/generated/types/EvmCommonContractData.ts deleted file mode 100644 index 55fe0d4297..0000000000 --- a/packages/common/evmUtils/src/generated/types/EvmCommonContractData.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { EvmContractTokenDetails, EvmContractTokenDetailsInput, EvmContractTokenDetailsJSON } from '../types/EvmContractTokenDetails'; -import { EvmContractSpenderDetails, EvmContractSpenderDetailsInput, EvmContractSpenderDetailsJSON } from '../types/EvmContractSpenderDetails'; - -// $ref: #/components/schemas/CommonContractData -// type: CommonContractData -// properties: -// - value ($ref: #/components/schemas/CommonContractData/properties/value) -// - value_formatted ($ref: #/components/schemas/CommonContractData/properties/value_formatted) -// - token ($ref: #/components/schemas/ContractTokenDetails) -// - spender ($ref: #/components/schemas/ContractSpenderDetails) - -export interface EvmCommonContractDataJSON { - readonly value: string; - readonly value_formatted?: string; - readonly token: EvmContractTokenDetailsJSON; - readonly spender: EvmContractSpenderDetailsJSON; -} - -export interface EvmCommonContractDataInput { - readonly value: string; - readonly valueFormatted?: string; - readonly token: EvmContractTokenDetailsInput | EvmContractTokenDetails; - readonly spender: EvmContractSpenderDetailsInput | EvmContractSpenderDetails; -} - -export class EvmCommonContractData { - public static create(input: EvmCommonContractDataInput | EvmCommonContractData): EvmCommonContractData { - if (input instanceof EvmCommonContractData) { - return input; - } - return new EvmCommonContractData(input); - } - - public static fromJSON(json: EvmCommonContractDataJSON): EvmCommonContractData { - const input: EvmCommonContractDataInput = { - value: json.value, - valueFormatted: json.value_formatted, - token: EvmContractTokenDetails.fromJSON(json.token), - spender: EvmContractSpenderDetails.fromJSON(json.spender), - }; - return EvmCommonContractData.create(input); - } - - public readonly value: string; - public readonly valueFormatted?: string; - public readonly token: EvmContractTokenDetails; - public readonly spender: EvmContractSpenderDetails; - - private constructor(input: EvmCommonContractDataInput) { - this.value = input.value; - this.valueFormatted = input.valueFormatted; - this.token = EvmContractTokenDetails.create(input.token); - this.spender = EvmContractSpenderDetails.create(input.spender); - } - - public toJSON(): EvmCommonContractDataJSON { - return { - value: this.value, - value_formatted: this.valueFormatted, - token: this.token.toJSON(), - spender: this.spender.toJSON(), - } - } -} diff --git a/packages/common/evmUtils/src/generated/types/EvmContractSpenderDetails.ts b/packages/common/evmUtils/src/generated/types/EvmContractSpenderDetails.ts deleted file mode 100644 index fccf4bf91b..0000000000 --- a/packages/common/evmUtils/src/generated/types/EvmContractSpenderDetails.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; - -// $ref: #/components/schemas/ContractSpenderDetails -// type: ContractSpenderDetails -// properties: -// - address ($ref: #/components/schemas/ContractSpenderDetails/properties/address) -// - address_label ($ref: #/components/schemas/ContractSpenderDetails/properties/address_label) -// - name ($ref: #/components/schemas/ContractSpenderDetails/properties/name) -// - symbol ($ref: #/components/schemas/ContractSpenderDetails/properties/symbol) -// - logo ($ref: #/components/schemas/ContractSpenderDetails/properties/logo) - -export interface EvmContractSpenderDetailsJSON { - readonly address: EvmAddressJSON; - readonly address_label?: string; - readonly name?: string; - readonly symbol?: string; - readonly logo?: string; -} - -export interface EvmContractSpenderDetailsInput { - readonly address: EvmAddressInput | EvmAddress; - readonly addressLabel?: string; - readonly name?: string; - readonly symbol?: string; - readonly logo?: string; -} - -export class EvmContractSpenderDetails { - public static create(input: EvmContractSpenderDetailsInput | EvmContractSpenderDetails): EvmContractSpenderDetails { - if (input instanceof EvmContractSpenderDetails) { - return input; - } - return new EvmContractSpenderDetails(input); - } - - public static fromJSON(json: EvmContractSpenderDetailsJSON): EvmContractSpenderDetails { - const input: EvmContractSpenderDetailsInput = { - address: EvmAddress.fromJSON(json.address), - addressLabel: json.address_label, - name: json.name, - symbol: json.symbol, - logo: json.logo, - }; - return EvmContractSpenderDetails.create(input); - } - - public readonly address: EvmAddress; - public readonly addressLabel?: string; - public readonly name?: string; - public readonly symbol?: string; - public readonly logo?: string; - - private constructor(input: EvmContractSpenderDetailsInput) { - this.address = EvmAddress.create(input.address); - this.addressLabel = input.addressLabel; - this.name = input.name; - this.symbol = input.symbol; - this.logo = input.logo; - } - - public toJSON(): EvmContractSpenderDetailsJSON { - return { - address: this.address.toJSON(), - address_label: this.addressLabel, - name: this.name, - symbol: this.symbol, - logo: this.logo, - } - } -} diff --git a/packages/common/evmUtils/src/generated/types/EvmContractTokenDetails.ts b/packages/common/evmUtils/src/generated/types/EvmContractTokenDetails.ts deleted file mode 100644 index d3be438e53..0000000000 --- a/packages/common/evmUtils/src/generated/types/EvmContractTokenDetails.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; - -// $ref: #/components/schemas/ContractTokenDetails -// type: ContractTokenDetails -// properties: -// - address ($ref: #/components/schemas/ContractTokenDetails/properties/address) -// - address_label ($ref: #/components/schemas/ContractTokenDetails/properties/address_label) -// - token_name ($ref: #/components/schemas/ContractTokenDetails/properties/token_name) -// - token_logo ($ref: #/components/schemas/ContractTokenDetails/properties/token_logo) -// - token_symbol ($ref: #/components/schemas/ContractTokenDetails/properties/token_symbol) - -export interface EvmContractTokenDetailsJSON { - readonly address: EvmAddressJSON; - readonly address_label?: string; - readonly token_name: string; - readonly token_logo: string; - readonly token_symbol: string; -} - -export interface EvmContractTokenDetailsInput { - readonly address: EvmAddressInput | EvmAddress; - readonly addressLabel?: string; - readonly tokenName: string; - readonly tokenLogo: string; - readonly tokenSymbol: string; -} - -export class EvmContractTokenDetails { - public static create(input: EvmContractTokenDetailsInput | EvmContractTokenDetails): EvmContractTokenDetails { - if (input instanceof EvmContractTokenDetails) { - return input; - } - return new EvmContractTokenDetails(input); - } - - public static fromJSON(json: EvmContractTokenDetailsJSON): EvmContractTokenDetails { - const input: EvmContractTokenDetailsInput = { - address: EvmAddress.fromJSON(json.address), - addressLabel: json.address_label, - tokenName: json.token_name, - tokenLogo: json.token_logo, - tokenSymbol: json.token_symbol, - }; - return EvmContractTokenDetails.create(input); - } - - public readonly address: EvmAddress; - public readonly addressLabel?: string; - public readonly tokenName: string; - public readonly tokenLogo: string; - public readonly tokenSymbol: string; - - private constructor(input: EvmContractTokenDetailsInput) { - this.address = EvmAddress.create(input.address); - this.addressLabel = input.addressLabel; - this.tokenName = input.tokenName; - this.tokenLogo = input.tokenLogo; - this.tokenSymbol = input.tokenSymbol; - } - - public toJSON(): EvmContractTokenDetailsJSON { - return { - address: this.address.toJSON(), - address_label: this.addressLabel, - token_name: this.tokenName, - token_logo: this.tokenLogo, - token_symbol: this.tokenSymbol, - } - } -} diff --git a/packages/common/evmUtils/src/generated/types/EvmResolveContractInteractionResponse.ts b/packages/common/evmUtils/src/generated/types/EvmResolveContractInteractionResponse.ts index 29d73300c1..ce9b831b56 100644 --- a/packages/common/evmUtils/src/generated/types/EvmResolveContractInteractionResponse.ts +++ b/packages/common/evmUtils/src/generated/types/EvmResolveContractInteractionResponse.ts @@ -1,63 +1,64 @@ -import { EvmCommonContractData, EvmCommonContractDataInput, EvmCommonContractDataJSON } from '../types/EvmCommonContractData'; +import { EvmApprovalResponse, EvmApprovalResponseJSON, EvmApprovalResponseInput } from '../types/EvmApprovalResponse'; +import { EvmRevokeResponse, EvmRevokeResponseJSON, EvmRevokeResponseInput } from '../types/EvmRevokeResponse'; +import { EvmSetApprovalAllResponse, EvmSetApprovalAllResponseJSON, EvmSetApprovalAllResponseInput } from '../types/EvmSetApprovalAllResponse'; +import { EvmSetRevokeAllResponse, EvmSetRevokeAllResponseJSON, EvmSetRevokeAllResponseInput } from '../types/EvmSetRevokeAllResponse'; // $ref: #/components/schemas/ResolveContractInteractionResponse -// type: ResolveContractInteractionResponse -// properties: -// - approvals ($ref: #/components/schemas/CommonContractData) -// - revokes ($ref: #/components/schemas/CommonContractData) -// - approvalsAll ($ref: #/components/schemas/CommonContractData) -// - revokesAll ($ref: #/components/schemas/CommonContractData) +// typeName: ResolveContractInteractionResponse +// unionType: oneOf -export interface EvmResolveContractInteractionResponseJSON { - readonly approvals?: EvmCommonContractDataJSON[]; - readonly revokes?: EvmCommonContractDataJSON[]; - readonly approvalsAll?: EvmCommonContractDataJSON[]; - readonly revokesAll?: EvmCommonContractDataJSON[]; -} - -export interface EvmResolveContractInteractionResponseInput { - readonly approvals?: EvmCommonContractDataInput[] | EvmCommonContractData[]; - readonly revokes?: EvmCommonContractDataInput[] | EvmCommonContractData[]; - readonly approvalsAll?: EvmCommonContractDataInput[] | EvmCommonContractData[]; - readonly revokesAll?: EvmCommonContractDataInput[] | EvmCommonContractData[]; -} +export type EvmResolveContractInteractionResponseJSON = EvmApprovalResponseJSON | EvmRevokeResponseJSON | EvmSetApprovalAllResponseJSON | EvmSetRevokeAllResponseJSON; +export type EvmResolveContractInteractionResponseInput = EvmApprovalResponseInput | EvmRevokeResponseInput | EvmSetApprovalAllResponseInput | EvmSetRevokeAllResponseInput; +export type EvmResolveContractInteractionResponseValue = EvmApprovalResponse | EvmRevokeResponse | EvmSetApprovalAllResponse | EvmSetRevokeAllResponse; -export class EvmResolveContractInteractionResponse { - public static create(input: EvmResolveContractInteractionResponseInput | EvmResolveContractInteractionResponse): EvmResolveContractInteractionResponse { - if (input instanceof EvmResolveContractInteractionResponse) { - return input; +export abstract class EvmResolveContractInteractionResponse { + public static create(input: EvmResolveContractInteractionResponseInput): EvmResolveContractInteractionResponseValue { + if (EvmApprovalResponse.isInput(input)) { + return EvmApprovalResponse.create(input); } - return new EvmResolveContractInteractionResponse(input); - } - - public static fromJSON(json: EvmResolveContractInteractionResponseJSON): EvmResolveContractInteractionResponse { - const input: EvmResolveContractInteractionResponseInput = { - approvals: json.approvals ? json.approvals.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, - revokes: json.revokes ? json.revokes.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, - approvalsAll: json.approvalsAll ? json.approvalsAll.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, - revokesAll: json.revokesAll ? json.revokesAll.map((item) => EvmCommonContractData.fromJSON(item)) : undefined, - }; - return EvmResolveContractInteractionResponse.create(input); + if (EvmRevokeResponse.isInput(input)) { + return EvmRevokeResponse.create(input); + } + if (EvmSetApprovalAllResponse.isInput(input)) { + return EvmSetApprovalAllResponse.create(input); + } + if (EvmSetRevokeAllResponse.isInput(input)) { + return EvmSetRevokeAllResponse.create(input); + } + throw new Error('Cannot resolve union from EvmResolveContractInteractionResponseInput'); } - public readonly approvals?: EvmCommonContractData[]; - public readonly revokes?: EvmCommonContractData[]; - public readonly approvalsAll?: EvmCommonContractData[]; - public readonly revokesAll?: EvmCommonContractData[]; - - private constructor(input: EvmResolveContractInteractionResponseInput) { - this.approvals = input.approvals ? input.approvals.map((item) => EvmCommonContractData.create(item)) : undefined; - this.revokes = input.revokes ? input.revokes.map((item) => EvmCommonContractData.create(item)) : undefined; - this.approvalsAll = input.approvalsAll ? input.approvalsAll.map((item) => EvmCommonContractData.create(item)) : undefined; - this.revokesAll = input.revokesAll ? input.revokesAll.map((item) => EvmCommonContractData.create(item)) : undefined; + public static fromJSON(json: EvmResolveContractInteractionResponseJSON): EvmResolveContractInteractionResponseValue { + if (EvmApprovalResponse.isJSON(json)) { + return EvmApprovalResponse.fromJSON(json); + } + if (EvmRevokeResponse.isJSON(json)) { + return EvmRevokeResponse.fromJSON(json); + } + if (EvmSetApprovalAllResponse.isJSON(json)) { + return EvmSetApprovalAllResponse.fromJSON(json); + } + if (EvmSetRevokeAllResponse.isJSON(json)) { + return EvmSetRevokeAllResponse.fromJSON(json); + } + const keys = Object.keys(json).join(', '); + const type = (json as any).type; + throw new Error(`Cannot resolve union from EvmResolveContractInteractionResponseJSON (keys: ${keys}, type: ${type})`); } - public toJSON(): EvmResolveContractInteractionResponseJSON { - return { - approvals: this.approvals ? this.approvals.map((item) => item.toJSON()) : undefined, - revokes: this.revokes ? this.revokes.map((item) => item.toJSON()) : undefined, - approvalsAll: this.approvalsAll ? this.approvalsAll.map((item) => item.toJSON()) : undefined, - revokesAll: this.revokesAll ? this.revokesAll.map((item) => item.toJSON()) : undefined, + public static toJSON(value: EvmResolveContractInteractionResponseValue): EvmResolveContractInteractionResponseJSON { + if (value instanceof EvmApprovalResponse) { + return value.toJSON(); + } + if (value instanceof EvmRevokeResponse) { + return value.toJSON(); + } + if (value instanceof EvmSetApprovalAllResponse) { + return value.toJSON(); + } + if (value instanceof EvmSetRevokeAllResponse) { + return value.toJSON(); } + throw new Error('Cannot resolve union from EvmResolveContractInteractionResponseValue'); } } diff --git a/packages/common/evmUtils/src/generated/types/EvmRevokeResponse.ts b/packages/common/evmUtils/src/generated/types/EvmRevokeResponse.ts new file mode 100644 index 0000000000..5e6672d536 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmRevokeResponse.ts @@ -0,0 +1,50 @@ +import { EvmApprovalData, EvmApprovalDataInput, EvmApprovalDataJSON } from '../types/EvmApprovalData'; + +// $ref: #/components/schemas/RevokeResponse +// type: RevokeResponse +// properties: +// - revokes ($ref: #/components/schemas/ApprovalData) + +export interface EvmRevokeResponseJSON { + readonly revokes?: EvmApprovalDataJSON[]; +} + +export interface EvmRevokeResponseInput { + readonly revokes?: EvmApprovalDataInput[] | EvmApprovalData[]; +} + +export class EvmRevokeResponse { + public static create(input: EvmRevokeResponseInput | EvmRevokeResponse): EvmRevokeResponse { + if (input instanceof EvmRevokeResponse) { + return input; + } + return new EvmRevokeResponse(input); + } + + public static fromJSON(json: EvmRevokeResponseJSON): EvmRevokeResponse { + const input: EvmRevokeResponseInput = { + revokes: json.revokes ? json.revokes.map((item) => EvmApprovalData.fromJSON(item)) : undefined, + }; + return EvmRevokeResponse.create(input); + } + + public static isInput(input: any): input is EvmRevokeResponseInput { + return [].every((name) => input[name] !== undefined); + } + + public static isJSON(json: any): json is EvmRevokeResponseJSON { + return [].every((name) => json[name] !== undefined); + } + + public readonly revokes?: EvmApprovalData[]; + + private constructor(input: EvmRevokeResponseInput) { + this.revokes = input.revokes ? input.revokes.map((item) => EvmApprovalData.create(item)) : undefined; + } + + public toJSON(): EvmRevokeResponseJSON { + return { + revokes: this.revokes ? this.revokes.map((item) => item.toJSON()) : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSetApprovalAllData.ts b/packages/common/evmUtils/src/generated/types/EvmSetApprovalAllData.ts new file mode 100644 index 0000000000..c48eb80b3a --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSetApprovalAllData.ts @@ -0,0 +1,50 @@ +import { EvmTokenDetails, EvmTokenDetailsInput, EvmTokenDetailsJSON } from '../types/EvmTokenDetails'; +import { EvmSpenderDetails, EvmSpenderDetailsInput, EvmSpenderDetailsJSON } from '../types/EvmSpenderDetails'; + +// $ref: #/components/schemas/SetApprovalAllData +// type: SetApprovalAllData +// properties: +// - token ($ref: #/components/schemas/TokenDetails) +// - operator ($ref: #/components/schemas/SpenderDetails) + +export interface EvmSetApprovalAllDataJSON { + readonly token?: EvmTokenDetailsJSON; + readonly operator?: EvmSpenderDetailsJSON; +} + +export interface EvmSetApprovalAllDataInput { + readonly token?: EvmTokenDetailsInput | EvmTokenDetails; + readonly operator?: EvmSpenderDetailsInput | EvmSpenderDetails; +} + +export class EvmSetApprovalAllData { + public static create(input: EvmSetApprovalAllDataInput | EvmSetApprovalAllData): EvmSetApprovalAllData { + if (input instanceof EvmSetApprovalAllData) { + return input; + } + return new EvmSetApprovalAllData(input); + } + + public static fromJSON(json: EvmSetApprovalAllDataJSON): EvmSetApprovalAllData { + const input: EvmSetApprovalAllDataInput = { + token: json.token ? EvmTokenDetails.fromJSON(json.token) : undefined, + operator: json.operator ? EvmSpenderDetails.fromJSON(json.operator) : undefined, + }; + return EvmSetApprovalAllData.create(input); + } + + public readonly token?: EvmTokenDetails; + public readonly operator?: EvmSpenderDetails; + + private constructor(input: EvmSetApprovalAllDataInput) { + this.token = input.token ? EvmTokenDetails.create(input.token) : undefined; + this.operator = input.operator ? EvmSpenderDetails.create(input.operator) : undefined; + } + + public toJSON(): EvmSetApprovalAllDataJSON { + return { + token: this.token ? this.token.toJSON() : undefined, + operator: this.operator ? this.operator.toJSON() : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSetApprovalAllResponse.ts b/packages/common/evmUtils/src/generated/types/EvmSetApprovalAllResponse.ts new file mode 100644 index 0000000000..1d41e5af1a --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSetApprovalAllResponse.ts @@ -0,0 +1,50 @@ +import { EvmSetApprovalAllData, EvmSetApprovalAllDataInput, EvmSetApprovalAllDataJSON } from '../types/EvmSetApprovalAllData'; + +// $ref: #/components/schemas/SetApprovalAllResponse +// type: SetApprovalAllResponse +// properties: +// - set_approvals_all ($ref: #/components/schemas/SetApprovalAllData) + +export interface EvmSetApprovalAllResponseJSON { + readonly set_approvals_all?: EvmSetApprovalAllDataJSON[]; +} + +export interface EvmSetApprovalAllResponseInput { + readonly setApprovalsAll?: EvmSetApprovalAllDataInput[] | EvmSetApprovalAllData[]; +} + +export class EvmSetApprovalAllResponse { + public static create(input: EvmSetApprovalAllResponseInput | EvmSetApprovalAllResponse): EvmSetApprovalAllResponse { + if (input instanceof EvmSetApprovalAllResponse) { + return input; + } + return new EvmSetApprovalAllResponse(input); + } + + public static fromJSON(json: EvmSetApprovalAllResponseJSON): EvmSetApprovalAllResponse { + const input: EvmSetApprovalAllResponseInput = { + setApprovalsAll: json.set_approvals_all ? json.set_approvals_all.map((item) => EvmSetApprovalAllData.fromJSON(item)) : undefined, + }; + return EvmSetApprovalAllResponse.create(input); + } + + public static isInput(input: any): input is EvmSetApprovalAllResponseInput { + return [].every((name) => input[name] !== undefined); + } + + public static isJSON(json: any): json is EvmSetApprovalAllResponseJSON { + return [].every((name) => json[name] !== undefined); + } + + public readonly setApprovalsAll?: EvmSetApprovalAllData[]; + + private constructor(input: EvmSetApprovalAllResponseInput) { + this.setApprovalsAll = input.setApprovalsAll ? input.setApprovalsAll.map((item) => EvmSetApprovalAllData.create(item)) : undefined; + } + + public toJSON(): EvmSetApprovalAllResponseJSON { + return { + set_approvals_all: this.setApprovalsAll ? this.setApprovalsAll.map((item) => item.toJSON()) : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSetRevokeAllResponse.ts b/packages/common/evmUtils/src/generated/types/EvmSetRevokeAllResponse.ts new file mode 100644 index 0000000000..806bacfb60 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSetRevokeAllResponse.ts @@ -0,0 +1,50 @@ +import { EvmSetApprovalAllData, EvmSetApprovalAllDataInput, EvmSetApprovalAllDataJSON } from '../types/EvmSetApprovalAllData'; + +// $ref: #/components/schemas/SetRevokeAllResponse +// type: SetRevokeAllResponse +// properties: +// - set_revokes_all ($ref: #/components/schemas/SetApprovalAllData) + +export interface EvmSetRevokeAllResponseJSON { + readonly set_revokes_all?: EvmSetApprovalAllDataJSON[]; +} + +export interface EvmSetRevokeAllResponseInput { + readonly setRevokesAll?: EvmSetApprovalAllDataInput[] | EvmSetApprovalAllData[]; +} + +export class EvmSetRevokeAllResponse { + public static create(input: EvmSetRevokeAllResponseInput | EvmSetRevokeAllResponse): EvmSetRevokeAllResponse { + if (input instanceof EvmSetRevokeAllResponse) { + return input; + } + return new EvmSetRevokeAllResponse(input); + } + + public static fromJSON(json: EvmSetRevokeAllResponseJSON): EvmSetRevokeAllResponse { + const input: EvmSetRevokeAllResponseInput = { + setRevokesAll: json.set_revokes_all ? json.set_revokes_all.map((item) => EvmSetApprovalAllData.fromJSON(item)) : undefined, + }; + return EvmSetRevokeAllResponse.create(input); + } + + public static isInput(input: any): input is EvmSetRevokeAllResponseInput { + return [].every((name) => input[name] !== undefined); + } + + public static isJSON(json: any): json is EvmSetRevokeAllResponseJSON { + return [].every((name) => json[name] !== undefined); + } + + public readonly setRevokesAll?: EvmSetApprovalAllData[]; + + private constructor(input: EvmSetRevokeAllResponseInput) { + this.setRevokesAll = input.setRevokesAll ? input.setRevokesAll.map((item) => EvmSetApprovalAllData.create(item)) : undefined; + } + + public toJSON(): EvmSetRevokeAllResponseJSON { + return { + set_revokes_all: this.setRevokesAll ? this.setRevokesAll.map((item) => item.toJSON()) : undefined, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmSpenderDetails.ts b/packages/common/evmUtils/src/generated/types/EvmSpenderDetails.ts new file mode 100644 index 0000000000..26d5e11312 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmSpenderDetails.ts @@ -0,0 +1,84 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/SpenderDetails +// type: SpenderDetails +// properties: +// - address ($ref: #/components/schemas/SpenderDetails/properties/address) +// - address_label ($ref: #/components/schemas/SpenderDetails/properties/address_label) +// - name ($ref: #/components/schemas/SpenderDetails/properties/name) +// - symbol ($ref: #/components/schemas/SpenderDetails/properties/symbol) +// - logo ($ref: #/components/schemas/SpenderDetails/properties/logo) +// - entity ($ref: #/components/schemas/SpenderDetails/properties/entity) +// - entity_logo ($ref: #/components/schemas/SpenderDetails/properties/entity_logo) + +export interface EvmSpenderDetailsJSON { + readonly address?: EvmAddressJSON; + readonly address_label?: string; + readonly name?: string; + readonly symbol?: string; + readonly logo?: string; + readonly entity?: string; + readonly entity_logo?: string; +} + +export interface EvmSpenderDetailsInput { + readonly address?: EvmAddressInput | EvmAddress; + readonly addressLabel?: string; + readonly name?: string; + readonly symbol?: string; + readonly logo?: string; + readonly entity?: string; + readonly entityLogo?: string; +} + +export class EvmSpenderDetails { + public static create(input: EvmSpenderDetailsInput | EvmSpenderDetails): EvmSpenderDetails { + if (input instanceof EvmSpenderDetails) { + return input; + } + return new EvmSpenderDetails(input); + } + + public static fromJSON(json: EvmSpenderDetailsJSON): EvmSpenderDetails { + const input: EvmSpenderDetailsInput = { + address: json.address ? EvmAddress.fromJSON(json.address) : undefined, + addressLabel: json.address_label, + name: json.name, + symbol: json.symbol, + logo: json.logo, + entity: json.entity, + entityLogo: json.entity_logo, + }; + return EvmSpenderDetails.create(input); + } + + public readonly address?: EvmAddress; + public readonly addressLabel?: string; + public readonly name?: string; + public readonly symbol?: string; + public readonly logo?: string; + public readonly entity?: string; + public readonly entityLogo?: string; + + private constructor(input: EvmSpenderDetailsInput) { + this.address = input.address ? EvmAddress.create(input.address) : undefined; + this.addressLabel = input.addressLabel; + this.name = input.name; + this.symbol = input.symbol; + this.logo = input.logo; + this.entity = input.entity; + this.entityLogo = input.entityLogo; + } + + public toJSON(): EvmSpenderDetailsJSON { + return { + address: this.address ? this.address.toJSON() : undefined, + address_label: this.addressLabel, + name: this.name, + symbol: this.symbol, + logo: this.logo, + entity: this.entity, + entity_logo: this.entityLogo, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmTokenApproval.ts b/packages/common/evmUtils/src/generated/types/EvmTokenApproval.ts new file mode 100644 index 0000000000..5cc524f4de --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmTokenApproval.ts @@ -0,0 +1,86 @@ +import { BigNumber, BigNumberInput, BigNumberJSON } from '@moralisweb3/common-core'; +import { EvmTokenApprovalToken, EvmTokenApprovalTokenInput, EvmTokenApprovalTokenJSON } from '../types/EvmTokenApprovalToken'; +import { EvmTokenApprovalSpender, EvmTokenApprovalSpenderInput, EvmTokenApprovalSpenderJSON } from '../types/EvmTokenApprovalSpender'; + +// $ref: #/components/schemas/tokenApproval +// type: tokenApproval +// properties: +// - block_number ($ref: #/components/schemas/tokenApproval/properties/block_number) +// - block_timestamp ($ref: #/components/schemas/tokenApproval/properties/block_timestamp) +// - transaction_hash ($ref: #/components/schemas/tokenApproval/properties/transaction_hash) +// - value ($ref: #/components/schemas/tokenApproval/properties/value) +// - value_formatted ($ref: #/components/schemas/tokenApproval/properties/value_formatted) +// - token ($ref: #/components/schemas/tokenApproval/properties/token) +// - spender ($ref: #/components/schemas/tokenApproval/properties/spender) + +export interface EvmTokenApprovalJSON { + readonly block_number: BigNumberJSON; + readonly block_timestamp?: string; + readonly transaction_hash?: string; + readonly value: string; + readonly value_formatted?: string; + readonly token: EvmTokenApprovalTokenJSON; + readonly spender: EvmTokenApprovalSpenderJSON; +} + +export interface EvmTokenApprovalInput { + readonly blockNumber: BigNumberInput | BigNumber; + readonly blockTimestamp?: string; + readonly transactionHash?: string; + readonly value: string; + readonly valueFormatted?: string; + readonly token: EvmTokenApprovalTokenInput | EvmTokenApprovalToken; + readonly spender: EvmTokenApprovalSpenderInput | EvmTokenApprovalSpender; +} + +export class EvmTokenApproval { + public static create(input: EvmTokenApprovalInput | EvmTokenApproval): EvmTokenApproval { + if (input instanceof EvmTokenApproval) { + return input; + } + return new EvmTokenApproval(input); + } + + public static fromJSON(json: EvmTokenApprovalJSON): EvmTokenApproval { + const input: EvmTokenApprovalInput = { + blockNumber: BigNumber.fromJSON(json.block_number), + blockTimestamp: json.block_timestamp, + transactionHash: json.transaction_hash, + value: json.value, + valueFormatted: json.value_formatted, + token: EvmTokenApprovalToken.fromJSON(json.token), + spender: EvmTokenApprovalSpender.fromJSON(json.spender), + }; + return EvmTokenApproval.create(input); + } + + public readonly blockNumber: BigNumber; + public readonly blockTimestamp?: string; + public readonly transactionHash?: string; + public readonly value: string; + public readonly valueFormatted?: string; + public readonly token: EvmTokenApprovalToken; + public readonly spender: EvmTokenApprovalSpender; + + private constructor(input: EvmTokenApprovalInput) { + this.blockNumber = BigNumber.create(input.blockNumber); + this.blockTimestamp = input.blockTimestamp; + this.transactionHash = input.transactionHash; + this.value = input.value; + this.valueFormatted = input.valueFormatted; + this.token = EvmTokenApprovalToken.create(input.token); + this.spender = EvmTokenApprovalSpender.create(input.spender); + } + + public toJSON(): EvmTokenApprovalJSON { + return { + block_number: this.blockNumber.toJSON(), + block_timestamp: this.blockTimestamp, + transaction_hash: this.transactionHash, + value: this.value, + value_formatted: this.valueFormatted, + token: this.token.toJSON(), + spender: this.spender.toJSON(), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmTokenApprovalSpender.ts b/packages/common/evmUtils/src/generated/types/EvmTokenApprovalSpender.ts new file mode 100644 index 0000000000..d96a11b4a4 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmTokenApprovalSpender.ts @@ -0,0 +1,63 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/tokenApproval/properties/spender +// type: tokenApproval_spender +// properties: +// - address ($ref: #/components/schemas/tokenApproval/properties/spender/properties/address) +// - address_label ($ref: #/components/schemas/tokenApproval/properties/spender/properties/address_label) +// - entity ($ref: #/components/schemas/tokenApproval/properties/spender/properties/entity) +// - entity_logo ($ref: #/components/schemas/tokenApproval/properties/spender/properties/entity_logo) + +export interface EvmTokenApprovalSpenderJSON { + readonly address?: EvmAddressJSON; + readonly address_label?: string; + readonly entity?: string; + readonly entity_logo?: string; +} + +export interface EvmTokenApprovalSpenderInput { + readonly address?: EvmAddressInput | EvmAddress; + readonly addressLabel?: string; + readonly entity?: string; + readonly entityLogo?: string; +} + +export class EvmTokenApprovalSpender { + public static create(input: EvmTokenApprovalSpenderInput | EvmTokenApprovalSpender): EvmTokenApprovalSpender { + if (input instanceof EvmTokenApprovalSpender) { + return input; + } + return new EvmTokenApprovalSpender(input); + } + + public static fromJSON(json: EvmTokenApprovalSpenderJSON): EvmTokenApprovalSpender { + const input: EvmTokenApprovalSpenderInput = { + address: json.address ? EvmAddress.fromJSON(json.address) : undefined, + addressLabel: json.address_label, + entity: json.entity, + entityLogo: json.entity_logo, + }; + return EvmTokenApprovalSpender.create(input); + } + + public readonly address?: EvmAddress; + public readonly addressLabel?: string; + public readonly entity?: string; + public readonly entityLogo?: string; + + private constructor(input: EvmTokenApprovalSpenderInput) { + this.address = input.address ? EvmAddress.create(input.address) : undefined; + this.addressLabel = input.addressLabel; + this.entity = input.entity; + this.entityLogo = input.entityLogo; + } + + public toJSON(): EvmTokenApprovalSpenderJSON { + return { + address: this.address ? this.address.toJSON() : undefined, + address_label: this.addressLabel, + entity: this.entity, + entity_logo: this.entityLogo, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmTokenApprovalToken.ts b/packages/common/evmUtils/src/generated/types/EvmTokenApprovalToken.ts new file mode 100644 index 0000000000..896ea50511 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmTokenApprovalToken.ts @@ -0,0 +1,112 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/tokenApproval/properties/token +// type: tokenApproval_token +// properties: +// - address ($ref: #/components/schemas/tokenApproval/properties/token/properties/address) +// - address_label ($ref: #/components/schemas/tokenApproval/properties/token/properties/address_label) +// - name ($ref: #/components/schemas/tokenApproval/properties/token/properties/name) +// - symbol ($ref: #/components/schemas/tokenApproval/properties/token/properties/symbol) +// - logo ($ref: #/components/schemas/tokenApproval/properties/token/properties/logo) +// - possible_spam ($ref: #/components/schemas/tokenApproval/properties/token/properties/possible_spam) +// - verified_contract ($ref: #/components/schemas/tokenApproval/properties/token/properties/verified_contract) +// - current_balance ($ref: #/components/schemas/tokenApproval/properties/token/properties/current_balance) +// - current_balance_formatted ($ref: #/components/schemas/tokenApproval/properties/token/properties/current_balance_formatted) +// - usd_price ($ref: #/components/schemas/tokenApproval/properties/token/properties/usd_price) +// - usd_at_risk ($ref: #/components/schemas/tokenApproval/properties/token/properties/usd_at_risk) + +export interface EvmTokenApprovalTokenJSON { + readonly address?: EvmAddressJSON; + readonly address_label?: string; + readonly name?: string; + readonly symbol?: string; + readonly logo?: string; + readonly possible_spam?: boolean; + readonly verified_contract?: boolean; + readonly current_balance?: string; + readonly current_balance_formatted?: string; + readonly usd_price?: string; + readonly usd_at_risk?: string; +} + +export interface EvmTokenApprovalTokenInput { + readonly address?: EvmAddressInput | EvmAddress; + readonly addressLabel?: string; + readonly name?: string; + readonly symbol?: string; + readonly logo?: string; + readonly possibleSpam?: boolean; + readonly verifiedContract?: boolean; + readonly currentBalance?: string; + readonly currentBalanceFormatted?: string; + readonly usdPrice?: string; + readonly usdAtRisk?: string; +} + +export class EvmTokenApprovalToken { + public static create(input: EvmTokenApprovalTokenInput | EvmTokenApprovalToken): EvmTokenApprovalToken { + if (input instanceof EvmTokenApprovalToken) { + return input; + } + return new EvmTokenApprovalToken(input); + } + + public static fromJSON(json: EvmTokenApprovalTokenJSON): EvmTokenApprovalToken { + const input: EvmTokenApprovalTokenInput = { + address: json.address ? EvmAddress.fromJSON(json.address) : undefined, + addressLabel: json.address_label, + name: json.name, + symbol: json.symbol, + logo: json.logo, + possibleSpam: json.possible_spam, + verifiedContract: json.verified_contract, + currentBalance: json.current_balance, + currentBalanceFormatted: json.current_balance_formatted, + usdPrice: json.usd_price, + usdAtRisk: json.usd_at_risk, + }; + return EvmTokenApprovalToken.create(input); + } + + public readonly address?: EvmAddress; + public readonly addressLabel?: string; + public readonly name?: string; + public readonly symbol?: string; + public readonly logo?: string; + public readonly possibleSpam?: boolean; + public readonly verifiedContract?: boolean; + public readonly currentBalance?: string; + public readonly currentBalanceFormatted?: string; + public readonly usdPrice?: string; + public readonly usdAtRisk?: string; + + private constructor(input: EvmTokenApprovalTokenInput) { + this.address = input.address ? EvmAddress.create(input.address) : undefined; + this.addressLabel = input.addressLabel; + this.name = input.name; + this.symbol = input.symbol; + this.logo = input.logo; + this.possibleSpam = input.possibleSpam; + this.verifiedContract = input.verifiedContract; + this.currentBalance = input.currentBalance; + this.currentBalanceFormatted = input.currentBalanceFormatted; + this.usdPrice = input.usdPrice; + this.usdAtRisk = input.usdAtRisk; + } + + public toJSON(): EvmTokenApprovalTokenJSON { + return { + address: this.address ? this.address.toJSON() : undefined, + address_label: this.addressLabel, + name: this.name, + symbol: this.symbol, + logo: this.logo, + possible_spam: this.possibleSpam, + verified_contract: this.verifiedContract, + current_balance: this.currentBalance, + current_balance_formatted: this.currentBalanceFormatted, + usd_price: this.usdPrice, + usd_at_risk: this.usdAtRisk, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmTokenDetails.ts b/packages/common/evmUtils/src/generated/types/EvmTokenDetails.ts new file mode 100644 index 0000000000..d14b41aab7 --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmTokenDetails.ts @@ -0,0 +1,70 @@ +import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; + +// $ref: #/components/schemas/TokenDetails +// type: TokenDetails +// properties: +// - address ($ref: #/components/schemas/TokenDetails/properties/address) +// - address_label ($ref: #/components/schemas/TokenDetails/properties/address_label) +// - token_name ($ref: #/components/schemas/TokenDetails/properties/token_name) +// - token_logo ($ref: #/components/schemas/TokenDetails/properties/token_logo) +// - token_symbol ($ref: #/components/schemas/TokenDetails/properties/token_symbol) + +export interface EvmTokenDetailsJSON { + readonly address?: EvmAddressJSON; + readonly address_label?: string; + readonly token_name?: string; + readonly token_logo?: string; + readonly token_symbol?: string; +} + +export interface EvmTokenDetailsInput { + readonly address?: EvmAddressInput | EvmAddress; + readonly addressLabel?: string; + readonly tokenName?: string; + readonly tokenLogo?: string; + readonly tokenSymbol?: string; +} + +export class EvmTokenDetails { + public static create(input: EvmTokenDetailsInput | EvmTokenDetails): EvmTokenDetails { + if (input instanceof EvmTokenDetails) { + return input; + } + return new EvmTokenDetails(input); + } + + public static fromJSON(json: EvmTokenDetailsJSON): EvmTokenDetails { + const input: EvmTokenDetailsInput = { + address: json.address ? EvmAddress.fromJSON(json.address) : undefined, + addressLabel: json.address_label, + tokenName: json.token_name, + tokenLogo: json.token_logo, + tokenSymbol: json.token_symbol, + }; + return EvmTokenDetails.create(input); + } + + public readonly address?: EvmAddress; + public readonly addressLabel?: string; + public readonly tokenName?: string; + public readonly tokenLogo?: string; + public readonly tokenSymbol?: string; + + private constructor(input: EvmTokenDetailsInput) { + this.address = input.address ? EvmAddress.create(input.address) : undefined; + this.addressLabel = input.addressLabel; + this.tokenName = input.tokenName; + this.tokenLogo = input.tokenLogo; + this.tokenSymbol = input.tokenSymbol; + } + + public toJSON(): EvmTokenDetailsJSON { + return { + address: this.address ? this.address.toJSON() : undefined, + address_label: this.addressLabel, + token_name: this.tokenName, + token_logo: this.tokenLogo, + token_symbol: this.tokenSymbol, + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletApprovals.ts b/packages/common/evmUtils/src/generated/types/EvmWalletApprovals.ts new file mode 100644 index 0000000000..43577af9ed --- /dev/null +++ b/packages/common/evmUtils/src/generated/types/EvmWalletApprovals.ts @@ -0,0 +1,72 @@ +import { EvmTokenApproval, EvmTokenApprovalInput, EvmTokenApprovalJSON } from '../types/EvmTokenApproval'; + +// $ref: #/components/schemas/walletApprovals +// type: walletApprovals +// properties: +// - page ($ref: #/components/schemas/walletApprovals/properties/page) +// - page_size ($ref: #/components/schemas/walletApprovals/properties/page_size) +// - cursor ($ref: #/components/schemas/walletApprovals/properties/cursor) +// - result ($ref: #/components/schemas/tokenApproval) + +export interface EvmWalletApprovalsJSON { + readonly page: number; + readonly page_size: number; + readonly cursor: string; + readonly result: EvmTokenApprovalJSON[]; +} + +export interface EvmWalletApprovalsInput { + readonly page: number; + readonly pageSize: number; + readonly cursor: string; + readonly result: EvmTokenApprovalInput[] | EvmTokenApproval[]; +} + +export class EvmWalletApprovals { + public static create(input: EvmWalletApprovalsInput | EvmWalletApprovals): EvmWalletApprovals { + if (input instanceof EvmWalletApprovals) { + return input; + } + return new EvmWalletApprovals(input); + } + + public static fromJSON(json: EvmWalletApprovalsJSON): EvmWalletApprovals { + const input: EvmWalletApprovalsInput = { + page: json.page, + pageSize: json.page_size, + cursor: json.cursor, + result: json.result.map((item) => EvmTokenApproval.fromJSON(item)), + }; + return EvmWalletApprovals.create(input); + } + + /** + * @description The current page of the result + */ + public readonly page: number; + /** + * @description The number of results per page + */ + public readonly pageSize: number; + /** + * @description The cursor to get to the next page + */ + public readonly cursor: string; + public readonly result: EvmTokenApproval[]; + + private constructor(input: EvmWalletApprovalsInput) { + this.page = input.page; + this.pageSize = input.pageSize; + this.cursor = input.cursor; + this.result = input.result.map((item) => EvmTokenApproval.create(item)); + } + + public toJSON(): EvmWalletApprovalsJSON { + return { + page: this.page, + page_size: this.pageSize, + cursor: this.cursor, + result: this.result.map((item) => item.toJSON()), + } + } +} diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts index 744dac7893..89c465ad72 100644 --- a/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts +++ b/packages/common/evmUtils/src/generated/types/EvmWalletHistoryTransaction.ts @@ -1,7 +1,7 @@ import { EvmAddress, EvmAddressInput, EvmAddressJSON, EvmInternalTransaction, EvmInternalTransactionInput, EvmInternalTransactionJSON } from '../../dataTypes'; import { BigNumber, BigNumberInput, BigNumberJSON } from '@moralisweb3/common-core'; import { EvmETransactionCategory, EvmETransactionCategoryValue, EvmETransactionCategoryInput, EvmETransactionCategoryJSON } from '../types/EvmETransactionCategory'; -import { EvmResolveContractInteractionResponse, EvmResolveContractInteractionResponseInput, EvmResolveContractInteractionResponseJSON } from '../types/EvmResolveContractInteractionResponse'; +import { EvmResolveContractInteractionResponse, EvmResolveContractInteractionResponseValue, EvmResolveContractInteractionResponseInput, EvmResolveContractInteractionResponseJSON } from '../types/EvmResolveContractInteractionResponse'; import { EvmWalletHistoryNftTransfer, EvmWalletHistoryNftTransferInput, EvmWalletHistoryNftTransferJSON } from '../types/EvmWalletHistoryNftTransfer'; import { EvmWalletHistoryErc20Transfer, EvmWalletHistoryErc20TransferInput, EvmWalletHistoryErc20TransferJSON } from '../types/EvmWalletHistoryErc20Transfer'; import { EvmNativeTransfer, EvmNativeTransferInput, EvmNativeTransferJSON } from '../types/EvmNativeTransfer'; @@ -70,7 +70,7 @@ export interface EvmWalletHistoryTransactionJSON { readonly block_hash: string; readonly internal_transactions?: EvmInternalTransactionJSON[]; readonly category: EvmETransactionCategoryJSON; - readonly contract_interactions?: EvmResolveContractInteractionResponseJSON; + readonly contract_interactions: EvmResolveContractInteractionResponseJSON; readonly possible_spam?: boolean; readonly method_label?: string; readonly summary: string; @@ -106,7 +106,7 @@ export interface EvmWalletHistoryTransactionInput { readonly blockHash: string; readonly internalTransactions?: EvmInternalTransactionInput[] | EvmInternalTransaction[]; readonly category: EvmETransactionCategoryInput | EvmETransactionCategoryValue; - readonly contractInteractions?: EvmResolveContractInteractionResponseInput | EvmResolveContractInteractionResponse; + readonly contractInteractions: EvmResolveContractInteractionResponseInput | EvmResolveContractInteractionResponseValue; readonly possibleSpam?: boolean; readonly methodLabel?: string; readonly summary: string; @@ -151,7 +151,7 @@ export class EvmWalletHistoryTransaction { blockHash: json.block_hash, internalTransactions: json.internal_transactions ? json.internal_transactions.map((item) => EvmInternalTransaction.fromJSON(item)) : undefined, category: EvmETransactionCategory.fromJSON(json.category), - contractInteractions: json.contract_interactions ? EvmResolveContractInteractionResponse.fromJSON(json.contract_interactions) : undefined, + contractInteractions: EvmResolveContractInteractionResponse.fromJSON(json.contract_interactions), possibleSpam: json.possible_spam, methodLabel: json.method_label, summary: json.summary, @@ -239,7 +239,7 @@ export class EvmWalletHistoryTransaction { /** * @description The contract interactions that happend in the transaction */ - public readonly contractInteractions?: EvmResolveContractInteractionResponse; + public readonly contractInteractions: EvmResolveContractInteractionResponseValue; /** * @description Is transaction possible spam */ @@ -283,7 +283,7 @@ export class EvmWalletHistoryTransaction { this.blockHash = input.blockHash; this.internalTransactions = input.internalTransactions ? input.internalTransactions.map((item) => EvmInternalTransaction.create(item)) : undefined; this.category = EvmETransactionCategory.create(input.category); - this.contractInteractions = input.contractInteractions ? EvmResolveContractInteractionResponse.create(input.contractInteractions) : undefined; + this.contractInteractions = EvmResolveContractInteractionResponse.create(input.contractInteractions); this.possibleSpam = input.possibleSpam; this.methodLabel = input.methodLabel; this.summary = input.summary; @@ -320,7 +320,7 @@ export class EvmWalletHistoryTransaction { block_hash: this.blockHash, internal_transactions: this.internalTransactions ? this.internalTransactions.map((item) => item.toJSON()) : undefined, category: this.category, - contract_interactions: this.contractInteractions ? this.contractInteractions.toJSON() : undefined, + contract_interactions: EvmResolveContractInteractionResponse.toJSON(this.contractInteractions), possible_spam: this.possibleSpam, method_label: this.methodLabel, summary: this.summary, diff --git a/packages/common/evmUtils/src/generated/types/EvmWalletProfitabilityTokenData.ts b/packages/common/evmUtils/src/generated/types/EvmWalletProfitabilityTokenData.ts index 7a418f3894..02a7d28ea4 100644 --- a/packages/common/evmUtils/src/generated/types/EvmWalletProfitabilityTokenData.ts +++ b/packages/common/evmUtils/src/generated/types/EvmWalletProfitabilityTokenData.ts @@ -20,8 +20,6 @@ import { EvmAddress, EvmAddressInput, EvmAddressJSON } from '../../dataTypes'; // - symbol ($ref: #/components/schemas/WalletProfitabilityTokenData/properties/symbol) // - decimals ($ref: #/components/schemas/WalletProfitabilityTokenData/properties/decimals) // - logo ($ref: #/components/schemas/WalletProfitabilityTokenData/properties/logo) -// - logo_hash ($ref: #/components/schemas/WalletProfitabilityTokenData/properties/logo_hash) -// - thumbnail ($ref: #/components/schemas/WalletProfitabilityTokenData/properties/thumbnail) // - possible_spam ($ref: #/components/schemas/WalletProfitabilityTokenData/properties/possible_spam) export interface EvmWalletProfitabilityTokenDataJSON { @@ -42,9 +40,7 @@ export interface EvmWalletProfitabilityTokenDataJSON { readonly symbol: string; readonly decimals: string; readonly logo: string; - readonly logo_hash: string; - readonly thumbnail: string; - readonly possible_spam?: boolean; + readonly possible_spam: boolean; } export interface EvmWalletProfitabilityTokenDataInput { @@ -65,9 +61,7 @@ export interface EvmWalletProfitabilityTokenDataInput { readonly symbol: string; readonly decimals: number; readonly logo: string; - readonly logoHash: string; - readonly thumbnail: string; - readonly possibleSpam?: boolean; + readonly possibleSpam: boolean; } export class EvmWalletProfitabilityTokenData { @@ -97,8 +91,6 @@ export class EvmWalletProfitabilityTokenData { symbol: json.symbol, decimals: Number(json.decimals), logo: json.logo, - logoHash: json.logo_hash, - thumbnail: json.thumbnail, possibleSpam: json.possible_spam, }; return EvmWalletProfitabilityTokenData.create(input); @@ -172,18 +164,10 @@ export class EvmWalletProfitabilityTokenData { * @description Logo URL of the token. */ public readonly logo: string; - /** - * @description Logo hash of the token. - */ - public readonly logoHash: string; - /** - * @description Thumbnail image URL of the token. - */ - public readonly thumbnail: string; /** * @description Indicates whether the token is possibly spam. */ - public readonly possibleSpam?: boolean; + public readonly possibleSpam: boolean; private constructor(input: EvmWalletProfitabilityTokenDataInput) { this.tokenAddress = EvmAddress.create(input.tokenAddress); @@ -203,8 +187,6 @@ export class EvmWalletProfitabilityTokenData { this.symbol = input.symbol; this.decimals = input.decimals; this.logo = input.logo; - this.logoHash = input.logoHash; - this.thumbnail = input.thumbnail; this.possibleSpam = input.possibleSpam; } @@ -227,8 +209,6 @@ export class EvmWalletProfitabilityTokenData { symbol: this.symbol, decimals: String(this.decimals), logo: this.logo, - logo_hash: this.logoHash, - thumbnail: this.thumbnail, possible_spam: this.possibleSpam, } } diff --git a/packages/common/evmUtils/src/generated/types/index.ts b/packages/common/evmUtils/src/generated/types/index.ts index 8154779c5a..034d3f88d4 100644 --- a/packages/common/evmUtils/src/generated/types/index.ts +++ b/packages/common/evmUtils/src/generated/types/index.ts @@ -17,6 +17,7 @@ export * from './EvmSoldPrice'; export * from './EvmErc20Price'; export * from './EvmGetMultipleTokenPricesDto'; export * from './EvmErc20TokenOwnerCollection'; +export * from './EvmWalletApprovals'; export * from './EvmWalletHistory'; export * from './EvmErc20TokenBalanceWithPriceResult'; export * from './EvmNetWorthResult'; @@ -51,6 +52,7 @@ export * from './EvmSoldPriceAverageSale'; export * from './EvmNativeErc20Price'; export * from './EvmTokenPriceItem'; export * from './EvmErc20TokenOwner'; +export * from './EvmTokenApproval'; export * from './EvmWalletHistoryTransaction'; export * from './EvmErc20TokenBalanceWithPrice'; export * from './EvmChainNetWorth'; @@ -75,7 +77,8 @@ export * from './EvmTopProfitableWalletPerTokenResponse'; export * from './EvmSoldPriceLastSalePaymentToken'; export * from './EvmSoldPriceLowestSalePaymentToken'; export * from './EvmSoldPriceHighestSalePaymentToken'; -export * from './EvmResolveContractInteractionResponse'; +export * from './EvmTokenApprovalToken'; +export * from './EvmTokenApprovalSpender'; export * from './EvmWalletHistoryNftTransfer'; export * from './EvmWalletHistoryErc20Transfer'; export * from './EvmNativeTransfer'; @@ -83,10 +86,16 @@ export * from './EvmLogVerbose'; export * from './EvmDefiTokenBalance'; export * from './EvmDefiPositionDetails'; export * from './EvmTransactionTimestamp'; -export * from './EvmCommonContractData'; +export * from './EvmApprovalResponse'; +export * from './EvmRevokeResponse'; +export * from './EvmSetApprovalAllResponse'; +export * from './EvmSetRevokeAllResponse'; export * from './EvmNormalizedMetadata'; export * from './EvmDecodedEvent'; -export * from './EvmContractTokenDetails'; -export * from './EvmContractSpenderDetails'; +export * from './EvmApprovalData'; +export * from './EvmSetApprovalAllData'; export * from './EvmNormalizedMetadataAttribute'; export * from './EvmDecodedEventParamsItem'; +export * from './EvmTokenDetails'; +export * from './EvmSpenderDetails'; +export * from './EvmResolveContractInteractionResponse'; diff --git a/packages/evmApi/src/generated/ClientEvmApi.ts b/packages/evmApi/src/generated/ClientEvmApi.ts index 6d1abbb18a..1a1c40a439 100644 --- a/packages/evmApi/src/generated/ClientEvmApi.ts +++ b/packages/evmApi/src/generated/ClientEvmApi.ts @@ -1,10 +1,10 @@ // CAUTION: This file is automatically generated. Do not edit it manually! -import { getBlockOperation, GetBlockRequest, GetBlockResponseAdapter, getDateToBlockOperation, GetDateToBlockRequest, GetDateToBlockResponseAdapter, GetBlockStatsOperationResponseJSON, GetBlockStatsOperation, GetBlockStatsOperationRequest, GetBlockStatsOperationResponse, getContractEventsOperation, GetContractEventsRequest, GetContractEventsResponseAdapter, getContractLogsOperation, GetContractLogsRequest, GetContractLogsResponseAdapter, getContractNFTsOperation, GetContractNFTsRequest, GetContractNFTsResponseAdapter, getMultipleNFTsOperation, GetMultipleNFTsRequest, GetMultipleNFTsResponseAdapter, getNFTContractMetadataOperation, GetNFTContractMetadataRequest, GetNFTContractMetadataResponseAdapter, getNFTContractTransfersOperation, GetNFTContractTransfersRequest, GetNFTContractTransfersResponseAdapter, getNFTLowestPriceOperation, GetNFTLowestPriceRequest, GetNFTLowestPriceResponseAdapter, getNFTMetadataOperation, GetNFTMetadataRequest, GetNFTMetadataResponseAdapter, getNFTOwnersOperation, GetNFTOwnersRequest, GetNFTOwnersResponseAdapter, getNFTTokenIdOwnersOperation, GetNFTTokenIdOwnersRequest, GetNFTTokenIdOwnersResponseAdapter, getNFTTransfersByBlockOperation, GetNFTTransfersByBlockRequest, GetNFTTransfersByBlockResponseAdapter, getNFTTransfersFromToBlockOperation, GetNFTTransfersFromToBlockRequest, GetNFTTransfersFromToBlockResponseAdapter, getNFTTransfersOperation, GetNFTTransfersRequest, GetNFTTransfersResponseAdapter, getWalletNFTCollectionsOperation, GetWalletNFTCollectionsRequest, GetWalletNFTCollectionsResponseAdapter, getWalletNFTsOperation, GetWalletNFTsRequest, GetWalletNFTsResponseAdapter, getWalletNFTTransfersOperation, GetWalletNFTTransfersRequest, GetWalletNFTTransfersResponseAdapter, reSyncMetadataOperation, ReSyncMetadataRequest, ReSyncMetadataResponseAdapter, syncNFTContractOperation, SyncNFTContractRequest, SyncNFTContractResponseAdapter, GetNFTTradesOperationResponseJSON, GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationResponse, GetNFTTradesByTokenOperationResponseJSON, GetNFTTradesByTokenOperation, GetNFTTradesByTokenOperationRequest, GetNFTTradesByTokenOperationResponse, GetNFTContractSalePricesOperationResponseJSON, GetNFTContractSalePricesOperation, GetNFTContractSalePricesOperationRequest, GetNFTContractSalePricesOperationResponse, GetNFTSalePricesOperationResponseJSON, GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSalePricesOperationResponse, GetNFTCollectionStatsOperationResponseJSON, GetNFTCollectionStatsOperation, GetNFTCollectionStatsOperationRequest, GetNFTCollectionStatsOperationResponse, GetNFTTokenStatsOperationResponseJSON, GetNFTTokenStatsOperation, GetNFTTokenStatsOperationRequest, GetNFTTokenStatsOperationResponse, getInternalTransactionsOperation, GetInternalTransactionsRequest, GetInternalTransactionsResponseAdapter, getTransactionOperation, GetTransactionRequest, GetTransactionResponseAdapter, getTransactionVerboseOperation, GetTransactionVerboseRequest, GetTransactionVerboseResponseAdapter, getWalletTransactionsOperation, GetWalletTransactionsRequest, GetWalletTransactionsResponseAdapter, getWalletTransactionsVerboseOperation, GetWalletTransactionsVerboseRequest, GetWalletTransactionsVerboseResponseAdapter, getNativeBalanceOperation, GetNativeBalanceRequest, GetNativeBalanceResponseAdapter, getNativeBalancesForAddressesOperation, GetNativeBalancesForAddressesRequest, GetNativeBalancesForAddressesResponseAdapter, getPairAddressOperation, GetPairAddressRequest, GetPairAddressResponseAdapter, getPairReservesOperation, GetPairReservesRequest, GetPairReservesResponseAdapter, GetPairPriceOperationResponseJSON, GetPairPriceOperation, GetPairPriceOperationRequest, GetPairPriceOperationResponse, getTokenAllowanceOperation, GetTokenAllowanceRequest, GetTokenAllowanceResponseAdapter, getTokenMetadataBySymbolOperation, GetTokenMetadataBySymbolRequest, GetTokenMetadataBySymbolResponseAdapter, getTokenMetadataOperation, GetTokenMetadataRequest, GetTokenMetadataResponseAdapter, getTokenPriceOperation, GetTokenPriceRequest, GetTokenPriceResponseAdapter, getTokenTransfersOperation, GetTokenTransfersRequest, GetTokenTransfersResponseAdapter, getWalletTokenBalancesOperation, GetWalletTokenBalancesRequest, GetWalletTokenBalancesResponseAdapter, getWalletTokenTransfersOperation, GetWalletTokenTransfersRequest, GetWalletTokenTransfersResponseAdapter, GetMultipleTokenPricesOperationResponseJSON, GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationBody, GetMultipleTokenPricesOperationResponse, GetTokenOwnersOperationResponseJSON, GetTokenOwnersOperation, GetTokenOwnersOperationRequest, GetTokenOwnersOperationResponse, GetTokenStatsOperationResponseJSON, GetTokenStatsOperation, GetTokenStatsOperationRequest, GetTokenStatsOperationResponse, GetTopProfitableWalletPerTokenOperationResponseJSON, GetTopProfitableWalletPerTokenOperation, GetTopProfitableWalletPerTokenOperationRequest, GetTopProfitableWalletPerTokenOperationResponse, resolveAddressOperation, ResolveAddressRequest, ResolveAddressResponseAdapter, resolveDomainOperation, ResolveDomainRequest, ResolveDomainResponseAdapter, resolveENSDomainOperation, ResolveENSDomainRequest, ResolveENSDomainResponseAdapter, ResolveAddressToDomainOperationResponseJSON, ResolveAddressToDomainOperation, ResolveAddressToDomainOperationRequest, ResolveAddressToDomainOperationResponse, runContractFunctionOperation, RunContractFunctionRequest, RunContractFunctionResponseAdapter, Web3ApiVersionOperationResponseJSON, Web3ApiVersionOperation, Web3ApiVersionOperationResponse, EndpointWeightsOperationResponseJSON, EndpointWeightsOperation, EndpointWeightsOperationResponse, ReviewContractsOperationResponseJSON, ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationBody, ReviewContractsOperationResponse, uploadFolderOperation, UploadFolderRequest, UploadFolderResponseAdapter, GetWalletHistoryOperationResponseJSON, GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationResponse, GetWalletTokenBalancesPriceOperationResponseJSON, GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationResponse, GetWalletNetWorthOperationResponseJSON, GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationResponse, GetDefiSummaryOperationResponseJSON, GetDefiSummaryOperation, GetDefiSummaryOperationRequest, GetDefiSummaryOperationResponse, GetDefiPositionsByProtocolOperationResponseJSON, GetDefiPositionsByProtocolOperation, GetDefiPositionsByProtocolOperationRequest, GetDefiPositionsByProtocolOperationResponse, GetDefiPositionsSummaryOperationResponseJSON, GetDefiPositionsSummaryOperation, GetDefiPositionsSummaryOperationRequest, GetDefiPositionsSummaryOperationResponse, GetWalletActiveChainsOperationResponseJSON, GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationResponse, GetWalletStatsOperationResponseJSON, GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationResponse, GetWalletProfitabilitySummaryOperationResponseJSON, GetWalletProfitabilitySummaryOperation, GetWalletProfitabilitySummaryOperationRequest, GetWalletProfitabilitySummaryOperationResponse, GetWalletProfitabilityOperationResponseJSON, GetWalletProfitabilityOperation, GetWalletProfitabilityOperationRequest, GetWalletProfitabilityOperationResponse, GetTopERC20TokensByMarketCapOperationResponseJSON, GetTopERC20TokensByMarketCapOperation, GetTopERC20TokensByMarketCapOperationResponse, GetTopERC20TokensByPriceMoversOperationResponseJSON, GetTopERC20TokensByPriceMoversOperation, GetTopERC20TokensByPriceMoversOperationResponse, GetTopNFTCollectionsByMarketCapOperationResponseJSON, GetTopNFTCollectionsByMarketCapOperation, GetTopNFTCollectionsByMarketCapOperationResponse, GetHottestNFTCollectionsByTradingVolumeOperationResponseJSON, GetHottestNFTCollectionsByTradingVolumeOperation, GetHottestNFTCollectionsByTradingVolumeOperationResponse, GetTopCryptoCurrenciesByMarketCapOperationResponseJSON, GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByMarketCapOperationResponse, GetTopCryptoCurrenciesByTradingVolumeOperationResponseJSON, GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesByTradingVolumeOperationResponse } from '@moralisweb3/common-evm-utils'; +import { getBlockOperation, GetBlockRequest, GetBlockResponseAdapter, getDateToBlockOperation, GetDateToBlockRequest, GetDateToBlockResponseAdapter, GetBlockStatsOperationResponseJSON, GetBlockStatsOperation, GetBlockStatsOperationRequest, GetBlockStatsOperationResponse, getContractEventsOperation, GetContractEventsRequest, GetContractEventsResponseAdapter, getContractLogsOperation, GetContractLogsRequest, GetContractLogsResponseAdapter, getContractNFTsOperation, GetContractNFTsRequest, GetContractNFTsResponseAdapter, getMultipleNFTsOperation, GetMultipleNFTsRequest, GetMultipleNFTsResponseAdapter, getNFTContractMetadataOperation, GetNFTContractMetadataRequest, GetNFTContractMetadataResponseAdapter, getNFTContractTransfersOperation, GetNFTContractTransfersRequest, GetNFTContractTransfersResponseAdapter, getNFTLowestPriceOperation, GetNFTLowestPriceRequest, GetNFTLowestPriceResponseAdapter, getNFTMetadataOperation, GetNFTMetadataRequest, GetNFTMetadataResponseAdapter, getNFTOwnersOperation, GetNFTOwnersRequest, GetNFTOwnersResponseAdapter, getNFTTokenIdOwnersOperation, GetNFTTokenIdOwnersRequest, GetNFTTokenIdOwnersResponseAdapter, getNFTTransfersByBlockOperation, GetNFTTransfersByBlockRequest, GetNFTTransfersByBlockResponseAdapter, getNFTTransfersFromToBlockOperation, GetNFTTransfersFromToBlockRequest, GetNFTTransfersFromToBlockResponseAdapter, getNFTTransfersOperation, GetNFTTransfersRequest, GetNFTTransfersResponseAdapter, getWalletNFTCollectionsOperation, GetWalletNFTCollectionsRequest, GetWalletNFTCollectionsResponseAdapter, getWalletNFTsOperation, GetWalletNFTsRequest, GetWalletNFTsResponseAdapter, getWalletNFTTransfersOperation, GetWalletNFTTransfersRequest, GetWalletNFTTransfersResponseAdapter, reSyncMetadataOperation, ReSyncMetadataRequest, ReSyncMetadataResponseAdapter, syncNFTContractOperation, SyncNFTContractRequest, SyncNFTContractResponseAdapter, GetNFTTradesOperationResponseJSON, GetNFTTradesOperation, GetNFTTradesOperationRequest, GetNFTTradesOperationResponse, GetNFTTradesByTokenOperationResponseJSON, GetNFTTradesByTokenOperation, GetNFTTradesByTokenOperationRequest, GetNFTTradesByTokenOperationResponse, GetNFTContractSalePricesOperationResponseJSON, GetNFTContractSalePricesOperation, GetNFTContractSalePricesOperationRequest, GetNFTContractSalePricesOperationResponse, GetNFTSalePricesOperationResponseJSON, GetNFTSalePricesOperation, GetNFTSalePricesOperationRequest, GetNFTSalePricesOperationResponse, GetNFTCollectionStatsOperationResponseJSON, GetNFTCollectionStatsOperation, GetNFTCollectionStatsOperationRequest, GetNFTCollectionStatsOperationResponse, GetNFTTokenStatsOperationResponseJSON, GetNFTTokenStatsOperation, GetNFTTokenStatsOperationRequest, GetNFTTokenStatsOperationResponse, getInternalTransactionsOperation, GetInternalTransactionsRequest, GetInternalTransactionsResponseAdapter, getTransactionOperation, GetTransactionRequest, GetTransactionResponseAdapter, getTransactionVerboseOperation, GetTransactionVerboseRequest, GetTransactionVerboseResponseAdapter, getWalletTransactionsOperation, GetWalletTransactionsRequest, GetWalletTransactionsResponseAdapter, getWalletTransactionsVerboseOperation, GetWalletTransactionsVerboseRequest, GetWalletTransactionsVerboseResponseAdapter, getNativeBalanceOperation, GetNativeBalanceRequest, GetNativeBalanceResponseAdapter, getNativeBalancesForAddressesOperation, GetNativeBalancesForAddressesRequest, GetNativeBalancesForAddressesResponseAdapter, getPairAddressOperation, GetPairAddressRequest, GetPairAddressResponseAdapter, getPairReservesOperation, GetPairReservesRequest, GetPairReservesResponseAdapter, GetPairPriceOperationResponseJSON, GetPairPriceOperation, GetPairPriceOperationRequest, GetPairPriceOperationResponse, getTokenAllowanceOperation, GetTokenAllowanceRequest, GetTokenAllowanceResponseAdapter, getTokenMetadataBySymbolOperation, GetTokenMetadataBySymbolRequest, GetTokenMetadataBySymbolResponseAdapter, getTokenMetadataOperation, GetTokenMetadataRequest, GetTokenMetadataResponseAdapter, getTokenPriceOperation, GetTokenPriceRequest, GetTokenPriceResponseAdapter, getTokenTransfersOperation, GetTokenTransfersRequest, GetTokenTransfersResponseAdapter, getWalletTokenBalancesOperation, GetWalletTokenBalancesRequest, GetWalletTokenBalancesResponseAdapter, getWalletTokenTransfersOperation, GetWalletTokenTransfersRequest, GetWalletTokenTransfersResponseAdapter, GetMultipleTokenPricesOperationResponseJSON, GetMultipleTokenPricesOperation, GetMultipleTokenPricesOperationRequest, GetMultipleTokenPricesOperationBody, GetMultipleTokenPricesOperationResponse, GetTokenOwnersOperationResponseJSON, GetTokenOwnersOperation, GetTokenOwnersOperationRequest, GetTokenOwnersOperationResponse, GetTokenStatsOperationResponseJSON, GetTokenStatsOperation, GetTokenStatsOperationRequest, GetTokenStatsOperationResponse, GetTopProfitableWalletPerTokenOperationResponseJSON, GetTopProfitableWalletPerTokenOperation, GetTopProfitableWalletPerTokenOperationRequest, GetTopProfitableWalletPerTokenOperationResponse, resolveAddressOperation, ResolveAddressRequest, ResolveAddressResponseAdapter, resolveDomainOperation, ResolveDomainRequest, ResolveDomainResponseAdapter, resolveENSDomainOperation, ResolveENSDomainRequest, ResolveENSDomainResponseAdapter, ResolveAddressToDomainOperationResponseJSON, ResolveAddressToDomainOperation, ResolveAddressToDomainOperationRequest, ResolveAddressToDomainOperationResponse, runContractFunctionOperation, RunContractFunctionRequest, RunContractFunctionResponseAdapter, Web3ApiVersionOperationResponseJSON, Web3ApiVersionOperation, Web3ApiVersionOperationResponse, EndpointWeightsOperationResponseJSON, EndpointWeightsOperation, EndpointWeightsOperationResponse, ReviewContractsOperationResponseJSON, ReviewContractsOperation, ReviewContractsOperationRequest, ReviewContractsOperationBody, ReviewContractsOperationResponse, uploadFolderOperation, UploadFolderRequest, UploadFolderResponseAdapter, GetWalletApprovalsOperationResponseJSON, GetWalletApprovalsOperation, GetWalletApprovalsOperationRequest, GetWalletApprovalsOperationResponse, GetWalletHistoryOperationResponseJSON, GetWalletHistoryOperation, GetWalletHistoryOperationRequest, GetWalletHistoryOperationResponse, GetWalletTokenBalancesPriceOperationResponseJSON, GetWalletTokenBalancesPriceOperation, GetWalletTokenBalancesPriceOperationRequest, GetWalletTokenBalancesPriceOperationResponse, GetWalletNetWorthOperationResponseJSON, GetWalletNetWorthOperation, GetWalletNetWorthOperationRequest, GetWalletNetWorthOperationResponse, GetDefiSummaryOperationResponseJSON, GetDefiSummaryOperation, GetDefiSummaryOperationRequest, GetDefiSummaryOperationResponse, GetDefiPositionsByProtocolOperationResponseJSON, GetDefiPositionsByProtocolOperation, GetDefiPositionsByProtocolOperationRequest, GetDefiPositionsByProtocolOperationResponse, GetDefiPositionsSummaryOperationResponseJSON, GetDefiPositionsSummaryOperation, GetDefiPositionsSummaryOperationRequest, GetDefiPositionsSummaryOperationResponse, GetWalletActiveChainsOperationResponseJSON, GetWalletActiveChainsOperation, GetWalletActiveChainsOperationRequest, GetWalletActiveChainsOperationResponse, GetWalletStatsOperationResponseJSON, GetWalletStatsOperation, GetWalletStatsOperationRequest, GetWalletStatsOperationResponse, GetWalletProfitabilitySummaryOperationResponseJSON, GetWalletProfitabilitySummaryOperation, GetWalletProfitabilitySummaryOperationRequest, GetWalletProfitabilitySummaryOperationResponse, GetWalletProfitabilityOperationResponseJSON, GetWalletProfitabilityOperation, GetWalletProfitabilityOperationRequest, GetWalletProfitabilityOperationResponse, GetTopERC20TokensByMarketCapOperationResponseJSON, GetTopERC20TokensByMarketCapOperation, GetTopERC20TokensByMarketCapOperationResponse, GetTopERC20TokensByPriceMoversOperationResponseJSON, GetTopERC20TokensByPriceMoversOperation, GetTopERC20TokensByPriceMoversOperationResponse, GetTopNFTCollectionsByMarketCapOperationResponseJSON, GetTopNFTCollectionsByMarketCapOperation, GetTopNFTCollectionsByMarketCapOperationResponse, GetHottestNFTCollectionsByTradingVolumeOperationResponseJSON, GetHottestNFTCollectionsByTradingVolumeOperation, GetHottestNFTCollectionsByTradingVolumeOperationResponse, GetTopCryptoCurrenciesByMarketCapOperationResponseJSON, GetTopCryptoCurrenciesByMarketCapOperation, GetTopCryptoCurrenciesByMarketCapOperationResponse, GetTopCryptoCurrenciesByTradingVolumeOperationResponseJSON, GetTopCryptoCurrenciesByTradingVolumeOperation, GetTopCryptoCurrenciesByTradingVolumeOperationResponse } from '@moralisweb3/common-evm-utils'; import { NullableOperationResolver, OperationResolver, OperationV3Resolver, PaginatedOperationResolver, PaginatedResponseV3Adapter, PaginatedOperationV3Resolver } from '@moralisweb3/api-utils'; import { ApiModule, ResponseAdapter } from '@moralisweb3/common-core'; export abstract class ClientEvmApi extends ApiModule { - + public readonly block = { getBlock: (request: GetBlockRequest): Promise => { return new NullableOperationResolver(getBlockOperation, this.baseUrl, this.core).fetch(request); @@ -217,6 +217,9 @@ export abstract class ClientEvmApi extends ApiModule { }; public readonly wallets = { + getWalletApprovals: (request: GetWalletApprovalsOperationRequest): Promise> => { + return new PaginatedOperationV3Resolver(GetWalletApprovalsOperation, this.baseUrl, this.core).fetch(request, null); + }, getWalletHistory: (request: GetWalletHistoryOperationRequest): Promise> => { return new PaginatedOperationV3Resolver(GetWalletHistoryOperation, this.baseUrl, this.core).fetch(request, null); },