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

Wallet uses JSON RPC #2929

Merged
merged 87 commits into from
Jan 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
7c244c9
Wallet talks to index over http
raphjaph Dec 31, 2023
e0efc59
Fix test
raphjaph Jan 2, 2024
bf5d451
It compiles
raphjaph Jan 2, 2024
548ddae
Place clippy + fmt
raphjaph Jan 2, 2024
8166805
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 2, 2024
17ca387
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 3, 2024
bb9ab59
Put chain in wallet
raphjaph Jan 3, 2024
b3dcb8b
Fix wallet bug
raphjaph Jan 3, 2024
cfd83c0
Getting somewhere; need to add status json endpoint
raphjaph Jan 3, 2024
00d72a4
Add TODO
raphjaph Jan 3, 2024
2578136
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 3, 2024
a73b960
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 3, 2024
c495f1f
Get server status
raphjaph Jan 3, 2024
ab9b080
Inscribe does not use index
raphjaph Jan 4, 2024
b0771dd
Rid balance command of the index
raphjaph Jan 4, 2024
44c350e
inscriptions command no index
raphjaph Jan 4, 2024
c8ea786
Rid sats command of index
raphjaph Jan 4, 2024
903857d
Start work on send, waiting for rune json endpoint
raphjaph Jan 4, 2024
69d4ba2
output and cardinal command no index
raphjaph Jan 4, 2024
8cc344f
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 5, 2024
38571af
fix merge
raphjaph Jan 5, 2024
c1d3605
Etch no index
raphjaph Jan 5, 2024
080998f
Send no index
raphjaph Jan 5, 2024
e17e475
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 6, 2024
b274285
Stuck
raphjaph Jan 6, 2024
c6c1abe
Add in index for output JSON
raphjaph Jan 6, 2024
aef6879
Merge branch 'add-in-index-to-output' into wallet-spawns-server
raphjaph Jan 6, 2024
6a15930
Add check sync
raphjaph Jan 6, 2024
fbb2e99
Fix unsynced index test
raphjaph Jan 6, 2024
296bd38
Remove unused functions and only pass in wallet
raphjaph Jan 6, 2024
8ecb107
stashing
raphjaph Jan 7, 2024
364123b
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 8, 2024
5d08319
Remove bool
raphjaph Jan 8, 2024
32e191b
fmt
raphjaph Jan 8, 2024
cbeb7fb
quick fix
raphjaph Jan 8, 2024
d40d14c
It works, just have to fix one test
raphjaph Jan 10, 2024
42172fe
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 10, 2024
f8480ba
quick fix
raphjaph Jan 10, 2024
e6de26c
Fix preview test
raphjaph Jan 10, 2024
c297ab4
It works but tests are slow now
raphjaph Jan 10, 2024
7ef0544
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 10, 2024
e3f8114
Some cleanup
raphjaph Jan 10, 2024
5a80f92
quick fix
raphjaph Jan 11, 2024
8585a54
quick fix
raphjaph Jan 11, 2024
eab91f4
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 11, 2024
df9b15e
Place clippy
raphjaph Jan 11, 2024
39fe0d6
quick fix
raphjaph Jan 11, 2024
efeede5
Clean up some bits here and there
raphjaph Jan 11, 2024
85417cd
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 13, 2024
66755df
Move wallet into separate module
raphjaph Jan 13, 2024
8be34a5
Place clippy
raphjaph Jan 13, 2024
288d25d
Horrible state
raphjaph Jan 15, 2024
a22ca3d
Horribel state 2
raphjaph Jan 15, 2024
6815ce4
Tests pass
raphjaph Jan 16, 2024
55b091d
Split up batch stuff
raphjaph Jan 16, 2024
930bf5d
Merge branch 'master' of github.com:ordinals/ord into wallet-spawns-s…
raphjaph Jan 16, 2024
257c2d8
Fix test
raphjaph Jan 16, 2024
f59744b
Require running ord server for wallet commands
raphjaph Jan 16, 2024
0e291ab
Got one test to pass with new setup
raphjaph Jan 19, 2024
660da09
All unit tests pass
raphjaph Jan 19, 2024
a7c883e
I think all integration tests pass
raphjaph Jan 20, 2024
9633b60
Rename helper function
raphjaph Jan 20, 2024
607e539
Maybe faster now
raphjaph Jan 21, 2024
5ede49f
Placate clippy
raphjaph Jan 21, 2024
1be0799
Fix preview command
raphjaph Jan 22, 2024
4bb5963
Fixed preview test?
raphjaph Jan 22, 2024
6e29ccb
quick fix
raphjaph Jan 22, 2024
b68451c
quick fix
raphjaph Jan 22, 2024
75a119f
quick fix
raphjaph Jan 22, 2024
1ee921c
Remove preview command
raphjaph Jan 22, 2024
c16b3c6
remove unused options field
casey Jan 22, 2024
e375a7a
Sort
casey Jan 22, 2024
b986bbe
Gracefully shut down index in ctrl-c handler
casey Jan 22, 2024
5b6b5bd
Move shutdown into success branch
casey Jan 22, 2024
151cd4d
Tweak
casey Jan 22, 2024
050a3ca
check -> has
casey Jan 22, 2024
a1dc47d
Avoid clone
casey Jan 22, 2024
7755af3
Reuse bitcoin client
casey Jan 22, 2024
fe7197b
Reuse client
casey Jan 22, 2024
68aadc8
Rename modules
casey Jan 22, 2024
20ff4fa
REsuse client
casey Jan 22, 2024
2e2a9eb
Use correct create wallet
casey Jan 23, 2024
ea7ba4e
Wallet
casey Jan 23, 2024
b3cd660
Tweak
casey Jan 23, 2024
5ce1d28
Tweak
casey Jan 23, 2024
4d1da88
Tweak
casey Jan 23, 2024
fdeff81
Tweak
casey Jan 23, 2024
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
Prev Previous commit
Next Next commit
Add in index for output JSON
  • Loading branch information
