예제 #1
0
 protected function buildNotification($block_event)
 {
     $notification = ['event' => 'block', 'notificationId' => null, 'network' => 'bitcoin', 'hash' => $block_event['hash'], 'height' => $block_event['height'], 'previousblockhash' => $block_event['previousblockhash'], 'time' => DateTimeUtil::ISO8601Date($block_event['time'])];
     return $notification;
 }
예제 #2
0
 protected function buildNotification($event_type, $parsed_tx, $quantity, $sources, $destinations, $confirmations, $block, $block_seq, $monitored_address)
 {
     $confirmation_timestamp = $block ? $block['parsed_block']['time'] : null;
     if ($event_type === null) {
         $notification = ['network' => $parsed_tx['network'], 'asset' => $parsed_tx['asset'], 'sources' => $sources, 'destinations' => $destinations, 'notificationId' => null, 'txid' => $parsed_tx['txid'], 'transactionTime' => DateTimeUtil::ISO8601Date($parsed_tx['timestamp']), 'confirmed' => $confirmations > 0 ? true : false, 'confirmations' => $confirmations, 'confirmationTime' => $confirmation_timestamp ? DateTimeUtil::ISO8601Date($confirmation_timestamp) : '', 'blockSeq' => $block_seq, 'bitcoinTx' => $parsed_tx['bitcoinTx'], 'transactionFingerprint' => isset($parsed_tx['transactionFingerprint']) ? $parsed_tx['transactionFingerprint'] : null];
     } else {
         $notification = ['event' => $event_type, 'network' => $parsed_tx['network'], 'asset' => $parsed_tx['asset'], 'quantity' => $quantity, 'quantitySat' => CurrencyUtil::valueToSatoshis($quantity), 'sources' => $sources, 'destinations' => $destinations, 'notificationId' => null, 'txid' => $parsed_tx['txid'], 'transactionTime' => DateTimeUtil::ISO8601Date($parsed_tx['timestamp']), 'confirmed' => $confirmations > 0 ? true : false, 'confirmations' => $confirmations, 'confirmationTime' => $confirmation_timestamp ? DateTimeUtil::ISO8601Date($confirmation_timestamp) : '', 'blockSeq' => $block_seq, 'notifiedAddress' => $monitored_address['address'], 'notifiedAddressId' => $monitored_address['uuid'], 'bitcoinTx' => $parsed_tx['bitcoinTx'], 'transactionFingerprint' => isset($parsed_tx['transactionFingerprint']) ? $parsed_tx['transactionFingerprint'] : null];
     }
     if ($block_seq === null) {
         unset($notification['blockSeq']);
     }
     return $notification;
 }