momoai-sdk
v0.1.0
Published
MomoAI tg mini SDK
Downloads
85
Readme
MomoAI tg mini SDK
MomoAI - People's Momo|Social|Web3Game|Telegram|Formerly MetaOasis. Note: The current version only supports Telegram mini-App.
Install
npm i momoai-sdk
Usage
import { Momoai,utils } from 'momoai-sdk'
const momoai = Momoai.init({
appId: 'momoai appId',
api: 'momoai api'
})
// login momoai
momoai.login().then((res: AuthResult)=>{
console.log(res)
})
// tg uitls
utils.getTgInitData().then(res=>{
// tg start_param eg:https://t.me/my_bot/app/startapp=hello
console.log(res.initData.start_param)
// print hello
// tg user
console.log(res.initData.user)
})
// ton
const address = await utils.ton.connectTon()
console.log(address)
const to = 'xxxx'
const tx = await utils.ton.sendTransactionWithPayload(to, 0.5, 'send 0.5 ton')
console.log(tx)