Skip to content

Commit

Permalink
fix(ScriptData): reduced fn name + give @ of ByteArray
Browse files Browse the repository at this point in the history
  • Loading branch information
lomasson committed Aug 5, 2024
1 parent 84f62f7 commit ab25e77
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/data/block.jq
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def block:
"
use raito::state::{Block, Header, Transaction, TxIn, TxOut};
pub fn test_data_btc_block() -> Block {
pub fn test_data_block() -> Block {
Block {
header : Header {
version: \(.version),
Expand Down
6 changes: 3 additions & 3 deletions scripts/data/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ while (( $total < $tx_count )); do
if (( $idx % 25 == 0)) then
btcBlockTxs=$(curl -sSL "$api$blockHash/txs/$total")
idx=0
echo "$total / $tx_count transactions recives"
echo "$total / $tx_count transactions recived"
fi
tx=$(echo $btcBlockTxs | jq -r ".[$idx]")
echo " Transaction {" >> $fileName
Expand All @@ -55,7 +55,7 @@ while (( $total < $tx_count )); do
((total++))
done
if (( $total == $tx_count)) then
echo "$total / $tx_count transactions recives"
echo "$total / $tx_count transactions recived"
echo "Execution successful, file created in $fileName"
fi

Expand All @@ -65,4 +65,4 @@ echo " }" >> $fileName
echo "}" >> $fileName
echo ""
echo -e "${green}add: \"pub mod block_$blockHash;\" in lib.cairo${reset}"
echo -e "${green}add: \"use raito::block_$blockHash::test_data_btc_block;\" in main.cairo${reset}"
echo -e "${green}add: \"use raito::block_$blockHash::test_data_block;\" in your file${reset}"
2 changes: 1 addition & 1 deletion scripts/data/tx_in.jq
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def tx_in:
" TxIn {
txid: 0x\(.txid),
index: \(.vout),
script: \"\(.scriptsig)\",
script: @\"\(.scriptsig)\",
sequence: \(.sequence),
},"
;
Expand Down
2 changes: 1 addition & 1 deletion scripts/data/tx_out.jq
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def tx_out:
" TxOut {
value : \(.value),
pk_script: \"\(.scriptpubkey)\",
pk_script: @\"\(.scriptpubkey)\",
},"
;
tx_out
12 changes: 6 additions & 6 deletions src/state.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ pub struct Transaction {
#[derive(Drop, Copy)]
pub struct TxOut {
/// The value of the output.
value: i64,
pub value: i64,
/// The public key script of the output.
pk_script: @ByteArray,
pub pk_script: @ByteArray,
}

/// Input of a transaction.
/// https://developer.bitcoin.org/reference/transactions.html#txin-a-transaction-input-non-coinbase
#[derive(Drop, Copy)]
pub struct TxIn {
/// The transaction ID of the input.
txid: u256,
pub txid: u256,
/// The index of the input.
index: u32,
pub index: u32,
/// The script of the input.
script: @ByteArray,
pub script: @ByteArray,
/// The sequence of the input.
sequence: u32,
pub sequence: u32,
}

0 comments on commit ab25e77

Please sign in to comment.