-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
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
Mahmoud/eng 3111 integrate with stacks raw hex signing on extension #652
Changes from all commits
d3d7da9
9a299ef
3c4dbce
ce32d7b
257853a
c236db2
7d7ec42
18051f4
308588b
2250045
4fcd9f6
d596b0d
156fd64
a5103b2
4171497
fef354f
0d0a5c4
d3d8657
38b5a92
06b05aa
5e33c8d
45d9f63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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 = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be good to have a return type here. related to the core code review on txPayloadToRequest There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an issue with strictly typing this hook since the types that are exposed from the I will open an issue on the |
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we currently still include
@stacks/encryption
inwebpack/webpack.config.js
, so I think it would make sense to remove it from there as well