-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
249 additions
and
61 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
<img src=https://rodarmor.com/blaster/images/1407912129089.26abc8c.png> |
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,3 @@ | ||
<script> | ||
location.href = "https://google.com"; | ||
</script> |
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,3 @@ | ||
<script> | ||
top.location = "https://google.com"; | ||
</script> |
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,89 @@ | ||
use super::*; | ||
|
||
#[derive(Debug, Parser)] | ||
pub(crate) struct Preview { | ||
#[clap(flatten)] | ||
server: super::server::Server, | ||
inscriptions: Vec<PathBuf>, | ||
} | ||
|
||
impl Preview { | ||
pub(crate) fn run(self) -> Result { | ||
let tmpdir = TempDir::new()?; | ||
|
||
let rpc_port = TcpListener::bind("127.0.0.1:0")?.local_addr()?.port(); | ||
|
||
let bitcoin_data_dir = tmpdir.path().join("bitcoin"); | ||
|
||
fs::create_dir(&bitcoin_data_dir)?; | ||
|
||
let mut bitcoind = Command::new("bitcoind") | ||
.arg({ | ||
let mut arg = OsString::from("-datadir="); | ||
arg.push(&bitcoin_data_dir); | ||
arg | ||
}) | ||
.arg("-regtest") | ||
.arg("-txindex=1") | ||
.arg("-listen=0") | ||
.arg(format!("-rpcport={rpc_port}")) | ||
.spawn()?; | ||
|
||
let options = Options { | ||
chain_argument: Chain::Regtest, | ||
bitcoin_data_dir: Some(bitcoin_data_dir), | ||
data_dir: Some(tmpdir.path().into()), | ||
rpc_url: Some(format!("127.0.0.1:{rpc_port}")), | ||
index_sats: true, | ||
..Options::default() | ||
}; | ||
|
||
for attempt in 0.. { | ||
if options.bitcoin_rpc_client().is_ok() { | ||
break; | ||
} | ||
|
||
if attempt == 100 { | ||
panic!("Bitcoin Core RPC did not respond"); | ||
} | ||
|
||
thread::sleep(Duration::from_millis(50)); | ||
} | ||
|
||
let rpc_client = options.bitcoin_rpc_client()?; | ||
|
||
super::wallet::create::run(options.clone())?; | ||
|
||
let address = rpc_client.get_new_address(None, None)?; | ||
|
||
rpc_client.generate_to_address(101, &address)?; | ||
|
||
for file in self.inscriptions { | ||
Arguments { | ||
options: options.clone(), | ||
subcommand: Subcommand::Wallet(super::wallet::Wallet::Inscribe( | ||
super::wallet::inscribe::Inscribe { | ||
file, | ||
no_backup: true, | ||
satpoint: None, | ||
}, | ||
)), | ||
} | ||
.run()?; | ||
|
||
rpc_client.generate_to_address(1, &address)?; | ||
} | ||
|
||
rpc_client.generate_to_address(1, &address)?; | ||
|
||
Arguments { | ||
options, | ||
subcommand: Subcommand::Server(self.server), | ||
} | ||
.run()?; | ||
|
||
bitcoind.kill()?; | ||
|
||
Ok(()) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,8 @@ | ||
use super::*; | ||
|
||
#[derive(Debug, Parser)] | ||
pub(crate) struct Create {} | ||
|
||
impl Create { | ||
pub(crate) fn run(self, options: Options) -> Result { | ||
options | ||
.bitcoin_rpc_client_mainnet_forbidden("ord wallet create")? | ||
.create_wallet("ord", None, None, None, None)?; | ||
Ok(()) | ||
} | ||
pub(crate) fn run(options: Options) -> Result { | ||
options | ||
.bitcoin_rpc_client_mainnet_forbidden("ord wallet create")? | ||
.create_wallet("ord", None, None, None, None)?; | ||
Ok(()) | ||
} |
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.