-
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: merge erc20 from develop to staging (#875)
* feat: merge erc20 from develop * feat: merge erc20 from develop * feat: merge erc20 from develop * fix: test ci
- Loading branch information
1 parent
12eb3d1
commit 1922f4d
Showing
12 changed files
with
2,000 additions
and
603 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
Oops, something went wrong.