diff --git a/package.json b/package.json index a16ef3d..44f9714 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bnc-sdk", - "version": "2.1.1", + "version": "2.1.2", "description": "SDK to connect to the blocknative backend via a websocket connection", "keywords": [ "ethereum", diff --git a/src/interfaces.ts b/src/interfaces.ts index 35048cc..aba43e3 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -41,6 +41,7 @@ export interface TransactionData { originalHash?: string counterparty?: string direction?: string + system?: System } export interface TransactionEvent { @@ -48,10 +49,12 @@ export interface TransactionEvent { transaction: TransactionData } +export type System = 'bitcoin' | 'ethereum' + export interface InitializationOptions { networkId: number dappId: string - system?: string + system?: System name?: string transactionHandlers?: TransactionHandler[] apiUrl?: string @@ -74,10 +77,27 @@ export interface Emitter { listeners: { [key: string]: EmitterListener } - on: (eventCode: string, listener: EmitterListener) => void + on: (eventCode: TransactionEventCode, listener: EmitterListener) => void emit: (state: TransactionData) => boolean | void | NotificationObject } +export type TransactionEventCode = + | 'txSent' + | 'txPool' + | 'txConfirmed' + | 'txSpeedUp' + | 'txCancel' + | 'txFailed' + | 'txRequest' + | 'nsfFail' + | 'txRepeat' + | 'txAwaitingApproval' + | 'txConfirmReminder' + | 'txSendFail' + | 'txError' + | 'txUnderPriced' + | 'all' + export interface Ac { address: string emitters: Emitter[]