File tree Expand file tree Collapse file tree 6 files changed +483
-455
lines changed Expand file tree Collapse file tree 6 files changed +483
-455
lines changed Original file line number Diff line number Diff line change @@ -747,6 +747,27 @@ namespace fc::api {
747
747
}));
748
748
return map;
749
749
};
750
+
751
+ api->MarketAddBalance = [=](auto &address, auto &wallet, auto &amount)
752
+ -> outcome::result<boost::optional<CID>> {
753
+ OUTCOME_TRY (
754
+ encoded_params,
755
+ codec::cbor::encode (
756
+ vm::actor::builtin::v0::market::AddBalance::Params{address}));
757
+ OUTCOME_TRY (signed_message,
758
+ api->MpoolPushMessage (
759
+ vm::message::UnsignedMessage (
760
+ kStorageMarketAddress ,
761
+ wallet,
762
+ 0 ,
763
+ amount,
764
+ 0 ,
765
+ 0 ,
766
+ vm::actor::builtin::v0::market::AddBalance::Number,
767
+ encoded_params),
768
+ api::kPushNoSpec ));
769
+ return signed_message.getCid ();
770
+ };
750
771
api->StateLookupID = [=](auto &address,
751
772
auto &tipset_key) -> outcome::result<Address> {
752
773
OUTCOME_TRY (context, tipsetContext (tipset_key, false ));
Original file line number Diff line number Diff line change @@ -74,8 +74,9 @@ namespace fc::api {
74
74
std::vector<Address> out;
75
75
out.reserve (all.size ());
76
76
77
- std::string k_name_prefix = " wallet-" ;
77
+ std::string k_name_prefix = " wallet-" ; // TODO not needed
78
78
for (auto &a : all) {
79
+ fmt::print (encodeToString (a));
79
80
if (encodeToString (a).substr (0 , k_name_prefix.size ())
80
81
== k_name_prefix) {
81
82
std::string name = encodeToString (a).erase (0 , k_name_prefix.size ());
@@ -113,6 +114,14 @@ namespace fc::api {
113
114
}
114
115
return key_store->verify (address, data, signature);
115
116
};
117
+ api->WalletDelete = [=](auto &address) -> outcome::result<void > {
118
+ OUTCOME_TRY (has, key_store->has (address));
119
+ if (has) {
120
+ OUTCOME_TRY (key_store->remove (address));
121
+ return outcome::success ();
122
+ }
123
+ return ERROR_TEXT (" WalletDelete: Address does not exist" );
124
+ };
116
125
}
117
126
118
127
} // namespace fc::api
Original file line number Diff line number Diff line change @@ -174,21 +174,21 @@ namespace fc::cli {
174
174
int pad = colLenghts[i] - e.size () + 2 ;
175
175
if (not column.separate_line && column.lines > 0 ) {
176
176
e += std::string (pad, ' ' );
177
- std::cout << e ;
177
+ fmt::print (e) ;
178
178
}
179
179
180
180
cols.push_back (e);
181
181
}
182
182
183
- std::cout << ' \n ' ;
183
+ fmt::print ( " \n " ) ;
184
184
185
185
for (int i = 0 ; i < columns.size (); ++i) {
186
186
Column &column = columns[i];
187
187
if (not column.separate_line || cols[i].size () == 0 ) {
188
188
continue ;
189
189
}
190
190
191
- std::cout << " " << column.name << " : " << cols[i] << ' \n ' ;
191
+ fmt::print ( " {}: {} \n " , column.name , cols[i]) ;
192
192
}
193
193
}
194
194
}
Original file line number Diff line number Diff line change
1
+ #
2
+ # Copyright Soramitsu Co., Ltd. All Rights Reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ #
5
+
6
+ add_executable (cli_example main.cpp )
7
+ target_link_libraries (cli_example
8
+ cli
9
+ rpc
10
+ api_ipfs_datastore
11
+ )
You can’t perform that action at this time.
0 commit comments