raphjaph committed Jan 6, 2024
commit c6c1abe5b188d745ab1cec0cf1494b896d07d93a
9 changes: 9 additions & 0 deletions src/index.rs
Original file line number Diff line number Diff line change
@@ -395,6 +395,15 @@ impl Index {
Ok(true)
}

pub(crate) fn contains(&self, output: &OutPoint) -> Result<bool> {
let rtx = self.database.begin_read()?;
let outpoint_to_value = rtx.open_table(OUTPOINT_TO_VALUE)?;

let contains = outpoint_to_value.get(&output.store())?.is_some();

Ok(contains)
}

pub(crate) fn has_rune_index(&self) -> bool {
self.index_runes
}
8 changes: 8 additions & 0 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
@@ -543,6 +543,8 @@ impl Server {
) -> ServerResult<Response> {
let list = index.list(outpoint)?;

let mut in_index = false;

let output = if outpoint == OutPoint::null() || outpoint == unbound_outpoint() {
let mut value = 0;

@@ -552,11 +554,15 @@ impl Server {
}
}

in_index = true;

TxOut {
value,
script_pubkey: ScriptBuf::new(),
}
} else {
in_index = index.contains(&outpoint)?;

index
.get_transaction(outpoint.txid)?
.ok_or_not_found(|| format!("output {outpoint}"))?
@@ -577,6 +583,7 @@ impl Server {
server_config.chain,
output,
inscriptions,
in_index,
runes
.into_iter()
.map(|(spaced_rune, pile)| (spaced_rune.rune, pile.amount))
@@ -2548,6 +2555,7 @@ mod tests {
address: None,
transaction: txid.to_string(),
sat_ranges: None,
in_index: true,
inscriptions: Vec::new(),
runes: vec![(Rune(RUNE), 340282366920938463463374607431768211455)]
.into_iter()
3 changes: 3 additions & 0 deletions src/templates/output.rs
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ pub struct OutputJson {
pub address: Option<String>,
pub transaction: String,
pub sat_ranges: Option<Vec<(u64, u64)>>,
pub in_index: bool,
pub inscriptions: Vec<InscriptionId>,
pub runes: BTreeMap<Rune, u128>,
}
@@ -28,6 +29,7 @@ impl OutputJson {
chain: Chain,
output: TxOut,
inscriptions: Vec<InscriptionId>,
in_index: bool,
runes: BTreeMap<Rune, u128>,
) -> Self {
Self {
@@ -43,6 +45,7 @@ impl OutputJson {
Some(List::Unspent(ranges)) => Some(ranges),
_ => None,
},
in_index,
inscriptions,
}
}
1 change: 1 addition & 0 deletions tests/json_api.rs
Original file line number Diff line number Diff line change
@@ -323,6 +323,7 @@ fn get_output() {
InscriptionId { txid, index: 1 },
InscriptionId { txid, index: 2 },
],
in_index: true,
runes: BTreeMap::new(),
}
);
1 change: 1 addition & 0 deletions tests/wallet/send.rs
Original file line number Diff line number Diff line change
@@ -260,6 +260,7 @@ fn splitting_merged_inscriptions_is_possible() {
index: 2
},
],
in_index: true,
runes: BTreeMap::new(),
}
);
Loading