🖥️Executing server side contract calls
In our previous guide Make Your First Contract Call (deployContract) , we explored the process of setting up a wallet connection on a client to facilitate smart contract executions. While wallets primarily manage user account keypairs, they can also be employed directly. This approach is often used on the server side to manage admin accounts responsible for performing specific transactions.
Step 1: Setup
Install the necessary libraries using:
Step 2: Instantiate the account
A near account will correspond to one or multiple keypairs, we can choose to instantiate one through the seedphrase or private key. In this case we will use a private key. We start by setting a keystore and then calling the connect method which produces an account object which can then be used to send transactions.
Step 3: Send Transactions
Now that we have the account object the next step is to create the arguments for the transactions. In this case we are gonna make a listing on the mintbase marketplace.
In order to make a listing I need to make a contract call to deposit storage and then another to make the listings.
For the list call the arguments are the contractAddress on which the nft was minted on and the corresponding tokenId. The token needs to belong to the account which was instantiated before.
You can learn how to mint an nft here Upload Reference Material To Arweave and Mint
Now we call the execute method that can take any amount of contract call arguments in an array and attach the account object from which the call is going to be made.
Last updated