-
Notifications
You must be signed in to change notification settings - Fork 7
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
[TS] Implement support for SEP-7 #141
Conversation
* | ||
* @returns {boolen} returns `true` if it's a valid Sep-7 uri, `false` otherwise. | ||
*/ | ||
export const isValidSep7Uri = (uri: string): boolean => { |
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 check that the xdr
parameter for tx operations are a valid TransactionEnvelope
?
Same question for destination
on the pay operation, should it check that the value is a valid account ID?
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.
Good call, I like your suggestions :)
I think I'll make this function returning something like:
{
result: boolean;
reason: string;
}
Where reason
should be a message letting devs know why the verification failed.
What do you think?
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.
yeah that sounds good to me, I like the more informational response. 👍
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.
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.
this lgtm 👏
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.
left one question but lgtm otherwise
Ticket: https://stellarorg.atlassian.net/jira/software/c/projects/WAL/boards/37?selectedIssue=WAL-1449
This PR adds support for SEP-7 through the following classes:
Sep7Base
: abstract base class with common functions and attributes used by bothtx
andpay
operationsSep7Tx
: implements the Sep-7tx
operationSep7Pay
: implements the Sep-7pay
operationThis PR also adds some convenient parsing/helper functions as follow:
isValidSep7Uri
: checks if uri is Sep-7 compliant, if not returns a explanatoryreason
messageparseSep7Uri
: parses a Sep-7 uri to either a Sep7Tx or Sep7Pay instancesep7ReplacementsFromString
: converts a complex replacements string to a list of friendly replacements objectssep7ReplacementsToString
: converts a list of friendly replacements objects to a complex replacements stringThose classes and functions can be used to either
generate
a new Sep-7 URI orhandle
an existing Sep-7 URI.This PR also adds a bunch of
tests
andJSDocs
that should cover all new classes and functions.This PR also adds a few missing types and exceptions from existing code (harmless changes).