Skip to content

Commit

Permalink
Merge remote-tracking branch 'tari/development' into collectibles-dat…
Browse files Browse the repository at this point in the history
…adir
  • Loading branch information
Byron Hambly committed Feb 8, 2022
2 parents 841e57c + 74df1d0 commit eca4545
Show file tree
Hide file tree
Showing 98 changed files with 2,164 additions and 588 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/base_node_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ jobs:
if: startsWith(runner.os,'macOS')
env:
MACOS_KEYCHAIN_PASS: ${{ secrets.MACOS_KEYCHAIN_PASS }}
MACOS_APPLICATION_ID: ${{ secrets.MACOS_APPLICATION_ID }}
MACOS_APPLICATION_CERT: ${{ secrets.MACOS_APPLICATION_CERT }}
MACOS_APPLICATION_PASS: ${{ secrets.MACOS_APPLICATION_PASS }}
MACOS_INSTALLER_ID: ${{ secrets.MACOS_INSTALLER_ID }}
MACOS_INSTALLER_CERT: ${{ secrets.MACOS_INSTALLER_CERT }}
MACOS_INSTALLER_PASS: ${{ secrets.MACOS_INSTALLER_PASS }}
run: |
Expand All @@ -206,15 +208,15 @@ jobs:
./create_osx_install_zip.sh unused nozip
FILES=("tari_base_node" "tari_console_wallet" "tari_mining_node" "tari_merge_mining_proxy")
for FILE in "${FILES[@]}"; do
codesign --force -s "Developer ID Application: Tari Labs, LLC (8XGMD9X2H2)" "/tmp/tari_testnet/runtime/$FILE" -v
codesign --force -s "Developer ID Application: $MACOS_APPLICATION_ID" "/tmp/tari_testnet/runtime/$FILE" -v
codesign --verify --deep --display --verbose=4 "/tmp/tari_testnet/runtime/$FILE"
done
pkgbuild --root /tmp/tari_testnet \
--identifier "com.tarilabs.pkg" \
--version "$VERSION" \
--install-location "/tmp/tari" \
--scripts "/tmp/tari_testnet/scripts" \
--sign "Developer ID Installer: Tari Labs, LLC (8XGMD9X2H2)" \
--sign "Developer ID Installer: $MACOS_INSTALLER_ID" \
"${{ github.workspace }}${{ env.TBN_DIST }}/tari-${{ env.VERSION }}.pkg"
- name: Artifact macos pkg
if: startsWith(runner.os,'macOS')
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ node_modules

# ignore output files from windows ISS
buildtools/Output/
/applications/tari_collectibles/src-tauri/data
/applications/tari_collectibles/src-tauri/data

