generated from bot-base/telegram-bot-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
128 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Composer } from "grammy"; | ||
import type { Context } from "#root/bot/context.js"; | ||
import { logHandle } from "#root/bot/helpers/logging.js"; | ||
import { NftCollection } from "#root/bot/models/nft-collection.js"; | ||
import { config } from "#root/config.js"; | ||
import { chatAction } from "@grammyjs/auto-chat-action"; | ||
import { openWallet, waitSeqno } from "#root/bot/helpers/ton.js"; | ||
import { isAdmin } from "#root/bot/filters/is-admin.js"; | ||
|
||
const composer = new Composer<Context>(); | ||
|
||
const feature = composer.chatType("private").filter(isAdmin); | ||
|
||
feature.command( | ||
"collection", | ||
logHandle("command-collection"), | ||
chatAction("upload_document"), | ||
async (ctx) => { | ||
const wallet = await openWallet(config.MNEMONICS!.split(" "), true); | ||
const collectionData = { | ||
ownerAddress: wallet.contract.address, | ||
royaltyPercent: 0.49, | ||
royaltyAddress: wallet.contract.address, | ||
nextItemIndex: 0, | ||
|
||
collectionContentUrl: `ipfs://QmXXjER4hMHLp6ESJFG21A7yrWaoBE57cLyAHKyt1XiFpF/collection.json`, | ||
commonContentUrl: ``, | ||
}; | ||
const collection = new NftCollection(collectionData); | ||
const seqno = await collection.deploy(wallet); | ||
ctx.logger.info(`Collection deployed: ${collection.address}`); | ||
await waitSeqno(seqno, wallet); | ||
ctx.reply(`Collection deployed: ${collection.address}`); | ||
}, | ||
); | ||
|
||
export { composer as collectionFeature }; |
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