-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mahmoud/eng 3111 integrate with stacks raw hex signing on extension (#…
…652) * init tx hex handling * added stx hex tx signing support * integrate with connect core utils * fix stx tx serialization * handle sign-hex for dapp interactions * update core version * add auh to tx-creation * fix pending txs handling * fix type issues * update core version * revert removing signMultipleTransactions * update core version * remove unused package aliases * Tim/eng 3475 nonce not updating correctly after switching accounts (#725) * fix: regenerate the unsignedTx with correct stxAddress after switch account * fix: minor cleanup * fix tx-request account switching * updated core version * added type checking and default values for feeMultipliers --------- Co-authored-by: Mahmoud Aboelenein <mahmoud@secretkeylabs.com> --------- Co-authored-by: Tim Man <tim@secretkeylabs.com>
- Loading branch information
1 parent
4855207
commit 65d33e3
Showing
28 changed files
with
700 additions
and
1,867 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { txPayloadToRequest } from '@secretkeylabs/xverse-core'; | ||
import { deserializeTransaction } from '@stacks/transactions'; | ||
import { decodeToken } from 'jsontokens'; | ||
import { useLocation } from 'react-router-dom'; | ||
|
||
const useStxTransactionRequest = () => { | ||
const { search } = useLocation(); | ||
const params = new URLSearchParams(search); | ||
const requestToken = params.get('request') ?? ''; | ||
const request = decodeToken(requestToken) as any; | ||
const tabId = params.get('tabId') ?? '0'; | ||
const stacksTransaction = request.payload.txHex | ||
? deserializeTransaction(request.payload.txHex!) | ||
: undefined; | ||
|
||
const getPayload = () => { | ||
if (stacksTransaction) { | ||
const txPayload = txPayloadToRequest( | ||
stacksTransaction, | ||
request.payload.stxAddress, | ||
request.payload.attachment, | ||
); | ||
return { | ||
...request.payload, | ||
...txPayload, | ||
}; | ||
} | ||
return request.payload; | ||
}; | ||
|
||
const txPayload = getPayload(); | ||
|
||
return { | ||
payload: txPayload, | ||
stacksTransaction, | ||
tabId, | ||
requestToken, | ||
}; | ||
}; | ||
|
||
export default useStxTransactionRequest; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.