@broxus/airdrop-ui
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

The library provides the AirdropUI utility for implementing an airdrop form, examples of usage.

To implement your own logic:

  1. checkQueue -- checks if the user has an airdrop and their position in the queue

    import { checkQueue } from '@broxus/airdrop-ui'
    const checkResult = await checkQueue(apiBaseUrl, workspaceId, userAddress)
    

    checkResult will have one of the following values:

    1. noReward -- no reward for the user.
    2. inQueue -- a reward is available, and the user is in the queue. checkResult.place contains the user's current position in the queue. In this case, you need to repeat the checkQueue operation every 30 seconds.
    3. signed -- the user's turn has come, and you can proceed to the next step.
  2. buildTransaction -- prepares the data for calling a transaction

    import { buildTransaction } from '@broxus/airdrop-ui'
    import { Clock, EverscaleStandaloneClient } from 'everscale-standalone-client'
    import { CHAIN } from '@tonconnect/ui'
    
    const clock = new Clock()
    const providerRpcClient = new ProviderRpcClient({
        fallback: () =>
            EverscaleStandaloneClient.create({
                clock,
                connection: {
                    data: {
                        endpoint: 'https://jrpc-ton.broxus.com/rpc',
                    },
                    id: Number(CHAIN.MAINNET),
                    type: 'jrpc',
                },
            }),
        forceUseFallback: true,
    })
    const trxData = await buildTransaction(claimData, providerRpcClient, clock)
    
  3. Execute the transaction

    import { TonConnectUI } from '@tonconnect/ui'
    const tonConnectUI = new TonConnectUI()
    tonConnectUI.sendTransaction(trxData)
    

Readme

Keywords

none

Package Sidebar

Install

npm i @broxus/airdrop-ui

Weekly Downloads

4

Version

1.0.6

License

AGPL-3.0

Unpacked Size

94.9 kB

Total Files

15

Last publish

Collaborators

  • pavel337
  • odrin
  • 30mb1
  • geronimo
  • rexagon
  • pavlovdog_