react-native-candle 0.1.19 → 0.1.21

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.
Files changed (54) hide show
  1. package/ReactNativeCandle.podspec +1 -1
  2. package/ios/Sources/CandleActionViewModel.swift +13 -0
  3. package/ios/Sources/CandleTradeExecutionSheetWrapper.swift +31 -0
  4. package/ios/Sources/HostingViewController.swift +7 -0
  5. package/ios/Sources/RNCandle.swift +300 -84
  6. package/lib/commonjs/index.js +140 -15
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/module/index.js +140 -15
  9. package/lib/module/index.js.map +1 -1
  10. package/lib/typescript/commonjs/src/index.d.ts +46 -13
  11. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  12. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +50 -2
  13. package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
  14. package/lib/typescript/module/src/index.d.ts +46 -13
  15. package/lib/typescript/module/src/index.d.ts.map +1 -1
  16. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +50 -2
  17. package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
  18. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +24 -8
  19. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +271 -113
  20. package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +30 -3
  21. package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +106 -57
  22. package/nitrogen/generated/ios/swift/AssetAccountRef.swift +55 -0
  23. package/nitrogen/generated/ios/swift/FiatAssetRef.swift +75 -0
  24. package/nitrogen/generated/ios/swift/Func_void_AssetAccount.swift +44 -0
  25. package/nitrogen/generated/ios/swift/Func_void_LinkedAccount.swift +5 -5
  26. package/nitrogen/generated/ios/swift/Func_void_TradeExecutionResult.swift +46 -0
  27. package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +7 -2
  28. package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +86 -24
  29. package/nitrogen/generated/ios/swift/LinkedAccountRef.swift +33 -0
  30. package/nitrogen/generated/ios/swift/MarketTradeAssetRef.swift +55 -0
  31. package/nitrogen/generated/ios/swift/NothingAssetRef.swift +33 -0
  32. package/nitrogen/generated/ios/swift/OtherAssetRef.swift +33 -0
  33. package/nitrogen/generated/ios/swift/TradeAssetRef.swift +176 -0
  34. package/nitrogen/generated/ios/swift/TradeExecutionResult.swift +82 -0
  35. package/nitrogen/generated/ios/swift/TradeQuote.swift +13 -2
  36. package/nitrogen/generated/ios/swift/TradeRef.swift +44 -0
  37. package/nitrogen/generated/ios/swift/TransportAssetRef.swift +55 -0
  38. package/nitrogen/generated/shared/c++/AssetAccountRef.hpp +77 -0
  39. package/nitrogen/generated/shared/c++/FiatAssetRef.hpp +78 -0
  40. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.cpp +4 -1
  41. package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +20 -8
  42. package/nitrogen/generated/shared/c++/{ExecuteTradeRequest.hpp → LinkedAccountRef.hpp} +11 -15
  43. package/nitrogen/generated/shared/c++/MarketTradeAssetRef.hpp +77 -0
  44. package/nitrogen/generated/shared/c++/NothingAssetRef.hpp +69 -0
  45. package/nitrogen/generated/shared/c++/OtherAssetRef.hpp +69 -0
  46. package/nitrogen/generated/shared/c++/TradeAssetRef.hpp +99 -0
  47. package/nitrogen/generated/shared/c++/TradeExecutionResult.hpp +76 -0
  48. package/nitrogen/generated/shared/c++/TradeQuote.hpp +7 -2
  49. package/nitrogen/generated/shared/c++/TradeRef.hpp +74 -0
  50. package/nitrogen/generated/shared/c++/TransportAssetRef.hpp +77 -0
  51. package/package.json +1 -1
  52. package/src/index.ts +199 -33
  53. package/src/specs/RNCandle.nitro.ts +64 -2
  54. package/nitrogen/generated/ios/swift/ExecuteTradeRequest.swift +0 -44
