Commit 6f793922 authored by Ishini Kiridena's avatar Ishini Kiridena

completed changes on the patient-practitioner NFT

parent 32f39bc7
......@@ -16,8 +16,8 @@ async function DoManageData(sourceSeed, assetCode, ipfsHash) {
// Build the transaction
const transaction = new StellarSdk.TransactionBuilder(account, {
fee,
networkPassphrase: StellarSdk.Networks.PUBLIC,
fee: StellarSdk.BASE_FEE,
networkPassphrase: StellarSdk.Networks.TESTNET,
})
.addOperation(operation)
.setTimeout(30)
......
const StellarSdk = require("stellar-sdk");
require("dotenv").config();
const server = new StellarSdk.Server(process.env.STELLARTESTNET);
async function SendPayment(
assetCode,
sourceSeed,
destinationPublicKey,
issuerPk
) {
try {
// Load source account details
const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSeed);
const sourceAccount = await server.loadAccount(sourceKeypair.publicKey());
// Load destination account details
const destinationAccount = await server.loadAccount(destinationPublicKey);
// Create the payment operation
const paymentOperation = StellarSdk.Operation.payment({
destination: destinationPublicKey,
asset: new StellarSdk.Asset(assetCode, issuerPk),
amount: "0.0000001",
});
// Build the transaction
const transaction = new StellarSdk.TransactionBuilder(sourceAccount, {
fee: StellarSdk.BASE_FEE,
networkPassphrase: StellarSdk.Networks.TESTNET,
})
.addOperation(paymentOperation)
.setTimeout(30)
.build();
// Sign the transaction with the source account keypair
transaction.sign(sourceKeypair);
// Submit the transaction to the Stellar network
const transactionResult = await server.submitTransaction(transaction);
// Log the transaction hash
console.log(`Transaction hash for payment : ${transactionResult.hash}`);
return true;
} catch (error) {
console.error(error);
return false;
}
}
module.exports = SendPayment;
const NFTRequest = require("./../model/stellar/nftRequests"); // assuming "nftRequest" is the name of the Mongoose model
async function UpdateNFTRequestStatus(assetcode) {
try {
const filter = { assetcode: assetcode };
const update = { status: "Completed" };
const options = { new: true }; // Return the updated document
const updatedRequest = await NFTRequest.findOneAndUpdate(
filter,
update,
options
);
return !!updatedRequest; // convert updatedRequest to boolean value
} catch (error) {
console.error(error);
return false;
}
}
module.exports = UpdateNFTRequestStatus;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment