Solana: fetch Mint Account details using web.3js V2
I submit to you the Obrazer Stati Out of the Mint Sing Web3.js V2 and Library Program @solana Program/Token.
caught the detail of the Mint Web3.js V2 and @solana Program/Token Programs
In this state, we dissatisfied with the detailed Mint ate them new solan web3.js v2 and library program @solana program/token. Websy wrapped up, a token program, and no soolana, but no web3.js for the data of the Mint.
PROVIDERS
- Installing SOLAN CLI
- Node.js set
- Web3.js Installation
Shag 1: Submit tokene program
O Program – Discharge from Solan Blockchain, which leaves you to proclaim the Polish tokens. Token a Token Program, we will use the library program solane/token program.
Submit the new directory for your project and its without npm:
`Bash
Kilogram Program Solon Program
CD Solan Token Program-Example
NPM INIT -Y
Installed the trees:
`Bash
NPM Install @solana Program/Token Programs
Submit the fille named Token Program.json's
s and the postcard code:
`JSON
{
"Name": "MyToken",
"Author": {
"ID": "Name of Polish"
}
"Description":
}
This will be a new token program with the name, auto and desk.
Shag 2: Dpl Token Program
The Tooten Tooten Program on Solan, we will use the Solan Program/Token program library. Submit the fille with the name dloy.sh
and add the following code:
`Bash
#!/Bin/Sh
Echo "Exaltation of the Token Program ..."
SOLO RUN -Script Script DPLOW -NAME MYTOKEN \
SOLANA program (tokens) -data-phile token program.json \
-ACount Name Accounts/0-SCRIPT WALH MY-TOKEN SCRIPT.JS
This will be a new expulsion from the token program on Solan.
Shag 3: Submit the catch written
To relate to the subcutaneous information of the Akkunte, the actual axial ACTOM ACDOMY, which are their deril. We dose the library program @solana program/tokens AGA.
Submit the file with the name Create-ccount.sh 'and the code of the
Bash
#!/Bin/Sh
Echo "Conservation of the Political Consistency ..."
Solo Run -Script Script DPLOW \
SOLANA (Token Programs) — Name Myaccount-Data-File Create-Account.json \
-Akcunt Name of UCHED REST/1-SCRIPT WALH MY-ACCOUNT.JS
This will be a new indivi -dostroming, which is composed of tokens.
Shag 4: Subsoste of the Mint Fetch
To relate the subcutaneous information of the Mint, Web3.js for the Solan. Submit the file with the Fetch-Mint-Account.sh
and the code:
`Bash
#!/Bin/Sh
Echo "Considering Undercutting Mint ..."
Const Web3 = Require ('Web3');
Const Accounts = Await Web3.eth.accounts.get ();
constanprogramaddress = 'Some Tokene Programs Adddress'; // replace the flipping through the token program
Const Transaction = {
free: 'Your-Username',
To: accounts [0] .Address, // replace on the polish address of the cuts
Currency: Web3
Gaslimit: 2000,
};
Web3.eth.Sendtransction (transaction)
.Then ((transctionreceipt) => {
Console.log (Sub -information on Mint:, transactionreceipt);
})
.catch ((liner) => {
Console.error ('Listening of testimonials about the coat:', distinction);
});
This will be a new transaction that you will get a sub -infort of objeys recording Mint, and the substitute sign that you do web3.js.
I collect all the way
Here’s the extinguishing that you can cut into:
`Bash
./Create-account.sh
./Fetch Mint-Account.sh
Over the “Myaccont”, your policeman name, “the program of some program with the furrowing program token and` your-uername ‘
This will be a new custom -made theme accomy accomy and then that they will be a seque designed web3.js.