-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add ExplorerUrl
to replace Network
explorer methods
#496
Conversation
Fix explorer and resolver URLs in examples.
Add message_url, resolver_url tests.
Ideally we would move the explorer stuff out of |
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.
Looks good for fixing the examples. I would also really like to move out the urls. Maybe we can have static instances, along the lines of:
lazy_static!{
static ref EXPLORER_MAIN: ExplorerUrl = ExplorerUrl::new(Url::parse("https://explorer.iota.org/mainnet/identity-resolver").unwrap());
static ref EXPLORER_DEV: ExplorerUrl = ExplorerUrl::new(Url::parse("https://explorer.iota.org/devnet/identity-resolver").unwrap());
}
impl ExplorerUrl {
pub fn message_url(&self, message_id: &str) -> Result<Url> { ... }
pub fn resolver_url(&self, did: &str) -> Result<Url> { ... }
}
Would be even nicer if these were infallible, since it's technically just formatting.
This can be done in a separate PR though, and this is good as-is.
Thanks for the review and I definitely like the
Edit: updated this PR to include |
ExplorerUrl
, fix example URLs
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.
Looks great! I really like the simplification of the Network
type. Some minor comments.
ExplorerUrl
ExplorerUrl
to replace Network
explorer methods
Description of change
Separates explorer URL code out of
Network
into its ownExplorerUrl
struct. This is primarily to avoid the explorer being unset on private Tangle networks unexpectedly when retrieved from e.g. anIotaDID
.Also corrects the examples to print both the explorer URL for messages and identity-resolver URL for DIDs, including the Wasm examples.
This fixes examples like
create_did
which print the wrong URL for messages.E.g.
should be
Type of change
Add an
x
to the boxes that are relevant to your changes.How the change has been tested
Unit tests and Wasm examples pass locally.
Change checklist