-
Notifications
You must be signed in to change notification settings - Fork 25
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
Sign Auth Entry API & modal flow #949
Merged
Merged
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6b98f9a
adds new path for signing auth entries, adds SignAuthEntry component …
aristidesstaffieri a6bad1e
Adds basic signing component for auth entry sign flow
aristidesstaffieri 5af3394
Adds new external api signAuthEntry, adds docs, adds sign auth entry …
aristidesstaffieri 380530a
Added translations
aristidesstaffieri a06003e
adds buildInvocationTree to render formatted json for invocations and…
aristidesstaffieri c589044
use correct key in responseQueue handler for signAuthEntry, clean up …
aristidesstaffieri db78b9f
splits SignTx and SignBlob, makes new route for sign-blob
aristidesstaffieri 7f7eb56
use buildInvocationTree in transaction render for signTx
aristidesstaffieri 3fb4eff
Added translations
aristidesstaffieri 4432d60
Added translations
aristidesstaffieri 2efbb74
remove accidental tarball commit
aristidesstaffieri 63a77ea
adds missing loading states, fixes missing error handling in message …
aristidesstaffieri 4b0d05a
remove extra line
aristidesstaffieri 47ea4f9
refactors signing flows to use a common helper hook
aristidesstaffieri 433a42d
dont allow HW signing on sign blob or sign auth entry, not currently …
aristidesstaffieri 1fdbabf
Added translations
aristidesstaffieri d0b7bdf
Added translations
aristidesstaffieri d1f4093
updates HW wallet not supported text
aristidesstaffieri 860e293
Added translations
aristidesstaffieri e03372a
refactors SorobanContext to accoutn for missing rpc urls
aristidesstaffieri 06295ca
moves dispatch to be in shared signing hook
aristidesstaffieri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -60,6 +60,7 @@ export const submitTransaction = async ( | |
}); | ||
} catch (e) { | ||
console.error(e); | ||
throw e; | ||
} | ||
const { signedTransaction, error } = response; | ||
|
||
|
@@ -86,6 +87,7 @@ export const submitBlob = async ( | |
}); | ||
} catch (e) { | ||
console.error(e); | ||
throw e; | ||
} | ||
const { signedBlob, error } = response; | ||
|
||
|
@@ -95,6 +97,33 @@ export const submitBlob = async ( | |
return signedBlob; | ||
}; | ||
|
||
export const submitAuthEntry = async ( | ||
entryXdr: string, | ||
opts?: { | ||
accountToSign?: string; | ||
}, | ||
): Promise<string> => { | ||
let response = { signedAuthEntry: "", error: "" }; | ||
const _opts = opts || {}; | ||
const accountToSign = _opts.accountToSign || ""; | ||
try { | ||
response = await sendMessageToContentScript({ | ||
entryXdr, | ||
accountToSign, | ||
type: EXTERNAL_SERVICE_TYPES.SUBMIT_AUTH_ENTRY, | ||
}); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
const { signedAuthEntry, error } = response; | ||
|
||
if (error) { | ||
throw error; | ||
throw error; | ||
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. repeated line 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. whops, thanks for the catch. Fixed in 4b0d05a |
||
} | ||
return signedAuthEntry; | ||
}; | ||
|
||
export const requestNetwork = async (): Promise<string> => { | ||
let response = { network: "", error: "" }; | ||
try { | ||
|
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,10 @@ | ||
import { submitAuthEntry } from "@shared/api/external"; | ||
import { isBrowser } from "."; | ||
|
||
export const signAuthEntry = ( | ||
entryXdr: string, | ||
opts?: { | ||
accountToSign?: string; | ||
} | ||
): Promise<string> => | ||
isBrowser ? submitAuthEntry(entryXdr, opts) : Promise.resolve(""); |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should this also do
response.error = e;
?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.
I think it's more appropriate to throw here because that would be an implementation error when the other is a type or API error. Added in 63a77ea but let me know if you disagree.
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.
def up to y'all cuz I'm unfamiliar w/ your error-handling conventions, I just more wanted to call out the distinction between exceptions and the response.error field