when ever i try to run this code
// create a completely new and unique pair of keys
// see more about KeyPair objects: https://stellar.github.io/js-stellar-sdk/Keypair.html
const pair = StellarSdk.Keypair.random();
pair.secret();
// SAV76USXIJOBMEQXPANUOQM6F5LIOTLPDIDVRJBFFE2MDJXG24TAPUU7
pair.publicKey();
// GCFXHS4GXL6BVUCXBWXGTITROWLVYXQKQLF4YH5O5JT3YZXCYPAFBJZB
// The SDK does not have tools for creating test accounts, so you'll have to
// make your own HTTP request.
// if you're trying this on Node, install the `node-fetch` library and
// uncomment the next line:
// const fetch = require('node-fetch');
(async function main() {
try {
const response = await fetch(
`https://friendbot.stellar.org?addr=${encodeURIComponent(
pair.publicKey(),
)}`,
);
const responseJSON = await response.json();
console.log("SUCCESS! You have a new account :)\n", responseJSON);
} catch (e) {
console.error("ERROR!", e);
}
})();
const server = new StellarSdk.Server("https://horizon-testnet.stellar.org");
// the JS SDK uses promises for most actions, such as retrieving an account
const account = server.loadAccount(pair.publicKey());
console.log("Balances for account: " + pair.publicKey());
account.balances.forEach(function (balance) {
console.log("Type:", balance.asset_type, ", Balance:", balance.balance);
});
I get an error
const pair = StellarSdk.Keypair.random();
^
ReferenceError: StellarSdk is not defined
I have copied this code from the stellar official website to create a block can anyone please help me with this