-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathResponses.swift
109 lines (93 loc) · 3.81 KB
/
Responses.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import Foundation
public struct StarknetInvokeTransactionResponse: Decodable, Equatable {
public let transactionHash: Felt
enum CodingKeys: String, CodingKey {
case transactionHash = "transaction_hash"
}
}
public struct StarknetFeeEstimate: Decodable, Equatable {
public let l1GasConsumed: Felt
public let l1GasPrice: Felt
public let l2GasConsumed: Felt
public let l2GasPrice: Felt
public let l1DataGasConsumed: Felt
public let l1DataGasPrice: Felt
public let overallFee: Felt
public let feeUnit: StarknetPriceUnit
enum CodingKeys: String, CodingKey {
case l1GasConsumed = "l1_gas_consumed"
case l1GasPrice = "l1_gas_price"
case l2GasConsumed = "l2_gas_consumed"
case l2GasPrice = "l2_gas_price"
case l1DataGasConsumed = "l1_data_gas_consumed"
case l1DataGasPrice = "l1_data_gas_price"
case overallFee = "overall_fee"
case feeUnit = "unit"
}
public init(l1GasConsumed: Felt, l1GasPrice: Felt, l2GasConsumed: Felt, l2GasPrice: Felt, l1DataGasConsumed: Felt, l1DataGasPrice: Felt, overallFee: Felt, feeUnit: StarknetPriceUnit) {
self.l1GasConsumed = l1GasConsumed
self.l1GasPrice = l1GasPrice
self.l2GasConsumed = l2GasConsumed
self.l2GasPrice = l2GasPrice
self.l1DataGasConsumed = l1DataGasConsumed
self.l1DataGasPrice = l1DataGasPrice
self.overallFee = overallFee
self.feeUnit = feeUnit
}
public init?(l1GasConsumed: Felt, l1GasPrice: Felt, l2GasConsumed: Felt, l2GasPrice: Felt, l1DataGasConsumed: Felt, l1DataGasPrice: Felt, feeUnit: StarknetPriceUnit) {
self.l1GasConsumed = l1GasConsumed
self.l1GasPrice = l1GasPrice
self.l2GasConsumed = l2GasConsumed
self.l2GasPrice = l2GasPrice
self.l1DataGasConsumed = l1DataGasConsumed
self.l1DataGasPrice = l1DataGasPrice
self.overallFee = Felt(l1GasPrice.value * l1GasConsumed.value + l2GasPrice.value * l2GasConsumed.value + l1DataGasPrice.value * l1DataGasConsumed.value)!
self.feeUnit = feeUnit
}
}
public struct StarknetDeployAccountResponse: Decodable, Equatable {
public let transactionHash: Felt
public let contractAddress: Felt
enum CodingKeys: String, CodingKey {
case transactionHash = "transaction_hash"
case contractAddress = "contract_address"
}
}
public struct StarknetBlockHashAndNumber: Decodable, Equatable {
public let blockHash: Felt
public let blockNumber: UInt64
enum CodingKeys: String, CodingKey {
case blockHash = "block_hash"
case blockNumber = "block_number"
}
}
public struct StarknetGetEventsResponse: Decodable, Equatable {
public let continuationToken: String?
public let events: [StarknetEmittedEvent]
enum CodingKeys: String, CodingKey {
case continuationToken = "continuation_token"
case events
}
}
public struct StarknetGetStorageProofResponse: Decodable, Equatable {
public let classesProof: NodeHashToNodeMapping
public let contractsProof: ContractsProof
public let contractsStorageProof: [NodeHashToNodeMapping]
public let globalRoots: GlobalRoots
enum CodingKeys: String, CodingKey {
case classesProof = "classes_proof"
case contractsProof = "contracts_proof"
case contractsStorageProof = "contracts_storage_proof"
case globalRoots = "global_roots"
}
}
public struct StarknetGetTransactionStatusResponse: Decodable, Equatable {
public let finalityStatus: StarknetTransactionStatus
public let executionStatus: StarknetTransactionExecutionStatus?
public let failureReason: String?
enum CodingKeys: String, CodingKey {
case finalityStatus = "finality_status"
case executionStatus = "execution_status"
case failureReason = "failure_reason"
}
}