| 12345678910111213141516171819202122232425262728293031323334 |
- const http = require("../utils/axios");
- module.exports = class BaseModel {
- static MODULES = {
- HISTORY: 'history',
- PENDING: 'pending',
- FACTORY: 'factory',
- TOKEN: 'token',
- V2_LP: 'v2-lp',
- V3_LP: 'v3-lp'
- }
- constructor(chainId, module) {
- if (!chainId || !module) throw "Must have [chainId, module]."
- this.chainId = chainId
- this.module = module
- }
- async find() {
- const url = `/${this.module}/findByChainId`
- const rst = await http.post(url, {
- chainId: this.chainId
- })
- return rst.data
- }
- async appendOrUpdate(data) {
- const url = `/${this.module}/appendOrUpdate`
- const rst = await http.post(url, data)
- return rst.data
- }
- }
|