Skip to content

Commit 9bc7455

Browse files
committed
update to latest version of the SDK
1 parent c5b176d commit 9bc7455

20 files changed

+110
-83
lines changed

Cargo.lock

Lines changed: 34 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ futures-util = "0.3.31"
3030
axum = { version = "0.8.3", features = ["macros"]}
3131
tower-http = { version = "0.6.2", features = ["cors"] }
3232
futures = "0.3.31"
33-
chia-wallet-sdk = { git = "https://github.com/xch-dev/chia-wallet-sdk.git", branch="the_merge", features=["offer-compression", "action-layer"] }
33+
chia-wallet-sdk = { git = "https://github.com/xch-dev/chia-wallet-sdk.git", rev="1199e568df1d8a77a824e166d674a1e913bef211", features=["offer-compression", "action-layer"] }
3434
sage-api = { version = "0.10.3", git = "https://github.com/xch-dev/sage.git" }
3535
chia-puzzles = "0.20.1"
3636

src/cli/catalog/broadcast_catalog_state_update.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use chia::clvm_utils::ToTreeHash;
22
use chia::protocol::Bytes32;
33
use chia_wallet_sdk::{
4-
driver::{CatalogRegistryConstants, CatalogRegistryState, DelegatedStateAction, MedievalVault},
4+
driver::{
5+
CatalogRegistryConstants, CatalogRegistryState, DelegatedStateAction, MedievalVault,
6+
SingletonInfo,
7+
},
58
types::{
69
puzzles::{DefaultCatMakerArgs, StateSchedulerLayerSolution},
710
Mod,

src/cli/catalog/catalog_api_client.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use chia::protocol::Bytes32;
2+
use chia_puzzle_types::LineageProof;
23
use reqwest::Client;
34
use std::time::Duration;
45

56
use crate::{hex_string_to_bytes32, CliError};
6-
use chia_wallet_sdk::driver::{Slot, SlotProof};
7+
use chia_wallet_sdk::driver::Slot;
78
use chia_wallet_sdk::types::puzzles::{CatalogSlotValue, SlotInfo};
89

910
use super::CatalogNeighborResponse;
@@ -88,18 +89,20 @@ impl CatalogApiClient {
8889
hex_string_to_bytes32(&neighbors_resp.left_parent_parent_info)?;
8990
let left_parent_inner_puzzle_hash =
9091
hex_string_to_bytes32(&neighbors_resp.left_parent_inner_puzzle_hash)?;
91-
let left_proof = SlotProof {
92-
parent_parent_info: left_parent_parent_info,
92+
let left_proof = LineageProof {
93+
parent_parent_coin_info: left_parent_parent_info,
9394
parent_inner_puzzle_hash: left_parent_inner_puzzle_hash,
95+
parent_amount: neighbors_resp.left_parent_amount,
9496
};
9597

9698
let right_parent_parent_info =
9799
hex_string_to_bytes32(&neighbors_resp.right_parent_parent_info)?;
98100
let right_parent_inner_puzzle_hash =
99101
hex_string_to_bytes32(&neighbors_resp.right_parent_inner_puzzle_hash)?;
100-
let right_proof = SlotProof {
101-
parent_parent_info: right_parent_parent_info,
102+
let right_proof = LineageProof {
103+
parent_parent_coin_info: right_parent_parent_info,
102104
parent_inner_puzzle_hash: right_parent_inner_puzzle_hash,
105+
parent_amount: neighbors_resp.right_parent_amount,
103106
};
104107

105108
let left_info = SlotInfo::<CatalogSlotValue>::from_value(launcher_id, 0, left_value);

src/cli/catalog/initiate_launch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use chia_wallet_sdk::{
1818
coinset::ChiaRpcClient,
1919
driver::{
2020
decode_offer, launch_catalog_registry, Cat, CatalogRegistryConstants, CatalogRegistryState,
21-
DriverError, Launcher, MedievalVaultHint, MedievalVaultInfo, Offer, SpendContext,
22-
StateSchedulerInfo,
21+
DriverError, Launcher, MedievalVaultHint, MedievalVaultInfo, Offer, SingletonInfo,
22+
SpendContext, StateSchedulerInfo,
2323
},
2424
types::{
2525
puzzles::DefaultCatMakerArgs, Conditions, Mod, MAINNET_CONSTANTS, TESTNET11_CONSTANTS,

src/cli/catalog/listen.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ pub struct CatalogNeighborResponse {
4040

4141
pub left_parent_parent_info: String,
4242
pub left_parent_inner_puzzle_hash: String,
43+
pub left_parent_amount: u64,
4344
pub right_parent_parent_info: String,
4445
pub right_parent_inner_puzzle_hash: String,
46+
pub right_parent_amount: u64,
4547
}
4648

4749
#[derive(Clone)]
@@ -148,12 +150,14 @@ async fn get_neighbors(
148150
left_left_asset_id: hex::encode(left.info.value.neighbors.left_value.to_bytes()),
149151
right_right_asset_id: hex::encode(right.info.value.neighbors.right_value.to_bytes()),
150152

151-
left_parent_parent_info: hex::encode(left.proof.parent_parent_info.to_bytes()),
153+
left_parent_parent_info: hex::encode(left.proof.parent_parent_coin_info.to_bytes()),
152154
left_parent_inner_puzzle_hash: hex::encode(left.proof.parent_inner_puzzle_hash.to_bytes()),
153-
right_parent_parent_info: hex::encode(right.proof.parent_parent_info.to_bytes()),
155+
left_parent_amount: left.proof.parent_amount,
156+
right_parent_parent_info: hex::encode(right.proof.parent_parent_coin_info.to_bytes()),
154157
right_parent_inner_puzzle_hash: hex::encode(
155158
right.proof.parent_inner_puzzle_hash.to_bytes(),
156159
),
160+
right_parent_amount: right.proof.parent_amount,
157161
};
158162

159163
Ok(Json(response))

src/cli/catalog/sync.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use chia_wallet_sdk::{
1010
coinset::{ChiaRpcClient, CoinsetClient},
1111
driver::{
1212
CatalogRegistry, CatalogRegistryConstants, CatalogRegistryInfo, CatalogRegistryState,
13-
DriverError, Layer, Puzzle, SingletonLayer, Slot, SlotProof, SpendContext,
13+
DriverError, Layer, Puzzle, SingletonLayer, Slot, SpendContext,
1414
},
1515
types::{
1616
puzzles::{CatalogSlotValue, SlotInfo},
@@ -135,9 +135,10 @@ pub async fn sync_catalog(
135135
CatalogRegistryInfo::new(initial_state, constants),
136136
);
137137

138-
let slot_proof = SlotProof {
139-
parent_parent_info: lineage_proof.parent_parent_coin_info,
138+
let slot_proof = LineageProof {
139+
parent_parent_coin_info: lineage_proof.parent_parent_coin_info,
140140
parent_inner_puzzle_hash: lineage_proof.parent_inner_puzzle_hash,
141+
parent_amount: lineage_proof.parent_amount,
141142
};
142143
let left_slot_value = CatalogSlotValue::initial_left_end();
143144
let right_slot_value = CatalogSlotValue::initial_right_end();

src/cli/database.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use chia::{clvm_utils::ToTreeHash, protocol::Bytes32};
2+
use chia_puzzle_types::LineageProof;
23
use chia_wallet_sdk::{
34
coinset::CoinRecord,
4-
driver::{DriverError, RewardDistributorConstants, Slot, SlotProof, XchandlesConstants},
5+
driver::{DriverError, RewardDistributorConstants, Slot, XchandlesConstants},
56
types::puzzles::SlotInfo,
67
};
78
use clvm_traits::{FromClvm, ToClvm};
@@ -37,9 +38,10 @@ impl Db {
3738
slot_value_hash BLOB NOT NULL,
3839
spent_block_height INTEGER NOT NULL,
3940
slot_value BLOB NOT NULL,
40-
parent_parent_info BLOB NOT NULL,
41+
parent_parent_coin_info BLOB NOT NULL,
4142
parent_inner_puzzle_hash BLOB NOT NULL,
42-
PRIMARY KEY (singleton_launcher_id, nonce, slot_value_hash, parent_parent_info)
43+
parent_amount INTEGER NOT NULL,
44+
PRIMARY KEY (singleton_launcher_id, nonce, slot_value_hash, parent_parent_coin_info, parent_amount)
4345
)
4446
",
4547
)
@@ -147,19 +149,20 @@ impl Db {
147149
"
148150
INSERT INTO slots (
149151
singleton_launcher_id, nonce, slot_value_hash, spent_block_height,
150-
slot_value, parent_parent_info, parent_inner_puzzle_hash
152+
slot_value, parent_parent_coin_info, parent_inner_puzzle_hash, parent_amount
151153
)
152-
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)
153-
ON CONFLICT(singleton_launcher_id, nonce, slot_value_hash, parent_parent_info) DO UPDATE SET spent_block_height = excluded.spent_block_height
154+
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)
155+
ON CONFLICT(singleton_launcher_id, nonce, slot_value_hash, parent_parent_coin_info, parent_amount) DO UPDATE SET spent_block_height = excluded.spent_block_height
154156
",
155157
)
156158
.bind(slot.info.launcher_id.to_vec())
157159
.bind(slot.info.nonce as i64)
158160
.bind(slot.info.value_hash.to_vec())
159161
.bind(spent_block_height)
160162
.bind(slot_value_bytes)
161-
.bind(slot.proof.parent_parent_info.to_vec())
163+
.bind(slot.proof.parent_parent_coin_info.to_vec())
162164
.bind(slot.proof.parent_inner_puzzle_hash.to_vec())
165+
.bind(slot.proof.parent_amount as i64)
163166
.execute(&self.pool)
164167
.await
165168
.map_err(CliError::Sqlx)?;
@@ -173,18 +176,21 @@ impl Db {
173176
{
174177
let launcher_id = column_to_bytes32(row.get::<&[u8], _>("singleton_launcher_id"))?;
175178
let nonce = row.get::<i64, _>("nonce") as u64;
176-
let parent_parent_info = column_to_bytes32(row.get::<&[u8], _>("parent_parent_info"))?;
179+
let parent_parent_coin_info =
180+
column_to_bytes32(row.get::<&[u8], _>("parent_parent_coin_info"))?;
177181
let parent_inner_puzzle_hash =
178182
column_to_bytes32(row.get::<&[u8], _>("parent_inner_puzzle_hash"))?;
183+
let parent_amount = row.get::<i64, _>("parent_amount") as u64;
179184

180185
let value = node_from_bytes(allocator, row.get::<&[u8], _>("slot_value"))?;
181186
let value = SV::from_clvm(allocator, value)
182187
.map_err(|err| CliError::Driver(DriverError::FromClvm(err)))?;
183188

184189
Ok(Slot::new(
185-
SlotProof {
186-
parent_parent_info,
190+
LineageProof {
191+
parent_parent_coin_info,
187192
parent_inner_puzzle_hash,
193+
parent_amount,
188194
},
189195
SlotInfo::<SV>::from_value(launcher_id, nonce, value),
190196
))

src/cli/multisig/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use chia::{
88
},
99
};
1010
use chia_wallet_sdk::driver::{
11-
MedievalVaultHint, MedievalVaultInfo, SpendContext, StateSchedulerInfo,
11+
MedievalVaultHint, MedievalVaultInfo, SingletonInfo, SpendContext, StateSchedulerInfo,
1212
};
1313
use chia_wallet_sdk::{
1414
coinset::{ChiaRpcClient, CoinsetClient},

src/cli/reward_distributor/broadcast_entry_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use chia::protocol::Bytes32;
22
use chia::{clvm_utils::ToTreeHash, protocol::Bytes};
33
use chia_wallet_sdk::driver::{
44
MedievalVault, RewardDistributorAddEntryAction, RewardDistributorRemoveEntryAction,
5-
RewardDistributorSyncAction,
5+
RewardDistributorSyncAction, SingletonInfo,
66
};
77
use chia_wallet_sdk::types::puzzles::StateSchedulerLayerSolution;
88
use clvmr::{Allocator, NodePtr};

0 commit comments

Comments
 (0)