Skip to main content

magiclink_server_wallets_api/
dto.rs

1use crate::domain::Network;
2use serde::{
3  Deserialize,
4  Serialize,
5};
6use std::collections::HashMap;
7
8#[derive(Debug, Deserialize)]
9pub struct ApiResponse<T> {
10  data: T,
11}
12
13#[derive(Debug, Serialize)]
14pub struct WalletGroupMetadataParam {
15  metadata: HashMap<String, String>,
16}
17
18#[derive(Debug, Serialize)]
19pub struct WalletParam {
20  encryption_context: String,
21  network: Network,
22  wallet_group_id: String,
23  metadata: HashMap<String, String>,
24}
25
26#[derive(Debug, Serialize)]
27pub struct RecoveryParam {
28  wallet_id: String,
29  encryption_context: String,
30  recovery_key: String,
31}
32
33#[derive(Debug, Serialize)]
34pub struct TransSigningParam<T> {
35  encryption_context: String,
36  access_key: String,
37  wallet_id: String,
38  payload: T,
39}
40
41#[derive(Debug, Serialize)]
42pub struct EVMPayload {
43  _type: u16,
44  chainId: u64,
45  nonce: u16,
46  value: String,
47  gas: u64,
48  maxFeePerGas: u64,
49  maxPriorityFeePerGas: u64,
50  to: String,
51}
52
53pub type SolanaPayload = String;
54
55#[derive(Debug, Serialize)]
56pub struct BitcoinPayload {
57  inputs: Vec<AddressInfo>,
58  outputs: Vec<AddressInfo>,
59}
60
61#[derive(Debug, Serialize)]
62pub struct AddressInfo {
63  address: String,
64  value: u16,
65  txid: Option<String>,
66  tx_num: Option<u16>,
67}
68
69#[derive(Debug, Serialize)]
70pub struct MessageSigningParam {
71  raw_data_hash: String,
72  encryption_context: String,
73  access_key: String,
74  wallet_id: String,
75}
76
77#[derive(Debug, Serialize)]
78pub struct SolanaSignMessageParam {
79  message_base64: String,
80  encryption_context: String,
81  access_key: String,
82  wallet_id: String,
83}