Once you have funds on Matic, you can use those funds to send to others instantly.
recipientis the receiver’s address, to whom the funds are supposed to be sent.
Now, depending upon your asset, add the following code:
Sidenote — you can change the
parentparameter to TRUE if you are using Matic.js to transfer funds on the main Ethereum network.
We will be making 2 different transfers worth
1 TEST and
0.100 TEST tokens respectively.
The screenshots below will provide context during the actual transfer.
We will be transferring
1 TEST from Account 1 to Account 2 on Matic Network.
0x1a06816065731fcBD7296f9B2400d632816b070B. This account currently holds
11 TEST tokens.
0xf66f409086647591e0c2f122C1945554b8e0e74F. This account currently holds
0 TEST tokens.
Now we will run the transfer function. Run this on the terminal:
$ node transfer-ERC20.js
Let’s verify our balances on Metamask.
Our balance on account address —
0x1a06816065731fcBD7296f9B2400d632816b070B is now updated to
10 TEST tokens.
And to confirm that on our receiver’s account, our balance is now updated to
1 TEST tokens.
You can also check the transaction on the Matic Explorer by searching the transaction hash.
Link to the explorer - https://mumbai-explorer.matic.today/
In this transaction we will attempt to transfer
0.100 TEST from Account 1 to Account 3.
0xbFF81BA6Fa6593F0467592ACcF770A120f740552. Account 3 currently has
0 TEST tokens.
We will again run
$ node transfer-ERC20.js from the terminal.
Balance on Account 1 now shows a balance of
whereas the balance on Account 3 shows us