The smart contract exposes multiple methods to handle creating NEAR/FT/NFT drops and claiming created drops by another user using a PublicKey.
Install cargo-near
and run:
cargo near build
cargo test
In this example we will be using NEAR CLI to interact with the NEAR blockchain and the smart contract
To initialize the contract do:
near call <deployed-to-account> new '{"top_level_account": "<deployed-to-account>"}' --accountId <deployed-to-account>
To create NEAR drop call 'create_near_drop' method and pass following parameters:
public_keys
- array of public keys to be used for claiming dropsamount_per_drop
- amount of NEAR tokens to claim per drop
near call <deployed-to-account> create_near_drop '{"public_keys": ["<public-key-1>", "<public-key-2>"], "amount_per_drop": "100000000000000000000000"}' --accountId <creator-account-id> --deposit 1 --gas 300000000000000
To create FT drop call 'create_ft_drop' method and pass following parameters:
public_keys
- array of public keys to be used for claiming dropsft_contract
- FT contract accountamount_per_drop
- amount of NEAR tokens to claim per drop
near call tight-achiever.testnet create_ft_drop '{"public_keys": ["<public-key-1>", "<public-key-2>"], "amount_per_drop": "1", "ft_contract": "ft.tight-achiever.testnet"}' --accountId tight-achiever.testnet --gas 300000000000000
To create NFT drop call 'create_ft_drop' method and pass following parameters:
public_key
- a public key to be used for claiming dropnft_contract
- NFT contract account
near call tight-achiever.testnet create_nft_drop '{"public_key": "<public-key>", "nft_contract": "nft.tight-achiever.testnet"}' --accountId tight-achiever.testnet --gas 300000000000000
near contract call-function as-transaction <deployed-to-account> claim_for json-args '{"account_id": "<existing-claimer-account-id>"}' prepaid-gas '30.0 Tgas' attached-deposit '0 NEAR' sign-as <deployed-to-account> network-config testnet sign-with-plaintext-private-key --signer-public-key <public-key> --signer-private-key <private-key> send
near contract call-function as-transaction <deployed-to-account> create_account_and_claim json-args '{"account_id": "<new-claimer-account-id>"}' prepaid-gas '300.0 Tgas' attached-deposit '0 NEAR' sign-as <account-id> network-config testnet sign-with-plaintext-private-key --signer-public-key <public-key> --signer-private-key <private-key> send
- cargo-near - NEAR smart contract development toolkit for Rust
- near CLI-RS - Iteract with NEAR blockchain from command line
- NEAR Rust SDK Documentation
- NEAR Documentation
- NEAR StackOverflow
- NEAR Discord
- NEAR Telegram Developers Community Group
- NEAR DevHub: Telegram, Twitter