Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Sergej Kostjucenko
cargo-contract
Commits
9902ee6f
Unverified
Commit
9902ee6f
authored
May 27, 2022
by
Michal Handzlik
Committed by
GitHub
May 27, 2022
Browse files
Manually convert Url::url to String in order to include the default port (#591)
parent
7035710e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cmd/extrinsics/call.rs
View file @
9902ee6f
...
...
@@ -89,7 +89,7 @@ impl CallCommand {
let
signer
=
super
::
pair_signer
(
self
.extrinsic_opts
.signer
()
?
);
async_std
::
task
::
block_on
(
async
{
let
url
=
self
.extrinsic_opts.url
.
to_string
();
let
url
=
self
.extrinsic_opts
.url
_
to_string
();
let
api
=
ClientBuilder
::
new
()
.set_url
(
&
url
)
.build
()
...
...
@@ -111,7 +111,7 @@ impl CallCommand {
signer
:
&
PairSigner
,
transcoder
:
&
ContractMessageTranscoder
<
'_
>
,
)
->
Result
<
()
>
{
let
url
=
self
.extrinsic_opts.url
.
to_string
();
let
url
=
self
.extrinsic_opts
.url
_
to_string
();
let
cli
=
WsClientBuilder
::
default
()
.build
(
&
url
)
.await
?
;
let
storage_deposit_limit
=
self
.extrinsic_opts
...
...
src/cmd/extrinsics/instantiate.rs
View file @
9902ee6f
...
...
@@ -136,7 +136,7 @@ impl InstantiateCommand {
let
transcoder
=
ContractMessageTranscoder
::
new
(
&
contract_metadata
);
let
data
=
transcoder
.encode
(
&
self
.constructor
,
&
self
.args
)
?
;
let
signer
=
super
::
pair_signer
(
self
.extrinsic_opts
.signer
()
?
);
let
url
=
self
.extrinsic_opts.url
.clone
();
let
url
=
self
.extrinsic_opts
.url
_to_string
();
let
verbosity
=
self
.extrinsic_opts
.verbosity
()
?
;
fn
load_code
(
wasm_path
:
&
Path
)
->
Result
<
Code
>
{
...
...
@@ -195,7 +195,7 @@ struct InstantiateArgs {
pub
struct
Exec
<
'a
>
{
args
:
InstantiateArgs
,
verbosity
:
Verbosity
,
url
:
url
::
Url
,
url
:
String
,
signer
:
PairSigner
,
transcoder
:
ContractMessageTranscoder
<
'a
>
,
}
...
...
@@ -203,7 +203,7 @@ pub struct Exec<'a> {
impl
<
'a
>
Exec
<
'a
>
{
async
fn
subxt_api
(
&
self
)
->
Result
<
RuntimeApi
>
{
let
api
=
ClientBuilder
::
new
()
.set_url
(
self
.url
.to_string
()
)
.set_url
(
&
self
.url
)
.build
()
.await
?
.to_runtime_api
::
<
RuntimeApi
>
();
...
...
@@ -326,8 +326,7 @@ impl<'a> Exec<'a> {
}
async
fn
instantiate_dry_run
(
&
self
,
code
:
Code
)
->
Result
<
ContractInstantiateResult
>
{
let
url
=
self
.url
.to_string
();
let
cli
=
WsClientBuilder
::
default
()
.build
(
&
url
)
.await
?
;
let
cli
=
WsClientBuilder
::
default
()
.build
(
&
self
.url
)
.await
?
;
let
storage_deposit_limit
=
self
.args
.storage_deposit_limit
...
...
src/cmd/extrinsics/mod.rs
View file @
9902ee6f
...
...
@@ -111,6 +111,18 @@ impl ExtrinsicOpts {
pub
fn
verbosity
(
&
self
)
->
Result
<
Verbosity
>
{
TryFrom
::
try_from
(
&
self
.verbosity
)
}
/// Convert URL to String without omitting the default port
pub
fn
url_to_string
(
&
self
)
->
String
{
let
mut
res
=
self
.url
.to_string
();
match
(
self
.url
.port
(),
self
.url
.port_or_known_default
())
{
(
None
,
Some
(
port
))
=>
{
res
.insert_str
(
res
.len
()
-
1
,
&
format!
(
":{}"
,
port
));
res
}
_
=>
res
,
}
}
}
/// For a contract project with its `Cargo.toml` at the specified `manifest_path`, load the cargo
...
...
src/cmd/extrinsics/upload.rs
View file @
9902ee6f
...
...
@@ -82,7 +82,7 @@ impl UploadCommand {
.context
(
format!
(
"Failed to read from {}"
,
wasm_path
.display
()))
?
;
async_std
::
task
::
block_on
(
async
{
let
url
=
self
.extrinsic_opts.url
.
to_string
();
let
url
=
self
.extrinsic_opts
.url
_
to_string
();
let
api
=
ClientBuilder
::
new
()
.set_url
(
&
url
)
.build
()
...
...
@@ -121,7 +121,7 @@ impl UploadCommand {
code
:
Vec
<
u8
>
,
signer
:
&
PairSigner
,
)
->
Result
<
CodeUploadResult
>
{
let
url
=
self
.extrinsic_opts.url
.
to_string
();
let
url
=
self
.extrinsic_opts
.url
_
to_string
();
let
cli
=
WsClientBuilder
::
default
()
.build
(
&
url
)
.await
?
;
let
storage_deposit_limit
=
self
.extrinsic_opts
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment