We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I use the method below, but it must be both slow and unstable. Is there any way to get the tx hash directly?
async send(): Promise<TransactionId> { await this.wallet.send(this.signedData) return await this.provider.findTxHashByMessageHash( this.wallet.address, this.signedData.hash().toString('base64') ) } // funcs async retry<T>(fn: () => Promise<T>, options: { retries: number; delay: number }): Promise<T> { let lastError: Error | undefined for (let i = 0; i < options.retries; i++) { try { return await fn() } catch (e) { if (e instanceof Error) { lastError = e } await new Promise((resolve) => setTimeout(resolve, options.delay)) } } throw lastError ?? new Error('Unknown error') } async findTxHashByMessageHash(address: Address, _hash: string): Promise<string> { return await this.retry( async () => { const transactions = await this.client1.getTransactions(address, { limit: 5 }) for (const tx of transactions) { const hash = tx.inMessage?.body.hash().toString('base64') if (hash === _hash) { return tx.hash().toString('hex') } } throw new Error('Transaction not found') }, { retries: 30, delay: 1000 } ) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I use the method below, but it must be both slow and unstable. Is there any way to get the tx hash directly?
The text was updated successfully, but these errors were encountered: