diff --git a/crates/sage-database/src/tables/assets/nft.rs b/crates/sage-database/src/tables/assets/nft.rs index 60889cce5..98da8a7a5 100644 --- a/crates/sage-database/src/tables/assets/nft.rs +++ b/crates/sage-database/src/tables/assets/nft.rs @@ -60,7 +60,7 @@ pub struct NftOfferInfo { } impl Database { - pub async fn owned_nft(&self, hash: Bytes32) -> Result> { + pub async fn wallet_nft(&self, hash: Bytes32) -> Result> { let hash = hash.as_ref(); query!( @@ -69,15 +69,15 @@ impl Database { asset_hash, asset_name, asset_ticker, asset_precision, asset_icon_url, asset_description, asset_is_sensitive_content, asset_is_visible, collections.hash AS 'collection_hash?', collections.name AS collection_name, - owned_nfts.minter_hash, owner_hash, metadata, metadata_updater_puzzle_hash, + wallet_nfts.minter_hash, owner_hash, metadata, metadata_updater_puzzle_hash, royalty_puzzle_hash, royalty_basis_points, data_hash, metadata_hash, license_hash, edition_number, edition_total, parent_coin_hash, puzzle_hash, amount, p2_puzzle_hash, created_height, spent_height, offer_hash AS 'offer_hash?', created_timestamp, spent_timestamp, clawback_expiration_seconds AS 'clawback_timestamp?', asset_hidden_puzzle_hash - FROM owned_nfts - LEFT JOIN collections ON collections.id = owned_nfts.collection_id - WHERE owned_nfts.asset_hash = ? + FROM wallet_nfts + LEFT JOIN collections ON collections.id = wallet_nfts.collection_id + WHERE wallet_nfts.asset_hash = ? ", hash ) diff --git a/crates/sage-database/src/tables/assets/option.rs b/crates/sage-database/src/tables/assets/option.rs index 1c52b5bc1..c951a00e3 100644 --- a/crates/sage-database/src/tables/assets/option.rs +++ b/crates/sage-database/src/tables/assets/option.rs @@ -68,7 +68,7 @@ impl Database { .await } - pub async fn owned_option(&self, launcher_id: Bytes32) -> Result> { + pub async fn wallet_option(&self, launcher_id: Bytes32) -> Result> { let launcher_id_ref = launcher_id.as_ref(); query!( @@ -76,8 +76,8 @@ impl Database { SELECT asset_hash, asset_name, asset_ticker, asset_precision, asset_icon_url, asset_description, asset_is_visible, asset_is_sensitive_content, - asset_hidden_puzzle_hash, owned_coins.created_height, owned_coins.spent_height, - owned_coins.parent_coin_hash, owned_coins.puzzle_hash, owned_coins.amount, owned_coins.p2_puzzle_hash, + asset_hidden_puzzle_hash, wallet_coins.created_height, wallet_coins.spent_height, + wallet_coins.parent_coin_hash, wallet_coins.puzzle_hash, wallet_coins.amount, wallet_coins.p2_puzzle_hash, offer_hash AS 'offer_hash?', created_timestamp, spent_timestamp, clawback_expiration_seconds AS 'clawback_timestamp?', p2_options.expiration_seconds AS option_expiration_seconds, @@ -97,8 +97,8 @@ impl Database { strike_amount, underlying_coin.amount AS underlying_amount, underlying_coin.hash AS underlying_coin_id - FROM owned_coins - INNER JOIN options ON options.asset_id = owned_coins.asset_id + FROM wallet_coins + INNER JOIN options ON options.asset_id = wallet_coins.asset_id INNER JOIN p2_options ON p2_options.option_asset_id = options.asset_id INNER JOIN coins AS underlying_coin ON underlying_coin.id = options.underlying_coin_id INNER JOIN assets AS strike_asset ON strike_asset.id = options.strike_asset_id diff --git a/crates/sage/src/endpoints/data.rs b/crates/sage/src/endpoints/data.rs index 4a0645d91..1d07aba1d 100644 --- a/crates/sage/src/endpoints/data.rs +++ b/crates/sage/src/endpoints/data.rs @@ -445,7 +445,7 @@ impl Sage { let Some(row) = wallet .db - .owned_option(parse_option_id(req.option_id)?) + .wallet_option(parse_option_id(req.option_id)?) .await? else { return Ok(GetOptionResponse { option: None }); @@ -671,7 +671,7 @@ impl Sage { let nft_id = parse_nft_id(req.nft_id)?; - let Some(row) = wallet.db.owned_nft(nft_id).await? else { + let Some(row) = wallet.db.wallet_nft(nft_id).await? else { return Ok(GetNftResponse { nft: None }); }; diff --git a/migrations/0003_unowned_assets.sql b/migrations/0003_unowned_assets.sql new file mode 100644 index 000000000..83c83edd9 --- /dev/null +++ b/migrations/0003_unowned_assets.sql @@ -0,0 +1,7 @@ +CREATE VIEW wallet_nfts AS + SELECT + wallet_coins.*, nfts.minter_hash, owner_hash, metadata, metadata_updater_puzzle_hash, + royalty_puzzle_hash, royalty_basis_points, data_hash, metadata_hash, license_hash, + edition_number, edition_total, nfts.collection_id + FROM wallet_coins + INNER JOIN nfts ON nfts.asset_id = wallet_coins.asset_id; \ No newline at end of file diff --git a/src/components/TransactionColumns.tsx b/src/components/TransactionColumns.tsx index ed40c83c3..87cc04127 100644 --- a/src/components/TransactionColumns.tsx +++ b/src/components/TransactionColumns.tsx @@ -76,17 +76,12 @@ export const columns: ColumnDef[] = [ return (
-
+