File tree Expand file tree Collapse file tree 2 files changed +5
-18
lines changed
UserInterface/Controllers/Web3/Model Expand file tree Collapse file tree 2 files changed +5
-18
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class SolanaTransferOperation: Web3TransferOperation {
43
43
}
44
44
45
45
func fee( for transaction: Solana . Transaction ) async throws -> Fee ? {
46
- let lamportsPerSignature = try await client . getRecentBlockhash ( ) . lamportsPerSignature
46
+ let lamportsPerSignature : UInt64 = 5000
47
47
guard let tokenCount = transaction. fee ( lamportsPerSignature: lamportsPerSignature) else {
48
48
return nil
49
49
}
@@ -57,7 +57,7 @@ class SolanaTransferOperation: Web3TransferOperation {
57
57
do {
58
58
Logger . web3. info ( category: " SolanaTransfer " , message: " Start " )
59
59
let priv = try await TIP . deriveSolanaPrivateKey ( pin: pin)
60
- let recentBlockhash = try await client. getRecentBlockhash ( ) . blockhash
60
+ let recentBlockhash = try await client. getLatestBlockhash ( )
61
61
Logger . web3. info ( category: " SolanaTransfer " , message: " Using blockhash: \( recentBlockhash) " )
62
62
guard let blockhash = Data ( base58EncodedString: recentBlockhash) else {
63
63
throw SigningError . invalidBlockhash
Original file line number Diff line number Diff line change @@ -3,11 +3,6 @@ import Alamofire
3
3
4
4
struct SolanaRPCClient {
5
5
6
- struct RecentBlockhash {
7
- let blockhash : String
8
- let lamportsPerSignature : UInt64
9
- }
10
-
11
6
struct ResponseError : Error , Decodable , CustomStringConvertible {
12
7
13
8
struct Data : Decodable {
@@ -66,32 +61,24 @@ struct SolanaRPCClient {
66
61
return value != nil
67
62
}
68
63
69
- func getRecentBlockhash ( ) async throws -> RecentBlockhash {
64
+ func getLatestBlockhash ( ) async throws -> String {
70
65
71
66
struct Result : Decodable {
72
67
73
68
struct Value : Decodable {
74
-
75
- struct FeeCalculator : Decodable {
76
- let lamportsPerSignature : UInt64
77
- }
78
-
79
69
let blockhash : String
80
- let feeCalculator : FeeCalculator
81
-
82
70
}
83
71
84
72
let value : Value
85
73
86
74
}
87
75
88
76
let response : Response < Result > = try await post (
89
- method: " getRecentBlockhash " ,
77
+ method: " getLatestBlockhash " ,
90
78
params: nil
91
79
)
92
80
let value = try response. getResult ( ) . value
93
- return RecentBlockhash ( blockhash: value. blockhash,
94
- lamportsPerSignature: value. feeCalculator. lamportsPerSignature)
81
+ return value. blockhash
95
82
}
96
83
97
84
func sendTransaction( signedTransaction: String ) async throws -> String {
You can’t perform that action at this time.
0 commit comments