@@ -4,7 +4,6 @@ import Foundation
44
55protocol DevnetClientProtocol {
66 var rpcUrl : String { get }
7- var mintUrl : String { get }
87
98 var host : String { get }
109 var port : Int { get }
@@ -155,7 +154,6 @@ func makeDevnetClient() -> DevnetClientProtocol {
155154 let seed : Int
156155 let baseUrl : String
157156 let rpcUrl : String
158- let mintUrl : String
159157
160158 let constants : DevnetClientConstants . Type = DevnetClientConstants . self
161159
@@ -166,7 +164,6 @@ func makeDevnetClient() -> DevnetClientProtocol {
166164
167165 baseUrl = " http:// \( host) : \( port) "
168166 rpcUrl = " \( baseUrl) /rpc "
169- mintUrl = " \( baseUrl) /mint "
170167
171168 devnetPath = ProcessInfo . processInfo. environment [ " DEVNET_PATH " ] ?? " starknet-devnet "
172169 scarbPath = ProcessInfo . processInfo. environment [ " SCARB_PATH " ] ?? " scarb "
@@ -305,18 +302,18 @@ func makeDevnetClient() -> DevnetClientProtocol {
305302 public func prefundAccount( address: Felt , amount: BigUInt , unit: StarknetPriceUnit ) async throws {
306303 try guardDevnetIsRunning ( )
307304
308- let url = URL ( string: mintUrl ) !
305+ let url = URL ( string: rpcUrl ) !
309306 var request = URLRequest ( url: url)
310307 request. httpMethod = " POST "
311308
312- let payload = PrefundPayload ( address: address, amount: amount, unit: unit)
313-
309+ let mintPayload = PrefundPayload ( address: address, amount: amount, unit: unit)
310+ let requestPayload = DevnetMintRequest ( params : mintPayload )
314311 // TODO(#209): Once we can use UInt128, we can simply set
315- // body as `request.httpBody = try JSONEncoder().encode(payload )`
312+ // body as `request.httpBody = try JSONEncoder().encode(requestPayload )`
316313 // Following adjustment is needed to remove quotes from the amount field
317314 // in the JSON body, because ATM we can't use UInt128 in the payload.
318315
319- let data = try JSONEncoder ( ) . encode ( payload )
316+ let data = try JSONEncoder ( ) . encode ( requestPayload )
320317
321318 guard var json = String ( data: data, encoding: . utf8) else {
322319 throw DevnetClientError . prefundError
0 commit comments