Add transaction signing functionality to App component
- Introduced a new button to sign transactions, allowing users to generate a signature for a predefined raw transaction. - Updated state management to handle the transaction signature and display it in the UI. - Enhanced connection logic to ensure the user's address is retrieved before signing. - Modified the WalletStore to improve transaction status handling during updates.
This commit is contained in:
1 parent
435ccbb3eb
commit
13eea0bfad
4 files changed
+32
-3
No files matched your search
@@ -14,6 +14,9 @@ export const parseSignedTxFromStartParam = (webApp: WebApp): SignTransactionResu
|
||||
if (!startParam) return null;
|
||||
|
||||
const result = decodeResult(startParam);
|
||||
if ('id' in result) {
|
||||
result.id = Number(result.id);
|
||||
}
|
||||
return 'signedTx' in result ? result : null;
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -90,7 +90,8 @@ export class WalletStore {
|
||||
|
||||
let shouldDispatch = false;
|
||||
dataTransactions.forEach(transaction => {
|
||||
if (!currentTransactions.find(t => t.id === transaction.id)) {
|
||||
const currentTransaction = currentTransactions.find(t => t.id === transaction.id);
|
||||
if (currentTransaction && currentTransaction.status !== transaction.status) {
|
||||
shouldDispatch = true;
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ export class Wallet implements InjectedWindowProvider {
|
||||
|
||||
return new Promise<SignerResult>((resolve) => {
|
||||
const id = this.store.subscribe('transactions', (transactions) => {
|
||||
const pendingTransaction = transactions.find(t => t.id === request.id && t.status === 'signing');
|
||||
const pendingTransaction = transactions.find(t => t.id === request.id && t.status !== 'signing');
|
||||
if (pendingTransaction) {
|
||||
this.store.unsubscribe('transactions', id);
|
||||
resolve({
|
||||
|
||||
Reference in new issue
Block a user