# Send Transaction

This example show how to send fund from one account to another account with the help of injected enzyme wallet.

# Javascript

import { web3FromAddress } from '@polkadot/extension-dapp';
import { ApiPromise, WsProvider } from '@polkadot/api';

// finds an injector for an address
const injector = await web3FromAddress('5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE');
const WS_PROVIDER = 'wss://dev-node.substrate.dev:9944';
// set provider
const provider = new WsProvider(WS_PROVIDER);
// create api to connect node
const api = await ApiPromise.create({ provider });

// 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) => { ... });

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Above code will open Enzyme extension to send funds. Enzyme extension will validate the transaction, if your account not have enough balance then it show's error message and disabled Allow button.

Once you click on allow, It will generate the signature and send the response back to dApp for send.