xxxxxxxxxx
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZjUyNThkMC00ZDcwLTQ1ZDItODM0Ny1hYTE2Mzc2NDhhYjMiLCJpZCI6IjVmNTI1OGQwLTRkNzAtNDVkMi04MzQ3LWFhMTYzNzY0OGFiMyIsImlhdCI6MTYyNDExMjUyNSwiZXhwIjoxNjI0MTk4OTI1fQ.iiqub_1HiloGQcQHot1c12jbN_D6DKjHzWnb1kjllEA
xxxxxxxxxx
// SearchTransactionsNote.js
// requires algosdk@1.6.1 or higher
// verify installed version
// npm list algosdk
const algosdk = require('algosdk');
const indexer_token = "";
const indexer_server = "http://localhost";
const indexer_port = 8980;
// Instantiate the indexer client wrapper
let indexerClient = new algosdk.Indexer(indexer_token, indexer_server, indexer_port);
(async () => {
let names = '{"firstName":"John"';
const enc = new TextEncoder();
const note = enc.encode(names);
const s = Buffer.from(note).toString("base64");
let transactionInfo = await indexerClient.searchForTransactions()
.minRound(10894697)
.notePrefix(s).do();
console.log("Information for Transaction search: " + JSON.stringify(transactionInfo, undefined, 2));
// create a buffer
if (transactionInfo.transactions.length > 0)
{
console.log("First Match:");
const buff = Buffer.from(transactionInfo.transactions[0].note, 'base64');
// decode buffer as UTF-8
const str = buff.toString('utf-8');
// print normal string
console.log(str);
}
})().catch(e => {
console.log(e);
console.trace();
});
xxxxxxxxxx
methods: {
loginUser() {
var data = {
email: this.userData.email,
password: this.userData.password
};
this.app.req.post("api/auth/authenticate", data).then(res => {
const token = res.data.token;
sessionStorage.setItem("chatbot_token", token);
this.$router.push("/admin");
});
}
}
xxxxxxxxxx
// Submit the transaction
await algodClient.sendRawTransaction(signedTxn).do();
// Wait for confirmation
let confirmedTxn = await waitForConfirmation(algodClient, txId, 4);
xxxxxxxxxx
it('should not allow a user to purchase more tokens than available', async () => {
// Assuming the token price is 0.001 Wei per token
// Try to purchase 10,000 tokens with 10 Wei
await expect(tokenSale.connect(buyer).buyTokens(10000, { value: etherToWei(0.01) })).to.be.revertedWith('Not enough tokens available');
});