Search code examples
nearprotocol

Near blockchain assign payment at backend


I'm new to backend and near blockchain https://github.com/Learn-NEAR/NCD.L1.sample--lottery NCD.L1.sample--lottery When Run the 2nd times

./scripts/2.play.sh

2nd play need to pay $1 near. How to run the 2nd play with set the payment. Any help, please!


Solution

  • You can just add the amount of NEAR tokens as a number after the play command and it will be passed to the variable called $1 in the script

    So you will write this:

    ./scripts/2.play.sh 5
    

    and this will send 5 NEAR tokens $PLAYER account to the contract

    You can read the code of the script here: https://github.com/Learn-NEAR/NCD.L1.sample--lottery/blob/main/scripts/2.play.sh