forked from layr-team/Layr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kadence_plugin.js
37 lines (26 loc) · 1007 Bytes
/
kadence_plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module.exports.kad_bat = function(node) {
node.use('BATNODE', (req, res, next) => {
let contact = node.batNode.address
if (node.batNode.server){
res.send(contact);
} else {
res.send(['false'])
}
});
node.getOtherBatNodeContact = function(targetNode, callback) {
let batcontact = node.batNode.address
node.send('BATNODE', batcontact, targetNode, callback); // batcontact is an object, targetNode is a contact tuple from a bucket
};
};
module.exports.stellar_account = function(node) {
node.use('STELLAR', (req, res, next) => {
let stellarId = node.batNode.stellarAccountId;
console.log('my stellar id is: ', stellarId)
res.send(`${stellarId}`)
})
node.getOtherNodeStellarAccount = function(targetNode, callback) {
console.log('my stellar id is: ', node.batNode.stellarAccountId)
console.log("requesting this node's stellar ID: ", targetNode)
node.send('STELLAR', [node.batNode.stellarAccountId], targetNode, callback)
}
}