-
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/reindex cw20 ( staging ) (#319)
* feat: reindex cw20 service * test: test cw20 reindexing * fix: idiot * refactor: code * feat: api admin
- Loading branch information
1 parent
e7fc664
commit 7fedf1c
Showing
14 changed files
with
807 additions
and
71 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
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
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,45 @@ | ||
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: 'cw20-admin', | ||
version: 1, | ||
}) | ||
export default class Cw20AdminService extends BaseService { | ||
public constructor(public broker: ServiceBroker) { | ||
super(broker); | ||
} | ||
|
||
@Post('/cw20-reindexing', { | ||
name: 'cw20Reindexing', | ||
params: { | ||
chainid: { | ||
type: 'string', | ||
optional: false, | ||
enum: networks.map((network) => network.chainId), | ||
}, | ||
contractAddress: { | ||
type: 'string', | ||
optional: false, | ||
}, | ||
}, | ||
}) | ||
async cw20ReindexingByChainId( | ||
ctx: Context< | ||
{ chainid: string; contractAddress: string }, | ||
Record<string, unknown> | ||
> | ||
) { | ||
const selectedChain = networks.find( | ||
(network) => network.chainId === ctx.params.chainid | ||
); | ||
return this.broker.call( | ||
`v1.Cw20ReindexingService.reindexing@${selectedChain?.moleculerNamespace}`, | ||
{ | ||
contractAddress: ctx.params.contractAddress, | ||
} | ||
); | ||
} | ||
} |
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.