@ledgerhq/coin-canton 0.12.0-nightly.20251217023943 → 0.12.0-nightly.20251218023953
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/.turbo/turbo-build.log +1 -1
- package/.unimportedrc.json +2 -1
- package/CHANGELOG.md +35 -9
- package/lib/bridge/sync.d.ts +1 -1
- package/lib/bridge/sync.d.ts.map +1 -1
- package/lib/bridge/sync.js +11 -20
- package/lib/bridge/sync.js.map +1 -1
- package/lib/network/gateway.d.ts +7 -7
- package/lib/network/gateway.d.ts.map +1 -1
- package/lib/network/gateway.js +6 -3
- package/lib/network/gateway.js.map +1 -1
- package/lib/supportedFeatures.d.ts +3 -0
- package/lib/supportedFeatures.d.ts.map +1 -0
- package/lib/supportedFeatures.js +7 -0
- package/lib/supportedFeatures.js.map +1 -0
- package/lib-es/bridge/sync.d.ts +1 -1
- package/lib-es/bridge/sync.d.ts.map +1 -1
- package/lib-es/bridge/sync.js +8 -17
- package/lib-es/bridge/sync.js.map +1 -1
- package/lib-es/network/gateway.d.ts +7 -7
- package/lib-es/network/gateway.d.ts.map +1 -1
- package/lib-es/network/gateway.js +4 -2
- package/lib-es/network/gateway.js.map +1 -1
- package/lib-es/supportedFeatures.d.ts +3 -0
- package/lib-es/supportedFeatures.d.ts.map +1 -0
- package/lib-es/supportedFeatures.js +4 -0
- package/lib-es/supportedFeatures.js.map +1 -0
- package/package.json +9 -9
- package/src/bridge/onboard.integ.test.ts +2 -2
- package/src/bridge/sync.test.ts +95 -48
- package/src/bridge/sync.ts +9 -19
- package/src/network/gateway.test.ts +29 -31
- package/src/network/gateway.ts +10 -8
- package/src/supportedFeatures.ts +5 -0
package/src/network/gateway.ts
CHANGED
|
@@ -327,6 +327,10 @@ export type OperationInfo =
|
|
|
327
327
|
};
|
|
328
328
|
};
|
|
329
329
|
|
|
330
|
+
export const SEPARATOR = "____";
|
|
331
|
+
|
|
332
|
+
export const getKey = (id: string, adminId: string) => `${id}${SEPARATOR}${adminId}`;
|
|
333
|
+
|
|
330
334
|
const getGatewayUrl = (currency: CryptoCurrency) => coinConfig.getCoinConfig(currency).gatewayUrl;
|
|
331
335
|
const getNodeId = (currency: CryptoCurrency) => {
|
|
332
336
|
const overrideNodeId = getEnv("CANTON_NODE_ID_OVERRIDE");
|
|
@@ -427,25 +431,23 @@ export function clearIsTopologyChangeRequiredCache(currency: CryptoCurrency, pub
|
|
|
427
431
|
}
|
|
428
432
|
|
|
429
433
|
export type InstrumentInfo = {
|
|
430
|
-
|
|
431
|
-
|
|
434
|
+
id: string;
|
|
435
|
+
admin: string;
|
|
432
436
|
};
|
|
433
437
|
|
|
434
|
-
export type InstrumentsResponse =
|
|
435
|
-
instruments: InstrumentInfo[];
|
|
436
|
-
};
|
|
438
|
+
export type InstrumentsResponse = InstrumentInfo[];
|
|
437
439
|
|
|
438
|
-
export async function getEnabledInstruments(currency: CryptoCurrency): Promise<string
|
|
440
|
+
export async function getEnabledInstruments(currency: CryptoCurrency): Promise<Set<string>> {
|
|
439
441
|
try {
|
|
440
442
|
const { data } = await gatewayNetwork<InstrumentsResponse>({
|
|
441
443
|
method: "GET",
|
|
442
444
|
url: `${getGatewayUrl(currency)}/v1/node/${getNodeId(currency)}/instruments`,
|
|
443
445
|
});
|
|
444
|
-
return data.
|
|
446
|
+
return new Set(data.map(({ id, admin }) => getKey(id, admin)));
|
|
445
447
|
} catch (error) {
|
|
446
448
|
// If API fails, return empty array (fail-safe: only native instrument will work)
|
|
447
449
|
console.error("Failed to fetch enabled instruments:", error);
|
|
448
|
-
return
|
|
450
|
+
return new Set();
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
|