diff --git a/packages/shared/src/lib/auxiliary/noves/enums/index.ts b/packages/shared/src/lib/auxiliary/noves/enums/index.ts index dbaec01429..edd36f0b92 100644 --- a/packages/shared/src/lib/auxiliary/noves/enums/index.ts +++ b/packages/shared/src/lib/auxiliary/noves/enums/index.ts @@ -1,2 +1,13 @@ export * from './eth-rpc-method.enum' +export * from './noves-tx-type-cross-chain.enum' +export * from './noves-tx-type-dex.enum' +export * from './noves-tx-type-domain.enum' +export * from './noves-tx-type-governance.enum' +export * from './noves-tx-type-infrastructure.enum' +export * from './noves-tx-type-lending.enum' +export * from './noves-tx-type-miscellaneous.enum' +export * from './noves-tx-type-nft.enum' +export * from './noves-tx-type-special.enum' +export * from './noves-tx-type-token.enum' +export * from './noves-tx-type-yield.enum' export * from './supported-noves-chain.enum' diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-cross-chain.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-cross-chain.enum.ts new file mode 100644 index 0000000000..00c0822c11 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-cross-chain.enum.ts @@ -0,0 +1,5 @@ +// https://docs.noves.fi/reference/cross-chain +export enum NovesTxTypeCrossChain { + ReceiveFromBridge = 'receiveFromBridge', + SendToBridge = 'sendToBridge', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-dex.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-dex.enum.ts new file mode 100644 index 0000000000..74a5117348 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-dex.enum.ts @@ -0,0 +1,12 @@ +// https://docs.noves.fi/reference/dex-transactions +export enum NovesTxTypeDEX { + AddLiquidity = 'addLiquidity', + CancelOrderTransaction = 'cancelOrderTransaction', + CustodiedRemoveLiquidity = 'custodiedRemoveLiquidity', + DepositToExchange = 'depositToExchange', + FillOrderTransaction = 'fillOrderTransaction', + PlaceOrderTransaction = 'placeOrderTransaction', + Swap = 'swap', + RemoveLiquidity = 'removeLiquidity', + WithdrawFromExchange = 'withdrawFromExchange', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-domain.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-domain.enum.ts new file mode 100644 index 0000000000..84db3fb271 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-domain.enum.ts @@ -0,0 +1,5 @@ +// https://docs.noves.fi/reference/domain-services +export enum NovesTxTypeDomain { + RegisterDomain = 'registerDomain', + RenewDomain = 'renewDomain', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-governance.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-governance.enum.ts new file mode 100644 index 0000000000..6101f25d54 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-governance.enum.ts @@ -0,0 +1,6 @@ +// https://docs.noves.fi/reference/governance +export enum NovesTxTypeGovernance { + Delegate = 'delegate', + SignMultisig = 'signMultisig', + Vote = 'vote', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-infrastructure.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-infrastructure.enum.ts new file mode 100644 index 0000000000..67ca420ebc --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-infrastructure.enum.ts @@ -0,0 +1,7 @@ +// https://docs.noves.fi/reference/infrastructure +export enum NovesTxTypeInfrastructure { + CreateContract = 'createContract', + DeployContract = 'deployContract', + SystemTransaction = 'systemTransaction', + ProtocolTransaction = 'protocolTransaction', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-lending.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-lending.enum.ts new file mode 100644 index 0000000000..679f9b3c19 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-lending.enum.ts @@ -0,0 +1,8 @@ +// https://docs.noves.fi/reference/lending +export enum NovesTxTypeLending { + Borrow = 'borrow', + DepositCollateral = 'depositCollateral', + Liquidate = 'liquidate', + RepayLoan = 'repayLoan', + WithdrawCollateral = 'withdrawCollateral', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-miscellaneous.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-miscellaneous.enum.ts new file mode 100644 index 0000000000..44b0ee5a7a --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-miscellaneous.enum.ts @@ -0,0 +1,6 @@ +// https://docs.noves.fi/reference/miscellaneous +export enum NovesTxTypeMiscellaneous { + Admin = 'admin', + MEVTransaction = 'MEVTransaction', + GamblingTransaction = 'gamblingTransaction', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-nft.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-nft.enum.ts new file mode 100644 index 0000000000..66245fba92 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-nft.enum.ts @@ -0,0 +1,19 @@ +// https://docs.noves.fi/reference/nft +export enum NovesTxTypeNFT { + ApproveNFTCollection = 'approveNFTCollection', + ApproveSingleNFT = 'approveSingleNFT', + BurnNFT = 'burnNFT', + BuyNFT = 'buyNFT', + CancelNFTListing = 'cancelNFTListing', + CreateNFTListing = 'createNFTListing', + MintNFT = 'mintNFT', + PlaceNFTBid = 'placeNFTBid', + ReceiveNFT = 'receiveNFT', + SendNFT = 'sendNFT', + ReceiveNFTAirdrop = 'receiveNFTAirdrop', + SendNFTAirdrop = 'sendNFTAirdrop', + ReceiveNFTRoyalty = 'receiveNFTRoyalty', + ReceiveSpamNFT = 'receiveSpamNFT', + RevokeNFTCollectionApproval = 'revokeNFTCollectionApproval', + SellNFT = 'sellNFT', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-special.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-special.enum.ts new file mode 100644 index 0000000000..846dddad89 --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-special.enum.ts @@ -0,0 +1,7 @@ +// https://docs.noves.fi/reference/special-types +export enum NovesTxTypeSpecial { + Composite = 'composite', + Failed = 'failed', + Unclassified = 'unclassified', + UnverifiedContract = 'unverifiedContract', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-token.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-token.enum.ts new file mode 100644 index 0000000000..ec4c72f38d --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-token.enum.ts @@ -0,0 +1,15 @@ +// https://docs.noves.fi/reference/token +export enum NovesTxTypeToken { + ApproveToken = 'approveToken', + BurnToken = 'burnToken', + MigrateToken = 'migrateToken', + SendToken = 'sendToken', + SendTokenAirdrop = 'sendTokenAirdrop', + ReceiveSpamToken = 'receiveSpamToken', + ReceiveToken = 'receiveToken', + ReceiveTokenAirdrop = 'receiveTokenAirdrop', + Refund = 'refund', + RevokeTokenApproval = 'revokeTokenApproval', + Unwrap = 'unwrap', + Wrap = 'wrap', +} diff --git a/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-yield.enum.ts b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-yield.enum.ts new file mode 100644 index 0000000000..2cb045f84a --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/enums/noves-tx-type-yield.enum.ts @@ -0,0 +1,12 @@ +// https://docs.noves.fi/reference/yield +export enum NovesTxTypeYield { + ClaimRewards = 'claimRewards', + ClaimAndStake = 'claimAndStake', + LeveragedFarming = 'leveragedFarming', + RebalancePosition = 'rebalancePosition', + Lock = 'lock', + StakeNFT = 'stakeNFT', + StakeToken = 'stakeToken', + UnstakeNFT = 'unstakeNFT', + UnstakeToken = 'unstakeToken', +} diff --git a/packages/shared/src/lib/auxiliary/noves/interfaces/noves-tx-response.interface.ts b/packages/shared/src/lib/auxiliary/noves/interfaces/noves-tx-response.interface.ts index e7e73cd5d4..1116dead76 100644 --- a/packages/shared/src/lib/auxiliary/noves/interfaces/noves-tx-response.interface.ts +++ b/packages/shared/src/lib/auxiliary/noves/interfaces/noves-tx-response.interface.ts @@ -1,3 +1,4 @@ +import { NovesTxType } from '../types/noves-tx-type.type' import { NovesToken } from './noves-token.interface' export interface NovesTxResponse { @@ -30,7 +31,7 @@ interface Protocol { } interface ClassificationData { - type: string + type: NovesTxType source: ClassificationSource description: string protocol: Protocol diff --git a/packages/shared/src/lib/auxiliary/noves/types/noves-tx-type.type.ts b/packages/shared/src/lib/auxiliary/noves/types/noves-tx-type.type.ts new file mode 100644 index 0000000000..4a8ef04c7e --- /dev/null +++ b/packages/shared/src/lib/auxiliary/noves/types/noves-tx-type.type.ts @@ -0,0 +1,26 @@ +import { + NovesTxTypeCrossChain, + NovesTxTypeDEX, + NovesTxTypeToken, + NovesTxTypeNFT, + NovesTxTypeLending, + NovesTxTypeYield, + NovesTxTypeDomain, + NovesTxTypeGovernance, + NovesTxTypeInfrastructure, + NovesTxTypeSpecial, + NovesTxTypeMiscellaneous, +} from '../enums' + +export type NovesTxType = + | NovesTxTypeCrossChain + | NovesTxTypeDEX + | NovesTxTypeToken + | NovesTxTypeNFT + | NovesTxTypeLending + | NovesTxTypeYield + | NovesTxTypeDomain + | NovesTxTypeGovernance + | NovesTxTypeInfrastructure + | NovesTxTypeSpecial + | NovesTxTypeMiscellaneous diff --git a/packages/shared/src/lib/core/activity/utils/evm/generateEvmActivityFromNovesTransaction.ts b/packages/shared/src/lib/core/activity/utils/evm/generateEvmActivityFromNovesTransaction.ts index a6ad015f0e..168960ffd3 100644 --- a/packages/shared/src/lib/core/activity/utils/evm/generateEvmActivityFromNovesTransaction.ts +++ b/packages/shared/src/lib/core/activity/utils/evm/generateEvmActivityFromNovesTransaction.ts @@ -10,6 +10,7 @@ import { ActivityDirection } from '@core/activity/enums' import { generateBaseEvmActivity } from './generateBaseEvmActivity' import { LocalEvmTransaction } from '@core/transactions/types' import { generateEvmActivityFromLocalEvmTransaction } from './generateEvmActivityFromLocalEvmTransaction' +import { NovesTxTypeToken } from '@auxiliary/noves/enums' export async function generateEvmActivityFromNovesTransaction( novesTx: NovesTxResponse, @@ -24,12 +25,10 @@ export async function generateEvmActivityFromNovesTransaction( account ) - switch ( - novesTx.classificationData.type // What are all the types and interfaces for this? - ) { - case 'sendToken': // TODO: this string should be an enum + switch (novesTx.classificationData.type) { + case NovesTxTypeToken.SendToken: return generateEvmActivityFromSendTokenClassification(baseActivity, novesTx, account) - case 'receiveToken': + case NovesTxTypeToken.ReceiveToken: return generateEvmActivityFromReceiveTokenClassification(baseActivity, novesTx, account) default: return localTransaction