1.2.28 • Published 1 year ago

@greenton/sdk-react v1.2.28

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

@greenton/sdk-react 🌳

This is official NPM package of GreenTON. It contains messages for our contracts. Also here you can find pretty React hooks for sending transaction using TONConnect.

Usage 🛠️

import { Address, toNano } from '@ton/core';
import { useNftCollection } from '@greenton/sdk-react';

const MyComponent: React.FC = () => {
  const { mint } = useNftCollection();

  return (
    <button
      onClick={() =>
        mint({
          validUntil: Math.floor(Date.now() / 1000) + 360,
          message: {
            body: {
              $$type: 'Mint',
              tree: {
                $$type: 'Tree',
                name: 'Oak',
                type: 'basic',
                region: 'Africa',
                location: 'Forest',
              },
              destination: Address.parse('0QDasdGa9ZX8dhsF9qOJexH4-V4nh5Bg3Nwv45DA7f0ieoiM'),
              order_id: null,
            },
            address: 'kQA4PYQ9k12KTIMq4HziIoBZefo-ZJNID0s0Du0M-M6Fi7WG',
            amount: toNano('1'),
          },
        })
      }
    >
      Mint!
    </button>
  );
};

You are also open to directly use messages. For example to create your custom hook:

import { useTonConnectUI } from '@tonconnect/ui-react';
import { GREENTON_MESSAGES, NftCollectionMintArgs } from '@greenton/sdk-react';
import { TransactionArgs } from '~/types/TransactionArgs';

export default function usePerfectNftCollection() {
  const [tonConnectUI] = useTonConnectUI();

  return {
    mint: (args: TransactionArgs<NftCollectionMintArgs>) =>
      tonConnectUI.sendTransaction({
        validUntil: args.validUntil,
        messages: [GREENTON_MESSAGES.nftCollection.mint(args.message)],
      }),
  };
}

Bug reports 👾

If you have experienced any problems or found some bugs, please create an issue in this repository ❤️

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.2.17

1 year ago

1.2.16

1 year ago

1.2.15

1 year ago

1.2.14

1 year ago

1.2.13

1 year ago

1.2.12

1 year ago

1.2.11

1 year ago

1.2.10

1 year ago

1.2.9

1 year ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.0

1 year ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

0.0.1

2 years ago