-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from input-output-hk/fix/ADP-1874-tx-submit-w…
…orker-error-handling fix/tx-submit-worker-error-handling
- Loading branch information
Showing
29 changed files
with
823 additions
and
458 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
9 changes: 9 additions & 0 deletions
9
packages/cardano-services/src/ProgramsCommon/errors/WrongOption.ts
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,9 @@ | ||
import { CustomError } from 'ts-custom-error'; | ||
import { Programs } from '../programs'; | ||
|
||
export class WrongOption extends CustomError { | ||
public constructor(program: Programs, option: string, expected: string[]) { | ||
super(); | ||
this.message = `${program} requires a valid ${option} program option. Expected: ${expected.join(', ')}`; | ||
} | ||
} |
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 @@ | ||
export * from './WrongOption'; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './CommonOptionDescriptions'; | ||
export * from './defaults'; | ||
export * from './errors'; | ||
export * from './options'; | ||
export * from './programs'; |
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,7 @@ | ||
/** | ||
* cardano-services programs | ||
*/ | ||
export enum Programs { | ||
HttpServer = 'HTTP server', | ||
RabbitmqWorker = 'RabbitMQ worker' | ||
} |
10 changes: 0 additions & 10 deletions
10
packages/cardano-services/src/TxWorker/errors/WrongTxWorkerOption.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
export * from './defaults'; | ||
export * from './errors'; | ||
export * from './loadTxWorker'; | ||
export * from './TxWorkerOptionDescriptions'; |
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
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,16 @@ | ||
/* eslint-disable prettier/prettier */ | ||
|
||
import { CSL, Cardano, cslToCore } from '../..'; | ||
|
||
export const deserializeTx = ((txBody: Buffer | Uint8Array | string) => { | ||
const buffer = | ||
txBody instanceof Buffer | ||
? txBody | ||
: (txBody instanceof Uint8Array | ||
? Buffer.from(txBody) | ||
: Buffer.from(Cardano.util.HexBlob(txBody).toString(), 'hex')); | ||
|
||
const txDecoded = CSL.Transaction.from_bytes(buffer); | ||
|
||
return cslToCore.newTx(txDecoded); | ||
}) as (txBody: Cardano.util.HexBlob | Buffer | Uint8Array | string) => Cardano.NewTxAlonzo<Cardano.NewTxBodyAlonzo>; |
Oops, something went wrong.