
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@coin-unknown/lottery-core
Advanced tools
This SDK provides a set of functions to interact with a TON blockchain-based lottery system. The SDK facilitates operations such as buying tickets, claiming rewards, creating lottery rounds, and managing referral programs.
More details can be found at Lottery Platform.
Ensure you have installed the necessary dependencies:
npm install @ton/core @tonconnect/sdk
async getFactory(): Promise<OpenedContract<LotteryFactory>>Returns a singleton instance of the lottery factory contract.
async getRefWallet(address: Address): Promise<OpenedContract<ReferralWallet>>Retrieves an instance of the referral wallet contract associated with the provided address.
async getLottery(roundIdx: number): Promise<OpenedContract<Lottery>>Gets a lottery contract instance for a specific round index.
getSender(tonconnect: TonConnect): TonConnectProviderInitializes and returns an instance of TonConnectProvider for blockchain interaction.
getReadableTicketNumber(number: number | bigint): stringFormats ticket numbers by adding leading zeros.
getTicketMatch(ticket: string, draw: string): numberCalculates the number of matching digits between a ticket and a draw result.
async getLastRoundId(): Promise<number>Returns the index of the last created lottery round.
getRoundStatus(status: bigint): RoundStatusConverts a numerical status code to a readable RoundStatus enum.
async getRound(wallet: Wallet, roundIdx?: number): Promise<IRound>Retrieves detailed information about a lottery round, including ticket sales, draw time, and user data.
async createReferralWallet(tonConnect: TonConnect)Creates a referral wallet with a small transaction fee.
async claimReferralReward(tonConnect: TonConnect)Withdraws referral rewards from the referral wallet.
async getTicketsPrice(roundIdx: number, qty: number): Promise<string>Calculates the price of purchasing a specific number of tickets.
async buyTicket(tonConnect: TonConnect, roundIdx: number, qty: number, cost: number, refWallet?: Address)Purchases lottery tickets for the sender.
async buyTicketFor(tonConnect: TonConnect, roundIdx: number, qty: number, cost: number, recipient: Address, refWallet?: Address)Purchases lottery tickets for another wallet.
async claimTickets(tonConnect: TonConnect, roundIdx: number, winTicketsIds: number[])Claims winnings for specified ticket IDs.
async claimPlatformComission(tonConnect: TonConnect, roundIdx: number)Claims the commission earned from a lottery round.
async createRound(tonConnect: TonConnect)Creates a new lottery round.
async closeRound(tonConnect: TonConnect, roundIdx: number)Closes an ongoing lottery round.
async drawRound(tonConnect: TonConnect, roundIdx: number)Initiates the draw process for a lottery round.
async moveFunds(tonConnect: TonConnect, roundIdx: number)Transfers the remaining funds to the next lottery round.
async _buyTicket(tonConnect: TonConnect, params: BuyTicketParams): Promise<boolean>Helper function to handle ticket purchase transactions internally.
import TonConnect from '@tonconnect/sdk';
import { buyTicket, getRound } from '@coin-unknown/lottery-core';
const tonConnect = new TonConnect();
const roundInfo = await getRound(tonConnect.wallet);
await buyTicket(tonConnect, roundInfo.id, 2, 10);
console.log(roundInfo);
This SDK is released under the MIT License.
FAQs
My awesome typescript library
We found that @coin-unknown/lottery-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.