Work in progress for binary options on Solana.
Example instance: https://m4tt4ew.com/#/pyth
git clone https://github.com/m1tttt4/solana-soce-ui
cd solana-soce-ui
git submodule update --init --recursive
yarn
yarn start
- Install Rust from https://rustup.rs/
- Install Solana v1.6.7 or later from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-tool
- Install Node
- Install NPM, Yarn
Run the following from the program/solana-soce subdirectory:
$ cargo build-bpf
$ cargo test-bpf
Solana program template in Rust
- process_instruction function is used to run all calls issued to the smart contract
Setup here actions that will interact with Solana programs using sendTransaction function
React context objects that are used propagate state of accounts across the application
Pyth hook
- usePyth - hook for fetching products and prices
Generic react hooks to interact with token program:
- useUserBalance - query for balance of any user token by mint, returns:
- balance
- balanceLamports
- balanceInUSD
- useUserTotalBalance - aggregates user balance across all token accounts and returns value in USD
- balanceInUSD
- useAccountByMint
- useTokenName
- useUserAccounts
- home - main page for your app
- faucet - airdrops SOL on Testnet and Devnet