Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signing and Sending Transaction with ContractExecuteTransaction Error #128

Closed
mojowlekaz opened this issue Aug 20, 2022 · 8 comments
Closed

Comments

@mojowlekaz
Copy link

Here is my Code

async function run() {

let saveData = {
	topic: "",
	pairingString: "",
	privateKey: "",
	pairedWalletData: null,
	pairedAccounts: [],
};
let appMetadata = {
	name: "Hedera dApp Days",
	description: "Let's buidl a dapp on Hedera",
	icon: "https://raw.githubusercontent.com/ed-marquez/hedera-dapp-days/testing/src/assets/hederaLogo.png",
};

let contractId = ContractId.fromString("0.0.47907889");
let accountId = "0.0.47905112"
const privateKey = PrivateKey.fromString("302e020100300506032b657004220420341b71552663fe46c2cec11d71dda6a5f804e704760f7e625ba59165a56d1a59");

let hashconnect = new HashConnect();

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."

@mojowlekaz mojowlekaz changed the title Signing and Sending Trasaction with ContractExecuteTransaction Error Signing and Sending Transaction with ContractExecuteTransaction Error Aug 20, 2022
@teacoat
Copy link
Contributor

teacoat commented Aug 20, 2022

You are not initializing hashconnect - please read docs

@teacoat teacoat closed this as completed Aug 20, 2022
@mojowlekaz
Copy link
Author

mojowlekaz commented Aug 20, 2022 via email

@teacoat
Copy link
Contributor

teacoat commented Aug 20, 2022

You are literally not calling .init()

@mojowlekaz
Copy link
Author

mojowlekaz commented Aug 20, 2022 via email

@teacoat
Copy link
Contributor

teacoat commented Aug 20, 2022

read the docs

@steffanjensen
Copy link

read the docs

Top the worst response I have ever seen on github..

great job

@teacoat
Copy link
Contributor

teacoat commented Sep 16, 2022

great job

Thank you

@steffanjensen
Copy link

Fixed it by following the examples:
https://github.com/Hashpack/hashconnect/tree/main/example/dapp

Still the documentation is lacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants