I am getting Error: Can not sign transactions for account
when I call play()
on this contract. What causes the error?
Here is the code,
https://github.com/Learn-NEAR/sample--lottery/blob/main/src/lottery/assembly/index.ts
play(): void {
assert(this.active, this.winner + " won " + this.pot.toString() + ". Please reset the game.");
const signer = Context.sender;
// if you've played before then you have to pay extra
if (this.players.has(signer)) {
const fee = this.fee();
assert(Context.attachedDeposit >= fee, this.generate_fee_message(fee));
this.increase_pot();
// if it's your first time then you may win for the price of gas
} else {
this.players.add(signer);
}
this.last_played = signer;
if (this.won()) {
this.winner = signer;
this.payout();
} else {
this.lose();
}
}
You need to login with your NEAR account and to do this type
near login
.