use crate::ClientBuilder;
use candid::CandidType;
use ic_canister_runtime::{IcError, StubRuntime};
use sol_rpc_types::{AccountData, AccountEncoding, AccountInfo};
impl<R> ClientBuilder<R> {
pub fn with_stub_responses(self) -> ClientBuilder<StubRuntime> {
self.with_runtime(|_runtime| StubRuntime::default())
}
pub fn with_stub_response<Out: CandidType>(
self,
stub_response: Out,
) -> ClientBuilder<StubRuntime> {
self.with_stub_responses().add_stub_response(stub_response)
}
}
impl ClientBuilder<StubRuntime> {
pub fn add_stub_response<Out: CandidType>(
self,
stub_response: Out,
) -> ClientBuilder<StubRuntime> {
self.with_runtime(|runtime| runtime.add_stub_response(stub_response))
}
pub fn add_stub_error(self, stub_error: IcError) -> ClientBuilder<StubRuntime> {
self.with_runtime(|runtime| runtime.add_stub_error(stub_error))
}
}
pub fn usdc_account() -> AccountInfo {
AccountInfo {
lamports: 388_127_047_454,
data: AccountData::Binary(
"KLUv/QBYkQIAAQAAAJj+huiNm+Lqi8HMpIeLKYjCQPUrhCS/tA7Rot3LXhmbQLUAvmbxIwAGAQEAAABicKqKWcWUBbRShshncubNEm6bil06OFNtN/e0FOi2Zw==".to_string(),
AccountEncoding::Base64Zstd,
),
owner: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA".to_string(),
executable: false,
rent_epoch: 18_446_744_073_709_551_615,
space: 82,
}
}
pub fn nonce_account() -> AccountInfo {
AccountInfo {
lamports: 1_499_900,
data: AccountData::Binary("AQAAAAEAAAA+ZK6at2Umwl1p39ifPkNAu66sw5w0AKkY72a19k0LVFBDMPwL0VO7EYlFDc0BAwVcV446FBr/cRWZCGdrPYW9iBMAAAAAAAA=".to_string(), AccountEncoding::Base64),
owner: "11111111111111111111111111111111".to_string(),
executable: false,
rent_epoch: 18_446_744_073_709_551_615,
space: 80,
}
}