dstack_sdk/
ethereum.rs

1// SPDX-FileCopyrightText: © 2025 Created-for-a-purpose <rachitchahar@gmail.com>
2// SPDX-FileCopyrightText: © 2025 Daniel Sharifi <daniel.sharifi@nearone.org>
3//
4// SPDX-License-Identifier: Apache-2.0
5
6use alloy::signers::local::PrivateKeySigner;
7use dstack_sdk_types::dstack::GetKeyResponse;
8
9pub fn to_account(
10    get_key_response: &GetKeyResponse,
11) -> Result<PrivateKeySigner, Box<dyn std::error::Error>> {
12    let key_bytes = hex::decode(&get_key_response.key)?;
13    let wallet = PrivateKeySigner::from_slice(&key_bytes)?;
14    Ok(wallet)
15}