-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/erc20 reindexing (#851) TG-231 #ready-to-test
* feat: erc20 reindex * test: test * fix: ci * fix: test * test: test * test: run with an erc20 contract * refactor: instantiate erc20 module account * refactor: instantiate erc20 module account
- Loading branch information
1 parent
bfafaed
commit d32da37
Showing
9 changed files
with
1,079 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Post, Service } from '@ourparentcenter/moleculer-decorators-extended'; | ||
import { Context, ServiceBroker } from 'moleculer'; | ||
import networks from '../../../network.json' assert { type: 'json' }; | ||
import BaseService from '../../base/base.service'; | ||
|
||
@Service({ | ||
name: 'erc20-admin', | ||
version: 1, | ||
}) | ||
export default class Erc20AdminService extends BaseService { | ||
public constructor(public broker: ServiceBroker) { | ||
super(broker); | ||
} | ||
|
||
@Post('/erc20-reindexing', { | ||
name: 'erc20Reindexing', | ||
params: { | ||
chainid: { | ||
type: 'string', | ||
optional: false, | ||
enum: networks.map((network) => network.chainId), | ||
}, | ||
addresses: { | ||
type: 'array', | ||
optional: false, | ||
items: 'string', | ||
}, | ||
}, | ||
}) | ||
async erc20Reindexing( | ||
ctx: Context< | ||
{ | ||
chainid: string; | ||
addresses: string[]; | ||
}, | ||
Record<string, unknown> | ||
> | ||
) { | ||
const selectedChain = networks.find( | ||
(network) => network.chainId === ctx.params.chainid | ||
); | ||
return this.broker.call( | ||
`v1.Erc20.reindexing@${selectedChain?.moleculerNamespace}`, | ||
{ | ||
addresses: ctx.params.addresses, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.