Skip to content

Commit

Permalink
feat: support json token uri (#901)
Browse files Browse the repository at this point in the history
* feat: support json token uri

* fix: ci

* refactor: review

* refactor: erc721 media handler

* refactor: notion

* refactor: issue
  • Loading branch information
phamphong9981 authored Oct 7, 2024
1 parent 1134085 commit 934015c
Show file tree
Hide file tree
Showing 4 changed files with 263 additions and 181 deletions.
12 changes: 5 additions & 7 deletions ci/.env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@ POSTGRES_DB_TEST=test
MNEMONIC=

# IPFS
IPFS_GATEWAY=
REQUEST_IPFS_TIMEOUT=
IPFS_GATEWAY=http://ipfs.dev.aura.network:8080/ipfs/
REQUEST_IPFS_TIMEOUT=100000
MAX_CONTENT_LENGTH_BYTE=100000000
MAX_BODY_LENGTH_BYTE=100000000

# AWS S3
AWS_SECRET_ACCESS_KEY=
AWS_ACCESS_KEY_ID=
AWS_REGION=
BUCKET=
S3_GATEWAY=

# IPFS
IPFS_GATEWAY=
REQUEST_IPFS_TIMEOUT=
S3_GATEWAY=
10 changes: 3 additions & 7 deletions src/services/evm/erc721.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { Erc721Contract } from '../../models/erc721_contract';
import { BULL_JOB_NAME, SERVICE } from './constant';
import { Erc721Handler } from './erc721_handler';
import * as Erc721MediaHandler from './erc721_media_handler';
import { Erc721MediaHandler, ITokenMediaInfo } from './erc721_media_handler';
import { Erc721Reindexer } from './erc721_reindex';

const { NODE_ENV } = Config;
Expand Down Expand Up @@ -239,9 +239,7 @@ export default class Erc721Service extends BullableService {
jobName: BULL_JOB_NAME.HANDLE_ERC721_TOKEN_MEDIA,
concurrency: config.erc721.concurrencyHandleTokenMedia,
})
async jobHandlerTokenMedia(_payload: {
tokenMedia: Erc721MediaHandler.ITokenMediaInfo;
}) {
async jobHandlerTokenMedia(_payload: { tokenMedia: ITokenMediaInfo }) {
let { tokenMedia } = _payload;
if (tokenMedia.onchain.token_uri) {
try {
Expand Down Expand Up @@ -386,9 +384,7 @@ export default class Erc721Service extends BullableService {
}
}

async getTokensUri(
tokens: Erc721Token[]
): Promise<Erc721MediaHandler.ITokenMediaInfo[]> {
async getTokensUri(tokens: Erc721Token[]): Promise<ITokenMediaInfo[]> {
const contracts = tokens.map((token) =>
getContract({
address: token.erc721_contract_address as `0x${string}`,
Expand Down
Loading

0 comments on commit 934015c

Please sign in to comment.