Skip to content

Commit

Permalink
[Issue-3862] feat: handle send failed
Browse files Browse the repository at this point in the history
  • Loading branch information
bluezdot committed Dec 6, 2024
1 parent 4194501 commit b7b1039
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { _CardanoApi, _ChainConnectionStatus } from '@subwallet/extension-base/s
import { createPromiseHandler, PromiseHandler } from '@subwallet/extension-base/utils';
import { BehaviorSubject } from 'rxjs';

import { hexAddPrefix, isHex } from '@polkadot/util';

export const API_KEY = { // todo: move to env.
mainnet: 'mainnet6uE9JH3zGYquaxRKA7IMhEuzRUB58uGK',
testnet: 'preprodcnP5RADcrWMlf2cQe4ZKm4cjRvrBQFXM'
Expand Down Expand Up @@ -169,7 +171,15 @@ export class CardanoApi implements _CardanoApi {
}
);

return (await response.text()).replace(/^"|"$/g, '');
const hash = (await response.text()).replace(/^"|"$/g, '');

if (isHex(hexAddPrefix(hash))) {
return hash;
} else {
console.error('Error on submitting cardano tx');

return '';
}
} catch (e) {
console.error('Error on submitting cardano tx', e);

Expand Down

0 comments on commit b7b1039

Please sign in to comment.