ton-watcher
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -7,2 +7,4 @@ export * from './modules/txs/tonTxWatcher'; | ||
export * from './utils/safeJson'; | ||
export * from './modules/process/runProcess'; | ||
import { runWatcher } from './modules/process/runProcess'; | ||
import { TonTxWatcher } from './modules/txs/tonTxWatcher'; | ||
@@ -22,9 +24,4 @@ import { JettonsDepo } from './modules/Jetons/JetonInfo'; | ||
}; | ||
runWatcher: typeof runWatcher; | ||
}; | ||
export default _default; | ||
export type InitData = { | ||
deposit_address: string; | ||
last_lt?: string; | ||
last_hash?: string; | ||
}; | ||
export declare function runWatcher(init: InitData): Promise<unknown>; |
@@ -17,3 +17,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.runWatcher = runWatcher; | ||
__exportStar(require("./modules/txs/tonTxWatcher"), exports); | ||
@@ -25,2 +24,4 @@ __exportStar(require("./modules/persistant/persistant"), exports); | ||
__exportStar(require("./utils/safeJson"), exports); | ||
__exportStar(require("./modules/process/runProcess"), exports); | ||
const runProcess_1 = require("./modules/process/runProcess"); | ||
const Transaction_1 = require("./modules/txs/Transaction"); | ||
@@ -31,5 +32,2 @@ const tonTxWatcher_1 = require("./modules/txs/tonTxWatcher"); | ||
const Queue_1 = require("./modules/queue/Queue"); | ||
const ton_access_1 = require("@orbs-network/ton-access"); | ||
const ton_1 = require("@ton/ton"); | ||
const safeJson_1 = require("./utils/safeJson"); | ||
exports.default = { | ||
@@ -40,26 +38,5 @@ parse_tx: Transaction_1.parse_tx, | ||
PriorityQueue: Queue_1.PriorityQueue, | ||
memorySore: persistant_1.memorySore | ||
memorySore: persistant_1.memorySore, | ||
runWatcher: runProcess_1.runWatcher | ||
}; | ||
async function runWatcher(init) { | ||
if (!init) { | ||
throw new Error('Invalid initial data'); | ||
} | ||
try { | ||
const address = init.deposit_address; | ||
const endpoint = await (0, ton_access_1.getHttpEndpoint)({ network: 'mainnet' }); | ||
const client = new ton_1.TonClient({ | ||
endpoint, | ||
}); | ||
const txWatcher = new tonTxWatcher_1.TonTxWatcher(client, address, init.last_lt, init.last_hash, undefined, { | ||
tonBalance: (data) => { process.send && process.send((0, safeJson_1.safeJSONStringify)({ data, event: 'tonBalance' })); }, | ||
jettonBalance: (data) => { process.send && process.send((0, safeJson_1.safeJSONStringify)({ data, event: 'jettonBalance' })); }, | ||
jettonDeposit: (data) => { process.send && process.send((0, safeJson_1.safeJSONStringify)({ data, event: 'jettonDeposit' })); }, | ||
}); | ||
txWatcher.start(); | ||
} | ||
catch (e) { | ||
process.send && process.send((0, safeJson_1.safeJSONStringify)({ event: 'error', data: e })); | ||
} | ||
return await new Promise(() => { }); | ||
} | ||
//# sourceMappingURL=index.js.map |
import { TonTxWatcher } from './modules/txs/tonTxWatcher'; | ||
import { JettonsDepo } from './modules/Jetons/JetonInfo'; | ||
import { PriorityQueue } from './modules/queue/Queue'; | ||
import { runWatcher } from './modules/process/runProcess'; | ||
export * from './utils/safeJson'; | ||
@@ -10,2 +11,3 @@ export * from './modules/txs/tonTxWatcher'; | ||
export * from './modules/queue/Queue'; | ||
export * from './modules/process/runProcess'; | ||
declare const _default: { | ||
@@ -21,3 +23,4 @@ parse_tx: (tx: import("@ton/core").Transaction) => any; | ||
}; | ||
runWatcher: typeof runWatcher; | ||
}; | ||
export default _default; |
@@ -22,2 +22,3 @@ "use strict"; | ||
const Queue_1 = require("./modules/queue/Queue"); | ||
const runProcess_1 = require("./modules/process/runProcess"); | ||
__exportStar(require("./utils/safeJson"), exports); | ||
@@ -29,2 +30,3 @@ __exportStar(require("./modules/txs/tonTxWatcher"), exports); | ||
__exportStar(require("./modules/queue/Queue"), exports); | ||
__exportStar(require("./modules/process/runProcess"), exports); | ||
exports.default = { | ||
@@ -35,4 +37,5 @@ parse_tx: Transaction_1.parse_tx, | ||
PriorityQueue: Queue_1.PriorityQueue, | ||
memorySore: persistant_1.memorySore | ||
memorySore: persistant_1.memorySore, | ||
runWatcher: runProcess_1.runWatcher | ||
}; | ||
//# sourceMappingURL=ton-watcher.js.map |
{ | ||
"name": "ton-watcher", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -7,12 +7,13 @@ export * from './modules/txs/tonTxWatcher'; | ||
export * from './utils/safeJson'; | ||
export * from './modules/process/runProcess'; | ||
import { runWatcher } from './modules/process/runProcess'; | ||
import { parse_tx } from './modules/txs/Transaction'; | ||
import { EventMap, TonTxWatcher } from './modules/txs/tonTxWatcher'; | ||
import { TonTxWatcher } from './modules/txs/tonTxWatcher'; | ||
import { JettonsDepo, getJetonInfo } from './modules/Jetons/JetonInfo'; | ||
import { memorySore } from './modules/persistant/persistant'; | ||
import { PriorityQueue } from './modules/queue/Queue'; | ||
import { getHttpEndpoint } from '@orbs-network/ton-access'; | ||
import { TonClient } from '@ton/ton'; | ||
import { safeJSONStringify } from './utils/safeJson'; | ||
export default { | ||
@@ -23,35 +24,5 @@ parse_tx, | ||
PriorityQueue, | ||
memorySore | ||
memorySore, | ||
runWatcher | ||
}; | ||
export type InitData = { | ||
deposit_address: string; | ||
last_lt?: string; | ||
last_hash?: string; | ||
}; | ||
export async function runWatcher(init: InitData) { | ||
if (!init) { | ||
throw new Error('Invalid initial data'); | ||
} | ||
try { | ||
const address = init.deposit_address; | ||
const endpoint = await getHttpEndpoint({ network: 'mainnet' }); | ||
const client = new TonClient({ | ||
endpoint, | ||
}); | ||
const txWatcher = new TonTxWatcher(client, address, init.last_lt, init.last_hash, undefined, { | ||
tonBalance: (data: unknown) => { process.send && process.send(safeJSONStringify({data, event: 'tonBalance'})) }, | ||
jettonBalance: (data: unknown) => { process.send && process.send(safeJSONStringify({data, event: 'jettonBalance'})) }, | ||
jettonDeposit: (data: unknown) => { process.send && process.send(safeJSONStringify({data, event: 'jettonDeposit'})) }, | ||
}); | ||
txWatcher.start(); | ||
} catch(e) { | ||
process.send && process.send(safeJSONStringify({ event: 'error', data: e })); | ||
} | ||
return await new Promise(() => {}); | ||
} |
@@ -6,2 +6,3 @@ import { parse_tx } from './modules/txs/Transaction'; | ||
import { PriorityQueue } from './modules/queue/Queue'; | ||
import { runWatcher } from './modules/process/runProcess'; | ||
@@ -14,2 +15,3 @@ export * from './utils/safeJson'; | ||
export * from './modules/queue/Queue'; | ||
export * from './modules/process/runProcess'; | ||
@@ -21,3 +23,4 @@ export default { | ||
PriorityQueue, | ||
memorySore | ||
memorySore, | ||
runWatcher | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
109878
54
1816