I'm trying to send a transaction from my react frontend to local chain, I have signed in wax cloud wallet and made a transaction. But at last I met this signature error.
"Message: transaction declares authority '{"actor":"mywarm.wam","permission":"active"}', but does not have signatures for it."
I found that it is because the private key supplied to the signature provider is incorrect for the actor in which the transaction is being signed for. but I can't find the way to fix this
Frontend Code
import './App.css';
import { useState, useEffect } from 'react';
import * as waxjs from "@waxio/waxjs/dist";
// import SignatureProvider from 'eosjs-ledger-signature-provider';
function App() {
const [wax, setWax] = useState('');
const [signedAccount, setSignedAccount] = useState('');
const [response, setResponse] = useState('');
const [message, setMessage] = useState('');
// const signatureProvider = new SignatureProvider()
useEffect(() => {
const wax = new waxjs.WaxJS({
rpcEndpoint: 'http://127.0.0.1:8888'
});
setWax(wax);
}, [])
const login = async () => {
try {
const userAccount = await wax.login();
setSignedAccount(userAccount);
} catch(e) {
setResponse(e.message);
}
}
const create = async () => {
if(!wax.api) {
setResponse('* Login first *');
}
try {
const result = await wax.api.transact({
actions: [{
account: 'armyassets',
name: 'createcol',
authorization: [{
actor: wax.userAccount,
permission: 'active',
}],
data: {
author: wax.userAccount,
collection_name: "bbcollection",
allow_notify: true,
authorized_accounts: wax.userAccount,
notify_accounts: wax.userAccount,
market_fee: 0.1,
data: [{
key:"name",
value:["string","bbcollection"],
}],
},
}]
}, {
// signatures: [signatureProvider],
blocksBehind: 3,
expireSeconds: 1200
});
setMessage(JSON.stringify(result));
await new Promise(resolve => setTimeout(resolve, 1000));
// await getCurrentMessage();
} catch(e) {
setMessage(e.message);
}
}
return (
<div className="App">
<header className="App-header">
This is the test app for wax blockchain
</header>
<div className="App-content">
<div className="App-button">
<button onClick={login} className="login-btn">Login</button>
<button onClick={create} className="sign-button">Create NFT</button>
</div>
<div className="App-account">
<div>Signed User : </div>
<div className="App-account-content">{signedAccount}</div>
</div>
</div>
<div className="App-response">
Response: {response}
</div>
<div className="App-response">
Message: {message}
</div>
</div>
);
}
export default App;
I have referenced this articles, but I still didn't find the solution.
transaction declares authority '{"actor":"mymultisig11","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms
Transaction requires authority, but does not have signatures for it
I have used development private key for eos on eos studio and deployed my smart contract code to local test net. And I signed in with my wax wallet account on my frontend, so the error might occur, I guess.
I also tried to make a transaction by using default actor on eos studio, but the same error appears.
authorization: [{
actor: "armyassets", //this is default actor on eos studio
// actor: wax.userAccount,
permission: 'active',
}]
Please recommend any possible ways to deal with this.
Best Regards