Skip to main content



The following is an explanation of how to initiate a transfer transaction in NEAR network by invoking the through dapp.request. We recommend utilizing a dedicated library rather than accessing the service directly if you want a greater degree of abstraction than the official API provides.

To send a transaction from the Juno-supported dApp, it needs to be followed the steps below.

  1. Detecting of Universal Provider (window.dapp)
  2. Detecting the NEAR network to which the user is linked
  3. Import the NEAR account of the user

The WELLDONE Wallet finds and imports networks associated with that wallet address. Before submitting a transaction, you should evaluate whether to transmit it to the mainnet or the testnet. The following format can be used to transmit the transaction:

const response = await dapp.request('near', {
method: 'dapp:signAndSendTransaction',

1. Returns

This method returns the transaction hash value as a Promise object of type string because you can send multiple transactions as well as one transaction.


2. Params

type HEX_STRING_TX_DATA = string;
  • HEX_STRING_TX_DATA must be passed to the parameter in order for a transaction to be sent from NEAR. The near-api-js library can provide these values, and the link and the example below can explain their detailed usage.

3. Example

import { providers, transactions, utils } from 'near-api-js';
const getSerializedTransaction = async ( accounts ) => {
const rpc = '';
const provider = new providers.JsonRpcProvider(rpc);
const accountLocal = currentAccount['near'].address;
const publicKey = currentAccount['near'].pubKey;
const signerId = accountLocal;
const accessKey = await provider.query(`access_key/${signerId}/${publicKey}`, '');
const actions = [transactions.transfer(new BN(10))];
const recentBlockHash = utils.serialize.base_decode(accessKey.block_hash);

const transaction = transactions.createTransaction(
accessKey.nonce + 1,

const bytes = transaction.encode();

return Buffer.from(bytes).toString('hex');

const sendTransaction = async = () => {
// get accounts first
const accounts = await dapp.request('near', { method: 'dapp:accounts' });
const HEX_STRING_TX_DATA = await getSerializedTransaction(accounts);
// sending a transaction
const response = await dapp.request('near' ,{
method: 'dapp:signAndSendTransaction',
params: [
// use serialized transaction
const txHash = response[0];
} catch (error) {
message: 'User denied transaction signature',
code: 4001,

To complete the transaction, follow the steps outlined below. A faucet is required to transmit a transaction. The following URL will send you a tap of the NEAR testnet token.

Live Editor