Skip to content

Commit 19fe822

Browse files
committed
Bump devnet to 0.6.0
1 parent 5e2a474 commit 19fe822

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
test_and_lint:
1717
runs-on: macos-15
1818
env:
19-
DEVNET_SHA: aafa74e4297734bacba72d0faa7c711eacecfc7a # v0.5.0-rc.1
19+
DEVNET_SHA: b4460c7b5d0679632d471bf72b9713805d38c0f0 # v0.6.0
2020
steps:
2121
- uses: actions/checkout@v4
2222
- name: Setup Xcode

Tests/StarknetTests/Utils/DevnetClient/DevnetClient.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Foundation
44

55
protocol 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

Tests/StarknetTests/Utils/DevnetClient/DevnetClientModels.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ struct PrefundPayload: Codable {
9393
}
9494
}
9595

96+
struct DevnetMintRequest: Codable {
97+
let jsonrpc: String
98+
let method: String
99+
let params: PrefundPayload
100+
let id: Int
101+
102+
init(params: PrefundPayload, id: Int = 0) {
103+
self.jsonrpc = "2.0"
104+
self.method = "devnet_mint"
105+
self.params = params
106+
self.id = id
107+
}
108+
}
109+
110+
96111
// Simplified receipt that is intended to support any JSON-RPC version starting 0.3,
97112
// to avoid DevnetClient relying on StarknetTransactionReceipt.
98113
// Only use it for checking whether a transaction was successful.

0 commit comments

Comments
 (0)