Send Delegate TX using web3

Hello!
I am willing to send delegate transactions using Metamask and web3, but I do not find anywhere in the docs the schema for the raw transaction.

Could anybody give me a clue?

Thanks!

1 Like

metamask and web3 does not support staking. you will have to use harmony-js sdk (sdk/README.md at master · harmony-one/sdk · GitHub) and onewallet (Interacting with One Wallet - Harmony)

Thanks Ganesha, I was already implementing the OneWallet but I was trying to add Metamask support.

Hello Ganesha,

I have tried following the docs but I cannot sign the staking the TX using the onewallet.signStaking() method as a I do not have access to the private key on the browser when using Harmony OneWallet.

I have been also following the github of chrome extension docs
but when calling signTransaction() the following error is being thrown:

Unhandled Rejection (TypeError): Cannot read property 'shardID' of undefined

I assume this is because the StakingFactory .build() method is returning a StakingTransaction which extends TransactionBase, but it is not Transaction, as expected by that method.

Am I missing anything?

The issue was solved by not instantiating HarmonyExtension with window.onewallet as parameter. I do not understand why, but I guess that HarmonyExtension class is only needed when using private key or a ledger, right?