@walletconnect/react-native-compat 2.18.1-canary-ca-2 → 2.18.1-canary-ca-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/Yttrium.mm +23 -13
- package/ios/Yttrium.swift +629 -241
- package/package.json +1 -1
package/ios/Yttrium.mm
CHANGED
@@ -2,29 +2,39 @@
|
|
2
2
|
|
3
3
|
@interface RCT_EXTERN_MODULE(Yttrium, NSObject)
|
4
4
|
|
5
|
-
//RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
|
6
|
-
// withResolver:(RCTPromiseResolveBlock)resolve
|
7
|
-
// withRejecter:(RCTPromiseRejectBlock)reject)
|
8
|
-
//
|
9
|
-
RCT_EXTERN_METHOD(status:(id)params
|
10
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
11
|
-
reject:(RCTPromiseRejectBlock)reject)
|
12
5
|
|
13
|
-
RCT_EXTERN_METHOD(
|
6
|
+
RCT_EXTERN_METHOD(initialize:(id)params
|
14
7
|
resolve:(RCTPromiseResolveBlock)resolve
|
15
8
|
reject:(RCTPromiseRejectBlock)reject)
|
16
9
|
|
17
|
-
RCT_EXTERN_METHOD(
|
10
|
+
RCT_EXTERN_METHOD(prepareDetailed:(id)params
|
18
11
|
resolve:(RCTPromiseResolveBlock)resolve
|
19
12
|
reject:(RCTPromiseRejectBlock)reject)
|
20
13
|
|
21
|
-
RCT_EXTERN_METHOD(
|
14
|
+
RCT_EXTERN_METHOD(execute:(id)params
|
22
15
|
resolve:(RCTPromiseResolveBlock)resolve
|
23
16
|
reject:(RCTPromiseRejectBlock)reject)
|
24
17
|
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
|
19
|
+
//RCT_EXTERN_METHOD(status:(id)params
|
20
|
+
// resolve:(RCTPromiseResolveBlock)resolve
|
21
|
+
// reject:(RCTPromiseRejectBlock)reject)
|
22
|
+
//
|
23
|
+
//RCT_EXTERN_METHOD(prepare:(id)params
|
24
|
+
// resolve:(RCTPromiseResolveBlock)resolve
|
25
|
+
// reject:(RCTPromiseRejectBlock)reject)
|
26
|
+
//
|
27
|
+
//RCT_EXTERN_METHOD(getBridgeDetails:(id)params
|
28
|
+
// resolve:(RCTPromiseResolveBlock)resolve
|
29
|
+
// reject:(RCTPromiseRejectBlock)reject)
|
30
|
+
//
|
31
|
+
//RCT_EXTERN_METHOD(getERC20Balance:(id)params
|
32
|
+
// resolve:(RCTPromiseResolveBlock)resolve
|
33
|
+
// reject:(RCTPromiseRejectBlock)reject)
|
34
|
+
//
|
35
|
+
//RCT_EXTERN_METHOD(estimateFees:(id)params
|
36
|
+
// resolve:(RCTPromiseResolveBlock)resolve
|
37
|
+
// reject:(RCTPromiseRejectBlock)reject)
|
28
38
|
|
29
39
|
|
30
40
|
+ (BOOL)requiresMainQueueSetup
|
package/ios/Yttrium.swift
CHANGED
@@ -4,301 +4,689 @@ import YttriumWrapper
|
|
4
4
|
@objc(Yttrium)
|
5
5
|
class Yttrium: NSObject {
|
6
6
|
|
7
|
+
struct CustomError: Error {
|
8
|
+
let message: String
|
9
|
+
}
|
10
|
+
|
11
|
+
private var client: ChainAbstractionClient?
|
12
|
+
|
7
13
|
@objc
|
8
|
-
func
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
let responseDict: [String: Any] = [
|
22
|
-
"createdAt": statusResponseCompleted.createdAt,
|
23
|
-
"status": "completed"
|
24
|
-
]
|
25
|
-
resolve(responseDict)
|
26
|
-
case let .error(statusResponseError):
|
27
|
-
print("status response error", statusResponseError)
|
28
|
-
let responseDict: [String: Any] = [
|
29
|
-
"createdAt": statusResponseError.createdAt,
|
30
|
-
"reason": statusResponseError.error,
|
31
|
-
"status": "error"
|
32
|
-
]
|
33
|
-
resolve(responseDict)
|
34
|
-
case let .pending(statusResponsePending):
|
35
|
-
print("status response pending", statusResponsePending)
|
36
|
-
let responseDict: [String: Any] = [
|
37
|
-
"createdAt": statusResponsePending.createdAt,
|
38
|
-
"checkIn": statusResponsePending.checkIn,
|
39
|
-
"status": "pending"
|
40
|
-
]
|
41
|
-
resolve(responseDict)
|
42
|
-
}
|
43
|
-
} catch {
|
44
|
-
print("Error occurred: \(error)")
|
45
|
-
print(error)
|
46
|
-
reject("checkStatus err", "checkStatus", error)
|
47
|
-
}
|
14
|
+
func initialize(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
15
|
+
do {
|
16
|
+
if let dict = params as? [String: Any],
|
17
|
+
let projectId = dict["projectId"] as? String,
|
18
|
+
let url = dict["url"] as? String,
|
19
|
+
let sdkVersion = dict["sdkVersion"] as? String {
|
20
|
+
let bundleID = Bundle.main.bundleIdentifier ?? ""
|
21
|
+
let pulseMetadata = PulseMetadata(url: url, bundleId: bundleID, sdkVersion: sdkVersion, sdkPlatform: "mobile")
|
22
|
+
client = ChainAbstractionClient(projectId: projectId, pulseMetadata: pulseMetadata)
|
23
|
+
resolve(true)
|
24
|
+
return
|
25
|
+
} else {
|
26
|
+
throw CustomError(message: "failed to initialize")
|
48
27
|
}
|
28
|
+
} catch {
|
29
|
+
reject("yttr_init", "yttr_init", error)
|
49
30
|
}
|
31
|
+
reject("yttr_init", "yttr_init", CustomError(message: "failed to init"))
|
50
32
|
}
|
51
33
|
|
52
|
-
func
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
"from": transaction.from,
|
57
|
-
"to": transaction.to,
|
58
|
-
"value": transaction.value,
|
59
|
-
"input": transaction.input,
|
60
|
-
"gasLimit": transaction.gasLimit,
|
61
|
-
"nonce": transaction.nonce
|
62
|
-
]
|
34
|
+
func convertNotRequiredToDictionary(payload: YttriumWrapper.PrepareDetailedResponse?) -> [String: Any]? {
|
35
|
+
// Ensure payload is not nil and extract the success case
|
36
|
+
guard case let .success(.notRequired(response)) = payload else {
|
37
|
+
return nil
|
63
38
|
}
|
64
39
|
|
65
|
-
|
40
|
+
let initialTransaction = response.initialTransaction
|
41
|
+
let transactions = response.transactions.map { txn in
|
66
42
|
return [
|
67
|
-
"chainId":
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
func initialTransactionMetadataToDictionary(_ metadata: YttriumWrapper.InitialTransactionMetadata) -> [String: Any] {
|
77
|
-
return [
|
78
|
-
"transferTo": metadata.transferTo,
|
79
|
-
"amount": metadata.amount,
|
80
|
-
"tokenContract": metadata.tokenContract,
|
81
|
-
"symbol": metadata.symbol,
|
82
|
-
"decimals": metadata.decimals
|
83
|
-
]
|
84
|
-
}
|
85
|
-
|
86
|
-
func metadataToDictionary(_ metadata: YttriumWrapper.Metadata) -> [String: Any] {
|
87
|
-
return [
|
88
|
-
"fundingFrom": metadata.fundingFrom.map { fundingMetadataToDictionary($0) },
|
89
|
-
"initialTransaction": initialTransactionMetadataToDictionary(metadata.initialTransaction),
|
90
|
-
"checkIn": metadata.checkIn
|
43
|
+
"chainId": txn.chainId,
|
44
|
+
"from": txn.from,
|
45
|
+
"to": txn.to,
|
46
|
+
"value": txn.value,
|
47
|
+
"input": txn.input,
|
48
|
+
"gasLimit": txn.gasLimit,
|
49
|
+
"nonce": txn.nonce
|
91
50
|
]
|
92
51
|
}
|
93
52
|
|
94
53
|
return [
|
95
|
-
"
|
96
|
-
|
97
|
-
|
98
|
-
|
54
|
+
"initialTransaction": [
|
55
|
+
"chainId": initialTransaction.chainId,
|
56
|
+
"from": initialTransaction.from,
|
57
|
+
"to": initialTransaction.to,
|
58
|
+
"value": initialTransaction.value,
|
59
|
+
"input": initialTransaction.input,
|
60
|
+
"gasLimit": initialTransaction.gasLimit,
|
61
|
+
"nonce": initialTransaction.nonce
|
62
|
+
],
|
63
|
+
"transactions": transactions
|
99
64
|
]
|
100
65
|
}
|
101
66
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
func prepare(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
106
|
-
print("checkRoute called with", params)
|
107
|
-
let dict = params as? [String: Any]
|
108
|
-
|
109
|
-
if let transactionData = dict?["transaction"] as? [String: String],
|
110
|
-
let from = transactionData["from"] ?? "" as Optional,
|
111
|
-
let chainId = transactionData["chainId"] ?? "" as Optional,
|
112
|
-
let data = transactionData["data"] ?? "" as Optional,
|
113
|
-
let value = transactionData["value"] ?? "" as Optional,
|
114
|
-
let to = transactionData["to"] ?? "" as Optional,
|
115
|
-
let projectId = dict?["projectId"] as? String {
|
116
|
-
|
117
|
-
let client = ChainAbstractionClient.init(projectId: projectId)
|
118
|
-
print("created client, checking route...")
|
119
|
-
Task {
|
120
|
-
do {
|
121
|
-
let transaction = InitialTransaction.init(chainId: chainId, from: from, to: to, value: value, input: data)
|
122
|
-
|
123
|
-
let routeResponseSuccess = try await client.prepare(initialTransaction: transaction)
|
124
|
-
print("result", routeResponseSuccess)
|
125
|
-
|
126
|
-
switch routeResponseSuccess {
|
127
|
-
case let .success(routeResponse):
|
128
|
-
switch routeResponse {
|
129
|
-
case let .available(availableResponse):
|
130
|
-
|
131
|
-
availableResponseDictionary[availableResponse.orchestrationId] = availableResponse;
|
132
|
-
// let uiFields = try await client.getRouteUiFields(routeResponse: availableResponse, initialTransaction: Transaction(from: from, to: to, value: value, gas: gas, data: data, nonce: nonce, chainId: chainId, gasPrice: gasPrice, maxFeePerGas: maxFeePerGas, maxPriorityFeePerGas: maxPriorityFeePerGas), currency: Currency.usd)
|
133
|
-
//
|
134
|
-
// let routesDetails = convertRouteUiFieldsToDictionary(uiFields)
|
135
|
-
// print("available result", availableResponse)
|
136
|
-
// print("ui_fields_json", routesDetails)
|
137
|
-
let responseDict = convertRouteResponseAvailableToDictionary(availableResponse)
|
138
|
-
print("parsed result dictionary", responseDict)
|
139
|
-
resolve(["status": "available", "data": responseDict])
|
140
|
-
// "routesDetails": routesDetails
|
141
|
-
|
142
|
-
case .notRequired(_):
|
143
|
-
print("not required")
|
144
|
-
resolve(["status": "not_required"])
|
145
|
-
}
|
146
|
-
case let .error(routeResponse):
|
147
|
-
switch routeResponse.error {
|
148
|
-
case BridgingError.insufficientFunds:
|
149
|
-
let responseDict: [String: Any] = [
|
150
|
-
"status": "error",
|
151
|
-
"reason": "insufficientFunds"
|
152
|
-
]
|
153
|
-
resolve(responseDict)
|
154
|
-
case BridgingError.insufficientGasFunds:
|
155
|
-
let responseDict: [String: Any] = [
|
156
|
-
"status": "error",
|
157
|
-
"reason": "insufficientGasFunds"
|
158
|
-
]
|
159
|
-
resolve(responseDict)
|
160
|
-
case BridgingError.noRoutesAvailable:
|
161
|
-
let responseDict: [String: Any] = [
|
162
|
-
"status": "error",
|
163
|
-
"reason": "noRoutesAvailable"
|
164
|
-
]
|
165
|
-
resolve(responseDict)
|
166
|
-
}
|
167
|
-
print(routeResponse)
|
168
|
-
print(routeResponse.error)
|
169
|
-
}
|
170
|
-
// resolve(result)
|
171
|
-
} catch {
|
172
|
-
print("Error occurred: \(error)")
|
173
|
-
print(error)
|
174
|
-
reject("yttrium err", "yttrium_err", error)
|
175
|
-
}
|
176
|
-
}
|
67
|
+
func convertUiFieldsToDictionary(payload: YttriumWrapper.PrepareDetailedResponse?) -> [String: Any]? {
|
68
|
+
guard case let .success(.available(uiFields)) = payload else {
|
69
|
+
return nil
|
177
70
|
}
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
71
|
+
|
72
|
+
let routeResponse = uiFields.routeResponse
|
73
|
+
|
74
|
+
let initialTransaction = routeResponse.initialTransaction
|
75
|
+
let initialTransactionDict: [String: Any] = [
|
76
|
+
"chainId": initialTransaction.chainId,
|
77
|
+
"from": initialTransaction.from,
|
78
|
+
"to": initialTransaction.to,
|
79
|
+
"value": initialTransaction.value,
|
80
|
+
"input": initialTransaction.input,
|
81
|
+
"gasLimit": initialTransaction.gasLimit,
|
82
|
+
"nonce": initialTransaction.nonce
|
83
|
+
]
|
84
|
+
|
85
|
+
let transactionsDict = routeResponse.transactions.map { txn in
|
182
86
|
return [
|
183
|
-
"chainId":
|
184
|
-
"from":
|
185
|
-
"to":
|
186
|
-
"value":
|
187
|
-
"input":
|
188
|
-
"gasLimit":
|
189
|
-
"nonce":
|
190
|
-
"maxFeePerGas": transaction.maxFeePerGas,
|
191
|
-
"maxPriorityFeePerGas": transaction.maxPriorityFeePerGas
|
87
|
+
"chainId": txn.chainId,
|
88
|
+
"from": txn.from,
|
89
|
+
"to": txn.to,
|
90
|
+
"value": txn.value,
|
91
|
+
"input": txn.input,
|
92
|
+
"gasLimit": txn.gasLimit,
|
93
|
+
"nonce": txn.nonce
|
192
94
|
]
|
193
95
|
}
|
194
|
-
|
195
|
-
|
96
|
+
|
97
|
+
let fundingFromDict = routeResponse.metadata.fundingFrom.map { funding in
|
196
98
|
return [
|
197
|
-
"
|
198
|
-
"
|
199
|
-
"
|
200
|
-
"
|
201
|
-
"
|
99
|
+
"chainId": funding.chainId,
|
100
|
+
"tokenContract": funding.tokenContract,
|
101
|
+
"symbol": funding.symbol,
|
102
|
+
"amount": funding.amount,
|
103
|
+
"bridgingFee": funding.bridgingFee,
|
104
|
+
"decimals": funding.decimals
|
202
105
|
]
|
203
106
|
}
|
204
|
-
|
205
|
-
|
107
|
+
|
108
|
+
let initialTransactionMetadataDict: [String: Any] = [
|
109
|
+
"transferTo": routeResponse.metadata.initialTransaction.transferTo,
|
110
|
+
"amount": routeResponse.metadata.initialTransaction.amount,
|
111
|
+
"tokenContract": routeResponse.metadata.initialTransaction.tokenContract,
|
112
|
+
"symbol": routeResponse.metadata.initialTransaction.symbol,
|
113
|
+
"decimals": routeResponse.metadata.initialTransaction.decimals
|
114
|
+
]
|
115
|
+
|
116
|
+
let checkIn = routeResponse.metadata.checkIn
|
117
|
+
|
118
|
+
let routeDict = uiFields.route.map { txnDetail in
|
119
|
+
let fee = txnDetail.fee
|
206
120
|
return [
|
207
|
-
"
|
208
|
-
|
121
|
+
"transaction": [
|
122
|
+
"chainId": txnDetail.transaction.chainId,
|
123
|
+
"from": txnDetail.transaction.from,
|
124
|
+
"to": txnDetail.transaction.to,
|
125
|
+
"value": txnDetail.transaction.value,
|
126
|
+
"input": txnDetail.transaction.input,
|
127
|
+
"gasLimit": txnDetail.transaction.gasLimit,
|
128
|
+
"nonce": txnDetail.transaction.nonce,
|
129
|
+
"maxFeePerGas": txnDetail.transaction.maxFeePerGas,
|
130
|
+
"maxPriorityFeePerGas": txnDetail.transaction.maxPriorityFeePerGas
|
131
|
+
],
|
132
|
+
"transactionHashToSign": txnDetail.transactionHashToSign,
|
133
|
+
"fee": [
|
134
|
+
"symbol": fee.fee.symbol,
|
135
|
+
"amount": fee.fee.amount,
|
136
|
+
"unit": fee.fee.unit,
|
137
|
+
"formatted": fee.fee.formatted,
|
138
|
+
"formattedAlt": fee.fee.formattedAlt
|
139
|
+
],
|
140
|
+
"localFee": [
|
141
|
+
"symbol": fee.localFee.symbol,
|
142
|
+
"amount": fee.localFee.amount,
|
143
|
+
"unit": fee.localFee.unit,
|
144
|
+
"formatted": fee.localFee.formatted,
|
145
|
+
"formattedAlt": fee.localFee.formattedAlt
|
146
|
+
]
|
209
147
|
]
|
210
148
|
}
|
211
|
-
|
212
|
-
|
149
|
+
|
150
|
+
let localRouteTotalDict: [String: Any] = [
|
151
|
+
"symbol": uiFields.localRouteTotal.symbol,
|
152
|
+
"amount": uiFields.localRouteTotal.amount,
|
153
|
+
"unit": uiFields.localRouteTotal.unit,
|
154
|
+
"formatted": uiFields.localRouteTotal.formatted,
|
155
|
+
"formattedAlt": uiFields.localRouteTotal.formattedAlt
|
156
|
+
]
|
157
|
+
|
158
|
+
let bridgeDict = uiFields.bridge.map { fee in
|
213
159
|
return [
|
214
|
-
"
|
215
|
-
|
160
|
+
"fee": [
|
161
|
+
"symbol": fee.fee.symbol,
|
162
|
+
"amount": fee.fee.amount,
|
163
|
+
"unit": fee.fee.unit,
|
164
|
+
"formatted": fee.fee.formatted,
|
165
|
+
"formattedAlt": fee.fee.formattedAlt
|
166
|
+
],
|
167
|
+
"localFee": [
|
168
|
+
"symbol": fee.localFee.symbol,
|
169
|
+
"amount": fee.localFee.amount,
|
170
|
+
"unit": fee.localFee.unit,
|
171
|
+
"formatted": fee.localFee.formatted,
|
172
|
+
"formattedAlt": fee.localFee.formattedAlt
|
173
|
+
]
|
216
174
|
]
|
217
175
|
}
|
218
|
-
|
176
|
+
|
177
|
+
let localBridgeTotalDict: [String: Any] = [
|
178
|
+
"symbol": uiFields.localBridgeTotal.symbol,
|
179
|
+
"amount": uiFields.localBridgeTotal.amount,
|
180
|
+
"unit": uiFields.localBridgeTotal.unit,
|
181
|
+
"formatted": uiFields.localBridgeTotal.formatted,
|
182
|
+
"formattedAlt": uiFields.localBridgeTotal.formattedAlt
|
183
|
+
]
|
184
|
+
|
185
|
+
let initialDict: [String: Any] = [
|
186
|
+
"transaction": [
|
187
|
+
"chainId": uiFields.initial.transaction.chainId,
|
188
|
+
"from": uiFields.initial.transaction.from,
|
189
|
+
"to": uiFields.initial.transaction.to,
|
190
|
+
"value": uiFields.initial.transaction.value,
|
191
|
+
"input": uiFields.initial.transaction.input,
|
192
|
+
"gasLimit": uiFields.initial.transaction.gasLimit,
|
193
|
+
"nonce": uiFields.initial.transaction.nonce,
|
194
|
+
"maxFeePerGas": uiFields.initial.transaction.maxFeePerGas,
|
195
|
+
"maxPriorityFeePerGas": uiFields.initial.transaction.maxPriorityFeePerGas
|
196
|
+
],
|
197
|
+
"transactionHashToSign": uiFields.initial.transactionHashToSign,
|
198
|
+
"fee": [
|
199
|
+
"symbol": uiFields.initial.fee.fee.symbol,
|
200
|
+
"amount": uiFields.initial.fee.fee.amount,
|
201
|
+
"unit": uiFields.initial.fee.fee.unit,
|
202
|
+
"formatted": uiFields.initial.fee.fee.formatted,
|
203
|
+
"formattedAlt": uiFields.initial.fee.fee.formattedAlt
|
204
|
+
],
|
205
|
+
"localFee": [
|
206
|
+
"symbol": uiFields.initial.fee.localFee.symbol,
|
207
|
+
"amount": uiFields.initial.fee.localFee.amount,
|
208
|
+
"unit": uiFields.initial.fee.localFee.unit,
|
209
|
+
"formatted": uiFields.initial.fee.localFee.formatted,
|
210
|
+
"formattedAlt": uiFields.initial.fee.localFee.formattedAlt
|
211
|
+
]
|
212
|
+
]
|
213
|
+
|
214
|
+
let localTotalDict: [String: Any] = [
|
215
|
+
"symbol": uiFields.localTotal.symbol,
|
216
|
+
"amount": uiFields.localTotal.amount,
|
217
|
+
"unit": uiFields.localTotal.unit,
|
218
|
+
"formatted": uiFields.localTotal.formatted,
|
219
|
+
"formattedAlt": uiFields.localTotal.formattedAlt
|
220
|
+
]
|
221
|
+
|
219
222
|
return [
|
220
|
-
"
|
221
|
-
"
|
222
|
-
"
|
223
|
-
"
|
224
|
-
|
225
|
-
|
223
|
+
"orchestrationId": routeResponse.orchestrationId,
|
224
|
+
"initialTransaction": initialTransactionDict,
|
225
|
+
"transactions": transactionsDict,
|
226
|
+
"metadata": [
|
227
|
+
"fundingFrom": fundingFromDict,
|
228
|
+
"initialTransaction": initialTransactionMetadataDict,
|
229
|
+
"checkIn": checkIn
|
230
|
+
],
|
231
|
+
"route": routeDict,
|
232
|
+
"localRouteTotal": localRouteTotalDict,
|
233
|
+
"bridge": bridgeDict,
|
234
|
+
"localBridgeTotal": localBridgeTotalDict,
|
235
|
+
"initial": initialDict,
|
236
|
+
"localTotal": localTotalDict
|
226
237
|
]
|
227
238
|
}
|
228
239
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
240
|
+
func convertPrepareDetailedErrorToDictionary(payload: YttriumWrapper.PrepareDetailedResponse?) -> [String: Any]? {
|
241
|
+
guard case let .error(error) = payload else {
|
242
|
+
return nil
|
243
|
+
}
|
233
244
|
|
234
|
-
|
235
|
-
|
245
|
+
switch error.error {
|
246
|
+
case .noRoutesAvailable:
|
247
|
+
return [
|
248
|
+
"error": "noRoutesAvailable"
|
249
|
+
]
|
236
250
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
resolve(uiFIeldsDict)
|
247
|
-
} catch {
|
248
|
-
print("Error occurred: \(error)")
|
249
|
-
print(error)
|
250
|
-
reject("yttrium err", "yttrium_err getBridgeDetails", error)
|
251
|
-
}
|
252
|
-
}
|
251
|
+
case .insufficientFunds:
|
252
|
+
return [
|
253
|
+
"error": "insufficientFunds"
|
254
|
+
]
|
255
|
+
|
256
|
+
case .insufficientGasFunds:
|
257
|
+
return [
|
258
|
+
"error": "insufficientGasFunds"
|
259
|
+
]
|
253
260
|
}
|
254
261
|
}
|
255
262
|
|
263
|
+
private var prepareDetailedResultDict: [String: UiFields] = [:]
|
264
|
+
|
265
|
+
|
256
266
|
@objc
|
257
|
-
func
|
258
|
-
print("
|
259
|
-
let dict = params as? [String:
|
267
|
+
func prepareDetailed(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
268
|
+
print("prepareDetailed called with", params)
|
269
|
+
let dict = params as? [String: Any]
|
260
270
|
|
261
|
-
if
|
262
|
-
let
|
263
|
-
let chainId =
|
264
|
-
let
|
271
|
+
if let transactionData = dict?["transaction"] as? [String: String],
|
272
|
+
let from = transactionData["from"] ?? "" as Optional,
|
273
|
+
let chainId = transactionData["chainId"] ?? "" as Optional,
|
274
|
+
let input = transactionData["input"] ?? "" as Optional,
|
275
|
+
let value = transactionData["value"] ?? "" as Optional,
|
276
|
+
let to = transactionData["to"] ?? "" as Optional {
|
265
277
|
|
266
|
-
|
278
|
+
print("created client, checking route...")
|
267
279
|
Task {
|
268
280
|
do {
|
269
|
-
|
270
|
-
|
271
|
-
|
281
|
+
if((client) != nil) {
|
282
|
+
// let transaction = InitialTransaction.init(chainId: chainId, from: from, to: to, value: value, input: data)
|
283
|
+
let call = Call(to: to, value: value, input: input)
|
284
|
+
let routeResponse = try await client?.prepareDetailed(chainId: chainId, from: from, call: call, localCurrency: Currency.usd)
|
285
|
+
print("result", routeResponse)
|
286
|
+
|
287
|
+
if let notRequiredDict = convertNotRequiredToDictionary(payload: routeResponse) {
|
288
|
+
resolve(notRequiredDict)
|
289
|
+
} else if let detailedDict = convertUiFieldsToDictionary(payload: routeResponse) {
|
290
|
+
guard case let .success(.available(uiFields)) = routeResponse else {
|
291
|
+
throw CustomError(message:"prepareDetailed, something went wrong")
|
292
|
+
}
|
293
|
+
prepareDetailedResultDict[uiFields.routeResponse.orchestrationId] = uiFields
|
294
|
+
|
295
|
+
resolve(detailedDict)
|
296
|
+
} else if let detailedError = convertPrepareDetailedErrorToDictionary(payload: routeResponse) {
|
297
|
+
resolve(detailedError)
|
298
|
+
}
|
299
|
+
|
300
|
+
return
|
301
|
+
} else {
|
302
|
+
reject("yttrium err", "yttrium_err", CustomError(message:"prepareDetailed: client not init"))
|
303
|
+
}
|
304
|
+
//
|
305
|
+
// switch routeResponseSuccess {
|
306
|
+
// case let .success(routeResponse):
|
307
|
+
// switch routeResponse {
|
308
|
+
// case let .available(availableResponse):
|
309
|
+
//
|
310
|
+
// availableResponseDictionary[availableResponse.orchestrationId] = availableResponse;
|
311
|
+
// // let uiFields = try await client.getRouteUiFields(routeResponse: availableResponse, initialTransaction: Transaction(from: from, to: to, value: value, gas: gas, data: data, nonce: nonce, chainId: chainId, gasPrice: gasPrice, maxFeePerGas: maxFeePerGas, maxPriorityFeePerGas: maxPriorityFeePerGas), currency: Currency.usd)
|
312
|
+
// //
|
313
|
+
// // let routesDetails = convertRouteUiFieldsToDictionary(uiFields)
|
314
|
+
//// print("available result", availableResponse)
|
315
|
+
// // print("ui_fields_json", routesDetails)
|
316
|
+
// let responseDict = convertRouteResponseAvailableToDictionary(availableResponse)
|
317
|
+
// print("parsed result dictionary", responseDict)
|
318
|
+
// resolve(["status": "available", "data": responseDict])
|
319
|
+
//// "routesDetails": routesDetails
|
320
|
+
//
|
321
|
+
// case .notRequired(_):
|
322
|
+
// print("not required")
|
323
|
+
// resolve(["status": "not_required"])
|
324
|
+
// }
|
325
|
+
// case let .error(routeResponse):
|
326
|
+
// switch routeResponse.error {
|
327
|
+
// case BridgingError.insufficientFunds:
|
328
|
+
// let responseDict: [String: Any] = [
|
329
|
+
// "status": "error",
|
330
|
+
// "reason": "insufficientFunds"
|
331
|
+
// ]
|
332
|
+
// resolve(responseDict)
|
333
|
+
// case BridgingError.insufficientGasFunds:
|
334
|
+
// let responseDict: [String: Any] = [
|
335
|
+
// "status": "error",
|
336
|
+
// "reason": "insufficientGasFunds"
|
337
|
+
// ]
|
338
|
+
// resolve(responseDict)
|
339
|
+
// case BridgingError.noRoutesAvailable:
|
340
|
+
// let responseDict: [String: Any] = [
|
341
|
+
// "status": "error",
|
342
|
+
// "reason": "noRoutesAvailable"
|
343
|
+
// ]
|
344
|
+
// resolve(responseDict)
|
345
|
+
// }
|
346
|
+
// print(routeResponse)
|
347
|
+
// print(routeResponse.error)
|
348
|
+
// }
|
349
|
+
// resolve(result)
|
272
350
|
} catch {
|
273
351
|
print("Error occurred: \(error)")
|
274
352
|
print(error)
|
275
|
-
reject("yttrium err", "yttrium_err
|
353
|
+
reject("yttrium err", "yttrium_err", error)
|
276
354
|
}
|
277
355
|
}
|
356
|
+
} else {
|
357
|
+
reject("prepareDetailed failed", "prepareDetailed", CustomError(message: "prepareDetailed failed"))
|
278
358
|
}
|
279
359
|
}
|
280
360
|
|
281
361
|
@objc
|
282
|
-
func
|
283
|
-
print("
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
362
|
+
func execute(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
363
|
+
print("execute called", params)
|
364
|
+
|
365
|
+
Task {
|
366
|
+
do {
|
367
|
+
if let dict = params as? [String: Any],
|
368
|
+
let bridgeSignedTransactions = dict["bridgeSignedTransactions"] as? Array<String>,
|
369
|
+
let initialSignedTransaction = dict["initialSignedTransaction"] as? String,
|
370
|
+
let orchestrationId = dict["initialSignedTransaction"] as? String {
|
371
|
+
|
372
|
+
if((client) != nil) {
|
373
|
+
|
374
|
+
guard let uiFields = prepareDetailedResultDict[orchestrationId] else {
|
375
|
+
throw CustomError(message: "prepareDetailed result not found, try again")
|
376
|
+
}
|
377
|
+
|
378
|
+
print("UI fields found for:", orchestrationId)
|
379
|
+
|
380
|
+
let result = try await client?.execute(uiFields: uiFields, routeTxnSigs: bridgeSignedTransactions, initialTxnSig: initialSignedTransaction)
|
381
|
+
print("execute success", orchestrationId, result)
|
382
|
+
resolve(true)
|
383
|
+
} else {
|
384
|
+
throw CustomError(message: "execute failed: client doesn't exist")
|
385
|
+
}
|
299
386
|
}
|
387
|
+
} catch {
|
388
|
+
print("execute threw")
|
389
|
+
reject("execute err", "execute", error)
|
300
390
|
}
|
301
391
|
}
|
302
392
|
}
|
303
393
|
|
394
|
+
//
|
395
|
+
// @objc
|
396
|
+
// func status(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
397
|
+
// print("checkStatus called with", params )
|
398
|
+
// if let dict = params as? [String: Any],
|
399
|
+
// let projectId = dict["projectId"] as? String,
|
400
|
+
// let orchestrationId = dict["orchestrationId"] as? String {
|
401
|
+
// let client = ChainAbstractionClient.init(projectId: projectId)
|
402
|
+
// Task {
|
403
|
+
// do {
|
404
|
+
// let statusResponse = try await client.status(orchestrationId: orchestrationId)
|
405
|
+
//
|
406
|
+
// switch statusResponse {
|
407
|
+
// case let .completed(statusResponseCompleted):
|
408
|
+
// print("status response completed", statusResponseCompleted)
|
409
|
+
// let responseDict: [String: Any] = [
|
410
|
+
// "createdAt": statusResponseCompleted.createdAt,
|
411
|
+
// "status": "completed"
|
412
|
+
// ]
|
413
|
+
// resolve(responseDict)
|
414
|
+
// case let .error(statusResponseError):
|
415
|
+
// print("status response error", statusResponseError)
|
416
|
+
// let responseDict: [String: Any] = [
|
417
|
+
// "createdAt": statusResponseError.createdAt,
|
418
|
+
// "reason": statusResponseError.error,
|
419
|
+
// "status": "error"
|
420
|
+
// ]
|
421
|
+
// resolve(responseDict)
|
422
|
+
// case let .pending(statusResponsePending):
|
423
|
+
// print("status response pending", statusResponsePending)
|
424
|
+
// let responseDict: [String: Any] = [
|
425
|
+
// "createdAt": statusResponsePending.createdAt,
|
426
|
+
// "checkIn": statusResponsePending.checkIn,
|
427
|
+
// "status": "pending"
|
428
|
+
// ]
|
429
|
+
// resolve(responseDict)
|
430
|
+
// }
|
431
|
+
// } catch {
|
432
|
+
// print("Error occurred: \(error)")
|
433
|
+
// print(error)
|
434
|
+
// reject("checkStatus err", "checkStatus", error)
|
435
|
+
// }
|
436
|
+
// }
|
437
|
+
// }
|
438
|
+
// }
|
439
|
+
//
|
440
|
+
// func convertRouteResponseAvailableToDictionary(_ routeResponse: RouteResponseAvailable) -> [String: Any] {
|
441
|
+
// func transactionToDictionary(_ transaction: YttriumWrapper.Transaction) -> [String: Any] {
|
442
|
+
// return [
|
443
|
+
// "chainId": transaction.chainId,
|
444
|
+
// "from": transaction.from,
|
445
|
+
// "to": transaction.to,
|
446
|
+
// "value": transaction.value,
|
447
|
+
// "input": transaction.input,
|
448
|
+
// "gasLimit": transaction.gasLimit,
|
449
|
+
// "nonce": transaction.nonce
|
450
|
+
// ]
|
451
|
+
// }
|
452
|
+
//
|
453
|
+
// func fundingMetadataToDictionary(_ metadata: YttriumWrapper.FundingMetadata) -> [String: Any] {
|
454
|
+
// return [
|
455
|
+
// "chainId": metadata.chainId,
|
456
|
+
// "tokenContract": metadata.tokenContract,
|
457
|
+
// "symbol": metadata.symbol,
|
458
|
+
// "amount": metadata.amount,
|
459
|
+
// "bridgingFee": metadata.bridgingFee,
|
460
|
+
// "decimals": metadata.decimals
|
461
|
+
// ]
|
462
|
+
// }
|
463
|
+
//
|
464
|
+
// func initialTransactionMetadataToDictionary(_ metadata: YttriumWrapper.InitialTransactionMetadata) -> [String: Any] {
|
465
|
+
// return [
|
466
|
+
// "transferTo": metadata.transferTo,
|
467
|
+
// "amount": metadata.amount,
|
468
|
+
// "tokenContract": metadata.tokenContract,
|
469
|
+
// "symbol": metadata.symbol,
|
470
|
+
// "decimals": metadata.decimals
|
471
|
+
// ]
|
472
|
+
// }
|
473
|
+
//
|
474
|
+
// func metadataToDictionary(_ metadata: YttriumWrapper.Metadata) -> [String: Any] {
|
475
|
+
// return [
|
476
|
+
// "fundingFrom": metadata.fundingFrom.map { fundingMetadataToDictionary($0) },
|
477
|
+
// "initialTransaction": initialTransactionMetadataToDictionary(metadata.initialTransaction),
|
478
|
+
// "checkIn": metadata.checkIn
|
479
|
+
// ]
|
480
|
+
// }
|
481
|
+
//
|
482
|
+
// return [
|
483
|
+
// "orchestrationId": routeResponse.orchestrationId,
|
484
|
+
// "initialTransaction": transactionToDictionary(routeResponse.initialTransaction),
|
485
|
+
// "transactions": routeResponse.transactions.map { transactionToDictionary($0) },
|
486
|
+
// "metadata": metadataToDictionary(routeResponse.metadata)
|
487
|
+
// ]
|
488
|
+
// }
|
489
|
+
//
|
490
|
+
// private var availableResponseDictionary: [String: RouteResponseAvailable] = [:]
|
491
|
+
//
|
492
|
+
// @objc
|
493
|
+
// func prepare(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
494
|
+
// print("checkRoute called with", params)
|
495
|
+
// let dict = params as? [String: Any]
|
496
|
+
//
|
497
|
+
// if let transactionData = dict?["transaction"] as? [String: String],
|
498
|
+
// let from = transactionData["from"] ?? "" as Optional,
|
499
|
+
// let chainId = transactionData["chainId"] ?? "" as Optional,
|
500
|
+
// let data = transactionData["data"] ?? "" as Optional,
|
501
|
+
// let value = transactionData["value"] ?? "" as Optional,
|
502
|
+
// let to = transactionData["to"] ?? "" as Optional,
|
503
|
+
// let projectId = dict?["projectId"] as? String {
|
504
|
+
//
|
505
|
+
// let client = ChainAbstractionClient.init(projectId: projectId)
|
506
|
+
// print("created client, checking route...")
|
507
|
+
// Task {
|
508
|
+
// do {
|
509
|
+
// let transaction = InitialTransaction.init(chainId: chainId, from: from, to: to, value: value, input: data)
|
510
|
+
//
|
511
|
+
// let routeResponseSuccess = try await client.prepare(initialTransaction: transaction)
|
512
|
+
// print("result", routeResponseSuccess)
|
513
|
+
//
|
514
|
+
// switch routeResponseSuccess {
|
515
|
+
// case let .success(routeResponse):
|
516
|
+
// switch routeResponse {
|
517
|
+
// case let .available(availableResponse):
|
518
|
+
//
|
519
|
+
// availableResponseDictionary[availableResponse.orchestrationId] = availableResponse;
|
520
|
+
// // let uiFields = try await client.getRouteUiFields(routeResponse: availableResponse, initialTransaction: Transaction(from: from, to: to, value: value, gas: gas, data: data, nonce: nonce, chainId: chainId, gasPrice: gasPrice, maxFeePerGas: maxFeePerGas, maxPriorityFeePerGas: maxPriorityFeePerGas), currency: Currency.usd)
|
521
|
+
// //
|
522
|
+
// // let routesDetails = convertRouteUiFieldsToDictionary(uiFields)
|
523
|
+
//// print("available result", availableResponse)
|
524
|
+
// // print("ui_fields_json", routesDetails)
|
525
|
+
// let responseDict = convertRouteResponseAvailableToDictionary(availableResponse)
|
526
|
+
// print("parsed result dictionary", responseDict)
|
527
|
+
// resolve(["status": "available", "data": responseDict])
|
528
|
+
//// "routesDetails": routesDetails
|
529
|
+
//
|
530
|
+
// case .notRequired(_):
|
531
|
+
// print("not required")
|
532
|
+
// resolve(["status": "not_required"])
|
533
|
+
// }
|
534
|
+
// case let .error(routeResponse):
|
535
|
+
// switch routeResponse.error {
|
536
|
+
// case BridgingError.insufficientFunds:
|
537
|
+
// let responseDict: [String: Any] = [
|
538
|
+
// "status": "error",
|
539
|
+
// "reason": "insufficientFunds"
|
540
|
+
// ]
|
541
|
+
// resolve(responseDict)
|
542
|
+
// case BridgingError.insufficientGasFunds:
|
543
|
+
// let responseDict: [String: Any] = [
|
544
|
+
// "status": "error",
|
545
|
+
// "reason": "insufficientGasFunds"
|
546
|
+
// ]
|
547
|
+
// resolve(responseDict)
|
548
|
+
// case BridgingError.noRoutesAvailable:
|
549
|
+
// let responseDict: [String: Any] = [
|
550
|
+
// "status": "error",
|
551
|
+
// "reason": "noRoutesAvailable"
|
552
|
+
// ]
|
553
|
+
// resolve(responseDict)
|
554
|
+
// }
|
555
|
+
// print(routeResponse)
|
556
|
+
// print(routeResponse.error)
|
557
|
+
// }
|
558
|
+
// // resolve(result)
|
559
|
+
// } catch {
|
560
|
+
// print("Error occurred: \(error)")
|
561
|
+
// print(error)
|
562
|
+
// reject("yttrium err", "yttrium_err", error)
|
563
|
+
// }
|
564
|
+
// }
|
565
|
+
// }
|
566
|
+
// }
|
567
|
+
//
|
568
|
+
// func convertUiFieldsToDictionary(_ uiFields: UiFields) -> [String: Any] {
|
569
|
+
// func feeEstimatedTransactionToDictionary(_ transaction: YttriumWrapper.FeeEstimatedTransaction) -> [String: Any] {
|
570
|
+
// return [
|
571
|
+
// "chainId": transaction.chainId,
|
572
|
+
// "from": transaction.from,
|
573
|
+
// "to": transaction.to,
|
574
|
+
// "value": transaction.value,
|
575
|
+
// "input": transaction.input,
|
576
|
+
// "gasLimit": transaction.gasLimit,
|
577
|
+
// "nonce": transaction.nonce,
|
578
|
+
// "maxFeePerGas": transaction.maxFeePerGas,
|
579
|
+
// "maxPriorityFeePerGas": transaction.maxPriorityFeePerGas
|
580
|
+
// ]
|
581
|
+
// }
|
582
|
+
//
|
583
|
+
// func amountToDictionary(_ amount: YttriumWrapper.Amount) -> [String: Any] {
|
584
|
+
// return [
|
585
|
+
// "symbol": amount.symbol,
|
586
|
+
// "amount": amount.amount,
|
587
|
+
// "unit": amount.unit,
|
588
|
+
// "formatted": amount.formatted,
|
589
|
+
// "formattedAlt": amount.formattedAlt
|
590
|
+
// ]
|
591
|
+
// }
|
592
|
+
//
|
593
|
+
// func transactionFeeToDictionary(_ fee: YttriumWrapper.TransactionFee) -> [String: Any] {
|
594
|
+
// return [
|
595
|
+
// "fee": amountToDictionary(fee.fee),
|
596
|
+
// "localFee": amountToDictionary(fee.localFee)
|
597
|
+
// ]
|
598
|
+
// }
|
599
|
+
//
|
600
|
+
// func txnDetailsToDictionary(_ txnDetails: YttriumWrapper.TxnDetails) -> [String: Any] {
|
601
|
+
// return [
|
602
|
+
// "transaction": feeEstimatedTransactionToDictionary(txnDetails.transaction),
|
603
|
+
// "fee": transactionFeeToDictionary(txnDetails.fee)
|
604
|
+
// ]
|
605
|
+
// }
|
606
|
+
//
|
607
|
+
// return [
|
608
|
+
// "route": uiFields.route.map { txnDetailsToDictionary($0) },
|
609
|
+
// "localRouteTotal": amountToDictionary(uiFields.localRouteTotal),
|
610
|
+
// "bridge": uiFields.bridge.map { transactionFeeToDictionary($0) },
|
611
|
+
// "localBridgeTotal": amountToDictionary(uiFields.localBridgeTotal),
|
612
|
+
// "initial": txnDetailsToDictionary(uiFields.initial),
|
613
|
+
// "localTotal": amountToDictionary(uiFields.localTotal)
|
614
|
+
// ]
|
615
|
+
// }
|
616
|
+
//
|
617
|
+
// @objc
|
618
|
+
// func getBridgeDetails(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
619
|
+
// print("getBridgeDetails called with", params)
|
620
|
+
// let dict = params as? [String: String]
|
621
|
+
//
|
622
|
+
// if let orchestrationId = dict?["orchestrationId"] ?? "" as Optional,
|
623
|
+
// let projectId = dict?["projectId"] as? String {
|
624
|
+
//
|
625
|
+
// let client = ChainAbstractionClient.init(projectId: projectId)
|
626
|
+
// print("created client, getting UI fields...")
|
627
|
+
// Task {
|
628
|
+
// do {
|
629
|
+
//
|
630
|
+
// let availableResponse = availableResponseDictionary[orchestrationId]!
|
631
|
+
// let uiFields = try await client.getUiFields(routeResponse: availableResponse, currency: Currency.usd)
|
632
|
+
// let uiFIeldsDict = convertUiFieldsToDictionary(uiFields)
|
633
|
+
// print("getBridgeDetails result", uiFields)
|
634
|
+
// resolve(uiFIeldsDict)
|
635
|
+
// } catch {
|
636
|
+
// print("Error occurred: \(error)")
|
637
|
+
// print(error)
|
638
|
+
// reject("yttrium err", "yttrium_err getBridgeDetails", error)
|
639
|
+
// }
|
640
|
+
// }
|
641
|
+
// }
|
642
|
+
// }
|
643
|
+
//
|
644
|
+
// @objc
|
645
|
+
// func getERC20Balance(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
646
|
+
// print("getERC20Balance called with", params)
|
647
|
+
// let dict = params as? [String: String]
|
648
|
+
//
|
649
|
+
// if let tokenAddress = dict?["tokenAddress"] ?? "" as Optional,
|
650
|
+
// let ownerAddress = dict?["ownerAddress"] ?? "" as Optional,
|
651
|
+
// let chainId = dict?["chainId"] ?? "" as Optional,
|
652
|
+
// let projectId = dict?["projectId"] as? String {
|
653
|
+
//
|
654
|
+
// let client = ChainAbstractionClient.init(projectId: projectId)
|
655
|
+
// Task {
|
656
|
+
// do {
|
657
|
+
// let balance = try await client.erc20TokenBalance(chainId: chainId, token: tokenAddress, owner: ownerAddress)
|
658
|
+
// print("getERC20Balance result", balance)
|
659
|
+
// resolve(balance)
|
660
|
+
// } catch {
|
661
|
+
// print("Error occurred: \(error)")
|
662
|
+
// print(error)
|
663
|
+
// reject("yttrium err", "yttrium_err getERC20Balance", error)
|
664
|
+
// }
|
665
|
+
// }
|
666
|
+
// }
|
667
|
+
// }
|
668
|
+
//
|
669
|
+
// @objc
|
670
|
+
// func estimateFees(_ params: Any, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
671
|
+
// print("getERC20Balance called with", params)
|
672
|
+
// let dict = params as? [String: String]
|
673
|
+
//
|
674
|
+
// if let chainId = dict?["chainId"] ?? "" as Optional,
|
675
|
+
// let projectId = dict?["projectId"] as? String {
|
676
|
+
//
|
677
|
+
// let client = ChainAbstractionClient.init(projectId: projectId)
|
678
|
+
// Task {
|
679
|
+
// do {
|
680
|
+
// let fees = try await client.estimateFees(chainId: chainId)
|
681
|
+
// print("estimateFees result", fees)
|
682
|
+
// resolve(["maxFeePerGas": fees.maxFeePerGas, "maxPriorityFeePerGas": fees.maxPriorityFeePerGas])
|
683
|
+
// } catch {
|
684
|
+
// print("Error occurred: \(error)")
|
685
|
+
// print(error)
|
686
|
+
// reject("yttrium err", "yttrium_err estimateFees", error)
|
687
|
+
// }
|
688
|
+
// }
|
689
|
+
// }
|
690
|
+
// }
|
691
|
+
|
304
692
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@walletconnect/react-native-compat",
|
3
3
|
"description": "Shims for WalletConnect Protocol in React Native Projects",
|
4
|
-
"version": "2.18.1-canary-ca-
|
4
|
+
"version": "2.18.1-canary-ca-3",
|
5
5
|
"author": "WalletConnect, Inc. <walletconnect.com>",
|
6
6
|
"homepage": "https://github.com/walletconnect/walletconnect-monorepo/",
|
7
7
|
"license": "Apache-2.0",
|