-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: typed return value in verifyWebhookSignature
- Loading branch information
1 parent
08eb1e3
commit db57940
Showing
7 changed files
with
201 additions
and
19 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Responses } from '..'; | ||
|
||
export type BlockPayload = Omit<Responses['block_content'], 'height'> & { | ||
height: number; | ||
}; | ||
|
||
export type TransactionPayload = { | ||
tx: Responses['tx_content']; | ||
inputs: Responses['tx_content_utxo']['inputs']; | ||
outputs: Responses['tx_content_utxo']['outputs']; | ||
}; | ||
|
||
export type StakeDelegationPayload = { | ||
tx: Responses['tx_content']; | ||
// delegations with pool data | ||
delegations: Responses['tx_content_delegations'][number] & { | ||
pool: Responses['pool']; | ||
}; | ||
}; | ||
|
||
export type EpochPayload = { | ||
previous_epoch: Responses['epoch_content']; | ||
current_epoch: Pick< | ||
Responses['epoch_content'], | ||
'epoch' | 'start_time' | 'end_time' | ||
>; | ||
}; | ||
|
||
interface WebhookEventCommon { | ||
id: string; | ||
webhook_id: string; | ||
created: number; | ||
api_version: number; | ||
} | ||
|
||
export type WebhookEventBlock = WebhookEventCommon & { | ||
type: 'block'; | ||
payload: BlockPayload; | ||
}; | ||
export type WebhookEventTransaction = WebhookEventCommon & { | ||
type: 'transaction'; | ||
payload: TransactionPayload[]; | ||
}; | ||
export type WebhookEventEpoch = WebhookEventCommon & { | ||
type: 'epoch'; | ||
payload: EpochPayload; | ||
}; | ||
export type WebhookEventDelegation = WebhookEventCommon & { | ||
type: 'delegation'; | ||
payload: StakeDelegationPayload[]; | ||
}; | ||
|
||
export type WebhookEvent = | ||
| WebhookEventBlock | ||
| WebhookEventTransaction | ||
| WebhookEventEpoch | ||
| WebhookEventDelegation; |
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