Closed mojowlekaz closed 2 years ago
You are not initializing hashconnect - please read docs
I did initialise Hashconnect
You can send me a link to that if I'm getting something wrong.
On Sat, 20 Aug 2022, 3:08 pm Tyler Cote, @.***> wrote:
You are not initializing hashconnect - please read docs
— Reply to this email directly, view it on GitHub https://github.com/Hashpack/hashconnect/issues/128#issuecomment-1221321361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWGVSZLJ6QHD67KN2CT2Z6LV2DREHANCNFSM57DBLOQA . You are receiving this because you authored the thread.Message ID: @.***>
You are literally not calling .init()
Oh..
I did that and I'm not sure what the error is about, could you show me how it'll be written properly?
On Sat, 20 Aug 2022, 3:12 pm Tyler Cote, @.***> wrote:
You are literally not calling .init()
— Reply to this email directly, view it on GitHub https://github.com/Hashpack/hashconnect/issues/128#issuecomment-1221322030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWGVSZPMDVX7BSSXWT2ARW3V2DRURANCNFSM57DBLOQA . You are receiving this because you authored the thread.Message ID: @.***>
read the docs
read the docs
Top the worst response I have ever seen on github..
great job
great job
Thank you
Fixed it by following the examples: https://github.com/Hashpack/hashconnect/tree/main/example/dapp
Still the documentation is lacking.
Here is my Code
async function run() {
let contractId = ContractId.fromString("0.0.47907889"); let accountId = "0.0.47905112" const privateKey = PrivateKey.fromString("302e020100300506032b657004220420341b71552663fe46c2cec11d71dda6a5f804e704760f7e625ba59165a56d1a59");
const provider = hashconnect.getProvider('testnet', saveData.topic, accountId) const signer = hashconnect.getSigner(provider) let balance = await provider.getAccountBalance(accountId) const stakeTx = await new ContractExecuteTransaction() .setContractId(contractId) .setGas(500000) .setPayableAmount(50) .setFunction("stakeTokens") .freezeWithSigner(signer); const result = await stakeTx.executeWithSigner(signer) console.log(result)
} when i run this, it gives me an error "Error: SimpleCrypto object MUST BE initialised with a SECRET KEY."