-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into LW-10449-SDK-e2e-tests-CI
- Loading branch information
Showing
225 changed files
with
17,504 additions
and
16,598 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
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
35 changes: 23 additions & 12 deletions
35
packages/cardano-services-client/src/TxSubmitProvider/cardanoTxSubmitErrorMapper.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 |
---|---|---|
@@ -1,20 +1,31 @@ | ||
/* eslint-disable wrap-regex */ | ||
import { TxSubmissionError, TxSubmissionErrorCode } from '@cardano-sdk/core'; | ||
|
||
// TODO: LW-9890 Map cardano-submit-api to core errors | ||
// For now this is a very superficial mapping, we should improve it in the future | ||
const parseStringishError = (errorData: string) => { | ||
if (/outsideofvalidity/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.OutsideOfValidityInterval, null, errorData); | ||
} | ||
if (/valuenotconserved/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.ValueNotConserved, null, errorData); | ||
} | ||
if (/nonadacollateral/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.NonAdaCollateral, null, errorData); | ||
} | ||
if (/incompletewithdrawals/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.IncompleteWithdrawals, null, errorData); | ||
} | ||
return null; | ||
}; | ||
|
||
export const mapCardanoTxSubmitError = (errorData: unknown): TxSubmissionError | null => { | ||
if (typeof errorData === 'string') { | ||
if (/outsideofvalidity/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.OutsideOfValidityInterval, null, errorData); | ||
} | ||
if (/valuenotconserved/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.ValueNotConserved, null, errorData); | ||
} | ||
if (/nonadacollateral/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.NonAdaCollateral, null, errorData); | ||
} | ||
if (/incompletewithdrawals/i.test(errorData)) { | ||
return new TxSubmissionError(TxSubmissionErrorCode.IncompleteWithdrawals, null, errorData); | ||
} | ||
return parseStringishError(errorData); | ||
} else if (typeof errorData === 'object' && errorData) { | ||
// cardano-submit-api started returning json instead of raw string. | ||
// For the moment, simply stringify it. In the future we may want to make use of it. | ||
return parseStringishError(JSON.stringify(errorData)); | ||
} | ||
return null; | ||
}; |
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 |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
], | ||
"chainHistory": [ | ||
"3.0.0", | ||
"3.0.1" | ||
"3.0.1", | ||
"3.1.0" | ||
], | ||
"handle": [ | ||
"1.0.0" | ||
|
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
Oops, something went wrong.