# Asset files
assets/
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 25 additions & 9 deletions applications/launchpad/gui-vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion applications/tari_app_grpc/proto/validator_node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ message InvokeMethodRequest{
message InvokeMethodResponse {
string status = 1;
bytes result = 2;
}
}
6 changes: 6 additions & 0 deletions applications/tari_app_grpc/proto/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ service Wallet {
rpc GetCompletedTransactions (GetCompletedTransactionsRequest) returns (stream GetCompletedTransactionsResponse);
// Returns the balance
rpc GetBalance (GetBalanceRequest) returns (GetBalanceResponse);
// Returns unspent amounts
rpc GetUnspentAmounts (Empty) returns (GetUnspentAmountsResponse);
// Request the wallet perform a coinsplit
rpc CoinSplit (CoinSplitRequest) returns (CoinSplitResponse);
// Import Utxo to wallet
Expand Down Expand Up @@ -206,6 +208,10 @@ message GetBalanceResponse {
uint64 pending_outgoing_balance = 3;
}

message GetUnspentAmountsResponse {
repeated uint64 amount = 1;
}

message GetCoinbaseRequest {
uint64 reward = 1;
uint64 fee = 2;
Expand Down
6 changes: 3 additions & 3 deletions applications/tari_collectibles/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,19 @@ impl WalletClient {
debug!(target: LOG_TARGET, "result {:?}", result);
Ok(result.into_inner())
}

pub async fn get_unspent_amounts(
&mut self,
) -> Result<grpc::GetUnspentAmountsResponse, CollectiblesError> {
let inner = self.inner.as_mut().unwrap();
let request = grpc::Empty {};
let result = inner.get_unspent_amounts(request).await.map_err(|source| {
CollectiblesError::ClientRequestError {
request: "get_unspent_amounts".to_string(),
source,
}
})?;
debug!(target: LOG_TARGET, "result {:?}", result);
Ok(result.into_inner())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ pub(crate) async fn asset_wallets_get_balance(
Ok(total)
}

#[tauri::command]
pub(crate) async fn asset_wallets_get_unspent_amounts(
state: tauri::State<'_, ConcurrentAppState>,
) -> Result<Vec<u64>, Status> {
let mut client = state.create_wallet_client().await;
client.connect().await?;
let result = client.get_unspent_amounts().await?;
Ok(result.amount)
}

#[tauri::command]
pub(crate) async fn asset_wallets_list(
state: tauri::State<'_, ConcurrentAppState>,
Expand Down
1 change: 1 addition & 0 deletions applications/tari_collectibles/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fn main() -> Result<(), Box<dyn Error>> {
commands::asset_wallets::asset_wallets_create,
commands::asset_wallets::asset_wallets_list,
commands::asset_wallets::asset_wallets_get_balance,
commands::asset_wallets::asset_wallets_get_unspent_amounts,
commands::asset_wallets::asset_wallets_get_latest_address,
commands::asset_wallets::asset_wallets_create_address,
commands::asset_wallets::asset_wallets_send_to,
Expand Down
5 changes: 5 additions & 0 deletions applications/tari_collectibles/web-app/src/Create.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ class Create extends React.Component {
templateIds.push(721);
}

let outputs = await binding.command_asset_wallets_get_unspent_amounts();

if (outputs.length <= 1) {
throw { message: "You need at least two unspent outputs" };
}
let publicKey = await binding.command_assets_create(
name,
description,
Expand Down
5 changes: 5 additions & 0 deletions applications/tari_collectibles/web-app/src/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ async function command_asset_wallets_get_balance(assetPublicKey) {
return await invoke("asset_wallets_get_balance", { assetPublicKey });
}

async function command_asset_wallets_get_unspent_amounts() {
return await invoke("asset_wallets_get_unspent_amounts", {});
}

const commands = {
command_create_db,
command_assets_create,
Expand All @@ -147,6 +151,7 @@ const commands = {
command_next_asset_public_key,
command_asset_wallets_create,
command_asset_wallets_get_balance,
command_asset_wallets_get_unspent_amounts,
command_asset_wallets_list,
command_asset_wallets_get_latest_address,
command_asset_wallets_create_address,
Expand Down
20 changes: 20 additions & 0 deletions applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use tari_app_grpc::{
GetOwnedAssetsResponse,
GetTransactionInfoRequest,
GetTransactionInfoResponse,
GetUnspentAmountsResponse,
GetVersionRequest,
GetVersionResponse,
ImportUtxosRequest,
Expand Down Expand Up @@ -163,6 +164,25 @@ impl wallet_server::Wallet for WalletGrpcServer {
}))
}

async fn get_unspent_amounts(
&self,
_: Request<tari_rpc::Empty>,
) -> Result<Response<GetUnspentAmountsResponse>, Status> {
let mut output_service = self.get_output_manager_service();
let unspent_amounts;
match output_service.get_unspent_outputs().await {
Ok(uo) => unspent_amounts = uo,
Err(e) => return Err(Status::not_found(format!("GetUnspentAmounts error! {}", e))),
}
Ok(Response::new(GetUnspentAmountsResponse {
amount: unspent_amounts
.into_iter()
.map(|o| o.value.as_u64())
.filter(|&a| a > 0)
.collect(),
}))
}

async fn revalidate_all_transactions(
&self,
_request: Request<RevalidateRequest>,
Expand Down
Loading

0 comments on commit eca4545

Please sign in to comment.