react-native-candle 0.1.17 → 0.1.19
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/ReactNativeCandle.podspec +1 -1
- package/ios/Sources/CandleLinkSheetWrapperView.swift +2 -167
- package/ios/Sources/RNCandle.swift +642 -53
- package/lib/commonjs/index.js +167 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +167 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +81 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +201 -9
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +81 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +201 -9
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +36 -4
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +528 -35
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +111 -6
- package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +125 -12
- package/nitrogen/generated/ios/swift/ACHAccountKind.swift +38 -0
- package/nitrogen/generated/ios/swift/ACHDetails.swift +55 -0
- package/nitrogen/generated/ios/swift/{Details.swift → ActiveLinkedAccountDetails.swift} +55 -22
- package/nitrogen/generated/ios/swift/Address.swift +33 -0
- package/nitrogen/generated/ios/swift/AssetAccount.swift +55 -0
- package/nitrogen/generated/ios/swift/AssetAccountDetails.swift +83 -0
- package/nitrogen/generated/ios/swift/AssetAccountKind.swift +42 -0
- package/nitrogen/generated/ios/swift/AssetAccountQuery.swift +76 -0
- package/nitrogen/generated/ios/swift/Coordinates.swift +44 -0
- package/nitrogen/generated/ios/swift/Counterparty.swift +115 -0
- package/nitrogen/generated/ios/swift/ExecuteTradeRequest.swift +44 -0
- package/nitrogen/generated/ios/swift/FiatAccountDetails.swift +165 -0
- package/nitrogen/generated/ios/swift/FiatAsset.swift +123 -0
- package/nitrogen/generated/ios/swift/FiatAssetQuoteRequest.swift +119 -0
- package/nitrogen/generated/ios/swift/Func_void_Trade.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_AssetAccount_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_TradeQuote_.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_Trade_.swift +45 -0
- package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +4 -3
- package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +79 -40
- package/nitrogen/generated/ios/swift/InactiveLinkedAccountDetails.swift +33 -0
- package/nitrogen/generated/ios/swift/LegalAccountKind.swift +46 -0
- package/nitrogen/generated/ios/swift/LinkedAccount.swift +16 -34
- package/nitrogen/generated/ios/swift/LinkedAccountDetails.swift +87 -0
- package/nitrogen/generated/ios/swift/MarketAccountDetails.swift +69 -0
- package/nitrogen/generated/ios/swift/MarketAssetQuoteRequest.swift +151 -0
- package/nitrogen/generated/ios/swift/MarketTradeAsset.swift +150 -0
- package/nitrogen/generated/ios/swift/MerchantCounterparty.swift +86 -0
- package/nitrogen/generated/ios/swift/MerchantLocation.swift +55 -0
- package/nitrogen/generated/ios/swift/NothingAsset.swift +33 -0
- package/nitrogen/generated/ios/swift/NothingAssetQuoteRequest.swift +33 -0
- package/nitrogen/generated/ios/swift/OtherAsset.swift +33 -0
- package/nitrogen/generated/ios/swift/ServiceCounterparty.swift +44 -0
- package/nitrogen/generated/ios/swift/Trade.swift +80 -0
- package/nitrogen/generated/ios/swift/TradeAsset.swift +175 -0
- package/nitrogen/generated/ios/swift/TradeAssetQuoteRequest.swift +148 -0
- package/nitrogen/generated/ios/swift/TradeQuery.swift +175 -0
- package/nitrogen/generated/ios/swift/TradeQuote.swift +44 -0
- package/nitrogen/generated/ios/swift/TradeQuoteRequest.swift +63 -0
- package/nitrogen/generated/ios/swift/TradeState.swift +42 -0
- package/nitrogen/generated/ios/swift/TransportAsset.swift +174 -0
- package/nitrogen/generated/ios/swift/TransportAssetQuoteRequest.swift +212 -0
- package/nitrogen/generated/ios/swift/UserCounterparty.swift +66 -0
- package/nitrogen/generated/ios/swift/WireDetails.swift +44 -0
- package/nitrogen/generated/shared/c++/{State.hpp → ACHAccountKind.hpp} +17 -17
- package/nitrogen/generated/shared/c++/ACHDetails.hpp +79 -0
- package/nitrogen/generated/shared/c++/{Details.hpp → ActiveLinkedAccountDetails.hpp} +25 -23
- package/nitrogen/generated/shared/c++/Address.hpp +69 -0
- package/nitrogen/generated/shared/c++/AssetAccount.hpp +82 -0
- package/nitrogen/generated/shared/c++/AssetAccountDetails.hpp +78 -0
- package/nitrogen/generated/shared/c++/AssetAccountKind.hpp +82 -0
- package/nitrogen/generated/shared/c++/AssetAccountQuery.hpp +76 -0
- package/nitrogen/generated/shared/c++/Coordinates.hpp +73 -0
- package/nitrogen/generated/shared/c++/Counterparty.hpp +85 -0
- package/nitrogen/generated/shared/c++/ExecuteTradeRequest.hpp +73 -0
- package/nitrogen/generated/shared/c++/FiatAccountDetails.hpp +106 -0
- package/nitrogen/generated/shared/c++/FiatAsset.hpp +96 -0
- package/nitrogen/generated/shared/c++/FiatAssetQuoteRequest.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridRNCandleSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +25 -3
- package/nitrogen/generated/shared/c++/InactiveLinkedAccountDetails.hpp +69 -0
- package/nitrogen/generated/shared/c++/LegalAccountKind.hpp +86 -0
- package/nitrogen/generated/shared/c++/LinkedAccount.hpp +13 -14
- package/nitrogen/generated/shared/c++/LinkedAccountDetails.hpp +78 -0
- package/nitrogen/generated/shared/c++/MarketAccountDetails.hpp +83 -0
- package/nitrogen/generated/shared/c++/MarketAssetQuoteRequest.hpp +86 -0
- package/nitrogen/generated/shared/c++/MarketTradeAsset.hpp +111 -0
- package/nitrogen/generated/shared/c++/MerchantCounterparty.hpp +84 -0
- package/nitrogen/generated/shared/c++/MerchantLocation.hpp +77 -0
- package/nitrogen/generated/shared/c++/NothingAsset.hpp +69 -0
- package/nitrogen/generated/shared/c++/NothingAssetQuoteRequest.hpp +69 -0
- package/nitrogen/generated/shared/c++/OtherAsset.hpp +69 -0
- package/nitrogen/generated/shared/c++/ServiceCounterparty.hpp +75 -0
- package/nitrogen/generated/shared/c++/Trade.hpp +93 -0
- package/nitrogen/generated/shared/c++/TradeAsset.hpp +99 -0
- package/nitrogen/generated/shared/c++/TradeAssetQuoteRequest.hpp +92 -0
- package/nitrogen/generated/shared/c++/TradeQuery.hpp +86 -0
- package/nitrogen/generated/shared/c++/TradeQuote.hpp +74 -0
- package/nitrogen/generated/shared/c++/TradeQuoteRequest.hpp +76 -0
- package/nitrogen/generated/shared/c++/TradeState.hpp +82 -0
- package/nitrogen/generated/shared/c++/TransportAsset.hpp +125 -0
- package/nitrogen/generated/shared/c++/TransportAssetQuoteRequest.hpp +99 -0
- package/nitrogen/generated/shared/c++/UserCounterparty.hpp +81 -0
- package/nitrogen/generated/shared/c++/WireDetails.hpp +73 -0
- package/package.json +1 -1
- package/src/index.ts +271 -3
- package/src/specs/RNCandle.nitro.ts +242 -10
- package/nitrogen/generated/ios/swift/State.swift +0 -38
package/src/index.ts
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
1
|
import { NitroModules } from "react-native-nitro-modules";
|
|
2
2
|
import type {
|
|
3
3
|
AppUser,
|
|
4
|
+
AssetAccount as NitroAssetAccount,
|
|
5
|
+
AssetAccountQuery,
|
|
6
|
+
FiatAsset,
|
|
7
|
+
FiatAssetQuoteRequest,
|
|
4
8
|
LinkedAccount,
|
|
9
|
+
MarketAssetQuoteRequest,
|
|
10
|
+
MarketTradeAsset,
|
|
11
|
+
NothingAsset,
|
|
12
|
+
NothingAssetQuoteRequest,
|
|
13
|
+
OtherAsset,
|
|
5
14
|
PresentationBackground,
|
|
6
15
|
PresentationStyle,
|
|
7
16
|
RNCandle,
|
|
8
17
|
Service,
|
|
18
|
+
TradeAsset as InternalTradeAsset,
|
|
19
|
+
TradeAssetQuoteRequest,
|
|
20
|
+
TradeQuery,
|
|
21
|
+
TransportAsset,
|
|
22
|
+
TransportAssetQuoteRequest,
|
|
23
|
+
LegalAccountKind,
|
|
24
|
+
WireDetails,
|
|
25
|
+
ACHDetails,
|
|
26
|
+
TradeState,
|
|
27
|
+
MerchantCounterparty,
|
|
28
|
+
UserCounterparty,
|
|
29
|
+
ServiceCounterparty,
|
|
30
|
+
Counterparty as InternalCounterparty,
|
|
31
|
+
ActiveLinkedAccountDetails,
|
|
32
|
+
ExecuteTradeRequest,
|
|
9
33
|
} from "./specs/RNCandle.nitro";
|
|
10
34
|
|
|
11
35
|
export class CandleClient {
|
|
@@ -48,8 +72,38 @@ export class CandleClient {
|
|
|
48
72
|
);
|
|
49
73
|
}
|
|
50
74
|
|
|
51
|
-
public async getLinkedAccounts(): Promise<
|
|
52
|
-
|
|
75
|
+
public async getLinkedAccounts(): Promise<
|
|
76
|
+
(
|
|
77
|
+
| (LinkedAccount & {
|
|
78
|
+
details: { state: "active" } & ActiveLinkedAccountDetails;
|
|
79
|
+
})
|
|
80
|
+
| (LinkedAccount & {
|
|
81
|
+
details: { state: "inactive" };
|
|
82
|
+
})
|
|
83
|
+
)[]
|
|
84
|
+
> {
|
|
85
|
+
const accounts = await this.candle.getLinkedAccounts();
|
|
86
|
+
return accounts.map((account) => {
|
|
87
|
+
if (account.details.activeLinkedAccountDetails !== undefined) {
|
|
88
|
+
return {
|
|
89
|
+
...account,
|
|
90
|
+
details: {
|
|
91
|
+
...account.details.activeLinkedAccountDetails,
|
|
92
|
+
state: "active",
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
} else if (account.details.inactiveLinkedAccountDetails !== undefined) {
|
|
96
|
+
return {
|
|
97
|
+
...account,
|
|
98
|
+
details: {
|
|
99
|
+
...account.details.inactiveLinkedAccountDetails,
|
|
100
|
+
state: "inactive",
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
} else {
|
|
104
|
+
throw new Error("Internal Candle Error: corrupted linked account.");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
53
107
|
}
|
|
54
108
|
|
|
55
109
|
public async unlinkAccount(linkedAccountID: string): Promise<void> {
|
|
@@ -64,12 +118,226 @@ export class CandleClient {
|
|
|
64
118
|
return this.candle.getAvailableTools();
|
|
65
119
|
}
|
|
66
120
|
|
|
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
|
+
|
|
67
132
|
public async executeTool(tool: {
|
|
68
133
|
name: string;
|
|
69
134
|
arguments: string;
|
|
70
135
|
}): Promise<string> {
|
|
71
136
|
return this.candle.executeTool(tool);
|
|
72
137
|
}
|
|
138
|
+
|
|
139
|
+
public async getAssetAccounts(
|
|
140
|
+
query: AssetAccountQuery = {}
|
|
141
|
+
): Promise<AssetAccount[]> {
|
|
142
|
+
const accounts = await this.candle.getAssetAccounts(query);
|
|
143
|
+
return accounts.map((account) => this.convertToAssetAccount(account));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
public async getTrades(
|
|
147
|
+
query: {
|
|
148
|
+
gainedAssetKind?: TradeQueryAssetKind;
|
|
149
|
+
lostAssetKind?: TradeQueryAssetKind;
|
|
150
|
+
counterpartyKind?: "merchant" | "user" | "service";
|
|
151
|
+
} & TradeQuery = {}
|
|
152
|
+
): Promise<Trade[]> {
|
|
153
|
+
const trades = await this.candle.getTrades(query);
|
|
154
|
+
return trades.map(({ dateTime, counterparty, gained, lost, state }) => ({
|
|
155
|
+
dateTime,
|
|
156
|
+
state,
|
|
157
|
+
counterparty: this.convertToCounterparty(counterparty),
|
|
158
|
+
lost: this.convertTradeAsset(lost),
|
|
159
|
+
gained: this.convertTradeAsset(gained),
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public async getTradeQuotes(request: {
|
|
164
|
+
linkedAccountIDs?: string;
|
|
165
|
+
gained:
|
|
166
|
+
| ({
|
|
167
|
+
assetKind: "nothing";
|
|
168
|
+
} & NothingAssetQuoteRequest)
|
|
169
|
+
| ({ assetKind: "transport" } & TransportAssetQuoteRequest)
|
|
170
|
+
| ({ assetKind: "fiat" } & FiatAssetQuoteRequest)
|
|
171
|
+
| ({ assetKind: "stock" | "crypto" } & MarketAssetQuoteRequest);
|
|
172
|
+
}): Promise<
|
|
173
|
+
{
|
|
174
|
+
gained: TradeAsset;
|
|
175
|
+
lost: TradeAsset;
|
|
176
|
+
}[]
|
|
177
|
+
> {
|
|
178
|
+
let gainedRequest: TradeAssetQuoteRequest;
|
|
179
|
+
|
|
180
|
+
switch (request.gained.assetKind) {
|
|
181
|
+
case "fiat":
|
|
182
|
+
gainedRequest = { fiatAssetQuoteRequest: request.gained };
|
|
183
|
+
break;
|
|
184
|
+
case "stock":
|
|
185
|
+
case "crypto":
|
|
186
|
+
gainedRequest = { marketAssetQuoteRequest: request.gained };
|
|
187
|
+
break;
|
|
188
|
+
case "transport":
|
|
189
|
+
gainedRequest = { transportAssetQuoteRequest: request.gained };
|
|
190
|
+
break;
|
|
191
|
+
case "nothing":
|
|
192
|
+
gainedRequest = { nothingAssetQuoteRequest: request.gained };
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const quotes = await this.candle.getTradeQuotes({
|
|
197
|
+
linkedAccountIDs: request.linkedAccountIDs,
|
|
198
|
+
gained: gainedRequest,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
return quotes.map((quote) => {
|
|
202
|
+
return {
|
|
203
|
+
gained: this.convertTradeAsset(quote.gained),
|
|
204
|
+
lost: this.convertTradeAsset(quote.lost),
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private convertTradeAsset(tradeAsset: InternalTradeAsset): TradeAsset {
|
|
210
|
+
if (tradeAsset.fiatAsset !== undefined) {
|
|
211
|
+
return {
|
|
212
|
+
...tradeAsset.fiatAsset,
|
|
213
|
+
assetKind: "fiat",
|
|
214
|
+
};
|
|
215
|
+
} else if (tradeAsset.marketTradeAsset !== undefined) {
|
|
216
|
+
return {
|
|
217
|
+
...tradeAsset.marketTradeAsset,
|
|
218
|
+
assetKind: tradeAsset.marketTradeAsset.assetKind as "stock" | "crypto",
|
|
219
|
+
};
|
|
220
|
+
} else if (tradeAsset.transportAsset !== undefined) {
|
|
221
|
+
return {
|
|
222
|
+
...tradeAsset.transportAsset,
|
|
223
|
+
assetKind: "transport",
|
|
224
|
+
};
|
|
225
|
+
} else if (tradeAsset.otherAsset !== undefined) {
|
|
226
|
+
return { assetKind: "other" };
|
|
227
|
+
} else if (tradeAsset.nothingAsset !== undefined) {
|
|
228
|
+
return { assetKind: "nothing" };
|
|
229
|
+
} else {
|
|
230
|
+
throw new Error("Internal Candle Error: corrupted trade asset.");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private convertToCounterparty(
|
|
235
|
+
counterparty: InternalCounterparty
|
|
236
|
+
): Counterparty {
|
|
237
|
+
if (counterparty.merchantCounterparty !== undefined) {
|
|
238
|
+
return {
|
|
239
|
+
...counterparty.merchantCounterparty,
|
|
240
|
+
kind: "merchant",
|
|
241
|
+
};
|
|
242
|
+
} else if (counterparty.userCounterparty !== undefined) {
|
|
243
|
+
return {
|
|
244
|
+
...counterparty.userCounterparty,
|
|
245
|
+
kind: "user",
|
|
246
|
+
};
|
|
247
|
+
} else if (counterparty.serviceCounterparty !== undefined) {
|
|
248
|
+
return {
|
|
249
|
+
...counterparty.serviceCounterparty,
|
|
250
|
+
kind: "service",
|
|
251
|
+
};
|
|
252
|
+
} else {
|
|
253
|
+
throw new Error("Unknown counterparty kind");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private convertToAssetAccount(account: NitroAssetAccount): AssetAccount {
|
|
258
|
+
const { legalAccountKind, nickname } = account;
|
|
259
|
+
const { fiatAccountDetails, marketAccountDetails } = account.details;
|
|
260
|
+
|
|
261
|
+
if (fiatAccountDetails !== undefined) {
|
|
262
|
+
return {
|
|
263
|
+
legalAccountKind,
|
|
264
|
+
nickname,
|
|
265
|
+
details: {
|
|
266
|
+
...fiatAccountDetails,
|
|
267
|
+
assetKind: "fiat",
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
} else if (marketAccountDetails !== undefined) {
|
|
271
|
+
return {
|
|
272
|
+
legalAccountKind,
|
|
273
|
+
nickname,
|
|
274
|
+
details: {
|
|
275
|
+
...marketAccountDetails,
|
|
276
|
+
assetKind: marketAccountDetails.assetKind as "stock" | "crypto",
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
} else {
|
|
280
|
+
throw new Error("Internal Candle Error: corrupted asset account.");
|
|
281
|
+
}
|
|
282
|
+
}
|
|
73
283
|
}
|
|
74
284
|
|
|
75
|
-
|
|
285
|
+
type TradeAsset =
|
|
286
|
+
| ({
|
|
287
|
+
assetKind: "nothing";
|
|
288
|
+
} & NothingAsset)
|
|
289
|
+
| ({
|
|
290
|
+
assetKind: "other";
|
|
291
|
+
} & OtherAsset)
|
|
292
|
+
| ({ assetKind: "transport" } & TransportAsset)
|
|
293
|
+
| ({ assetKind: "fiat" } & FiatAsset)
|
|
294
|
+
| ({ assetKind: "stock" | "crypto" } & MarketTradeAsset);
|
|
295
|
+
|
|
296
|
+
type Counterparty =
|
|
297
|
+
| ({ kind: "merchant" } & MerchantCounterparty)
|
|
298
|
+
| ({
|
|
299
|
+
kind: "user";
|
|
300
|
+
} & UserCounterparty)
|
|
301
|
+
| ({
|
|
302
|
+
kind: "service";
|
|
303
|
+
} & ServiceCounterparty);
|
|
304
|
+
|
|
305
|
+
type TradeQueryAssetKind =
|
|
306
|
+
| "fiat"
|
|
307
|
+
| "stock"
|
|
308
|
+
| "crypto"
|
|
309
|
+
| "transport"
|
|
310
|
+
| "other"
|
|
311
|
+
| "nothing";
|
|
312
|
+
|
|
313
|
+
type AssetAccount = {
|
|
314
|
+
legalAccountKind: LegalAccountKind;
|
|
315
|
+
nickname: string;
|
|
316
|
+
details:
|
|
317
|
+
| {
|
|
318
|
+
assetKind: "fiat";
|
|
319
|
+
serviceAccountID: string;
|
|
320
|
+
currencyCode: string;
|
|
321
|
+
balance?: number;
|
|
322
|
+
linkedAccountID: string;
|
|
323
|
+
service: Service;
|
|
324
|
+
ach?: ACHDetails;
|
|
325
|
+
wire?: WireDetails;
|
|
326
|
+
}
|
|
327
|
+
| {
|
|
328
|
+
assetKind: "stock" | "crypto";
|
|
329
|
+
serviceAccountID: string;
|
|
330
|
+
linkedAccountID: string;
|
|
331
|
+
service: Service;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
type Trade = {
|
|
336
|
+
dateTime: string;
|
|
337
|
+
state: TradeState;
|
|
338
|
+
counterparty: Counterparty;
|
|
339
|
+
lost: TradeAsset;
|
|
340
|
+
gained: TradeAsset;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export type { LinkedAccount, AppUser, Service, TradeState, TradeAsset, Trade };
|
|
@@ -6,6 +6,228 @@ export type AppUser = {
|
|
|
6
6
|
appUserID?: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
type ACHAccountKind = "checking" | "savings";
|
|
10
|
+
|
|
11
|
+
export type ACHDetails = {
|
|
12
|
+
accountNumber: string;
|
|
13
|
+
routingNumber: string;
|
|
14
|
+
accountKind: ACHAccountKind;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type WireDetails = {
|
|
18
|
+
accountNumber: string;
|
|
19
|
+
routingNumber: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type FiatAccountDetails = {
|
|
23
|
+
assetKind: string; // fiat
|
|
24
|
+
serviceAccountID: string;
|
|
25
|
+
currencyCode: string;
|
|
26
|
+
balance?: number;
|
|
27
|
+
ach?: ACHDetails;
|
|
28
|
+
wire?: WireDetails;
|
|
29
|
+
linkedAccountID: string;
|
|
30
|
+
service: Service;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type MarketAccountDetails = {
|
|
34
|
+
assetKind: string; // "stock" | "crypto"
|
|
35
|
+
serviceAccountID: string;
|
|
36
|
+
linkedAccountID: string;
|
|
37
|
+
service: Service;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type AssetAccountDetails = {
|
|
41
|
+
fiatAccountDetails?: FiatAccountDetails;
|
|
42
|
+
marketAccountDetails?: MarketAccountDetails;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type LegalAccountKind =
|
|
46
|
+
| "individual"
|
|
47
|
+
| "joint"
|
|
48
|
+
| "traditionalIra"
|
|
49
|
+
| "rothIra";
|
|
50
|
+
|
|
51
|
+
export type AssetAccount = {
|
|
52
|
+
legalAccountKind: LegalAccountKind;
|
|
53
|
+
nickname: string;
|
|
54
|
+
details: AssetAccountDetails;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
type AssetAccountKind = "fiat" | "stock" | "crypto";
|
|
58
|
+
|
|
59
|
+
export type AssetAccountQuery = {
|
|
60
|
+
linkedAccountIDs?: string;
|
|
61
|
+
assetKind?: AssetAccountKind;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type FiatAsset = {
|
|
65
|
+
assetKind: string; // fiat
|
|
66
|
+
serviceTradeID?: string;
|
|
67
|
+
serviceAccountID: string;
|
|
68
|
+
currencyCode: string;
|
|
69
|
+
amount: number;
|
|
70
|
+
linkedAccountID: string;
|
|
71
|
+
service: Service;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export type MarketTradeAsset = {
|
|
75
|
+
assetKind: string; // "stock" | "crypto"
|
|
76
|
+
serviceAccountID: string;
|
|
77
|
+
serviceAssetID: string;
|
|
78
|
+
symbol: string;
|
|
79
|
+
amount: number;
|
|
80
|
+
serviceTradeID: string;
|
|
81
|
+
linkedAccountID: string;
|
|
82
|
+
name: string;
|
|
83
|
+
color: string;
|
|
84
|
+
logoURL: string;
|
|
85
|
+
service: Service;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
type Coordinates = {
|
|
89
|
+
latitude: number;
|
|
90
|
+
longitude: number;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type Address = {
|
|
94
|
+
value: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export type TransportAsset = {
|
|
98
|
+
assetKind: string; // "transport"
|
|
99
|
+
serviceTradeID: string;
|
|
100
|
+
serviceAssetID: string;
|
|
101
|
+
name: string;
|
|
102
|
+
description: string;
|
|
103
|
+
// FIXME: use URL type for url fields
|
|
104
|
+
imageURL: string;
|
|
105
|
+
originCoordinates: Coordinates;
|
|
106
|
+
originAddress: Address;
|
|
107
|
+
destinationCoordinates: Coordinates;
|
|
108
|
+
destinationAddress: Address;
|
|
109
|
+
seats: number;
|
|
110
|
+
linkedAccountID: string;
|
|
111
|
+
service: Service;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type OtherAsset = {
|
|
115
|
+
assetKind: string; // "other"
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type NothingAsset = {
|
|
119
|
+
assetKind: string; // "nothing"
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type TradeAsset = {
|
|
123
|
+
fiatAsset?: FiatAsset;
|
|
124
|
+
marketTradeAsset?: MarketTradeAsset;
|
|
125
|
+
transportAsset?: TransportAsset;
|
|
126
|
+
otherAsset?: OtherAsset;
|
|
127
|
+
nothingAsset?: NothingAsset;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
type MerchantLocation = {
|
|
131
|
+
countryCode: string;
|
|
132
|
+
countrySubdivisionCode: string;
|
|
133
|
+
localityName: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export type MerchantCounterparty = {
|
|
137
|
+
kind: string; // "merchant";
|
|
138
|
+
name: string;
|
|
139
|
+
logoURL: string;
|
|
140
|
+
location?: MerchantLocation;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type UserCounterparty = {
|
|
144
|
+
kind: string; // "user"
|
|
145
|
+
legalName: string;
|
|
146
|
+
avatarURL: string;
|
|
147
|
+
username: string;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export type ServiceCounterparty = {
|
|
151
|
+
kind: string; // "service"
|
|
152
|
+
service: Service;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type Counterparty = {
|
|
156
|
+
merchantCounterparty?: MerchantCounterparty;
|
|
157
|
+
userCounterparty?: UserCounterparty;
|
|
158
|
+
serviceCounterparty?: ServiceCounterparty;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export type TradeState = "success" | "inProgress" | "failure";
|
|
162
|
+
|
|
163
|
+
export type Trade = {
|
|
164
|
+
dateTime: string;
|
|
165
|
+
state: TradeState;
|
|
166
|
+
counterparty: Counterparty;
|
|
167
|
+
lost: TradeAsset;
|
|
168
|
+
gained: TradeAsset;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type TradeQuery = {
|
|
172
|
+
linkedAccountIDs?: string;
|
|
173
|
+
dateTimeSpan?: string;
|
|
174
|
+
// FIXME: define enum here rather than in JS wrapper layer
|
|
175
|
+
gainedAssetKind?: string; // "fiat" | "stock" | "crypto" | "transport" | "other" | "nothing"
|
|
176
|
+
lostAssetKind?: string; // "fiat" | "stock" | "crypto" | "transport" | "other" | "nothing"
|
|
177
|
+
counterpartyKind?: string; // "merchant" | "user" | "service"
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export type FiatAssetQuoteRequest = {
|
|
181
|
+
assetKind: string; // fiat
|
|
182
|
+
serviceAccountID?: string;
|
|
183
|
+
currencyCode?: string;
|
|
184
|
+
amount?: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type MarketAssetQuoteRequest = {
|
|
188
|
+
assetKind: string; // "stock" | "crypto"
|
|
189
|
+
serviceAccountID?: string;
|
|
190
|
+
serviceAssetID?: string;
|
|
191
|
+
symbol?: string;
|
|
192
|
+
amount?: number;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export type TransportAssetQuoteRequest = {
|
|
196
|
+
assetKind: string; // "transport"
|
|
197
|
+
serviceAssetID?: string;
|
|
198
|
+
originCoordinates?: Coordinates;
|
|
199
|
+
originAddress?: Address;
|
|
200
|
+
destinationCoordinates?: Coordinates;
|
|
201
|
+
destinationAddress?: Address;
|
|
202
|
+
seats?: number;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type NothingAssetQuoteRequest = {
|
|
206
|
+
assetKind: string; // "nothing"
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
export type TradeAssetQuoteRequest = {
|
|
210
|
+
fiatAssetQuoteRequest?: FiatAssetQuoteRequest;
|
|
211
|
+
marketAssetQuoteRequest?: MarketAssetQuoteRequest;
|
|
212
|
+
transportAssetQuoteRequest?: TransportAssetQuoteRequest;
|
|
213
|
+
nothingAssetQuoteRequest?: NothingAssetQuoteRequest;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export type TradeQuoteRequest = {
|
|
217
|
+
linkedAccountIDs?: string;
|
|
218
|
+
gained: TradeAssetQuoteRequest;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export type ExecuteTradeRequest = {
|
|
222
|
+
linkedAccountID: string;
|
|
223
|
+
context: string;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export type TradeQuote = {
|
|
227
|
+
lost: TradeAsset;
|
|
228
|
+
gained: TradeAsset;
|
|
229
|
+
};
|
|
230
|
+
|
|
9
231
|
export type Service =
|
|
10
232
|
| "robinhood"
|
|
11
233
|
| "cash_app"
|
|
@@ -93,18 +315,28 @@ export type PresentationStyle = "sheet" | "fullScreen";
|
|
|
93
315
|
|
|
94
316
|
export type State = "active" | "inactive";
|
|
95
317
|
|
|
96
|
-
export type
|
|
97
|
-
state:
|
|
98
|
-
|
|
318
|
+
export type ActiveLinkedAccountDetails = {
|
|
319
|
+
state: string; // "active"
|
|
320
|
+
accountOpened?: string;
|
|
321
|
+
username?: string;
|
|
322
|
+
emailAddress?: string;
|
|
99
323
|
legalName: string;
|
|
100
|
-
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export type InactiveLinkedAccountDetails = {
|
|
327
|
+
state: string; // "inactive"
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export type LinkedAccountDetails = {
|
|
331
|
+
activeLinkedAccountDetails?: ActiveLinkedAccountDetails;
|
|
332
|
+
inactiveLinkedAccountDetails?: InactiveLinkedAccountDetails;
|
|
101
333
|
};
|
|
102
334
|
|
|
103
335
|
export type LinkedAccount = {
|
|
104
|
-
serviceUserID: string;
|
|
105
|
-
details: Details | undefined;
|
|
106
336
|
linkedAccountID: string;
|
|
107
337
|
service: Service;
|
|
338
|
+
serviceUserID: string;
|
|
339
|
+
details: LinkedAccountDetails;
|
|
108
340
|
};
|
|
109
341
|
|
|
110
342
|
export type ToolCall = {
|
|
@@ -126,10 +358,10 @@ export interface RNCandle extends HybridObject<{ ios: "swift" }> {
|
|
|
126
358
|
initialize(appUser: AppUser): void;
|
|
127
359
|
getLinkedAccounts(): Promise<LinkedAccount[]>;
|
|
128
360
|
unlinkAccount(linkedAccountID: string): Promise<void>;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
361
|
+
getAssetAccounts(query: AssetAccountQuery): Promise<AssetAccount[]>;
|
|
362
|
+
getTrades(query: TradeQuery): Promise<Trade[]>;
|
|
363
|
+
getTradeQuotes(request: TradeQuoteRequest): Promise<TradeQuote[]>;
|
|
364
|
+
executeTrade(request: ExecuteTradeRequest): Promise<Trade>;
|
|
133
365
|
deleteUser(): Promise<void>;
|
|
134
366
|
// FIXME: The return type should be a more specific type based on the actual tool calls available.
|
|
135
367
|
getAvailableTools(): Promise<Array<AnyMap>>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// State.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
|
-
/// Represents the JS union `State`, backed by a C++ enum.
|
|
9
|
-
public typealias State = margelo.nitro.rncandle.State
|
|
10
|
-
|
|
11
|
-
extension State {
|
|
12
|
-
/**
|
|
13
|
-
* Get a State for the given String value, or
|
|
14
|
-
* return `nil` if the given value was invalid/unknown.
|
|
15
|
-
*/
|
|
16
|
-
public init?(fromString string: String) {
|
|
17
|
-
switch string {
|
|
18
|
-
case "active":
|
|
19
|
-
self = .active
|
|
20
|
-
case "inactive":
|
|
21
|
-
self = .inactive
|
|
22
|
-
default:
|
|
23
|
-
return nil
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Get the String value this State represents.
|
|
29
|
-
*/
|
|
30
|
-
public var stringValue: String {
|
|
31
|
-
switch self {
|
|
32
|
-
case .active:
|
|
33
|
-
return "active"
|
|
34
|
-
case .inactive:
|
|
35
|
-
return "inactive"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|