Skip to content

use @kadena/client Pact builder and sign with Ecko wallet #1350

Answered by ash-vd
veznidav asked this question in Q&A
Discussion options

You must be logged in to vote

Ecko expects a signing request, not an ICommand. You have to convert your command to a signing request before sending it to Ecko. An easier way to get this working is using the signWithEckoWallet function:

const tx = Pact.builder
.execution(
  Pact.modules.coin.transfer(acc, rec, {
    decimal: '1',
  })
)
.addSigner(keyFromAccount(acc), (withCapability) => [
  withCapability('coin.GAS'),
  withCapability('coin.TRANSFER', acc, rec, {
    decimal: '1',
  }),
])
.setMeta({ chainId: '1', senderAccount: keyFromAccount(acc) })
.setNetworkId('mainnet01')
.createTransaction();
const signWithEckoWallet = createEckoWalletSign();

await signWithEckoWallet(tx);

If you prefer to do it in the way you…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by veznidav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants