Compare commits
5 Commits
main
...
reduce_tx_
Author | SHA1 | Date |
---|---|---|
jenya | 152c90f965 | 2 years ago |
jenya | 1f548bbc26 | 2 years ago |
jenya | d717b3f7ad | 2 years ago |
jenya | a14d7b3ef4 | 2 years ago |
jenya | 1189c6f386 | 2 years ago |
File diff suppressed because one or more lines are too long
@ -1,44 +1,51 @@ |
||||
import {Response, Request, Router, NextFunction} from 'express' |
||||
import * as controllers from 'src/api/controllers' |
||||
import {catchAsync} from 'src/api/rest/utils' |
||||
import {ShardID} from 'src/types/blockchain' |
||||
|
||||
export const erc1155Router = Router({mergeParams: true}) |
||||
|
||||
erc1155Router.get('/', catchAsync(getAllERC1155)) |
||||
|
||||
export async function getAllERC1155(req: Request, res: Response, next: NextFunction) { |
||||
const data = await controllers.getAllERC1155() |
||||
const {shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getAllERC1155(s) |
||||
next(data) |
||||
} |
||||
|
||||
erc1155Router.get('/address/:address/balances', catchAsync(getUserERC1155Balances)) |
||||
|
||||
export async function getUserERC1155Balances(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const data = await controllers.getUserERC1155Balances(address) |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getUserERC1155Balances(s, address) |
||||
next(data) |
||||
} |
||||
|
||||
erc1155Router.get('/token/:address/balances', catchAsync(getTokenERC1155Balances)) |
||||
|
||||
export async function getTokenERC1155Balances(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const data = await controllers.getTokenERC1155Balances(address) |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getTokenERC1155Balances(s, address) |
||||
next(data) |
||||
} |
||||
|
||||
erc1155Router.get('/token/:address/assets', catchAsync(getTokenERC1155Assets)) |
||||
|
||||
export async function getTokenERC1155Assets(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const data = await controllers.getTokenERC1155Assets(address) |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getTokenERC1155Assets(s, address) |
||||
next(data) |
||||
} |
||||
|
||||
erc1155Router.get('/token/:address/asset/:tokenID', catchAsync(getTokenERC1155AssetDetails)) |
||||
|
||||
export async function getTokenERC1155AssetDetails(req: Request, res: Response, next: NextFunction) { |
||||
const {address, tokenID} = req.params |
||||
const data = await controllers.getTokenERC1155AssetDetails(address, tokenID) |
||||
const {address, tokenID, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getTokenERC1155AssetDetails(s, address, tokenID) |
||||
next(data) |
||||
} |
||||
|
@ -1,33 +1,38 @@ |
||||
import {Response, Request, Router, NextFunction} from 'express' |
||||
import * as controllers from 'src/api/controllers' |
||||
import {catchAsync} from 'src/api/rest/utils' |
||||
import {ShardID} from 'src/types/blockchain' |
||||
|
||||
export const erc20Router = Router({mergeParams: true}) |
||||
|
||||
erc20Router.get('/', catchAsync(getAllERC20)) |
||||
|
||||
export async function getAllERC20(req: Request, res: Response, next: NextFunction) { |
||||
const data = await controllers.getAllERC20() |
||||
const {shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getAllERC20(s) |
||||
next(data) |
||||
} |
||||
|
||||
erc20Router.get('/address/:address/balances', catchAsync(getUserERC20Balances)) |
||||
|
||||
export async function getUserERC20Balances(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const data = await controllers.getUserERC20Balances(address) |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getUserERC20Balances(s, address) |
||||
next(data) |
||||
} |
||||
|
||||
erc20Router.get('/token/:address/holders', catchAsync(getERC20TokenHolders)) |
||||
|
||||
export async function getERC20TokenHolders(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const {offset, limit} = req.query |
||||
const filter = { |
||||
offset: (+offset! as number) || 0, |
||||
limit: (+limit! as number) || 100, |
||||
} |
||||
const data = await controllers.getERC20TokenHolders(address, filter.limit, filter.offset) |
||||
const data = await controllers.getERC20TokenHolders(s, address, filter.limit, filter.offset) |
||||
next(data) |
||||
} |
||||
|
@ -1,28 +1,33 @@ |
||||
import {Response, Request, Router, NextFunction} from 'express' |
||||
import * as controllers from 'src/api/controllers' |
||||
import {catchAsync} from 'src/api/rest/utils' |
||||
import {ShardID} from 'src/types/blockchain' |
||||
|
||||
export const erc721Router = Router({mergeParams: true}) |
||||
|
||||
erc721Router.get('/', catchAsync(getAllERC721)) |
||||
|
||||
export async function getAllERC721(req: Request, res: Response, next: NextFunction) { |
||||
const data = await controllers.getAllERC721() |
||||
const {shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getAllERC721(s) |
||||
next(data) |
||||
} |
||||
|
||||
erc721Router.get('/address/:address/balances', catchAsync(getUserERC721Assets)) |
||||
|
||||
export async function getUserERC721Assets(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const data = await controllers.getUserERC721Assets(address) |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getUserERC721Assets(s, address) |
||||
next(data) |
||||
} |
||||
|
||||
erc721Router.get('/token/:address/balances', catchAsync(getTokenERC721Assets)) |
||||
|
||||
export async function getTokenERC721Assets(req: Request, res: Response, next: NextFunction) { |
||||
const {address} = req.params |
||||
const data = await controllers.getTokenERC721Assets(address) |
||||
const {address, shardID} = req.params |
||||
const s = +shardID as ShardID |
||||
const data = await controllers.getTokenERC721Assets(s, address) |
||||
next(data) |
||||
} |
||||
|
@ -1,5 +1,6 @@ |
||||
import {ABIManager} from 'src/indexer/indexer/contracts/utils/ABIManager' |
||||
import ERC1155ABI from 'src/indexer/indexer/contracts/erc1155/ERC1155ABI.json' |
||||
import {IABI} from 'src/indexer/indexer/contracts/types' |
||||
import {ShardID} from 'src/types' |
||||
|
||||
export const ABI = ABIManager(ERC1155ABI as IABI) |
||||
export const ABIFactory = (shardID: ShardID) => ABIManager(shardID, ERC1155ABI as IABI) |
||||
|
@ -1,5 +1,6 @@ |
||||
import {ABIManager} from 'src/indexer/indexer/contracts/utils/ABIManager' |
||||
import ERC20ABI from 'src/indexer/indexer/contracts/erc20/ERC20ABI.json' |
||||
import {IABI} from 'src/indexer/indexer/contracts/types' |
||||
import {ShardID} from 'src/types' |
||||
|
||||
export const ABI = ABIManager(ERC20ABI as IABI) |
||||
export const ABIFactory = (shardID: ShardID) => ABIManager(shardID, ERC20ABI as IABI) |
||||
|
@ -1,5 +1,6 @@ |
||||
import {ABIManager} from 'src/indexer/indexer/contracts/utils/ABIManager' |
||||
import ERC721ABI from 'src/indexer/indexer/contracts/erc721/ERC721ABI.json' |
||||
import {IABI} from 'src/indexer/indexer/contracts/types' |
||||
import {ShardID} from 'src/types' |
||||
|
||||
export const ABI = ABIManager(ERC721ABI as IABI) |
||||
export const ABIFactory = (shardID: ShardID) => ABIManager(shardID, ERC721ABI as IABI) |
||||
|
Loading…
Reference in new issue