mirror of
https://github.com/zhigang1992/wallet.git
synced 2026-04-24 04:45:58 +08:00
fix: thrown error with sponsored tx
This commit is contained in:
@@ -2,6 +2,11 @@ import { broadcastRawTransaction } from '@stacks/transactions';
|
||||
import { Buffer } from 'buffer';
|
||||
import { logger } from '@shared/logger';
|
||||
import { validateTxId } from '@app/common/validation/validate-tx-id';
|
||||
import { delay } from '@app/common/utils';
|
||||
|
||||
async function simulateShortDelayToAvoidUndefinedTabId() {
|
||||
await delay(1000);
|
||||
}
|
||||
|
||||
interface BroadcastTransactionOptions {
|
||||
txRaw: string;
|
||||
@@ -13,7 +18,10 @@ interface BroadcastTransactionOptions {
|
||||
export async function broadcastTransaction(options: BroadcastTransactionOptions) {
|
||||
const { txRaw, serialized, isSponsored, attachment, networkUrl } = options;
|
||||
|
||||
if (isSponsored) return { txRaw };
|
||||
if (isSponsored) {
|
||||
await simulateShortDelayToAvoidUndefinedTabId();
|
||||
return { txRaw };
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await broadcastRawTransaction(
|
||||
|
||||
@@ -64,7 +64,7 @@ export const Debugger = () => {
|
||||
};
|
||||
|
||||
const sponsoredTx = await sponsorTransaction(sponsorOptions);
|
||||
return broadcastTransaction(sponsoredTx, network);
|
||||
return await broadcastTransaction(sponsoredTx, network);
|
||||
};
|
||||
|
||||
const callBnsTransfer = async () => {
|
||||
|
||||
Reference in New Issue
Block a user