|
3 | 3 |
|
4 | 4 | /* ABI of the Fungible Token Example Application */ |
5 | 5 |
|
6 | | -use async_graphql::{scalar, Request, Response}; |
| 6 | +use async_graphql::scalar; |
7 | 7 | pub use linera_sdk::abis::fungible::*; |
8 | | -use linera_sdk::{ |
9 | | - abi::{ContractAbi, ServiceAbi}, |
10 | | - graphql::GraphQLMutationRoot, |
11 | | - linera_base_types::{AccountOwner, Amount}, |
12 | | -}; |
| 8 | +use linera_sdk::linera_base_types::{AccountOwner, Amount}; |
13 | 9 | use serde::{Deserialize, Serialize}; |
14 | 10 | #[cfg(all(any(test, feature = "test"), not(target_arch = "wasm32")))] |
15 | 11 | use { |
@@ -65,71 +61,6 @@ impl OwnerSpender { |
65 | 61 | } |
66 | 62 | } |
67 | 63 |
|
68 | | -/// An ABI for applications that implement a fungible token. |
69 | | -pub struct FungibleTokenAbi; |
70 | | - |
71 | | -impl ContractAbi for FungibleTokenAbi { |
72 | | - type Operation = Operation; |
73 | | - type Response = FungibleResponse; |
74 | | -} |
75 | | - |
76 | | -impl ServiceAbi for FungibleTokenAbi { |
77 | | - type Query = Request; |
78 | | - type QueryResponse = Response; |
79 | | -} |
80 | | - |
81 | | -/// An operation |
82 | | -#[derive(Debug, Deserialize, Serialize, GraphQLMutationRoot)] |
83 | | -pub enum Operation { |
84 | | - /// Requests an account balance. |
85 | | - Balance { |
86 | | - /// Owner to query the balance for |
87 | | - owner: AccountOwner, |
88 | | - }, |
89 | | - /// Requests this fungible token's ticker symbol. |
90 | | - TickerSymbol, |
91 | | - /// Approve the transfer of tokens |
92 | | - Approve { |
93 | | - /// Owner to transfer from |
94 | | - owner: AccountOwner, |
95 | | - /// The spender account |
96 | | - spender: AccountOwner, |
97 | | - /// Maximum amount to be transferred |
98 | | - allowance: Amount, |
99 | | - }, |
100 | | - /// Transfers tokens from a (locally owned) account to a (possibly remote) account. |
101 | | - Transfer { |
102 | | - /// Owner to transfer from |
103 | | - owner: AccountOwner, |
104 | | - /// Amount to be transferred |
105 | | - amount: Amount, |
106 | | - /// Target account to transfer the amount to |
107 | | - target_account: Account, |
108 | | - }, |
109 | | - /// Transfers tokens from a (locally owned) account to a (possibly remote) account by using the allowance. |
110 | | - TransferFrom { |
111 | | - /// Owner to transfer from |
112 | | - owner: AccountOwner, |
113 | | - /// The spender of the amount. |
114 | | - spender: AccountOwner, |
115 | | - /// Amount to be transferred |
116 | | - amount: Amount, |
117 | | - /// Target account to transfer the amount to |
118 | | - target_account: Account, |
119 | | - }, |
120 | | - /// Same as `Transfer` but the source account may be remote. Depending on its |
121 | | - /// configuration, the target chain may take time or refuse to process |
122 | | - /// the message. |
123 | | - Claim { |
124 | | - /// Source account to claim amount from |
125 | | - source_account: Account, |
126 | | - /// Amount to be claimed |
127 | | - amount: Amount, |
128 | | - /// Target account to claim the amount into |
129 | | - target_account: Account, |
130 | | - }, |
131 | | -} |
132 | | - |
133 | 64 | /// Creates a fungible token application and distributes `initial_amounts` to new individual |
134 | 65 | /// chains. |
135 | 66 | #[cfg(all(any(test, feature = "test"), not(target_arch = "wasm32")))] |
@@ -168,7 +99,7 @@ pub async fn create_with_accounts( |
168 | 99 | .add_block(|block| { |
169 | 100 | block.with_operation( |
170 | 101 | application_id, |
171 | | - Operation::Claim { |
| 102 | + FungibleOperation::Claim { |
172 | 103 | source_account: Account { |
173 | 104 | chain_id: token_chain.id(), |
174 | 105 | owner: *account, |
|
0 commit comments