mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-05 02:19:46 +00:00
change Solana node (#1903)
* change Solana node * Fix reaching limit for fetching transactions
This commit is contained in:
parent
3e93a5ecb8
commit
ed12ff6afe
13 changed files with 90 additions and 48 deletions
|
@ -173,6 +173,7 @@ jobs:
|
||||||
echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
|
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
|
@ -185,6 +186,7 @@ jobs:
|
||||||
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
||||||
|
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
||||||
echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
|
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
|
||||||
|
|
2
.github/workflows/pr_test_build_android.yml
vendored
2
.github/workflows/pr_test_build_android.yml
vendored
|
@ -184,6 +184,7 @@ jobs:
|
||||||
echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
|
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
|
@ -197,6 +198,7 @@ jobs:
|
||||||
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
||||||
|
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
||||||
echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
|
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
|
||||||
|
|
2
.github/workflows/pr_test_build_linux.yml
vendored
2
.github/workflows/pr_test_build_linux.yml
vendored
|
@ -156,6 +156,7 @@ jobs:
|
||||||
echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
|
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
echo "const chatwootWebsiteToken = '${{ secrets.CHATWOOT_WEBSITE_TOKEN }}';" >> lib/.secrets.g.dart
|
echo "const chatwootWebsiteToken = '${{ secrets.CHATWOOT_WEBSITE_TOKEN }}';" >> lib/.secrets.g.dart
|
||||||
|
@ -167,6 +168,7 @@ jobs:
|
||||||
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
echo "const nowNodesApiKey = '${{ secrets.EVM_NOWNODES_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
|
||||||
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
||||||
|
echo "const chainStackApiKey = '${{ secrets.CHAIN_STACK_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
|
||||||
echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
|
||||||
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
|
echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
|
||||||
|
|
|
@ -7,4 +7,7 @@
|
||||||
-
|
-
|
||||||
uri: solana-rpc.publicnode.com:443
|
uri: solana-rpc.publicnode.com:443
|
||||||
useSSL: true
|
useSSL: true
|
||||||
|
-
|
||||||
|
uri: solana-mainnet.core.chainstack.com
|
||||||
|
useSSL: true
|
||||||
is_default: true
|
is_default: true
|
|
@ -47,7 +47,11 @@ class TransactionInputNotSupported implements Exception {}
|
||||||
|
|
||||||
class SignNativeTokenTransactionRentException implements Exception {}
|
class SignNativeTokenTransactionRentException implements Exception {}
|
||||||
|
|
||||||
class CreateAssociatedTokenAccountException implements Exception {}
|
class CreateAssociatedTokenAccountException implements Exception {
|
||||||
|
final String errorMessage;
|
||||||
|
|
||||||
|
CreateAssociatedTokenAccountException(this.errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
class SignSPLTokenTransactionRentException implements Exception {}
|
class SignSPLTokenTransactionRentException implements Exception {}
|
||||||
|
|
||||||
|
|
|
@ -21,22 +21,23 @@ class SolanaWalletClient {
|
||||||
|
|
||||||
bool connect(Node node) {
|
bool connect(Node node) {
|
||||||
try {
|
try {
|
||||||
Uri? rpcUri;
|
Uri rpcUri = node.uri;
|
||||||
String webSocketUrl;
|
String webSocketUrl = 'wss://${node.uriRaw}';
|
||||||
bool isModifiedNodeUri = false;
|
|
||||||
|
|
||||||
if (node.uriRaw == 'rpc.ankr.com') {
|
if (node.uriRaw == 'rpc.ankr.com') {
|
||||||
isModifiedNodeUri = true;
|
|
||||||
String ankrApiKey = secrets.ankrApiKey;
|
String ankrApiKey = secrets.ankrApiKey;
|
||||||
|
|
||||||
rpcUri = Uri.https(node.uriRaw, '/solana/$ankrApiKey');
|
rpcUri = Uri.https(node.uriRaw, '/solana/$ankrApiKey');
|
||||||
webSocketUrl = 'wss://${node.uriRaw}/solana/ws/$ankrApiKey';
|
webSocketUrl = 'wss://${node.uriRaw}/solana/ws/$ankrApiKey';
|
||||||
} else {
|
} else if (node.uriRaw == 'solana-mainnet.core.chainstack.com') {
|
||||||
webSocketUrl = 'wss://${node.uriRaw}';
|
String chainStackApiKey = secrets.chainStackApiKey;
|
||||||
|
|
||||||
|
rpcUri = Uri.https(node.uriRaw, '/$chainStackApiKey');
|
||||||
|
webSocketUrl = 'wss://${node.uriRaw}/$chainStackApiKey';
|
||||||
}
|
}
|
||||||
|
|
||||||
_client = SolanaClient(
|
_client = SolanaClient(
|
||||||
rpcUrl: isModifiedNodeUri ? rpcUri! : node.uri,
|
rpcUrl: rpcUri,
|
||||||
websocketUrl: Uri.parse(webSocketUrl),
|
websocketUrl: Uri.parse(webSocketUrl),
|
||||||
timeout: const Duration(minutes: 2),
|
timeout: const Duration(minutes: 2),
|
||||||
);
|
);
|
||||||
|
@ -115,10 +116,14 @@ class SolanaWalletClient {
|
||||||
final message =
|
final message =
|
||||||
_getMessageForNativeTransaction(ownerKeypair, ownerKeypair.address, lamportsPerSol);
|
_getMessageForNativeTransaction(ownerKeypair, ownerKeypair.address, lamportsPerSol);
|
||||||
|
|
||||||
final recentBlockhash = await _getRecentBlockhash(commitment);
|
final latestBlockhash = await _getLatestBlockhash(commitment);
|
||||||
|
|
||||||
final estimatedFee =
|
final estimatedFee = _getFeeFromCompiledMessage(
|
||||||
_getFeeFromCompiledMessage(message, ownerKeypair.publicKey, recentBlockhash, commitment);
|
message,
|
||||||
|
ownerKeypair.publicKey,
|
||||||
|
latestBlockhash,
|
||||||
|
commitment,
|
||||||
|
);
|
||||||
return estimatedFee;
|
return estimatedFee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,13 +136,25 @@ class SolanaWalletClient {
|
||||||
List<SolanaTransactionModel> transactions = [];
|
List<SolanaTransactionModel> transactions = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await _client!.rpcClient.getTransactionsList(
|
final signatures = await _client!.rpcClient.getSignaturesForAddress(
|
||||||
publicKey,
|
publicKey.toBase58(),
|
||||||
commitment: Commitment.confirmed,
|
commitment: Commitment.confirmed,
|
||||||
limit: 1000,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
for (final tx in response) {
|
final List<TransactionDetails> transactionDetails = [];
|
||||||
|
for (int i = 0; i < signatures.length; i += 20) {
|
||||||
|
final response = await _client!.rpcClient.getMultipleTransactions(
|
||||||
|
signatures.sublist(i, math.min(i + 20, signatures.length)),
|
||||||
|
commitment: Commitment.confirmed,
|
||||||
|
encoding: Encoding.jsonParsed,
|
||||||
|
);
|
||||||
|
transactionDetails.addAll(response);
|
||||||
|
|
||||||
|
// to avoid reaching the node RPS limit
|
||||||
|
await Future.delayed(Duration(milliseconds: 500));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final tx in transactionDetails) {
|
||||||
if (tx.transaction is ParsedTransaction) {
|
if (tx.transaction is ParsedTransaction) {
|
||||||
final parsedTx = (tx.transaction as ParsedTransaction);
|
final parsedTx = (tx.transaction as ParsedTransaction);
|
||||||
final message = parsedTx.message;
|
final message = parsedTx.message;
|
||||||
|
@ -310,16 +327,16 @@ class SolanaWalletClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<RecentBlockhash> _getRecentBlockhash(Commitment commitment) async {
|
Future<LatestBlockhash> _getLatestBlockhash(Commitment commitment) async {
|
||||||
final latestBlockhash =
|
final latestBlockHashResult =
|
||||||
await _client!.rpcClient.getLatestBlockhash(commitment: commitment).value;
|
await _client!.rpcClient.getLatestBlockhash(commitment: commitment).value;
|
||||||
|
|
||||||
final recentBlockhash = RecentBlockhash(
|
final latestBlockhash = LatestBlockhash(
|
||||||
blockhash: latestBlockhash.blockhash,
|
blockhash: latestBlockHashResult.blockhash,
|
||||||
feeCalculator: const FeeCalculator(lamportsPerSignature: 500),
|
lastValidBlockHeight: latestBlockHashResult.lastValidBlockHeight,
|
||||||
);
|
);
|
||||||
|
|
||||||
return recentBlockhash;
|
return latestBlockhash;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message _getMessageForNativeTransaction(
|
Message _getMessageForNativeTransaction(
|
||||||
|
@ -342,11 +359,11 @@ class SolanaWalletClient {
|
||||||
Future<double> _getFeeFromCompiledMessage(
|
Future<double> _getFeeFromCompiledMessage(
|
||||||
Message message,
|
Message message,
|
||||||
Ed25519HDPublicKey feePayer,
|
Ed25519HDPublicKey feePayer,
|
||||||
RecentBlockhash recentBlockhash,
|
LatestBlockhash latestBlockhash,
|
||||||
Commitment commitment,
|
Commitment commitment,
|
||||||
) async {
|
) async {
|
||||||
final compile = message.compile(
|
final compile = message.compile(
|
||||||
recentBlockhash: recentBlockhash.blockhash,
|
recentBlockhash: latestBlockhash.blockhash,
|
||||||
feePayer: feePayer,
|
feePayer: feePayer,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -391,12 +408,12 @@ class SolanaWalletClient {
|
||||||
|
|
||||||
final signers = [ownerKeypair];
|
final signers = [ownerKeypair];
|
||||||
|
|
||||||
RecentBlockhash recentBlockhash = await _getRecentBlockhash(commitment);
|
LatestBlockhash latestBlockhash = await _getLatestBlockhash(commitment);
|
||||||
|
|
||||||
final fee = await _getFeeFromCompiledMessage(
|
final fee = await _getFeeFromCompiledMessage(
|
||||||
message,
|
message,
|
||||||
signers.first.publicKey,
|
signers.first.publicKey,
|
||||||
recentBlockhash,
|
latestBlockhash,
|
||||||
commitment,
|
commitment,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -422,14 +439,14 @@ class SolanaWalletClient {
|
||||||
message: updatedMessage,
|
message: updatedMessage,
|
||||||
signers: signers,
|
signers: signers,
|
||||||
commitment: commitment,
|
commitment: commitment,
|
||||||
recentBlockhash: recentBlockhash,
|
latestBlockhash: latestBlockhash,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
signedTx = await _signTransactionInternal(
|
signedTx = await _signTransactionInternal(
|
||||||
message: message,
|
message: message,
|
||||||
signers: signers,
|
signers: signers,
|
||||||
commitment: commitment,
|
commitment: commitment,
|
||||||
recentBlockhash: recentBlockhash,
|
latestBlockhash: latestBlockhash,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,12 +524,12 @@ class SolanaWalletClient {
|
||||||
|
|
||||||
final signers = [ownerKeypair];
|
final signers = [ownerKeypair];
|
||||||
|
|
||||||
RecentBlockhash recentBlockhash = await _getRecentBlockhash(commitment);
|
LatestBlockhash latestBlockhash = await _getLatestBlockhash(commitment);
|
||||||
|
|
||||||
final fee = await _getFeeFromCompiledMessage(
|
final fee = await _getFeeFromCompiledMessage(
|
||||||
message,
|
message,
|
||||||
signers.first.publicKey,
|
signers.first.publicKey,
|
||||||
recentBlockhash,
|
latestBlockhash,
|
||||||
commitment,
|
commitment,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -530,7 +547,7 @@ class SolanaWalletClient {
|
||||||
message: message,
|
message: message,
|
||||||
signers: signers,
|
signers: signers,
|
||||||
commitment: commitment,
|
commitment: commitment,
|
||||||
recentBlockhash: recentBlockhash,
|
latestBlockhash: latestBlockhash,
|
||||||
);
|
);
|
||||||
|
|
||||||
sendTx() async => await sendTransaction(
|
sendTx() async => await sendTransaction(
|
||||||
|
@ -552,9 +569,9 @@ class SolanaWalletClient {
|
||||||
required Message message,
|
required Message message,
|
||||||
required List<Ed25519HDKeyPair> signers,
|
required List<Ed25519HDKeyPair> signers,
|
||||||
required Commitment commitment,
|
required Commitment commitment,
|
||||||
required RecentBlockhash recentBlockhash,
|
required LatestBlockhash latestBlockhash,
|
||||||
}) async {
|
}) async {
|
||||||
final signedTx = await signTransaction(recentBlockhash, message, signers);
|
final signedTx = await signTransaction(latestBlockhash, message, signers);
|
||||||
|
|
||||||
return signedTx;
|
return signedTx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,7 @@ class SolanaSignNativeTokenTransactionRentException
|
||||||
extends SignNativeTokenTransactionRentException {}
|
extends SignNativeTokenTransactionRentException {}
|
||||||
|
|
||||||
class SolanaCreateAssociatedTokenAccountException extends CreateAssociatedTokenAccountException {
|
class SolanaCreateAssociatedTokenAccountException extends CreateAssociatedTokenAccountException {
|
||||||
SolanaCreateAssociatedTokenAccountException(this.exceptionMessage);
|
SolanaCreateAssociatedTokenAccountException(super.errorMessage);
|
||||||
|
|
||||||
final String exceptionMessage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SolanaSignSPLTokenTransactionRentException extends SignSPLTokenTransactionRentException {}
|
class SolanaSignSPLTokenTransactionRentException extends SignSPLTokenTransactionRentException {}
|
||||||
|
|
|
@ -11,7 +11,7 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
solana: ^0.30.4
|
solana: ^0.31.0+1
|
||||||
cw_core:
|
cw_core:
|
||||||
path: ../cw_core
|
path: ../cw_core
|
||||||
http: ^1.1.0
|
http: ^1.1.0
|
||||||
|
|
|
@ -140,25 +140,24 @@ abstract class Web3WalletServiceBase with Store {
|
||||||
for (final cId in SolanaChainId.values) {
|
for (final cId in SolanaChainId.values) {
|
||||||
final node = appStore.settingsStore.getCurrentNode(appStore.wallet!.type);
|
final node = appStore.settingsStore.getCurrentNode(appStore.wallet!.type);
|
||||||
|
|
||||||
Uri? rpcUri;
|
Uri rpcUri = node.uri;
|
||||||
String webSocketUrl;
|
String webSocketUrl = 'wss://${node.uriRaw}';
|
||||||
bool isModifiedNodeUri = false;
|
|
||||||
|
|
||||||
if (node.uriRaw == 'rpc.ankr.com') {
|
if (node.uriRaw == 'rpc.ankr.com') {
|
||||||
isModifiedNodeUri = true;
|
|
||||||
|
|
||||||
//A better way to handle this instead of adding this to the general secrets?
|
|
||||||
String ankrApiKey = secrets.ankrApiKey;
|
String ankrApiKey = secrets.ankrApiKey;
|
||||||
|
|
||||||
rpcUri = Uri.https(node.uriRaw, '/solana/$ankrApiKey');
|
rpcUri = Uri.https(node.uriRaw, '/solana/$ankrApiKey');
|
||||||
webSocketUrl = 'wss://${node.uriRaw}/solana/ws/$ankrApiKey';
|
webSocketUrl = 'wss://${node.uriRaw}/solana/ws/$ankrApiKey';
|
||||||
} else {
|
} else if (node.uriRaw == 'solana-mainnet.core.chainstack.com') {
|
||||||
webSocketUrl = 'wss://${node.uriRaw}';
|
String chainStackApiKey = secrets.chainStackApiKey;
|
||||||
|
|
||||||
|
rpcUri = Uri.https(node.uriRaw, '/$chainStackApiKey');
|
||||||
|
webSocketUrl = 'wss://${node.uriRaw}/$chainStackApiKey';
|
||||||
}
|
}
|
||||||
|
|
||||||
SolanaChainServiceImpl(
|
SolanaChainServiceImpl(
|
||||||
reference: cId,
|
reference: cId,
|
||||||
rpcUrl: isModifiedNodeUri ? rpcUri! : node.uri,
|
rpcUrl: rpcUri,
|
||||||
webSocketUrl: webSocketUrl,
|
webSocketUrl: webSocketUrl,
|
||||||
wcKeyService: walletKeyService,
|
wcKeyService: walletKeyService,
|
||||||
bottomSheetService: _bottomSheetHandler,
|
bottomSheetService: _bottomSheetHandler,
|
||||||
|
|
|
@ -40,7 +40,7 @@ const polygonDefaultNodeUri = 'polygon-bor.publicnode.com';
|
||||||
const cakeWalletBitcoinCashDefaultNodeUri = 'bitcoincash.stackwallet.com:50002';
|
const cakeWalletBitcoinCashDefaultNodeUri = 'bitcoincash.stackwallet.com:50002';
|
||||||
const nanoDefaultNodeUri = 'nano.nownodes.io';
|
const nanoDefaultNodeUri = 'nano.nownodes.io';
|
||||||
const nanoDefaultPowNodeUri = 'rpc.nano.to';
|
const nanoDefaultPowNodeUri = 'rpc.nano.to';
|
||||||
const solanaDefaultNodeUri = 'solana-rpc.publicnode.com:443';
|
const solanaDefaultNodeUri = 'solana-mainnet.core.chainstack.com';
|
||||||
const tronDefaultNodeUri = 'api.trongrid.io';
|
const tronDefaultNodeUri = 'api.trongrid.io';
|
||||||
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
|
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
|
||||||
const wowneroDefaultNodeUri = 'node3.monerodevs.org:34568';
|
const wowneroDefaultNodeUri = 'node3.monerodevs.org:34568';
|
||||||
|
@ -347,6 +347,19 @@ Future<void> defaultSettingsMigration(
|
||||||
type: WalletType.litecoin,
|
type: WalletType.litecoin,
|
||||||
useSSL: true,
|
useSSL: true,
|
||||||
);
|
);
|
||||||
|
_changeDefaultNode(
|
||||||
|
nodes: nodes,
|
||||||
|
sharedPreferences: sharedPreferences,
|
||||||
|
type: WalletType.solana,
|
||||||
|
newDefaultUri: solanaDefaultNodeUri,
|
||||||
|
currentNodePreferenceKey: PreferencesKey.currentSolanaNodeIdKey,
|
||||||
|
useSSL: true,
|
||||||
|
oldUri: [
|
||||||
|
'rpc.ankr.com',
|
||||||
|
'api.mainnet-beta.solana.com:443',
|
||||||
|
'solana-rpc.publicnode.com:443',
|
||||||
|
],
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -680,7 +680,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error is CreateAssociatedTokenAccountException) {
|
if (error is CreateAssociatedTokenAccountException) {
|
||||||
return S.current.solana_create_associated_token_account_exception;
|
return "${S.current.solana_create_associated_token_account_exception}\n\n${error.errorMessage}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error is SignSPLTokenTransactionRentException) {
|
if (error is SignSPLTokenTransactionRentException) {
|
||||||
|
|
|
@ -106,7 +106,7 @@ dependencies:
|
||||||
flutter_svg: ^2.0.9
|
flutter_svg: ^2.0.9
|
||||||
polyseed: ^0.0.6
|
polyseed: ^0.0.6
|
||||||
nostr_tools: ^1.0.9
|
nostr_tools: ^1.0.9
|
||||||
solana: ^0.30.1
|
solana: ^0.31.0+1
|
||||||
ledger_flutter_plus: ^1.4.1
|
ledger_flutter_plus: ^1.4.1
|
||||||
hashlib: ^1.19.2
|
hashlib: ^1.19.2
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class SecretKey {
|
||||||
SecretKey('walletConnectProjectId', () => ''),
|
SecretKey('walletConnectProjectId', () => ''),
|
||||||
SecretKey('moralisApiKey', () => ''),
|
SecretKey('moralisApiKey', () => ''),
|
||||||
SecretKey('ankrApiKey', () => ''),
|
SecretKey('ankrApiKey', () => ''),
|
||||||
|
SecretKey('chainStackApiKey', () => ''),
|
||||||
SecretKey('quantexExchangeMarkup', () => ''),
|
SecretKey('quantexExchangeMarkup', () => ''),
|
||||||
SecretKey('seeds', () => ''),
|
SecretKey('seeds', () => ''),
|
||||||
SecretKey('testCakePayApiKey', () => ''),
|
SecretKey('testCakePayApiKey', () => ''),
|
||||||
|
@ -86,6 +87,7 @@ class SecretKey {
|
||||||
|
|
||||||
static final solanaSecrets = [
|
static final solanaSecrets = [
|
||||||
SecretKey('ankrApiKey', () => ''),
|
SecretKey('ankrApiKey', () => ''),
|
||||||
|
SecretKey('chainStackApiKey', () => ''),
|
||||||
];
|
];
|
||||||
|
|
||||||
static final nanoSecrets = [
|
static final nanoSecrets = [
|
||||||
|
|
Loading…
Reference in a new issue