From 84c7870499abc2016f81b7127922be666b787873 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Sun, 14 Jul 2019 11:29:50 +0200 Subject: [PATCH] transfer signAndSend example for the dapp dev (#76) --- packages/extension-dapp/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/extension-dapp/README.md b/packages/extension-dapp/README.md index c4fc4814..654099c2 100644 --- a/packages/extension-dapp/README.md +++ b/packages/extension-dapp/README.md @@ -28,4 +28,11 @@ const injector = await web3FromAddress('5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7 // sets the signer for the address on the @polkadot/api api.setSigner(injector.signer); + +// sign and send out transaction - notice here that the address of the account (as retrieved injected) +// is passed through as the param to the `signAndSend`, the API then calls the extension to present +// to the user and get it signed. Once completex, the api sends the tx + signature via the normal process +api.tx.balances + .transfer('5C5555yEXUcmEJ5kkcCMvdZjUo7NGJiQJMS7vZXEeoMhj3VQ', 123456) + .signAndSend('5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE', (status) => { ... }); ```