From b48dcadbbd46312e56bc2ea19e02da28056d2494 Mon Sep 17 00:00:00 2001 From: Franco Testagrossa Date: Mon, 6 May 2024 18:19:08 +0200 Subject: [PATCH] REFACTOR to MONOLITH --- Cargo.lock | 57 ++++----- Cargo.toml | 3 +- Makefile | 39 +++---- {bounty => backend}/Cargo.toml | 4 +- .../github/github.did => backend/backend.did | 26 ++++- .../src => backend/src/bounty}/api/accept.rs | 2 +- .../src => backend/src/bounty}/api/claim.rs | 12 +- .../src => backend/src/bounty}/api/deposit.rs | 0 .../src => backend/src/bounty}/api/icrc1.rs | 0 .../src => backend/src/bounty}/api/init.rs | 0 .../src => backend/src/bounty}/api/state.rs | 0 backend/src/lib.rs | 109 ++++++++++++++++++ .../src/provider/github}/api/get_fixed_by.rs | 0 .../src/provider/github}/api/get_is_merged.rs | 0 .../src/provider/github}/api/get_issue.rs | 0 .../github}/api/get_merged_details.rs | 0 .../src/provider/github}/client.rs | 0 .../src/provider/github}/utils.rs | 0 bounty/bounty.did | 20 ---- bounty/src/lib.rs | 35 ------ dfx.json | 13 +-- .../{install_bounty.sh => install_backend.sh} | 2 +- make/test/deposit.sh | 16 +-- provider/github/Cargo.toml | 20 ---- provider/github/src/lib.rs | 64 ---------- 25 files changed, 196 insertions(+), 226 deletions(-) rename {bounty => backend}/Cargo.toml (85%) rename provider/github/github.did => backend/backend.did (60%) rename {bounty/src => backend/src/bounty}/api/accept.rs (98%) rename {bounty/src => backend/src/bounty}/api/claim.rs (89%) rename {bounty/src => backend/src/bounty}/api/deposit.rs (100%) rename {bounty/src => backend/src/bounty}/api/icrc1.rs (100%) rename {bounty/src => backend/src/bounty}/api/init.rs (100%) rename {bounty/src => backend/src/bounty}/api/state.rs (100%) create mode 100644 backend/src/lib.rs rename {provider/github/src => backend/src/provider/github}/api/get_fixed_by.rs (100%) rename {provider/github/src => backend/src/provider/github}/api/get_is_merged.rs (100%) rename {provider/github/src => backend/src/provider/github}/api/get_issue.rs (100%) rename {provider/github/src => backend/src/provider/github}/api/get_merged_details.rs (100%) rename {provider/github/src => backend/src/provider/github}/client.rs (100%) rename {provider/github/src => backend/src/provider/github}/utils.rs (100%) delete mode 100644 bounty/bounty.did delete mode 100644 bounty/src/lib.rs rename make/{install_bounty.sh => install_backend.sh} (68%) delete mode 100644 provider/github/Cargo.toml delete mode 100644 provider/github/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 3acb594..dd7f8be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,6 +40,25 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "backend" +version = "0.1.0" +dependencies = [ + "async-trait", + "candid", + "futures", + "ic-cdk", + "ic-cdk-macros", + "ic-ledger-types", + "num-bigint", + "num-traits", + "regex", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", +] + [[package]] name = "binread" version = "2.2.0" @@ -72,25 +91,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bounty" -version = "0.1.0" -dependencies = [ - "async-trait", - "candid", - "futures", - "github", - "ic-cdk", - "ic-cdk-macros", - "ic-ledger-types", - "num-bigint", - "num-traits", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -134,9 +134,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -293,21 +293,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "github" -version = "0.1.0" -dependencies = [ - "async-trait", - "candid", - "ic-cdk", - "ic-cdk-macros", - "regex", - "serde", - "serde_bytes", - "serde_derive", - "serde_json", -] - [[package]] name = "hex" version = "0.4.3" diff --git a/Cargo.toml b/Cargo.toml index 72dc3e8..b6c0834 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,5 @@ [workspace] members = [ - "provider/github", - "bounty", + "backend" ] resolver = "2" diff --git a/Makefile b/Makefile index a12c4d7..206a270 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,7 @@ build: node_modules --with-cycles 1_000_000_000_000 \ --specified-id n5wcd-faaaa-aaaar-qaaea-cai \ icrc1_index - dfx canister create github - dfx canister create bounty + dfx canister create backend dfx build .PHONY: install @@ -36,8 +35,7 @@ install: build dfx canister install identity --argument '(null)' --mode reinstall --yes ./make/install_ledger.sh ./make/install_ledger_index.sh - dfx canister install github --mode reinstall --yes - ./make/install_bounty.sh + ./make/install_backend.sh .PHONY: upgrade .SILENT: upgrade @@ -45,8 +43,7 @@ upgrade: build dfx canister install identity --argument '(null)' --mode=upgrade dfx canister install icrc1_ledger --mode=upgrade dfx canister install icrc1_index --argument '(null)' --mode=upgrade - dfx canister install github --mode=upgrade - dfx canister install bounty --mode=upgrade + dfx canister install backend --mode=upgrade .PHONY: clean .SILENT: clean @@ -59,10 +56,10 @@ clean: .PHONY: test-1 .SILENT: test-1 test-1: install - # Call the github canister to get the GitHub issue and capture the output - @echo "Calling get_issue on github canister..." + # Call the backend canister to get the GitHub issue and capture the output + @echo "Calling get_issue on backend canister..." @TMP_FILE=$$(mktemp); \ - dfx canister call github get_issue '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ + dfx canister call backend get_issue '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ echo "get_issue response:"; \ cat $$TMP_FILE; \ rm -f $$TMP_FILE @@ -70,10 +67,10 @@ test-1: install .PHONY: test-2 .SILENT: test-2 test-2: install - # Call the github canister to get the GitHub PR that close some issue and capture the output - @echo "Calling get_fixed_by on github canister..." + # Call the backend canister to get the GitHub PR that close some issue and capture the output + @echo "Calling get_fixed_by on backend canister..." @TMP_FILE=$$(mktemp); \ - dfx canister call github get_fixed_by '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ + dfx canister call backend get_fixed_by '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ echo "get_fixed_by response:"; \ cat $$TMP_FILE; \ rm -f $$TMP_FILE @@ -81,10 +78,10 @@ test-2: install .PHONY: test-3 .SILENT: test-3 test-3: install - # Call the github canister to get the GitHub PR merge status and capture the output - @echo "Calling get_is_merged on github canister..." + # Call the backend canister to get the GitHub PR merge status and capture the output + @echo "Calling get_is_merged on backend canister..." @TMP_FILE=$$(mktemp); \ - dfx canister call github get_is_merged '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ + dfx canister call backend get_is_merged '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ echo "get_is_merged response:"; \ cat $$TMP_FILE; \ rm -f $$TMP_FILE @@ -92,10 +89,10 @@ test-3: install .PHONY: test-4 .SILENT: test-4 test-4: install - # Call the github canister to get the GitHub closing PR details and capture the output - @echo "Calling get_merged_details on github canister..." + # Call the backend canister to get the GitHub closing PR details and capture the output + @echo "Calling get_merged_details on backend canister..." @TMP_FILE=$$(mktemp); \ - dfx canister call github get_merged_details '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ + dfx canister call backend get_merged_details '("${GITHUB_TOKEN}")' > $$TMP_FILE; \ echo "get_merged_details response:"; \ cat $$TMP_FILE; \ rm -f $$TMP_FILE @@ -103,10 +100,10 @@ test-4: install .PHONY: test-a .SILENT: test-a test-a: install - # Call the bounty canister for healthcheck and capture the output - @echo "Calling healthcheck on bounty canister..." + # Call the backend canister for healthcheck and capture the output + @echo "Calling healthcheck on backend canister..." @TMP_FILE=$$(mktemp); \ - dfx canister call bounty healthcheck > $$TMP_FILE; \ + dfx canister call backend healthcheck > $$TMP_FILE; \ echo "healthcheck response:"; \ cat $$TMP_FILE; \ rm -f $$TMP_FILE diff --git a/bounty/Cargo.toml b/backend/Cargo.toml similarity index 85% rename from bounty/Cargo.toml rename to backend/Cargo.toml index 90d26f4..73d5d03 100644 --- a/bounty/Cargo.toml +++ b/backend/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bounty" +name = "backend" version = "0.1.0" edition = "2021" @@ -21,4 +21,4 @@ num-bigint = "0.4.4" num-traits = "0.2.18" futures = "0.3.30" async-trait = "0.1.8" -github = { path = "../provider/github", version = "0.1.0"} +regex = "1.5.4" diff --git a/provider/github/github.did b/backend/backend.did similarity index 60% rename from provider/github/github.did rename to backend/backend.did index 97ac2ed..5ae1a4e 100644 --- a/provider/github/github.did +++ b/backend/backend.did @@ -1,3 +1,5 @@ +// GitHub Service + type Issue = record { state: opt text; login: opt text; @@ -32,10 +34,32 @@ type User = record { type GithubToken = text; -service : { +// Bounty Service + +type Contributor = record { + address: principal; + crypto_address: text; +}; + +type DepositReceipt = variant { + Err: DepositErr; + Ok: nat; +}; + +type DepositErr = variant { + TransferFailure : record { reason : text }; +}; + +service : (authority: principal, github_issue_id: int32) -> { + // Bounty Service + "healthcheck": () -> (text); + "accept": (Contributor, github_pr_id: int32) -> (); + "deposit": () -> (DepositReceipt); + // GitHub Service "get_issue": (GithubToken) -> (Issue); "get_fixed_by": (GithubToken) -> (text); "get_is_merged": (GithubToken) -> (text); "get_merged_details": (GithubToken) -> (PrDetailsResponse); } + diff --git a/bounty/src/api/accept.rs b/backend/src/bounty/api/accept.rs similarity index 98% rename from bounty/src/api/accept.rs rename to backend/src/bounty/api/accept.rs index 8b84716..8d9e6d6 100644 --- a/bounty/src/api/accept.rs +++ b/backend/src/bounty/api/accept.rs @@ -22,7 +22,7 @@ pub fn accept_impl(contributor: Contributor, github_pr_id: i32) -> () { #[cfg(test)] mod test_accept { use super::*; - use crate::api::init::init_impl; + use crate::bounty::api::init::init_impl; use candid::Principal; #[test] diff --git a/bounty/src/api/claim.rs b/backend/src/bounty/api/claim.rs similarity index 89% rename from bounty/src/api/claim.rs rename to backend/src/bounty/api/claim.rs index 34ee906..9c490aa 100644 --- a/bounty/src/api/claim.rs +++ b/backend/src/bounty/api/claim.rs @@ -1,9 +1,9 @@ -use crate::api::state::BOUNTY_STATE; +use crate::bounty::api::state::{BOUNTY_STATE, Contributor}; use candid::{CandidType, Principal}; use serde::{Deserialize, Serialize}; -use super::state::Contributor; -use github::{api::{get_issue::IssueResponse, get_merged_details::PrDetailsResponse}, client::IGithubClient}; +use crate::provider::github::api::{get_issue::IssueResponse, get_merged_details::PrDetailsResponse}; +use crate::provider::github::client::IGithubClient; #[derive(Debug, Serialize, Deserialize, CandidType)] pub enum ClaimError { @@ -55,9 +55,9 @@ pub async fn claim_impl( #[cfg(test)] mod test_claim { - use crate::api::accept::accept_impl; - use crate::api::init::init_impl; - use crate::api::state::{Contributor, BOUNTY_STATE}; + use crate::bounty::api::accept::accept_impl; + use crate::bounty::api::init::init_impl; + use crate::bounty::api::state::{Contributor, BOUNTY_STATE}; use candid::Principal; use futures::executor::block_on; diff --git a/bounty/src/api/deposit.rs b/backend/src/bounty/api/deposit.rs similarity index 100% rename from bounty/src/api/deposit.rs rename to backend/src/bounty/api/deposit.rs diff --git a/bounty/src/api/icrc1.rs b/backend/src/bounty/api/icrc1.rs similarity index 100% rename from bounty/src/api/icrc1.rs rename to backend/src/bounty/api/icrc1.rs diff --git a/bounty/src/api/init.rs b/backend/src/bounty/api/init.rs similarity index 100% rename from bounty/src/api/init.rs rename to backend/src/bounty/api/init.rs diff --git a/bounty/src/api/state.rs b/backend/src/bounty/api/state.rs similarity index 100% rename from bounty/src/api/state.rs rename to backend/src/bounty/api/state.rs diff --git a/backend/src/lib.rs b/backend/src/lib.rs new file mode 100644 index 0000000..4aee131 --- /dev/null +++ b/backend/src/lib.rs @@ -0,0 +1,109 @@ +use candid::Principal; + +// GITHUB SERVICE +pub mod provider { + pub mod github { + pub mod api { + pub mod get_fixed_by; + pub mod get_is_merged; + pub mod get_issue; + pub mod get_merged_details; + } + pub mod client; + pub mod utils; + } +} +use provider::github::api::get_issue::IssueResponse; +use provider::github::api::get_merged_details::PrDetailsResponse; +use provider::github::client::{GithubClient, IGithubClient}; + +// BOUNTY SERVICE +pub mod bounty { + pub mod api { + pub mod accept; + pub mod claim; + pub mod deposit; + pub mod icrc1; + pub mod init; + pub mod state; + } +} + +use bounty::api::accept::accept_impl; +use bounty::api::init::init_impl; +use bounty::api::deposit::{deposit_impl, DepositReceipt}; +use bounty::api::state::Contributor; + +// GITHUB SERVICE +#[ic_cdk::update] +async fn get_issue(github_token: String) -> IssueResponse { + let owner = "input-output-hk".to_string(); + let repo = "hydra".to_string(); + let issue_nbr = 1218; + let client = GithubClient { + owner, + repo, + github_token, + }; + return client.get_issue(issue_nbr).await; +} + +#[ic_cdk::update] +async fn get_fixed_by(github_token: String) -> String { + let owner = "input-output-hk".to_string(); + let repo = "hydra".to_string(); + let issue_nbr = 1370; + let client = GithubClient { + owner, + repo, + github_token, + }; + return client.get_fixed_by(issue_nbr).await; +} + +#[ic_cdk::update] +async fn get_is_merged(github_token: String) -> String { + let owner = "input-output-hk".to_string(); + let repo = "hydra".to_string(); + let pr_nbr = 1266; + let client = GithubClient { + owner, + repo, + github_token, + }; + return client.get_is_merged(pr_nbr).await; +} + +#[ic_cdk::update] +async fn get_merged_details(github_token: String) -> PrDetailsResponse { + let owner = "input-output-hk".to_string(); + let repo = "hydra".to_string(); + let pr_nbr = 1266; + let client = GithubClient { + owner, + repo, + github_token, + }; + return client.get_merged_details(pr_nbr).await; +} + +// BOUNTY SERVICE +#[ic_cdk::init] +fn init(authority: Principal, github_issue_id: i32) -> () { + init_impl(authority, github_issue_id); +} + +#[ic_cdk::update] +fn accept(contributor: Contributor, github_pr_id: i32) -> () { + accept_impl(contributor, github_pr_id); +} + +#[ic_cdk::update] +async fn deposit() -> DepositReceipt { + return deposit_impl().await; +} + +#[ic_cdk::update] +async fn healthcheck() -> String { + return "OK".to_string(); +} diff --git a/provider/github/src/api/get_fixed_by.rs b/backend/src/provider/github/api/get_fixed_by.rs similarity index 100% rename from provider/github/src/api/get_fixed_by.rs rename to backend/src/provider/github/api/get_fixed_by.rs diff --git a/provider/github/src/api/get_is_merged.rs b/backend/src/provider/github/api/get_is_merged.rs similarity index 100% rename from provider/github/src/api/get_is_merged.rs rename to backend/src/provider/github/api/get_is_merged.rs diff --git a/provider/github/src/api/get_issue.rs b/backend/src/provider/github/api/get_issue.rs similarity index 100% rename from provider/github/src/api/get_issue.rs rename to backend/src/provider/github/api/get_issue.rs diff --git a/provider/github/src/api/get_merged_details.rs b/backend/src/provider/github/api/get_merged_details.rs similarity index 100% rename from provider/github/src/api/get_merged_details.rs rename to backend/src/provider/github/api/get_merged_details.rs diff --git a/provider/github/src/client.rs b/backend/src/provider/github/client.rs similarity index 100% rename from provider/github/src/client.rs rename to backend/src/provider/github/client.rs diff --git a/provider/github/src/utils.rs b/backend/src/provider/github/utils.rs similarity index 100% rename from provider/github/src/utils.rs rename to backend/src/provider/github/utils.rs diff --git a/bounty/bounty.did b/bounty/bounty.did deleted file mode 100644 index 1735173..0000000 --- a/bounty/bounty.did +++ /dev/null @@ -1,20 +0,0 @@ -type Contributor = record { - address: principal; - crypto_address: text; -}; - -type DepositReceipt = variant { - Err: DepositErr; - Ok: nat; -}; - -type DepositErr = variant { - TransferFailure : record { reason : text }; -}; - -service : (authority: principal, github_issue_id: int32) -> { - "healthcheck": () -> (text); - "accept": (Contributor, github_pr_id: int32) -> (); - "deposit": () -> (DepositReceipt); -} - diff --git a/bounty/src/lib.rs b/bounty/src/lib.rs deleted file mode 100644 index 0f9549d..0000000 --- a/bounty/src/lib.rs +++ /dev/null @@ -1,35 +0,0 @@ -use candid::Principal; - -pub mod api { - pub mod accept; - pub mod claim; - pub mod deposit; - pub mod icrc1; - pub mod init; - pub mod state; -} - -use api::accept::accept_impl; -use api::deposit::{deposit_impl, DepositReceipt}; -use api::init::init_impl; -use api::state::Contributor; - -#[ic_cdk::init] -fn init(authority: Principal, github_issue_id: i32) -> () { - init_impl(authority, github_issue_id); -} - -#[ic_cdk::update] -fn accept(contributor: Contributor, github_pr_id: i32) -> () { - accept_impl(contributor, github_pr_id); -} - -#[ic_cdk::update] -async fn deposit() -> DepositReceipt { - return deposit_impl().await; -} - -#[ic_cdk::update] -async fn healthcheck() -> String { - return "OK".to_string(); -} diff --git a/dfx.json b/dfx.json index 3c9ac6e..c43cee5 100644 --- a/dfx.json +++ b/dfx.json @@ -1,15 +1,10 @@ { "canisters": { - "github": { - "candid": "provider/github/github.did", - "package": "github", - "type": "rust" - }, - "bounty": { - "candid": "bounty/bounty.did", - "package": "bounty", + "backend": { + "candid": "backend/backend.did", + "package": "backend", "type": "rust", - "dependencies": ["icrc1_ledger", "github"] + "dependencies": ["icrc1_ledger"] }, "identity": { "type": "custom", diff --git a/make/install_bounty.sh b/make/install_backend.sh similarity index 68% rename from make/install_bounty.sh rename to make/install_backend.sh index 6577032..8a6c809 100755 --- a/make/install_bounty.sh +++ b/make/install_backend.sh @@ -5,5 +5,5 @@ set -e DEPLOY_ID=$(dfx identity get-principal) BOUNTY_ISSUE=1218 -dfx canister install bounty --mode reinstall --yes --argument \ +dfx canister install backend --mode reinstall --yes --argument \ "(principal \"${DEPLOY_ID}\", ${BOUNTY_ISSUE} : int32)" diff --git a/make/test/deposit.sh b/make/test/deposit.sh index c5a2568..e3dcebb 100755 --- a/make/test/deposit.sh +++ b/make/test/deposit.sh @@ -13,26 +13,26 @@ approve_allowance() { } deposit() { - dfx canister call --output=json bounty deposit "()" + dfx canister call --output=json backend deposit "()" } CALLER=$(dfx identity get-principal) -BOUNTY=$(dfx canister id bounty) +BACKEND=$(dfx canister id backend) -# Call the bounty canister to deposit from caller and capture the output -echo "Calling deposit on bounty canister..." +# Call the backend canister to deposit from caller and capture the output +echo "Calling deposit on backend canister..." # check initial balances echo "Caller initial balance: $(balance_of $CALLER)" -echo "Bounty initial balance: $(balance_of $BOUNTY)" +echo "Backend initial balance: $(balance_of $BACKEND)" # deposit -echo "Bounty allowance: $(approve_allowance 100_000 $BOUNTY)" -echo "Bounty deposit: $(deposit)" +echo "Backend allowance: $(approve_allowance 100_000 $BACKEND)" +echo "Backend deposit: $(deposit)" # check final balances sleep 1 echo "Caller final balance: $(balance_of $CALLER)" -echo "Bounty final balance: $(balance_of $BOUNTY)" +echo "Backend final balance: $(balance_of $BACKEND)" echo "PASS" diff --git a/provider/github/Cargo.toml b/provider/github/Cargo.toml deleted file mode 100644 index 23f049e..0000000 --- a/provider/github/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "github" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -crate-type = ["lib", "cdylib", "staticlib"] - -[dependencies] -candid = "0.10.4" -ic-cdk = "0.13.2" -ic-cdk-macros = "0.13.2" -serde = "1.0.199" -serde_derive = "1.0.199" -serde_json = "1.0.116" -serde_bytes = "0.11.14" -regex = "1.5.4" -async-trait = "0.1.8" diff --git a/provider/github/src/lib.rs b/provider/github/src/lib.rs deleted file mode 100644 index abb5945..0000000 --- a/provider/github/src/lib.rs +++ /dev/null @@ -1,64 +0,0 @@ -pub mod api { - pub mod get_fixed_by; - pub mod get_is_merged; - pub mod get_issue; - pub mod get_merged_details; -} -pub mod client; -pub mod utils; - -use api::get_issue::IssueResponse; -use api::get_merged_details::PrDetailsResponse; -use client::{GithubClient, IGithubClient}; - -#[ic_cdk::update] -async fn get_issue(github_token: String) -> IssueResponse { - let owner = "input-output-hk".to_string(); - let repo = "hydra".to_string(); - let issue_nbr = 1218; - let client = GithubClient { - owner, - repo, - github_token, - }; - return client.get_issue(issue_nbr).await; -} - -#[ic_cdk::update] -async fn get_fixed_by(github_token: String) -> String { - let owner = "input-output-hk".to_string(); - let repo = "hydra".to_string(); - let issue_nbr = 1370; - let client = GithubClient { - owner, - repo, - github_token, - }; - return client.get_fixed_by(issue_nbr).await; -} - -#[ic_cdk::update] -async fn get_is_merged(github_token: String) -> String { - let owner = "input-output-hk".to_string(); - let repo = "hydra".to_string(); - let pr_nbr = 1266; - let client = GithubClient { - owner, - repo, - github_token, - }; - return client.get_is_merged(pr_nbr).await; -} - -#[ic_cdk::update] -async fn get_merged_details(github_token: String) -> PrDetailsResponse { - let owner = "input-output-hk".to_string(); - let repo = "hydra".to_string(); - let pr_nbr = 1266; - let client = GithubClient { - owner, - repo, - github_token, - }; - return client.get_merged_details(pr_nbr).await; -}