-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
245 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,33 +4,33 @@ | |
# 'meteor add' and 'meteor remove' will edit this file for you, | ||
# but you can also edit it by hand. | ||
|
||
meteor-base@1.2.0 # Packages every Meteor app needs to have | ||
meteor-base@1.3.0 # Packages every Meteor app needs to have | ||
[email protected] # Packages for a great mobile UX | ||
mongo@1.3.1 # The database Meteor supports right now | ||
mongo@1.4.2 # The database Meteor supports right now | ||
[email protected] # Compile .html files into Meteor Blaze views | ||
[email protected] # Reactive variable for tracker | ||
[email protected] # Meteor's client-side reactive programming library | ||
|
||
standard-minifier-css@1.3.5 # CSS minifier run for production mode | ||
standard-minifier-js@2.2.0 # JS minifier run for production mode | ||
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers | ||
ecmascript@0.9.0 # Enable ECMAScript2015+ syntax in app code | ||
[email protected].0 # Server-side component of the `meteor shell` command | ||
standard-minifier-css@1.4.0 # CSS minifier run for production mode | ||
standard-minifier-js@2.3.1 # JS minifier run for production mode | ||
es5-shim@4.7.0 # ECMAScript 5 compatibility for older browsers | ||
ecmascript@0.10.6 # Enable ECMAScript2015+ syntax in app code | ||
[email protected].1 # Server-side component of the `meteor shell` command | ||
|
||
planettraining:material-design-icons-font | ||
nimble:restivus | ||
accounts-password | ||
accounts-password@1.5.0 | ||
alanning:roles | ||
ddp-rate-limiter | ||
ddp-rate-limiter@1.0.7 | ||
universe:i18n | ||
react-meteor-data | ||
aldeed:collection2-core | ||
aldeed:schema-deny | ||
session | ||
less | ||
session@1.1.7 | ||
less@2.7.11 | ||
mdg:validated-method | ||
vsivsi:job-collection | ||
email@1.2.3 | ||
aldeed:[email protected] | ||
aldeed:schema-index | ||
http | ||
http@1.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[email protected].0.1 | ||
[email protected].1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,41 +6,41 @@ aldeed:[email protected] | |
aldeed:[email protected] | ||
aldeed:[email protected] | ||
[email protected] | ||
autoupdate@1.3.12 | ||
babel-compiler@6.24.7 | ||
babel-runtime@1.1.1 | ||
autoupdate@1.4.0 | ||
babel-compiler@7.0.7 | ||
babel-runtime@1.2.0 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
boilerplate-generator@1.3.1 | ||
boilerplate-generator@1.4.0 | ||
[email protected] | ||
[email protected] | ||
callback-hook@1.0.10 | ||
check@1.2.5 | ||
callback-hook@1.1.0 | ||
check@1.3.0 | ||
[email protected] | ||
[email protected] | ||
ddp-client@2.2.0 | ||
ddp-common@1.3.0 | ||
ddp-client@2.3.1 | ||
ddp-common@1.4.0 | ||
[email protected] | ||
[email protected].1 | ||
[email protected].2 | ||
[email protected] | ||
diff-sequence@1.0.7 | ||
dynamic-import@0.2.1 | ||
ecmascript@0.9.0 | ||
diff-sequence@1.1.0 | ||
dynamic-import@0.3.0 | ||
ecmascript@0.10.6 | ||
[email protected] | ||
ecmascript-runtime-client@0.5.0 | ||
ecmascript-runtime-client@0.6.0 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
es5-shim@4.6.15 | ||
es5-shim@4.7.0 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
http@1.3.0 | ||
id-map@1.0.9 | ||
http@1.4.0 | ||
id-map@1.1.0 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -49,44 +49,47 @@ [email protected] | |
[email protected] | ||
mdg:[email protected] | ||
[email protected] | ||
meteor-base@1.2.0 | ||
minifier-css@1.2.16 | ||
minifier-js@2.2.2 | ||
meteor-base@1.3.0 | ||
minifier-css@1.3.0 | ||
minifier-js@2.3.1 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected].2 | ||
[email protected].3 | ||
[email protected] | ||
mongo@1.3.1 | ||
mongo@1.4.2 | ||
[email protected] | ||
[email protected] | ||
mrt:[email protected] | ||
nimble:[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
ordered-dict@1.0.9 | ||
ordered-dict@1.1.0 | ||
planettraining:[email protected] | ||
[email protected].0 | ||
[email protected].1 | ||
raix:[email protected] | ||
random@1.0.10 | ||
random@1.1.0 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
reload@1.1.11 | ||
retry@1.0.9 | ||
reload@1.2.0 | ||
retry@1.1.0 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
simple:[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
standard-minifier-css@1.3.5 | ||
standard-minifier-js@2.2.3 | ||
standard-minifier-css@1.4.0 | ||
standard-minifier-js@2.3.1 | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
|
@@ -96,7 +99,7 @@ [email protected] | |
[email protected] | ||
[email protected] | ||
universe:[email protected] | ||
url@1.1.0 | ||
url@1.2.0 | ||
vsivsi:[email protected] | ||
webapp@1.4.0 | ||
webapp@1.5.0 | ||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 39 additions & 30 deletions
69
imports/modules/server/namecoin/check_new_transactions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,55 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { listSinceBlock, nameShow } from '../../../../server/api/namecoin.js'; | ||
import { getRawTransaction, nameShow } from '../../../../server/api/namecoin.js'; | ||
import { CONFIRM_CLIENT, CONFIRM_ADDRESS } from '../../../startup/server/namecoin-configuration.js'; | ||
import { Meta } from '../../../api/meta/meta.js'; | ||
import addOrUpdateMeta from '../meta/addOrUpdate.js'; | ||
import addNamecoinEntry from './add_entry_and_fetch_data.js' | ||
import {isDebug} from "../../../startup/server/dapp-configuration"; | ||
|
||
const TX_NAME_START = "update: e/"; | ||
const LAST_CHECKED_BLOCK_KEY = "lastCheckedBlock"; | ||
const TX_NAME_START = "e/"; | ||
|
||
const checkNewTransactions = () => { | ||
|
||
const checkNewTransaction = (txid) => { | ||
try { | ||
var lastCheckedBlock = Meta.findOne({key: LAST_CHECKED_BLOCK_KEY}); | ||
if(lastCheckedBlock !== undefined) lastCheckedBlock = lastCheckedBlock.value; | ||
const ret = listSinceBlock(CONFIRM_CLIENT, lastCheckedBlock); | ||
if(ret === undefined || ret.transactions === undefined) return; | ||
const txs = ret.transactions; | ||
lastCheckedBlock = ret.lastblock; | ||
const addressTxs = txs.filter(tx => | ||
tx.address === CONFIRM_ADDRESS && | ||
tx.category === 'receive' && | ||
tx.confirmations >= 1 && | ||
tx.name !== undefined && | ||
tx.name.startsWith(TX_NAME_START)); | ||
addressTxs.forEach(tx => addTx(tx)); | ||
addOrUpdateMeta({key: LAST_CHECKED_BLOCK_KEY, value: lastCheckedBlock}); | ||
console.log("Transactions updated"); | ||
|
||
if(isDebug()) { console.log("txid: "+txid+' was triggered by walletnotify getting its data from blockchain'); } | ||
|
||
const ret = getRawTransaction(CONFIRM_CLIENT, txid); | ||
if(isDebug()) { console.log('gettransaction was called via rpc'); } | ||
|
||
const txs = ret.vout; | ||
if(!ret || !txs || !txs.length===0){ | ||
console.log("txid"+txid+'does not contain transaction details or transaction not found.'); | ||
return; | ||
} | ||
if(isDebug()) { console.log("get transaction details:"+JSON.stringify(txs)); } | ||
|
||
const addressTxs = txs.filter(tx => | ||
tx.scriptPubKey.nameOp !== undefined | ||
&& tx.scriptPubKey.nameOp.op === "name_doi" | ||
&& tx.scriptPubKey.addresses[0] === CONFIRM_ADDRESS | ||
&& tx.scriptPubKey.nameOp.name !== undefined | ||
&& tx.scriptPubKey.nameOp.name.startsWith(TX_NAME_START) | ||
); | ||
|
||
addressTxs.forEach(tx => addTx(tx,txid)); | ||
|
||
} catch(exception) { | ||
throw new Meteor.Error('namecoin.checkNewTransactions.exception', exception); | ||
} | ||
}; | ||
|
||
function addTx(tx) { | ||
var txName = tx.name.substring(TX_NAME_START.length); | ||
const ety = nameShow(CONFIRM_CLIENT, txName); | ||
function addTx(tx,txid) { | ||
|
||
if(isDebug()) { console.log("addTx:"+JSON.stringify(tx)); } | ||
const txName = tx.scriptPubKey.nameOp.name.substring(TX_NAME_START.length); | ||
const txValue = tx.scriptPubKey.nameOp.value; | ||
const txAddress = tx.scriptPubKey.addresses[0]; //a soi entry can only be send to one address so far. | ||
|
||
addNamecoinEntry({ | ||
name: txName, | ||
value: ety.value, | ||
address: ety.address, | ||
txId: ety.txid, | ||
expiresIn: ety.expires_in, | ||
expired: ety.expired | ||
value: txValue, | ||
address: txAddress, | ||
txId: txid | ||
}); | ||
} | ||
|
||
export default checkNewTransactions; | ||
export default checkNewTransaction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.