react-native-candle 0.1.17 → 0.1.18
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 +542 -46
- package/lib/commonjs/index.js +157 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +157 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +79 -3
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +197 -9
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +79 -3
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +197 -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 +108 -6
- package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +122 -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/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++/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 +22 -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 +259 -3
- package/src/specs/RNCandle.nitro.ts +237 -10
- package/nitrogen/generated/ios/swift/State.swift +0 -38
package/src/index.ts
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
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,
|
|
9
32
|
} from "./specs/RNCandle.nitro";
|
|
10
33
|
|
|
11
34
|
export class CandleClient {
|
|
@@ -48,8 +71,38 @@ export class CandleClient {
|
|
|
48
71
|
);
|
|
49
72
|
}
|
|
50
73
|
|
|
51
|
-
public async getLinkedAccounts(): Promise<
|
|
52
|
-
|
|
74
|
+
public async getLinkedAccounts(): Promise<
|
|
75
|
+
(
|
|
76
|
+
| (LinkedAccount & {
|
|
77
|
+
details: { state: "active" } & ActiveLinkedAccountDetails;
|
|
78
|
+
})
|
|
79
|
+
| (LinkedAccount & {
|
|
80
|
+
details: { state: "inactive" };
|
|
81
|
+
})
|
|
82
|
+
)[]
|
|
83
|
+
> {
|
|
84
|
+
const accounts = await this.candle.getLinkedAccounts();
|
|
85
|
+
return accounts.map((account) => {
|
|
86
|
+
if (account.details.activeLinkedAccountDetails !== undefined) {
|
|
87
|
+
return {
|
|
88
|
+
...account,
|
|
89
|
+
details: {
|
|
90
|
+
...account.details.activeLinkedAccountDetails,
|
|
91
|
+
state: "active",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
} else if (account.details.inactiveLinkedAccountDetails !== undefined) {
|
|
95
|
+
return {
|
|
96
|
+
...account,
|
|
97
|
+
details: {
|
|
98
|
+
...account.details.inactiveLinkedAccountDetails,
|
|
99
|
+
state: "inactive",
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
} else {
|
|
103
|
+
throw new Error("Internal Candle Error: corrupted linked account.");
|
|
104
|
+
}
|
|
105
|
+
});
|
|
53
106
|
}
|
|
54
107
|
|
|
55
108
|
public async unlinkAccount(linkedAccountID: string): Promise<void> {
|
|
@@ -70,6 +123,209 @@ export class CandleClient {
|
|
|
70
123
|
}): Promise<string> {
|
|
71
124
|
return this.candle.executeTool(tool);
|
|
72
125
|
}
|
|
126
|
+
|
|
127
|
+
public async getAssetAccounts(
|
|
128
|
+
query: AssetAccountQuery = {}
|
|
129
|
+
): Promise<AssetAccount[]> {
|
|
130
|
+
const accounts = await this.candle.getAssetAccounts(query);
|
|
131
|
+
return accounts.map((account) => this.convertToAssetAccount(account));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public async getTrades(
|
|
135
|
+
query: {
|
|
136
|
+
gainedAssetKind?: TradeQueryAssetKind;
|
|
137
|
+
lostAssetKind?: TradeQueryAssetKind;
|
|
138
|
+
counterpartyKind?: "merchant" | "user" | "service";
|
|
139
|
+
} & TradeQuery = {}
|
|
140
|
+
): Promise<
|
|
141
|
+
{
|
|
142
|
+
dateTime: string;
|
|
143
|
+
state: TradeState;
|
|
144
|
+
counterparty: Counterparty;
|
|
145
|
+
lost: TradeAsset;
|
|
146
|
+
gained: TradeAsset;
|
|
147
|
+
}[]
|
|
148
|
+
> {
|
|
149
|
+
const trades = await this.candle.getTrades(query);
|
|
150
|
+
return trades.map(({ dateTime, counterparty, gained, lost, state }) => ({
|
|
151
|
+
dateTime,
|
|
152
|
+
state,
|
|
153
|
+
counterparty: this.convertToCounterparty(counterparty),
|
|
154
|
+
lost: this.convertTradeAsset(lost),
|
|
155
|
+
gained: this.convertTradeAsset(gained),
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
public async getTradeQuotes(request: {
|
|
160
|
+
linkedAccountIDs?: string;
|
|
161
|
+
gained:
|
|
162
|
+
| ({
|
|
163
|
+
assetKind: "nothing";
|
|
164
|
+
} & NothingAssetQuoteRequest)
|
|
165
|
+
| ({ assetKind: "transport" } & TransportAssetQuoteRequest)
|
|
166
|
+
| ({ assetKind: "fiat" } & FiatAssetQuoteRequest)
|
|
167
|
+
| ({ assetKind: "stock" | "crypto" } & MarketAssetQuoteRequest);
|
|
168
|
+
}): Promise<
|
|
169
|
+
{
|
|
170
|
+
gained: TradeAsset;
|
|
171
|
+
lost: TradeAsset;
|
|
172
|
+
}[]
|
|
173
|
+
> {
|
|
174
|
+
let gainedRequest: TradeAssetQuoteRequest;
|
|
175
|
+
|
|
176
|
+
switch (request.gained.assetKind) {
|
|
177
|
+
case "fiat":
|
|
178
|
+
gainedRequest = { fiatAssetQuoteRequest: request.gained };
|
|
179
|
+
break;
|
|
180
|
+
case "stock":
|
|
181
|
+
case "crypto":
|
|
182
|
+
gainedRequest = { marketAssetQuoteRequest: request.gained };
|
|
183
|
+
break;
|
|
184
|
+
case "transport":
|
|
185
|
+
gainedRequest = { transportAssetQuoteRequest: request.gained };
|
|
186
|
+
break;
|
|
187
|
+
case "nothing":
|
|
188
|
+
gainedRequest = { nothingAssetQuoteRequest: request.gained };
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const quotes = await this.candle.getTradeQuotes({
|
|
193
|
+
linkedAccountIDs: request.linkedAccountIDs,
|
|
194
|
+
gained: gainedRequest,
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
return quotes.map((quote) => {
|
|
198
|
+
return {
|
|
199
|
+
gained: this.convertTradeAsset(quote.gained),
|
|
200
|
+
lost: this.convertTradeAsset(quote.lost),
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private convertTradeAsset(tradeAsset: InternalTradeAsset): TradeAsset {
|
|
206
|
+
if (tradeAsset.fiatAsset !== undefined) {
|
|
207
|
+
return {
|
|
208
|
+
...tradeAsset.fiatAsset,
|
|
209
|
+
assetKind: "fiat",
|
|
210
|
+
};
|
|
211
|
+
} else if (tradeAsset.marketTradeAsset !== undefined) {
|
|
212
|
+
return {
|
|
213
|
+
...tradeAsset.marketTradeAsset,
|
|
214
|
+
assetKind: tradeAsset.marketTradeAsset.assetKind as "stock" | "crypto",
|
|
215
|
+
};
|
|
216
|
+
} else if (tradeAsset.transportAsset !== undefined) {
|
|
217
|
+
return {
|
|
218
|
+
...tradeAsset.transportAsset,
|
|
219
|
+
assetKind: "transport",
|
|
220
|
+
};
|
|
221
|
+
} else if (tradeAsset.otherAsset !== undefined) {
|
|
222
|
+
return { assetKind: "other" };
|
|
223
|
+
} else if (tradeAsset.nothingAsset !== undefined) {
|
|
224
|
+
return { assetKind: "nothing" };
|
|
225
|
+
} else {
|
|
226
|
+
throw new Error("Internal Candle Error: corrupted trade asset.");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private convertToCounterparty(
|
|
231
|
+
counterparty: InternalCounterparty
|
|
232
|
+
): Counterparty {
|
|
233
|
+
if (counterparty.merchantCounterparty !== undefined) {
|
|
234
|
+
return {
|
|
235
|
+
...counterparty.merchantCounterparty,
|
|
236
|
+
kind: "merchant",
|
|
237
|
+
};
|
|
238
|
+
} else if (counterparty.userCounterparty !== undefined) {
|
|
239
|
+
return {
|
|
240
|
+
...counterparty.userCounterparty,
|
|
241
|
+
kind: "user",
|
|
242
|
+
};
|
|
243
|
+
} else if (counterparty.serviceCounterparty !== undefined) {
|
|
244
|
+
return {
|
|
245
|
+
...counterparty.serviceCounterparty,
|
|
246
|
+
kind: "service",
|
|
247
|
+
};
|
|
248
|
+
} else {
|
|
249
|
+
throw new Error("Unknown counterparty kind");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
private convertToAssetAccount(account: NitroAssetAccount): AssetAccount {
|
|
254
|
+
const { legalAccountKind, nickname } = account;
|
|
255
|
+
const { fiatAccountDetails, marketAccountDetails } = account.details;
|
|
256
|
+
|
|
257
|
+
if (fiatAccountDetails !== undefined) {
|
|
258
|
+
return {
|
|
259
|
+
legalAccountKind,
|
|
260
|
+
nickname,
|
|
261
|
+
details: {
|
|
262
|
+
...fiatAccountDetails,
|
|
263
|
+
assetKind: "fiat",
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
} else if (marketAccountDetails !== undefined) {
|
|
267
|
+
return {
|
|
268
|
+
legalAccountKind,
|
|
269
|
+
nickname,
|
|
270
|
+
details: {
|
|
271
|
+
...marketAccountDetails,
|
|
272
|
+
assetKind: marketAccountDetails.assetKind as "stock" | "crypto",
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
} else {
|
|
276
|
+
throw new Error("Internal Candle Error: corrupted asset account.");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
73
279
|
}
|
|
74
280
|
|
|
75
|
-
|
|
281
|
+
type TradeAsset =
|
|
282
|
+
| ({
|
|
283
|
+
assetKind: "nothing";
|
|
284
|
+
} & NothingAsset)
|
|
285
|
+
| ({
|
|
286
|
+
assetKind: "other";
|
|
287
|
+
} & OtherAsset)
|
|
288
|
+
| ({ assetKind: "transport" } & TransportAsset)
|
|
289
|
+
| ({ assetKind: "fiat" } & FiatAsset)
|
|
290
|
+
| ({ assetKind: "stock" | "crypto" } & MarketTradeAsset);
|
|
291
|
+
|
|
292
|
+
type Counterparty =
|
|
293
|
+
| ({ kind: "merchant" } & MerchantCounterparty)
|
|
294
|
+
| ({
|
|
295
|
+
kind: "user";
|
|
296
|
+
} & UserCounterparty)
|
|
297
|
+
| ({
|
|
298
|
+
kind: "service";
|
|
299
|
+
} & ServiceCounterparty);
|
|
300
|
+
|
|
301
|
+
type TradeQueryAssetKind =
|
|
302
|
+
| "fiat"
|
|
303
|
+
| "stock"
|
|
304
|
+
| "crypto"
|
|
305
|
+
| "transport"
|
|
306
|
+
| "other"
|
|
307
|
+
| "nothing";
|
|
308
|
+
|
|
309
|
+
type AssetAccount = {
|
|
310
|
+
legalAccountKind: LegalAccountKind;
|
|
311
|
+
nickname: string;
|
|
312
|
+
details:
|
|
313
|
+
| {
|
|
314
|
+
assetKind: "fiat";
|
|
315
|
+
serviceAccountID: string;
|
|
316
|
+
currencyCode: string;
|
|
317
|
+
balance?: number;
|
|
318
|
+
linkedAccountID: string;
|
|
319
|
+
service: Service;
|
|
320
|
+
ach?: ACHDetails;
|
|
321
|
+
wire?: WireDetails;
|
|
322
|
+
}
|
|
323
|
+
| {
|
|
324
|
+
assetKind: "stock" | "crypto";
|
|
325
|
+
serviceAccountID: string;
|
|
326
|
+
linkedAccountID: string;
|
|
327
|
+
service: Service;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export type { LinkedAccount, AppUser, Service, TradeState, TradeAsset };
|
|
@@ -6,6 +6,223 @@ 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 TradeQuote = {
|
|
222
|
+
lost: TradeAsset;
|
|
223
|
+
gained: TradeAsset;
|
|
224
|
+
};
|
|
225
|
+
|
|
9
226
|
export type Service =
|
|
10
227
|
| "robinhood"
|
|
11
228
|
| "cash_app"
|
|
@@ -93,18 +310,28 @@ export type PresentationStyle = "sheet" | "fullScreen";
|
|
|
93
310
|
|
|
94
311
|
export type State = "active" | "inactive";
|
|
95
312
|
|
|
96
|
-
export type
|
|
97
|
-
state:
|
|
98
|
-
|
|
313
|
+
export type ActiveLinkedAccountDetails = {
|
|
314
|
+
state: string; // "active"
|
|
315
|
+
accountOpened?: string;
|
|
316
|
+
username?: string;
|
|
317
|
+
emailAddress?: string;
|
|
99
318
|
legalName: string;
|
|
100
|
-
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
export type InactiveLinkedAccountDetails = {
|
|
322
|
+
state: string; // "inactive"
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
export type LinkedAccountDetails = {
|
|
326
|
+
activeLinkedAccountDetails?: ActiveLinkedAccountDetails;
|
|
327
|
+
inactiveLinkedAccountDetails?: InactiveLinkedAccountDetails;
|
|
101
328
|
};
|
|
102
329
|
|
|
103
330
|
export type LinkedAccount = {
|
|
104
|
-
serviceUserID: string;
|
|
105
|
-
details: Details | undefined;
|
|
106
331
|
linkedAccountID: string;
|
|
107
332
|
service: Service;
|
|
333
|
+
serviceUserID: string;
|
|
334
|
+
details: LinkedAccountDetails;
|
|
108
335
|
};
|
|
109
336
|
|
|
110
337
|
export type ToolCall = {
|
|
@@ -126,10 +353,10 @@ export interface RNCandle extends HybridObject<{ ios: "swift" }> {
|
|
|
126
353
|
initialize(appUser: AppUser): void;
|
|
127
354
|
getLinkedAccounts(): Promise<LinkedAccount[]>;
|
|
128
355
|
unlinkAccount(linkedAccountID: string): Promise<void>;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
356
|
+
getAssetAccounts(query: AssetAccountQuery): Promise<AssetAccount[]>;
|
|
357
|
+
getTrades(query: TradeQuery): Promise<Trade[]>;
|
|
358
|
+
getTradeQuotes(request: TradeQuoteRequest): Promise<TradeQuote[]>;
|
|
359
|
+
submitTrade(serviceTradeID: string): Promise<Trade>;
|
|
133
360
|
deleteUser(): Promise<void>;
|
|
134
361
|
// FIXME: The return type should be a more specific type based on the actual tool calls available.
|
|
135
362
|
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
|
-
}
|