LaborX smart contracts events save to store
How to use
Listener service
const LxEventsStore = require('@chronotech/laborx.contracts.events.store');
const eventsStore = new LxEventsStore({
mongoose, // initialized mongoose instance
type: 1,
logger: new MyLogger() // any logger instance
});
eventsStore.persist({
blockchain: 2,
event: "ContractCreated",
sender: "0x01b63828398479D854e1f2585BFb62Ad7aa30Fcf",
txid: "0x580f525970f3593363b7e54b81ebf361131f3e01f04f404e51b1a8a61ebb36e9",
contractId: "0xd35dc4e10f7809583e8fef65df04be5a10ca0805a91e02a35392f705fd758b4c",
block: 100500,
raw: {
txid: "0x580f525970f3593363b7e54b81ebf361131f3e01f04f404e51b1a8a61ebb36e9",
event: "ContractCreated",
sender: "0x01b63828398479D854e1f2585BFb62Ad7aa30Fcf",
data: {
0: "0xd35dc4e10f7809583e8fef65df04be5a10ca0805a91e02a35392f705fd758b4c",
1: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
2: "44059400000000000000",
3: "0x0000000000000000000000000000000000000000",
4: "1643652110",
contractId: "0xd35dc4e10f7809583e8fef65df04be5a10ca0805a91e02a35392f705fd758b4c",
token: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
amount: "44059400000000000000",
disputer: "0x0000000000000000000000000000000000000000",
deadline: "1643652110"
},
contract: {
name: "LaborXContract",
address: "0x49d3Cee812f5A3ABFc9764229DE93Faf9CBe8484",
version: 2
},
blockchain: 2
}
});
Bridge service
const LxEventsStore = require('@chronotech/laborx.contracts.events.store');
const eventsStore = new LxEventsStore({
mongoose, // initialized mongoose instance
type: 2,
logger: new MyLogger() // any logger instance
});
eventsStore.persist({
blockchain: 2,
event: "Minted",
sender: "0xA4e4C91e5671333B1E4C879F28aF14466f11073E",
txid: "0xa54a8fffa9e8b8125ca270bddc05ccf071c456317a0094cc96f0770cb8348007",
uid: "450",
amount: "8990000000",
fromChainId: 1,
toChainId: 1,
block: 100500,
raw: {
validator: "0x390c0A8060789B11E5f4f4800Fabb4e91B68A071",
blockchain: 2,
event: "Minted",
amount: "8990000000",
sender: "0xA4e4C91e5671333B1E4C879F28aF14466f11073E",
scUid: "450",
txid: "0xa54a8fffa9e8b8125ca270bddc05ccf071c456317a0094cc96f0770cb8348007",
tokenId: 1,
fromChainId: 1,
toChainId: 56
}
});
Types
1 - Listener service
2 - Bridge service