* FIX!

* resolve conflicts with main

* undo debug changes

* fix: methods

* fix: methods2

* Fix Tron issue

* fix: 1k limit & reaching top

* fix: missing unspents

* fix: missing commit

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
rafael_xmr 2025-05-25 16:28:08 -03:00 committed by GitHub
parent e52bceda3a
commit 7b8ddf9685
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 667 additions and 402 deletions

View file

@ -1,26 +1,33 @@
import 'dart:convert';
import 'package:http/http.dart';
import 'package:on_chain/solana/solana.dart';
class SolanaRPCHTTPService implements SolanaJSONRPCService {
class SolanaRPCHTTPService implements SolanaServiceProvider {
SolanaRPCHTTPService(
{required this.url, Client? client, this.defaultRequestTimeout = const Duration(seconds: 30)})
: client = client ?? Client();
@override
final String url;
final Client client;
final Duration defaultRequestTimeout;
@override
Future<Map<String, dynamic>> call(SolanaRequestDetails params, [Duration? timeout]) async {
final response = await client.post(
Uri.parse(url),
body: params.toRequestBody(),
headers: {
'Content-Type': 'application/json',
},
).timeout(timeout ?? defaultRequestTimeout);
final data = json.decode(response.body) as Map<String, dynamic>;
return data;
Future<SolanaServiceResponse<T>> doRequest<T>(SolanaRequestDetails params,
{Duration? timeout}) async {
if (!params.type.isPostRequest) {
final response = await client.get(
params.toUri(url),
headers: {'Content-Type': 'application/json'},
).timeout(timeout ?? defaultRequestTimeout);
return params.toResponse(response.bodyBytes, response.statusCode);
}
final response = await client
.post(
params.toUri(url),
headers: {'Content-Type': 'application/json'},
body: params.body(),
)
.timeout(timeout ?? defaultRequestTimeout);
return params.toResponse(response.bodyBytes, response.statusCode);
}
}

View file

@ -50,11 +50,11 @@ packages:
dependency: transitive
description:
path: "."
ref: cake-update-v2
resolved-ref: "59fdf29d72068e0522a96a8953ed7272833a9f57"
ref: cake-update-v4
resolved-ref: "437dadd0bd9bf73ec6a551299577799341f6486a"
url: "https://github.com/cake-tech/blockchain_utils"
source: git
version: "3.3.0"
version: "4.3.0"
boolean_selector:
dependency: transitive
description:
@ -478,11 +478,11 @@ packages:
dependency: "direct main"
description:
path: "."
ref: cake-update-v2
resolved-ref: "93440dc5126369b873ca1fccc13c3c1240b1c5c2"
ref: cake-update-v4
resolved-ref: "084fb7bf13ec42d74f26ac08c883ce07c10fca7e"
url: "https://github.com/cake-tech/on_chain.git"
source: git
version: "3.7.0"
version: "6.2.0"
package_config:
dependency: transitive
description:

View file

@ -30,7 +30,7 @@ dependencies:
on_chain:
git:
url: https://github.com/cake-tech/on_chain.git
ref: cake-update-v2
ref: cake-update-v4
# tor:
# git:
# url: https://github.com/cake-tech/tor.git