Skip to content
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

Do not require source account when fetching an asset's contract id. #1647

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,14 @@ Utilities to deploy a Stellar Asset Contract or get its id

Get Id of builtin Soroban Asset Contract. Deprecated, use `stellar contract id asset` instead

**Usage:** `stellar contract asset id [OPTIONS] --asset <ASSET> --source-account <SOURCE_ACCOUNT>`
**Usage:** `stellar contract asset id [OPTIONS] --asset <ASSET>`

###### **Options:**

* `--asset <ASSET>` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail
* `--hd-path <HD_PATH>` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."

Expand Down Expand Up @@ -444,16 +442,14 @@ Generate the contract id for a given contract or asset

Deploy builtin Soroban Asset Contract

**Usage:** `stellar contract id asset [OPTIONS] --asset <ASSET> --source-account <SOURCE_ACCOUNT>`
**Usage:** `stellar contract id asset [OPTIONS] --asset <ASSET>`

###### **Options:**

* `--asset <ASSET>` — ID of the Stellar classic asset to wrap, e.g. "USDC:G...5"
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--source-account <SOURCE_ACCOUNT>` — Account that where transaction originates from. Alias `source`. Can be an identity (--source alice), a public key (--source GDKW...), a muxed account (--source MDA…), a secret key (--source SC36…), or a seed phrase (--source "kite urban…"). If `--build-only` or `--sim-only` flags were NOT provided, this key will also be used to sign the final transaction. In that case, trying to sign with public key will fail
* `--hd-path <HD_PATH>` — If using a seed phrase, which hierarchical deterministic path to use, e.g. `m/44'/148'/{hd_path}`. Example: `--hd-path 1`. Default: `0`
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."

Expand Down
2 changes: 0 additions & 2 deletions cmd/crates/soroban-test/tests/it/integration/cookbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ mod tests {
.arg("asset")
.arg("--asset")
.arg("native")
.arg("--source-account")
.arg(source)
.assert()
.stdout_as_str();
let contract_id = deploy_hello(&sandbox).await;
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/contract/id/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct Cmd {
pub asset: builder::Asset,

#[command(flatten)]
pub config: config::Args,
pub config: config::ArgsLocatorAndNetwork,
}
#[derive(thiserror::Error, Debug)]
pub enum Error {
Expand Down
16 changes: 16 additions & 0 deletions cmd/soroban-cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,19 @@ impl Pwd for Args {

#[derive(Default, Serialize, Deserialize)]
pub struct Config {}

#[derive(Debug, clap::Args, Clone, Default)]
#[group(skip)]
pub struct ArgsLocatorAndNetwork {
#[command(flatten)]
pub network: network::Args,

#[command(flatten)]
pub locator: locator::Args,
}

impl ArgsLocatorAndNetwork {
pub fn get_network(&self) -> Result<Network, Error> {
Ok(self.network.get(&self.locator)?)
}
}
1 change: 0 additions & 1 deletion cookbook/deploy-stellar-asset-contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ For any asset, the contract address can be fetched with:

```bash
stellar contract id asset \
--source S... \
--network testnet \
--asset native
```
Expand Down
2 changes: 1 addition & 1 deletion cookbook/payments-and-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ stellar keys fund bob
3. Obtain the stellar asset contract ID:

```bash
stellar contract id asset --asset native --source-account alice
stellar contract id asset --asset native
```

4. Get Bob's public key:
Expand Down
Loading