refactor: ♻️ remove duplicated code

This commit is contained in:
DavideSegullo 2023-05-24 19:04:57 +02:00
parent 4d022115eb
commit 134ecc216f
2 changed files with 4 additions and 14 deletions

View File

@ -311,13 +311,8 @@ export class CosmWasmClient {
: pollForTx(txId);
};
const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx });
if (broadcasted.code) {
return Promise.reject(
new BroadcastTxError(broadcasted.code, broadcasted.codespace ?? "", broadcasted.log),
);
}
const transactionId = toHex(broadcasted.hash).toUpperCase();
const transactionId = await this.broadcastTxSync(tx);
return new Promise((resolve, reject) =>
pollForTx(transactionId).then(
(value) => {

View File

@ -470,13 +470,8 @@ export class StargateClient {
: pollForTx(txId);
};
const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx });
if (broadcasted.code) {
return Promise.reject(
new BroadcastTxError(broadcasted.code, broadcasted.codespace ?? "", broadcasted.log),
);
}
const transactionId = toHex(broadcasted.hash).toUpperCase();
const transactionId = await this.broadcastTxSync(tx);
return new Promise((resolve, reject) =>
pollForTx(transactionId).then(
(value) => {