Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 16
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 16
22_23-J 16
Commits
6f793922
Commit
6f793922
authored
Apr 16, 2023
by
Ishini Kiridena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completed changes on the patient-practitioner NFT
parent
32f39bc7
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
253 additions
and
60 deletions
+253
-60
ExpressBackend/route/patient-routes/nft-route.js
ExpressBackend/route/patient-routes/nft-route.js
+181
-58
ExpressBackend/services/manageDataForAsset.js
ExpressBackend/services/manageDataForAsset.js
+2
-2
ExpressBackend/services/paymentOperation.js
ExpressBackend/services/paymentOperation.js
+50
-0
ExpressBackend/services/updateNFTRequest.js
ExpressBackend/services/updateNFTRequest.js
+20
-0
No files found.
ExpressBackend/route/patient-routes/nft-route.js
View file @
6f793922
This diff is collapsed.
Click to expand it.
ExpressBackend/services/manageDataForAsset.js
View file @
6f793922
...
...
@@ -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
)
...
...
ExpressBackend/services/paymentOperation.js
0 → 100644
View file @
6f793922
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
;
ExpressBackend/services/updateNFTRequest.js
0 → 100644
View file @
6f793922
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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment