Broadcasting transaction error is fixed with using a Promise object (#1101)

This commit is contained in:
Furkan KAMACI 2022-03-30 01:23:46 +03:00 committed by GitHub
parent 1e11948c07
commit 0d609f1292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -372,8 +372,10 @@ export class StargateClient {
const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx }); const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx });
if (broadcasted.code) { if (broadcasted.code) {
throw new Error( return Promise.reject(
`Broadcasting transaction failed with code ${broadcasted.code} (codespace: ${broadcasted.codeSpace}). Log: ${broadcasted.log}`, new Error(
`Broadcasting transaction failed with code ${broadcasted.code} (codespace: ${broadcasted.codeSpace}). Log: ${broadcasted.log}`,
),
); );
} }
const transactionId = toHex(broadcasted.hash).toUpperCase(); const transactionId = toHex(broadcasted.hash).toUpperCase();