diff --git a/.changeset/wise-tomatoes-battle.md b/.changeset/wise-tomatoes-battle.md new file mode 100644 index 0000000000..466828bd0d --- /dev/null +++ b/.changeset/wise-tomatoes-battle.md @@ -0,0 +1,6 @@ +--- +'@moralisweb3/common-evm-utils': minor +'@moralisweb3/evm-api': minor +--- + +Add spam detection diff --git a/packages/common/evmUtils/src/dataTypes/Erc20/Erc20.ts b/packages/common/evmUtils/src/dataTypes/Erc20/Erc20.ts index 435196b86a..4a19e8b0dc 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20/Erc20.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20/Erc20.ts @@ -48,6 +48,7 @@ export class Erc20Token implements MoralisDataObject { logoHash: maybe(value.logoHash), thumbnail: maybe(value.thumbnail), chain: EvmChain.create(value.chain, core), + possibleSpam: value.possibleSpam, }); /** @@ -229,4 +230,12 @@ export class Erc20Token implements MoralisDataObject { get thumbnail() { return this._value.thumbnail; } + + /** + * @returns possibility of the token being a spam token + * @example transfer.possibleSpam // true + */ + get possibleSpam() { + return this._value.possibleSpam; + } } diff --git a/packages/common/evmUtils/src/dataTypes/Erc20/types.ts b/packages/common/evmUtils/src/dataTypes/Erc20/types.ts index ebe0e26e66..229606fa70 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20/types.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20/types.ts @@ -15,6 +15,7 @@ import { EvmChain, EvmChainish } from '../EvmChain'; * thumbnail: null, * decimals: "6", * chain: 1, + * possibleSpam: false, * } * ``` */ @@ -27,6 +28,7 @@ export interface Erc20Input { logo?: string | null; logoHash?: string | null; thumbnail?: string | null; + possibleSpam?: boolean; } /** @@ -41,4 +43,5 @@ export interface Erc20Data { logo?: string | null; logoHash?: string | null; thumbnail?: string | null; + possibleSpam?: boolean; } diff --git a/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.test.ts b/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.test.ts index e60d88e281..7995c12f9f 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.test.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.test.ts @@ -14,6 +14,7 @@ const exampleInput: Erc20ApprovalInput = { transactionHash: '0xb7b4d321e2ab26c1cde1a2ef49413e21b65dcc663d6de8f75ddbdd868b98b4bf', transactionIndex: 4, logIndex: 25, + possibleSpam: false, value: '100000000000000000000000000000', }; @@ -43,6 +44,7 @@ describe('Erc20Approval', () => { expect(erc20Approval.transactionHash).toBe('0xb7b4d321e2ab26c1cde1a2ef49413e21b65dcc663d6de8f75ddbdd868b98b4bf'); expect(erc20Approval.transactionIndex).toBe(4); expect(erc20Approval.logIndex).toBe(25); + expect(erc20Approval.possibleSpam).toBe(false); expect(erc20Approval.value.toString()).toBe('100000000000000000000000000000'); }); @@ -65,6 +67,7 @@ describe('Erc20Approval', () => { transactionHash: '0xb7b4d321e2ab26c1cde1a2ef49413e21b65dcc663d6de8f75ddbdd868b98b4bf', transactionIndex: 4, logIndex: 25, + possibleSpam: false, value: '100000000000000000000000000000', }); }); diff --git a/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.ts b/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.ts index e3459d6ac4..12729985f4 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20Approval/Erc20Approval.ts @@ -189,4 +189,12 @@ export class Erc20Approval implements MoralisDataObject { get logIndex() { return this._data.logIndex; } + + /** + * @returns possibility of the token being a spam token + * @example transfer.possibleSpam // true + */ + get possibleSpam() { + return this._data.possibleSpam; + } } diff --git a/packages/common/evmUtils/src/dataTypes/Erc20Approval/types.ts b/packages/common/evmUtils/src/dataTypes/Erc20Approval/types.ts index b8dace0844..00e4acf5cc 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20Approval/types.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20Approval/types.ts @@ -16,6 +16,7 @@ import { EvmChain, EvmChainish } from '../EvmChain'; * transactionHash: "0xb7b4d321e2ab26c1cde1a2ef49413e21b65dcc663d6de8f75ddbdd868b98b4bf", * transactionIndex: "4", * logIndex: "25", + * possibleSpam: false, * value: "100000000000000000000000000000" * } * ``` @@ -32,6 +33,7 @@ export interface Erc20ApprovalInput { transactionIndex: number; logIndex: number; value: BigNumberish; + possibleSpam: boolean; } /** @@ -49,4 +51,5 @@ export interface Erc20ApprovalData { transactionIndex: number; logIndex: number; value: BigNumber; + possibleSpam: boolean; } diff --git a/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.test.ts b/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.test.ts index 285ce3f6a8..a34099538c 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.test.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.test.ts @@ -15,6 +15,7 @@ const exampleInput: Erc20TransferInput = { transactionIndex: 4, logIndex: 25, value: '100000000000000000000000000000', + possibleSpam: false, }; describe('Erc20Transfer', () => { @@ -50,6 +51,7 @@ describe('Erc20Transfer', () => { expect(erc20Mint.transactionHash).toBe('0xb7b4d321e2ab26c1cde1a2ef49413e21b65dcc663d6de8f75ddbdd868b98b4bf'); expect(erc20Mint.transactionIndex).toBe(4); expect(erc20Mint.logIndex).toBe(25); + expect(erc20Mint.possibleSpam).toBe(false); expect(erc20Mint.value.toString()).toBe('100000000000000000000000000000'); }); @@ -72,6 +74,7 @@ describe('Erc20Transfer', () => { transactionHash: '0xb7b4d321e2ab26c1cde1a2ef49413e21b65dcc663d6de8f75ddbdd868b98b4bf', transactionIndex: 4, logIndex: 25, + possibleSpam: false, value: '100000000000000000000000000000', }); }); diff --git a/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.ts b/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.ts index 04a534a03b..6fc5f66b7c 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20Transfer/Erc20Transfer.ts @@ -220,4 +220,12 @@ export class Erc20Transfer implements MoralisDataObject { get logIndex() { return this._data.logIndex; } + + /** + * @returns possibility of the token being a spam token + * @example transfer.possibleSpam // true + */ + get possibleSpam() { + return this._data.possibleSpam; + } } diff --git a/packages/common/evmUtils/src/dataTypes/Erc20Transfer/types.ts b/packages/common/evmUtils/src/dataTypes/Erc20Transfer/types.ts index 211e626f39..683835793f 100644 --- a/packages/common/evmUtils/src/dataTypes/Erc20Transfer/types.ts +++ b/packages/common/evmUtils/src/dataTypes/Erc20Transfer/types.ts @@ -16,8 +16,9 @@ import { EvmChain, EvmChainish } from '../EvmChain'; * blockTimestamp: "2021-04-02T10:07:54.000Z", * blockHash: "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86", * blockNumber: "12526958", - * transactionHash: "0x2d30ca6f024dbc1307ac8a1a44ca27de6f797ec22ef20627a1307243b0ab7d09" - * transactionIndex: 3; + * transactionHash: "0x2d30ca6f024dbc1307ac8a1a44ca27de6f797ec22ef20627a1307243b0ab7d09", + * transactionIndex: 3, + * possibleSpam: false, * logIndex: 2 * } * ``` @@ -34,6 +35,7 @@ export interface Erc20TransferInput { value: BigNumberish; transactionIndex: number; logIndex: number; + possibleSpam: boolean; } /** @@ -51,4 +53,5 @@ export interface Erc20TransferData { value: BigNumber; transactionIndex: number; logIndex: number; + possibleSpam: boolean; } diff --git a/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.test.ts b/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.test.ts index cba826ad79..7935dfb136 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.test.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.test.ts @@ -55,7 +55,7 @@ describe('EvmNftMedia', () => { expect(erc20Mint.mimetype).toBe('image/png'); expect(erc20Mint.parentHash).toBe('0x21ba1263dd63696f0d9ede101b00a4e2f4985a854483076c92a3415624fca051'); expect(erc20Mint.status).toBe('success'); - expect(erc20Mint.updatedAt.toISOString()).toBe('2023-03-17T14:12:24.192Z'); + expect(erc20Mint.updatedAt?.toISOString()).toBe('2023-03-17T14:12:24.192Z'); expect(erc20Mint.originalMediaUrl).toBe('original_url'); }); diff --git a/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.ts b/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.ts index 1925fbae61..13ee7c004b 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmNftMedia/EvmNftMedia.ts @@ -1,4 +1,4 @@ -import Core, { MoralisDataObject, dateInputToDate, CoreProvider } from '@moralisweb3/common-core'; +import Core, { MoralisDataObject, dateInputToDate, CoreProvider, maybe } from '@moralisweb3/common-core'; import { EvmChain } from '../EvmChain'; import { EvmNftMediaInput, EvmNftMediaData } from './types'; @@ -16,7 +16,7 @@ export class EvmNftMedia implements MoralisDataObject { * const media = EvmNftMedia.create(data); *``` */ - static create(data: EvmNftMedia | EvmNftMediaInput, core?: Core) { + static create(data: EvmNftMediaInput, core?: Core) { if (data instanceof EvmNftMedia) { return data; } @@ -34,7 +34,7 @@ export class EvmNftMedia implements MoralisDataObject { static parse = (data: EvmNftMediaInput, core: Core): EvmNftMediaData => ({ ...data, chain: EvmChain.create(data.chain, core), - updatedAt: dateInputToDate(data.updatedAt), + updatedAt: maybe(data.updatedAt, (date) => dateInputToDate(date)), }); /** diff --git a/packages/common/evmUtils/src/dataTypes/EvmNftMedia/types.ts b/packages/common/evmUtils/src/dataTypes/EvmNftMedia/types.ts index 7d8482c5b4..ae6771b85a 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmNftMedia/types.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmNftMedia/types.ts @@ -2,6 +2,13 @@ import { DateInput } from '@moralisweb3/common-core'; import { EvmChain, EvmChainish } from '../EvmChain'; export type EvmNftMediaCategory = 'image' | 'video' | 'audio'; +export type EvmNftMediaStatus = + | 'success' + | 'processing' + | 'unsupported_media' + | 'invalid_url' + | 'host_unavailable' + | 'temporarily_unavailable'; export type EvmNftMediaItem = { height: number; @@ -11,9 +18,9 @@ export type EvmNftMediaItem = { export interface EvmNftMediaInput { chain: EvmChainish; - status: string; - updatedAt: DateInput; - originalMediaUrl: string; + status?: EvmNftMediaStatus; + updatedAt?: DateInput; + originalMediaUrl?: string; category?: EvmNftMediaCategory; mimetype?: string; parentHash?: string; @@ -26,9 +33,9 @@ export interface EvmNftMediaInput { export interface EvmNftMediaData { chain: EvmChain; - status: string; - updatedAt: Date; - originalMediaUrl: string; + status?: EvmNftMediaStatus; + updatedAt?: Date; + originalMediaUrl?: string; category?: EvmNftMediaCategory; mimetype?: string; parentHash?: string; diff --git a/packages/common/evmUtils/src/operations/openapi.ts b/packages/common/evmUtils/src/operations/openapi.ts index f375b625c6..153a170dd9 100644 --- a/packages/common/evmUtils/src/operations/openapi.ts +++ b/packages/common/evmUtils/src/operations/openapi.ts @@ -502,6 +502,11 @@ export interface components { * @example 1234 */ value: string; + /** + * @description Indicates if a contract is possibly a spam contract + * @example false + */ + possible_spam: boolean; }; erc20Burn: { /** @example 0x3105d328c66d8d55092358cf595d54608178e9b5 */ @@ -621,6 +626,11 @@ export interface components { * @example 1234 */ value: string; + /** + * @description Indicates if a contract is possibly a spam contract + * @example false + */ + possible_spam: boolean; }; erc20TransfersResponse: { /** @description The cursor to get to the next page */ @@ -1221,6 +1231,11 @@ export interface components { * @example 123456789 */ balance: string; + /** + * @description Indicates if a contract is possibly a spam contract + * @example false + */ + possible_spam: boolean; }; nativeBalance: { /** @@ -1711,28 +1726,39 @@ export interface components { url: string; }; mediaCollection: { - /** @description Information about the original media file */ - original: components["schemas"]["mediaItem"]; /** @description Preview media file, lowest quality (for images 100px x 100px) */ low: components["schemas"]["mediaItem"]; /** @description Preview media file, medium quality (for images 250px x 250px) */ medium: components["schemas"]["mediaItem"]; /** @description Preview media file, highest quality (for images 500px x 500px) */ high: components["schemas"]["mediaItem"]; + } & { + original: unknown; }; media: { - status: string; - updatedAt: string; /** @description The mimetype of the media file [see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types] */ - mimetype: string; + mimetype?: string; /** @enum {undefined} */ - category: "image" | "audio" | "video"; + category?: "image" | "audio" | "video"; + /** + * @description
successThe NFT Preview was created / retrieved successfully
processingThe NFT Preview was not found and has been submitted for generation.
unsupported_mediaThe mime-type of the NFT's media file indicates a type not currently supported.
invalid_urlThe 'image' URL from the NFT's metadata is not a valid URL and cannot be processed.
host_unavailableThe 'image' URL from the NFT's metadata returned an HttpCode indicating the host / file is not available.
temporarily_unavailableThe attempt to load / parse the NFT media file failed (usually due to rate limiting) and will be tried again at next request.
+ * @enum {undefined} + */ + status?: + | "success" + | "processing" + | "unsupported_media" + | "invalid_url" + | "host_unavailable" + | "temporarily_unavailable"; /** @description The url of the original media file. */ - original_media_url: string; + original_media_url?: string; + /** @description The timestamp of the last update to this NFT media record. */ + updatedAt?: string; /** @description Hash value of the original media file. */ - parent_hash: string; + parent_hash?: string; /** @description Preview item associated with the original */ - media_collection: components["schemas"]["mediaCollection"]; + media_collection?: components["schemas"]["mediaCollection"]; }; nftOwnerCollection: { /** @@ -1947,6 +1973,11 @@ export interface components { * @example 2 */ log_index: number; + /** + * @description Indicates if a contract is possibly a spam contract + * @example false + */ + possible_spam: boolean; }; historicalNftTransfer: { /** @@ -2032,6 +2063,11 @@ export interface components { thumbnail?: string; block_number?: string; validated?: string; + /** + * @description Indicates if a contract is possibly a spam contract + * @example false + */ + possible_spam: boolean; }; metadataResync: { /** @description The status of the resync request */ diff --git a/packages/common/evmUtils/src/operations/token/getWalletTokenBalancesOperation.ts b/packages/common/evmUtils/src/operations/token/getWalletTokenBalancesOperation.ts index fa1e00bcc2..c9b0784617 100644 --- a/packages/common/evmUtils/src/operations/token/getWalletTokenBalancesOperation.ts +++ b/packages/common/evmUtils/src/operations/token/getWalletTokenBalancesOperation.ts @@ -79,6 +79,7 @@ function deserializeResponse( logo: token.logo, thumbnail: token.thumbnail, chain: EvmChainResolver.resolve(request.chain, core), + possibleSpam: token.possible_spam, }, }, core, diff --git a/packages/evmApi/integration/mocks/endpoints/getErc20Approvals.ts b/packages/evmApi/integration/mocks/endpoints/getErc20Approvals.ts index 04ff79c1f9..2155f476e7 100644 --- a/packages/evmApi/integration/mocks/endpoints/getErc20Approvals.ts +++ b/packages/evmApi/integration/mocks/endpoints/getErc20Approvals.ts @@ -41,6 +41,7 @@ export const mockGetErc20Approvals = MockScenarios.create( transaction_index: '148', log_index: '356', value: '80000000000000000', + possible_spam: false, }, { from_wallet: '0xbafa44efe7901e04e39dad13167d089c559c1138', @@ -53,6 +54,7 @@ export const mockGetErc20Approvals = MockScenarios.create( transaction_index: '148', log_index: '355', value: '80000000000000000', + possible_spam: false, }, { from_wallet: '0xa7ba1c6d5ffa3ce2542e04bc3e4b4021bcc2e134', @@ -65,6 +67,7 @@ export const mockGetErc20Approvals = MockScenarios.create( transaction_index: '141', log_index: '340', value: '115792089237316195423570985008687907853269984665640563249457584007913129639935', + possible_spam: false, }, ], }, diff --git a/packages/evmApi/integration/mocks/endpoints/getErc20Transfers.ts b/packages/evmApi/integration/mocks/endpoints/getErc20Transfers.ts index 2d92ab2e53..113bb3f7e3 100644 --- a/packages/evmApi/integration/mocks/endpoints/getErc20Transfers.ts +++ b/packages/evmApi/integration/mocks/endpoints/getErc20Transfers.ts @@ -41,6 +41,7 @@ export const mockGetErc20Transfers = MockScenarios.create( transaction_index: '151', log_index: '368', value: '201110013289805900', + possible_spam: false, }, { from_wallet: '0x9fcf8f5bd54db123470c96620441ca5c342a8bd4', @@ -53,6 +54,7 @@ export const mockGetErc20Transfers = MockScenarios.create( transaction_index: '151', log_index: '366', value: '390000000000000', + possible_spam: false, }, { from_wallet: '0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b', @@ -65,6 +67,7 @@ export const mockGetErc20Transfers = MockScenarios.create( transaction_index: '149', log_index: '362', value: '120000000000000000', + possible_spam: false, }, ], }, diff --git a/packages/evmApi/integration/mocks/endpoints/getTokenMetadata.ts b/packages/evmApi/integration/mocks/endpoints/getTokenMetadata.ts index 035082bae9..2fb6ca3baf 100644 --- a/packages/evmApi/integration/mocks/endpoints/getTokenMetadata.ts +++ b/packages/evmApi/integration/mocks/endpoints/getTokenMetadata.ts @@ -27,6 +27,7 @@ export const mockGetTokenMetadata = MockScenarios.create( null, null, '2022-01-20T10:39:55.818Z', + false, ), ], }, diff --git a/packages/evmApi/integration/mocks/endpoints/getTokenMetadataBySymbol.ts b/packages/evmApi/integration/mocks/endpoints/getTokenMetadataBySymbol.ts index ea91801641..ec5d78eb03 100644 --- a/packages/evmApi/integration/mocks/endpoints/getTokenMetadataBySymbol.ts +++ b/packages/evmApi/integration/mocks/endpoints/getTokenMetadataBySymbol.ts @@ -27,6 +27,7 @@ export const mockGetTokenMetadataBySymbols = MockScenarios.create( null, null, '2022-01-20T10:39:55.818Z', + false, ), ], }, diff --git a/packages/evmApi/integration/mocks/endpoints/getTokenTransfers.ts b/packages/evmApi/integration/mocks/endpoints/getTokenTransfers.ts index fbf7616590..9145cd12b3 100644 --- a/packages/evmApi/integration/mocks/endpoints/getTokenTransfers.ts +++ b/packages/evmApi/integration/mocks/endpoints/getTokenTransfers.ts @@ -28,6 +28,7 @@ export const mockGetTokenTransfers = MockScenarios.create( '0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D', '0x72FDD62FbFa2fAa9A8677C58d9992068772e0f7F', '347995260860000000000', + false, ), ), 12, @@ -52,6 +53,7 @@ export const mockGetTokenTransfers = MockScenarios.create( '0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D', '0x72FDD62FbFa2fAa9A8677C58d9992068772e0f7F', '347995260860000000000', + false, ), ), 12, @@ -76,6 +78,7 @@ export const mockGetTokenTransfers = MockScenarios.create( '0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D', '0x72FDD62FbFa2fAa9A8677C58d9992068772e0f7F', '347995260860000000000', + false, ), ), 12, diff --git a/packages/evmApi/integration/mocks/endpoints/getWalletTokenBalances.ts b/packages/evmApi/integration/mocks/endpoints/getWalletTokenBalances.ts index 77f2b64f70..8ee0f2feb3 100644 --- a/packages/evmApi/integration/mocks/endpoints/getWalletTokenBalances.ts +++ b/packages/evmApi/integration/mocks/endpoints/getWalletTokenBalances.ts @@ -24,6 +24,7 @@ export const mockGetWalletTokenBalances = MockScenarios.create( 'https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_thumb.png', 18, '795917396650797993089', + false, ), createTokenBalanceResponse( '0x514910771af9ca656af840dff83e8264ecf986ca', @@ -33,6 +34,7 @@ export const mockGetWalletTokenBalances = MockScenarios.create( 'https://cdn.moralis.io/eth/0x514910771af9ca656af840dff83e8264ecf986ca_thumb.png', 18, '155304334804334409393921', + false, ), ], }, diff --git a/packages/evmApi/integration/mocks/endpoints/getWalletTokenTransfers.ts b/packages/evmApi/integration/mocks/endpoints/getWalletTokenTransfers.ts index 5b84b33f06..7490223c7e 100644 --- a/packages/evmApi/integration/mocks/endpoints/getWalletTokenTransfers.ts +++ b/packages/evmApi/integration/mocks/endpoints/getWalletTokenTransfers.ts @@ -29,6 +29,7 @@ export const mockGetWalletTokenTransfers = MockScenarios.create( '0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D', '0x72fdd62fbfa2faa9a8677c58d9992068772e0f7f', '347995260860000000000', + false, ), ), 12, @@ -53,6 +54,7 @@ export const mockGetWalletTokenTransfers = MockScenarios.create( '0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D', '0x72fdd62fbfa2faa9a8677c58d9992068772e0f7f', '347995260860000000000', + false, ), ), 12, @@ -78,6 +80,7 @@ export const mockGetWalletTokenTransfers = MockScenarios.create( '0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D', '0x72fdd62fbfa2faa9a8677c58d9992068772e0f7f', '347995260860000000000', + false, ), ), 12, diff --git a/packages/evmApi/integration/mocks/response/tokenBalanceResponse.ts b/packages/evmApi/integration/mocks/response/tokenBalanceResponse.ts index f6716f52e9..93607f242a 100644 --- a/packages/evmApi/integration/mocks/response/tokenBalanceResponse.ts +++ b/packages/evmApi/integration/mocks/response/tokenBalanceResponse.ts @@ -6,6 +6,7 @@ export const createTokenBalanceResponse = ( thumbnail: string, decimals: number, balance: string, + possibleSpam: boolean, ) => ({ token_address: tokenAddress, name, @@ -14,4 +15,5 @@ export const createTokenBalanceResponse = ( thumbnail, decimals, balance, + possible_spam: possibleSpam, }); diff --git a/packages/evmApi/integration/mocks/response/tokenMetadataResponse.ts b/packages/evmApi/integration/mocks/response/tokenMetadataResponse.ts index e62f8612af..0cf4855aae 100644 --- a/packages/evmApi/integration/mocks/response/tokenMetadataResponse.ts +++ b/packages/evmApi/integration/mocks/response/tokenMetadataResponse.ts @@ -9,6 +9,7 @@ export const createTokenMetadataResponse = ( blockNumber: string | null, validated: string | null, createdAt: string, + possibleSpam: false, ) => ({ address, name, @@ -20,4 +21,5 @@ export const createTokenMetadataResponse = ( block_number: blockNumber, validated, created_at: createdAt, + possible_spam: possibleSpam, }); diff --git a/packages/evmApi/integration/mocks/response/transferResponse.ts b/packages/evmApi/integration/mocks/response/transferResponse.ts index fa15b59c30..d5ddaad283 100644 --- a/packages/evmApi/integration/mocks/response/transferResponse.ts +++ b/packages/evmApi/integration/mocks/response/transferResponse.ts @@ -7,6 +7,7 @@ export const createTransferResponse = ( fromAddress: string, toAddress: string, value: string, + possibleSpam: boolean, ) => ({ transaction_hash, address, @@ -16,4 +17,5 @@ export const createTransferResponse = ( from_address: fromAddress, to_address: toAddress, value, + possible_spam: possibleSpam, }); diff --git a/packages/evmApi/integration/test/getErc20Approvals.test.ts b/packages/evmApi/integration/test/getErc20Approvals.test.ts index 24611980e3..58753b1387 100644 --- a/packages/evmApi/integration/test/getErc20Approvals.test.ts +++ b/packages/evmApi/integration/test/getErc20Approvals.test.ts @@ -35,6 +35,7 @@ describe('getErc20Approvals', () => { expect(transfer.transactionHash).toBe('0x61b87b32196fda49b93998236fa0d51e0a0598ab0a052fa706053391d1950be2'); expect(transfer.transactionIndex).toBe(148); expect(transfer.logIndex).toBe(356); + expect(transfer.possibleSpam).toBe(false); expect(transfer.value.toString()).toBe('80000000000000000'); }); diff --git a/packages/evmApi/integration/test/getErc20Transfers.test.ts b/packages/evmApi/integration/test/getErc20Transfers.test.ts index 59be9a0ef3..b14911f7e0 100644 --- a/packages/evmApi/integration/test/getErc20Transfers.test.ts +++ b/packages/evmApi/integration/test/getErc20Transfers.test.ts @@ -35,6 +35,7 @@ describe('getErc20Transfers', () => { expect(transfer.transactionHash).toBe('0xdebc1c8e0e93fc848c587d6841cd4b5fb4d309ffa58faef8fad7d1a38455e0cc'); expect(transfer.transactionIndex).toBe(151); expect(transfer.logIndex).toBe(368); + expect(transfer.possibleSpam).toBe(false); expect(transfer.value.toString()).toBe('201110013289805900'); }); diff --git a/packages/evmApi/integration/test/getTokenMetadata.test.ts b/packages/evmApi/integration/test/getTokenMetadata.test.ts index 18e669869f..cf69e62cd6 100644 --- a/packages/evmApi/integration/test/getTokenMetadata.test.ts +++ b/packages/evmApi/integration/test/getTokenMetadata.test.ts @@ -23,5 +23,6 @@ describe('getTokenMetadata', () => { expect(metadata.token.name).toEqual('SHIBA INU'); expect(metadata.token.symbol).toEqual('SHIB'); expect(metadata.token.decimals).toEqual(18); + expect(metadata.token.possibleSpam).toBe(false); }); }); diff --git a/packages/evmApi/integration/test/getTokenMetadataBySymbol.test.ts b/packages/evmApi/integration/test/getTokenMetadataBySymbol.test.ts index f56094d30c..8c8b11d98d 100644 --- a/packages/evmApi/integration/test/getTokenMetadataBySymbol.test.ts +++ b/packages/evmApi/integration/test/getTokenMetadataBySymbol.test.ts @@ -24,5 +24,6 @@ describe('getTokenMetadataBySymbol', () => { expect(metadata.token.name).toEqual('SHIBA INU'); expect(metadata.token.symbol).toEqual('SHIB'); expect(metadata.token.decimals).toEqual(18); + expect(metadata.token.possibleSpam).toBe(false); }); }); diff --git a/packages/evmApi/integration/test/getTokenTransfers.test.ts b/packages/evmApi/integration/test/getTokenTransfers.test.ts index 4e65be6aff..9fd2931dac 100644 --- a/packages/evmApi/integration/test/getTokenTransfers.test.ts +++ b/packages/evmApi/integration/test/getTokenTransfers.test.ts @@ -20,6 +20,7 @@ describe('getTokenTransfers', () => { expect(transfer.value.toString()).toBe('347995260860000000000'); expect(transfer.fromAddress.checksum).toBe('0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D'); expect(transfer.toAddress.checksum).toBe('0x72FDD62FbFa2fAa9A8677C58d9992068772e0f7F'); + expect(transfer.possibleSpam).toBe(false); } it('returns transfers', async () => { diff --git a/packages/evmApi/integration/test/getWalletTokenBalances.test.ts b/packages/evmApi/integration/test/getWalletTokenBalances.test.ts index 26e5b17419..69a048ff23 100644 --- a/packages/evmApi/integration/test/getWalletTokenBalances.test.ts +++ b/packages/evmApi/integration/test/getWalletTokenBalances.test.ts @@ -32,5 +32,6 @@ describe('getWalletTokenBalances', () => { 'https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_thumb.png', ); expect(balance.token!.decimals).toBe(balance.decimals); + expect(balance.token!.possibleSpam).toBe(false); }); }); diff --git a/packages/evmApi/integration/test/getWalletTokenTransfers.test.ts b/packages/evmApi/integration/test/getWalletTokenTransfers.test.ts index d410caa299..f9d17466b0 100644 --- a/packages/evmApi/integration/test/getWalletTokenTransfers.test.ts +++ b/packages/evmApi/integration/test/getWalletTokenTransfers.test.ts @@ -20,6 +20,7 @@ describe('getWalletTokenTransfers', () => { expect(transfer.value.toString()).toBe('347995260860000000000'); expect(transfer.fromAddress.checksum).toBe('0xd73a9EAdFff6A332aFDa7dDBB18CFf84bBf6dd0D'); expect(transfer.toAddress.checksum).toBe('0x72FDD62FbFa2fAa9A8677C58d9992068772e0f7F'); + expect(transfer.possibleSpam).toBe(false); } it('returns transfers (no pagination)', async () => {