@@ -0,0 +1,77 @@
1
+ ///
2
+ /// TransportAssetRef.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+
21
+
22
+
23
+ #include <string>
24
+
25
+ namespace margelo::nitro::rncandle {
26
+
27
+ /**
28
+ * A struct which can be represented as a JavaScript object (TransportAssetRef).
29
+ */
30
+ struct TransportAssetRef {
31
+ public:
32
+ std::string assetKind SWIFT_PRIVATE;
33
+ std::string serviceTradeID SWIFT_PRIVATE;
34
+ std::string linkedAccountID SWIFT_PRIVATE;
35
+
36
+ public:
37
+ TransportAssetRef() = default;
38
+ explicit TransportAssetRef(std::string assetKind, std::string serviceTradeID, std::string linkedAccountID): assetKind(assetKind), serviceTradeID(serviceTradeID), linkedAccountID(linkedAccountID) {}
39
+ };
40
+
41
+ } // namespace margelo::nitro::rncandle
42
+
43
+ namespace margelo::nitro {
44
+
45
+ using namespace margelo::nitro::rncandle;
46
+
47
+ // C++ TransportAssetRef <> JS TransportAssetRef (object)
48
+ template <>
49
+ struct JSIConverter<TransportAssetRef> final {
50
+ static inline TransportAssetRef fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
+ jsi::Object obj = arg.asObject(runtime);
52
+ return TransportAssetRef(
53
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "assetKind")),
54
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "serviceTradeID")),
55
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "linkedAccountID"))
56
+ );
57
+ }
58
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const TransportAssetRef& arg) {
59
+ jsi::Object obj(runtime);
60
+ obj.setProperty(runtime, "assetKind", JSIConverter<std::string>::toJSI(runtime, arg.assetKind));
61
+ obj.setProperty(runtime, "serviceTradeID", JSIConverter<std::string>::toJSI(runtime, arg.serviceTradeID));
62
+ obj.setProperty(runtime, "linkedAccountID", JSIConverter<std::string>::toJSI(runtime, arg.linkedAccountID));
63
+ return obj;
64
+ }
65
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
66
+ if (!value.isObject()) {
67
+ return false;
68
+ }
69
+ jsi::Object obj = value.getObject(runtime);
70
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "assetKind"))) return false;
71
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "serviceTradeID"))) return false;
72
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "linkedAccountID"))) return false;
73
+ return true;
74
+ }
75
+ };
76
+
77
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-candle",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Candle SDK for React Native",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { NitroModules } from "react-native-nitro-modules";
2
2
  import type {
3
3
  AppUser,
4
- AssetAccount as NitroAssetAccount,
4
+ AssetAccount as InternalAssetAccount,
5
5
  AssetAccountQuery,
6
6
  FiatAsset,
7
7
  FiatAssetQuoteRequest,
@@ -17,7 +17,8 @@ import type {
17
17
  Service,
18
18
  TradeAsset as InternalTradeAsset,
19
19
  TradeAssetQuoteRequest,
20
- TradeQuery,
20
+ TradeQuery as InternalTradeQuery,
21
+ TradeQuote as InternalTradeQuote,
21
22
  TransportAsset,
22
23
  TransportAssetQuoteRequest,
23
24
  LegalAccountKind,
@@ -29,7 +30,14 @@ import type {
29
30
  ServiceCounterparty,
30
31
  Counterparty as InternalCounterparty,
31
32
  ActiveLinkedAccountDetails,
32
- ExecuteTradeRequest,
33
+ AssetAccountRef,
34
+ LinkedAccountRef,
35
+ NothingAssetRef,
36
+ TransportAssetRef,
37
+ OtherAssetRef,
38
+ FiatAssetRef,
39
+ MarketTradeAssetRef,
40
+ TradeAssetRef as InternalTradeAssetRef,
33
41
  } from "./specs/RNCandle.nitro";
34
42
 
35
43
  export class CandleClient {
@@ -42,6 +50,41 @@ export class CandleClient {
42
50
  this.candle.initialize(appUser);
43
51
  }
44
52
 
53
+ public presentTradeExecutionSheet(input: {
54
+ tradeQuote: TradeQuote;
55
+ presentationBackground?: PresentationBackground;
56
+ completion?: (
57
+ result: ({ kind: "success" } & Trade) | { kind: "failure"; error: string }
58
+ ) => void;
59
+ }): void {
60
+ const quote = this.convertTradeQuote(input.tradeQuote);
61
+ this.candle.candleTradeExecutionSheet(
62
+ quote,
63
+ input.presentationBackground ?? "default",
64
+ (result) => {
65
+ if (input.completion === undefined) {
66
+ return;
67
+ }
68
+ if (result.trade !== undefined) {
69
+ input.completion({
70
+ kind: "success",
71
+ ...result.trade,
72
+ counterparty: this.convertToCounterparty(result.trade.counterparty),
73
+ lost: this.convertTradeAsset(result.trade.lost),
74
+ gained: this.convertTradeAsset(result.trade.gained),
75
+ });
76
+ } else {
77
+ if (result.error === undefined) {
78
+ throw new Error(
79
+ "Internal Candle Error: corrupted trade execution result."
80
+ );
81
+ }
82
+ input.completion({ kind: "failure", error: result.error });
83
+ }
84
+ }
85
+ );
86
+ }
87
+
45
88
  public presentCandleLinkSheet({
46
89
  services = undefined,
47
90
  cornerRadius = 24,
@@ -106,8 +149,12 @@ export class CandleClient {
106
149
  });
107
150
  }
108
151
 
109
- public async unlinkAccount(linkedAccountID: string): Promise<void> {
110
- await this.candle.unlinkAccount(linkedAccountID);
152
+ public async getLinkedAccount(ref: LinkedAccountRef): Promise<LinkedAccount> {
153
+ return this.candle.getLinkedAccount(ref);
154
+ }
155
+
156
+ public async unlinkAccount(path: LinkedAccountRef): Promise<void> {
157
+ await this.candle.unlinkAccount(path);
111
158
  }
112
159
 
113
160
  public async deleteUser(): Promise<void> {
@@ -118,17 +165,6 @@ export class CandleClient {
118
165
  return this.candle.getAvailableTools();
119
166
  }
120
167
 
121
- public async executeTrade(request: ExecuteTradeRequest): Promise<Trade> {
122
- const result = await this.candle.executeTrade(request);
123
- return {
124
- dateTime: result.dateTime,
125
- state: result.state,
126
- counterparty: this.convertToCounterparty(result.counterparty),
127
- lost: this.convertTradeAsset(result.lost),
128
- gained: this.convertTradeAsset(result.gained),
129
- };
130
- }
131
-
132
168
  public async executeTool(tool: {
133
169
  name: string;
134
170
  arguments: string;
@@ -143,13 +179,12 @@ export class CandleClient {
143
179
  return accounts.map((account) => this.convertToAssetAccount(account));
144
180
  }
145
181
 
146
- public async getTrades(
147
- query: {
148
- gainedAssetKind?: TradeQueryAssetKind;
149
- lostAssetKind?: TradeQueryAssetKind;
150
- counterpartyKind?: "merchant" | "user" | "service";
151
- } & TradeQuery = {}
152
- ): Promise<Trade[]> {
182
+ public async getAssetAccount(ref: AssetAccountRef): Promise<AssetAccount> {
183
+ const account = await this.candle.getAssetAccount(ref);
184
+ return this.convertToAssetAccount(account);
185
+ }
186
+
187
+ public async getTrades(query: TradeQuery = {}): Promise<Trade[]> {
153
188
  const trades = await this.candle.getTrades(query);
154
189
  return trades.map(({ dateTime, counterparty, gained, lost, state }) => ({
155
190
  dateTime,
@@ -160,6 +195,23 @@ export class CandleClient {
160
195
  }));
161
196
  }
162
197
 
198
+ public async getTrade(input: {
199
+ lost: TradeAssetRef;
200
+ gained: TradeAssetRef;
201
+ }): Promise<Trade> {
202
+ const trade = await this.candle.getTrade({
203
+ lost: this.convertTradeAssetRef(input.lost),
204
+ gained: this.convertTradeAssetRef(input.gained),
205
+ });
206
+ return {
207
+ dateTime: trade.dateTime,
208
+ state: trade.state,
209
+ counterparty: this.convertToCounterparty(trade.counterparty),
210
+ lost: this.convertTradeAsset(trade.lost),
211
+ gained: this.convertTradeAsset(trade.gained),
212
+ };
213
+ }
214
+
163
215
  public async getTradeQuotes(request: {
164
216
  linkedAccountIDs?: string;
165
217
  gained:
@@ -169,12 +221,7 @@ export class CandleClient {
169
221
  | ({ assetKind: "transport" } & TransportAssetQuoteRequest)
170
222
  | ({ assetKind: "fiat" } & FiatAssetQuoteRequest)
171
223
  | ({ assetKind: "stock" | "crypto" } & MarketAssetQuoteRequest);
172
- }): Promise<
173
- {
174
- gained: TradeAsset;
175
- lost: TradeAsset;
176
- }[]
177
- > {
224
+ }): Promise<TradeQuote[]> {
178
225
  let gainedRequest: TradeAssetQuoteRequest;
179
226
 
180
227
  switch (request.gained.assetKind) {
@@ -202,10 +249,85 @@ export class CandleClient {
202
249
  return {
203
250
  gained: this.convertTradeAsset(quote.gained),
204
251
  lost: this.convertTradeAsset(quote.lost),
252
+ context: quote.context,
205
253
  };
206
254
  });
207
255
  }
208
256
 
257
+ private convertTradeAssetRef(
258
+ tradeAssetRef: TradeAssetRef
259
+ ): InternalTradeAssetRef {
260
+ switch (tradeAssetRef.assetKind) {
261
+ case "fiat":
262
+ return {
263
+ fiatAssetRef: {
264
+ assetKind: "fiat",
265
+ linkedAccountID: tradeAssetRef.linkedAccountID,
266
+ serviceTradeID: tradeAssetRef.serviceTradeID,
267
+ },
268
+ };
269
+ case "stock":
270
+ case "crypto":
271
+ return {
272
+ marketTradeAssetRef: {
273
+ assetKind: tradeAssetRef.assetKind,
274
+ linkedAccountID: tradeAssetRef.linkedAccountID,
275
+ serviceTradeID: tradeAssetRef.serviceTradeID,
276
+ },
277
+ };
278
+ case "transport":
279
+ return {
280
+ transportAssetRef: {
281
+ assetKind: "transport",
282
+ linkedAccountID: tradeAssetRef.linkedAccountID,
283
+ serviceTradeID: tradeAssetRef.serviceTradeID,
284
+ },
285
+ };
286
+ case "other":
287
+ return {
288
+ otherAssetRef: {
289
+ assetKind: "other",
290
+ },
291
+ };
292
+ case "nothing":
293
+ return {
294
+ nothingAssetRef: {
295
+ assetKind: "nothing",
296
+ },
297
+ };
298
+ }
299
+ }
300
+
301
+ private toInternalTradeAsset(asset: TradeAsset): InternalTradeAsset {
302
+ switch (asset.assetKind) {
303
+ case "fiat":
304
+ return { fiatAsset: asset };
305
+ case "stock":
306
+ case "crypto":
307
+ return {
308
+ marketTradeAsset: {
309
+ ...asset,
310
+ assetKind: asset.assetKind,
311
+ },
312
+ };
313
+ case "transport":
314
+ return { transportAsset: asset };
315
+ case "other":
316
+ return { otherAsset: asset };
317
+ case "nothing":
318
+ return { nothingAsset: asset };
319
+ }
320
+ }
321
+
322
+ private convertTradeQuote(tradeQuote: TradeQuote): InternalTradeQuote {
323
+ const { context, gained, lost } = tradeQuote;
324
+ return {
325
+ context,
326
+ gained: this.toInternalTradeAsset(gained),
327
+ lost: this.toInternalTradeAsset(lost),
328
+ };
329
+ }
330
+
209
331
  private convertTradeAsset(tradeAsset: InternalTradeAsset): TradeAsset {
210
332
  if (tradeAsset.fiatAsset !== undefined) {
211
333
  return {
@@ -213,9 +335,12 @@ export class CandleClient {
213
335
  assetKind: "fiat",
214
336
  };
215
337
  } else if (tradeAsset.marketTradeAsset !== undefined) {
338
+ this.assertMarketAssetKind(tradeAsset.marketTradeAsset.assetKind);
216
339
  return {
217
340
  ...tradeAsset.marketTradeAsset,
218
- assetKind: tradeAsset.marketTradeAsset.assetKind as "stock" | "crypto",
341
+ assetKind: this.assertMarketAssetKind(
342
+ tradeAsset.marketTradeAsset.assetKind
343
+ ),
219
344
  };
220
345
  } else if (tradeAsset.transportAsset !== undefined) {
221
346
  return {
@@ -254,7 +379,15 @@ export class CandleClient {
254
379
  }
255
380
  }
256
381
 
257
- private convertToAssetAccount(account: NitroAssetAccount): AssetAccount {
382
+ private assertMarketAssetKind(kind: string): "stock" | "crypto" {
383
+ if (kind !== "stock" && kind !== "crypto") {
384
+ throw new Error("Internal Candle Error: corrupted market account.");
385
+ } else {
386
+ return kind;
387
+ }
388
+ }
389
+
390
+ private convertToAssetAccount(account: InternalAssetAccount): AssetAccount {
258
391
  const { legalAccountKind, nickname } = account;
259
392
  const { fiatAccountDetails, marketAccountDetails } = account.details;
260
393
 
@@ -273,7 +406,7 @@ export class CandleClient {
273
406
  nickname,
274
407
  details: {
275
408
  ...marketAccountDetails,
276
- assetKind: marketAccountDetails.assetKind as "stock" | "crypto",
409
+ assetKind: this.assertMarketAssetKind(marketAccountDetails.assetKind),
277
410
  },
278
411
  };
279
412
  } else {
@@ -302,6 +435,18 @@ type Counterparty =
302
435
  kind: "service";
303
436
  } & ServiceCounterparty);
304
437
 
438
+ type TradeQuery = {
439
+ gainedAssetKind?: TradeQueryAssetKind;
440
+ lostAssetKind?: TradeQueryAssetKind;
441
+ counterpartyKind?: "merchant" | "user" | "service";
442
+ } & InternalTradeQuery;
443
+
444
+ type TradeQuote = {
445
+ gained: TradeAsset;
446
+ lost: TradeAsset;
447
+ context: string;
448
+ };
449
+
305
450
  type TradeQueryAssetKind =
306
451
  | "fiat"
307
452
  | "stock"
@@ -340,4 +485,25 @@ type Trade = {
340
485
  gained: TradeAsset;
341
486
  };
342
487
 
343
- export type { LinkedAccount, AppUser, Service, TradeState, TradeAsset, Trade };
488
+ type TradeAssetRef =
489
+ | ({ assetKind: "transport" } & TransportAssetRef)
490
+ | ({ assetKind: "nothing" } & NothingAssetRef)
491
+ | ({ assetKind: "other" } & OtherAssetRef)
492
+ | ({ assetKind: "fiat" } & FiatAssetRef)
493
+ | ({ assetKind: "stock" | "crypto" } & MarketTradeAssetRef);
494
+
495
+ export type {
496
+ LinkedAccountRef,
497
+ AssetAccountRef,
498
+ TradeAssetRef,
499
+ LinkedAccount,
500
+ AppUser,
501
+ Service,
502
+ TradeState,
503
+ TradeAsset,
504
+ Trade,
505
+ TradeQuery,
506
+ Counterparty,
507
+ AssetAccount,
508
+ TradeQuote,
509
+ };
@@ -226,6 +226,7 @@ export type ExecuteTradeRequest = {
226
226
  export type TradeQuote = {
227
227
  lost: TradeAsset;
228
228
  gained: TradeAsset;
229
+ context: string;
229
230
  };
230
231
 
231
232
  export type Service =
@@ -344,6 +345,60 @@ export type ToolCall = {
344
345
  arguments: string;
345
346
  };
346
347
 
348
+ export type LinkedAccountRef = {
349
+ linkedAccountID: string;
350
+ };
351
+
352
+ export type AssetAccountRef = {
353
+ linkedAccountID: string;
354
+ assetKind: string; // "fiat" | "stock" | "crypto"
355
+ serviceAccountID: string;
356
+ };
357
+
358
+ export type FiatAssetRef = {
359
+ assetKind: string; // fiat
360
+ serviceTradeID?: string;
361
+ linkedAccountID: string;
362
+ };
363
+
364
+ export type MarketTradeAssetRef = {
365
+ assetKind: string; // "stock" | "crypto"
366
+ serviceTradeID: string;
367
+ linkedAccountID: string;
368
+ };
369
+
370
+ export type TransportAssetRef = {
371
+ assetKind: string; // "transport"
372
+ serviceTradeID: string;
373
+ linkedAccountID: string;
374
+ };
375
+
376
+ export type OtherAssetRef = {
377
+ assetKind: string; // "other"
378
+ };
379
+
380
+ export type NothingAssetRef = {
381
+ assetKind: string; // "nothing"
382
+ };
383
+
384
+ export type TradeAssetRef = {
385
+ fiatAssetRef?: FiatAssetRef;
386
+ marketTradeAssetRef?: MarketTradeAssetRef;
387
+ transportAssetRef?: TransportAssetRef;
388
+ otherAssetRef?: OtherAssetRef;
389
+ nothingAssetRef?: NothingAssetRef;
390
+ };
391
+
392
+ export type TradeRef = {
393
+ lost: TradeAssetRef;
394
+ gained: TradeAssetRef;
395
+ };
396
+
397
+ export type TradeExecutionResult = {
398
+ trade?: Trade;
399
+ error?: string;
400
+ };
401
+
347
402
  export interface RNCandle extends HybridObject<{ ios: "swift" }> {
348
403
  candleLinkSheet(
349
404
  isPresented: boolean,
@@ -355,13 +410,20 @@ export interface RNCandle extends HybridObject<{ ios: "swift" }> {
355
410
  presentationStyle: PresentationStyle,
356
411
  onSuccess: (account: LinkedAccount) => void
357
412
  ): void;
413
+ candleTradeExecutionSheet(
414
+ tradeQuote: TradeQuote,
415
+ presentationBackground: PresentationBackground,
416
+ completion: (result: TradeExecutionResult) => void
417
+ ): void;
358
418
  initialize(appUser: AppUser): void;
359
419
  getLinkedAccounts(): Promise<LinkedAccount[]>;
360
- unlinkAccount(linkedAccountID: string): Promise<void>;
420
+ getLinkedAccount(ref: LinkedAccountRef): Promise<LinkedAccount>;
421
+ unlinkAccount(ref: LinkedAccountRef): Promise<void>;
361
422
  getAssetAccounts(query: AssetAccountQuery): Promise<AssetAccount[]>;
423
+ getAssetAccount(ref: AssetAccountRef): Promise<AssetAccount>;
362
424
  getTrades(query: TradeQuery): Promise<Trade[]>;
425
+ getTrade(ref: TradeRef): Promise<Trade>;
363
426
  getTradeQuotes(request: TradeQuoteRequest): Promise<TradeQuote[]>;
364
- executeTrade(request: ExecuteTradeRequest): Promise<Trade>;
365
427
  deleteUser(): Promise<void>;
366
428
  // FIXME: The return type should be a more specific type based on the actual tool calls available.
367
429
  getAvailableTools(): Promise<Array<AnyMap>>;
@@ -1,44 +0,0 @@
1
- ///
2
- /// ExecuteTradeRequest.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /// Represents an instance of `ExecuteTradeRequest`, backed by a C++ struct.
11
- public typealias ExecuteTradeRequest = margelo.nitro.rncandle.ExecuteTradeRequest
12
-
13
- extension ExecuteTradeRequest {
14
- private typealias bridge = margelo.nitro.rncandle.bridge.swift
15
-
16
- /**
17
- * Create a new instance of `ExecuteTradeRequest`.
18
- */
19
- public init(linkedAccountID: String, context: String) {
20
- self.init(std.string(linkedAccountID), std.string(context))
21
- }
22
-
23
- public var linkedAccountID: String {
24
- @inline(__always)
25
- get {
26
- return String(self.__linkedAccountID)
27
- }
28
- @inline(__always)
29
- set {
30
- self.__linkedAccountID = std.string(newValue)
31
- }
32
- }
33
-
34
- public var context: String {
35
- @inline(__always)
36
- get {
37
- return String(self.__context)
38
- }
39
- @inline(__always)
40
- set {
41
- self.__context = std.string(newValue)
42
- }
43
- }
44
- }