v4.10.0 & v1.7.0 (#1113)

* New versions

* update the new version text after macos [skip ci]

* add cake-wallet headers

* add nano/banano to getAddressFromStringPattern

* Revert "Exolix integration (#1080)"

This reverts commit 9eb6867ab9.

* fix: Bug in conditions check and clean up of repeated code in switch cases (#1117)

* update build numbers [skip ci]

---------

Co-authored-by: fosse <matt.cfosse@gmail.com>
Co-authored-by: Adegoke David <64401859+Blazebrain@users.noreply.github.com>
This commit is contained in:
Omar Hatem
2023-10-09 18:18:59 +03:00
committed by GitHub
co-authored by fosse Adegoke David
parent 5a20d342ad
commit e5408a388e
32 changed files with 146 additions and 554 deletions
+12 -12
View File
@@ -13,6 +13,11 @@ class NanoClient {
static const String DEFAULT_REPRESENTATIVE =
"nano_38713x95zyjsqzx6nm1dsom1jmm668owkeb9913ax6nfgj15az3nu8xkx579";
static const Map<String, String> CAKE_HEADERS = {
"Content-Type": "application/json",
"nano-app": "cake-wallet"
};
Node? _node;
Node? _powNode;
@@ -37,7 +42,7 @@ class NanoClient {
Future<NanoBalance> getBalance(String address) async {
final response = await http.post(
_node!.uri,
headers: {"Content-Type": "application/json"},
headers: CAKE_HEADERS,
body: jsonEncode(
{
"action": "account_balance",
@@ -57,7 +62,7 @@ class NanoClient {
try {
final response = await http.post(
_node!.uri,
headers: {"Content-Type": "application/json"},
headers: CAKE_HEADERS,
body: jsonEncode(
{
"action": "account_info",
@@ -123,7 +128,7 @@ class NanoClient {
Future<String> requestWork(String hash) async {
final response = await http.post(
_powNode!.uri,
headers: {'Content-type': 'application/json'},
headers: CAKE_HEADERS,
body: json.encode(
{
"action": "work_generate",
@@ -157,7 +162,6 @@ class NanoClient {
}
Future<String> processBlock(Map<String, String> block, String subtype) async {
final headers = {"Content-Type": "application/json"};
final processBody = jsonEncode({
"action": "process",
"json_block": "true",
@@ -167,7 +171,7 @@ class NanoClient {
final processResponse = await http.post(
_node!.uri,
headers: headers,
headers: CAKE_HEADERS,
body: processBody,
);
@@ -260,10 +264,6 @@ class NanoClient {
}) async {
bool openBlock = false;
final headers = {
"Content-Type": "application/json",
};
// first check if the account is open:
// get the account info (we need the frontier and representative):
AccountInfoResponse? infoData = await getAccountInfo(destinationAddress);
@@ -335,7 +335,7 @@ class NanoClient {
});
final processResponse = await http.post(
_node!.uri,
headers: headers,
headers: CAKE_HEADERS,
body: processBody,
);
@@ -351,7 +351,7 @@ class NanoClient {
required String privateKey,
}) async {
final receivableResponse = await http.post(_node!.uri,
headers: {"Content-Type": "application/json"},
headers: CAKE_HEADERS,
body: jsonEncode({
"action": "receivable",
"account": destinationAddress,
@@ -401,7 +401,7 @@ class NanoClient {
Future<List<NanoTransactionModel>> fetchTransactions(String address) async {
try {
final response = await http.post(_node!.uri,
headers: {"Content-Type": "application/json"},
headers: CAKE_HEADERS,
body: jsonEncode({
"action": "account_history",
"account": address,